Final pyupgrade

This commit is contained in:
Andrew Rogl 2021-08-26 20:13:15 +10:00
parent 1ec87a3bdd
commit 0f48ccde78
4 changed files with 15 additions and 26 deletions

View file

@ -1,8 +1,4 @@
# -*- coding: utf-8 -*- AUTHOR = 'Adrian Sampson'
from __future__ import division, absolute_import, print_function
AUTHOR = u'Adrian Sampson'
# General configuration # General configuration
@ -12,8 +8,8 @@ exclude_patterns = ['_build']
source_suffix = '.rst' source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
project = u'beets' project = 'beets'
copyright = u'2016, Adrian Sampson' copyright = '2016, Adrian Sampson'
version = '1.5' version = '1.5'
release = '1.5.1' release = '1.5.1'
@ -41,14 +37,14 @@ htmlhelp_basename = 'beetsdoc'
# Options for LaTeX output # Options for LaTeX output
latex_documents = [ latex_documents = [
('index', 'beets.tex', u'beets Documentation', ('index', 'beets.tex', 'beets Documentation',
AUTHOR, 'manual'), AUTHOR, 'manual'),
] ]
# Options for manual page output # Options for manual page output
man_pages = [ man_pages = [
('reference/cli', 'beet', u'music tagger and library organizer', ('reference/cli', 'beet', 'music tagger and library organizer',
[AUTHOR], 1), [AUTHOR], 1),
('reference/config', 'beetsconfig', u'beets configuration file', ('reference/config', 'beetsconfig', 'beets configuration file',
[AUTHOR], 5), [AUTHOR], 5),
] ]

View file

@ -1,5 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""A utility script for automating the beets release process. """A utility script for automating the beets release process.
""" """
@ -110,14 +109,14 @@ def bump_version(version):
out_lines.append(line) out_lines.append(line)
if not found: if not found:
print("No pattern found in {}".format(filename)) print(f"No pattern found in {filename}")
# Write the file back. # Write the file back.
with open(filename, 'w') as f: with open(filename, 'w') as f:
f.write(''.join(out_lines)) f.write(''.join(out_lines))
# Generate bits to insert into changelog. # Generate bits to insert into changelog.
header_line = '{} (in development)'.format(version) header_line = f'{version} (in development)'
header = '\n\n' + header_line + '\n' + '-' * len(header_line) + '\n\n' header = '\n\n' + header_line + '\n' + '-' * len(header_line) + '\n\n'
header += 'Changelog goes here!\n' header += 'Changelog goes here!\n'
@ -277,7 +276,7 @@ def prep():
cur_version = get_version() cur_version = get_version()
# Tag. # Tag.
subprocess.check_output(['git', 'tag', 'v{}'.format(cur_version)]) subprocess.check_output(['git', 'tag', f'v{cur_version}'])
# Build. # Build.
with chdir(BASE): with chdir(BASE):
@ -292,7 +291,7 @@ def prep():
# FIXME It should be possible to specify this as an argument. # FIXME It should be possible to specify this as an argument.
version_parts = [int(n) for n in cur_version.split('.')] version_parts = [int(n) for n in cur_version.split('.')]
version_parts[-1] += 1 version_parts[-1] += 1
next_version = u'.'.join(map(str, version_parts)) next_version = '.'.join(map(str, version_parts))
bump_version(next_version) bump_version(next_version)
@ -311,7 +310,7 @@ def publish():
subprocess.check_call(['git', 'push', '--tags']) subprocess.check_call(['git', 'push', '--tags'])
# Upload to PyPI. # Upload to PyPI.
path = os.path.join(BASE, 'dist', 'beets-{}.tar.gz'.format(version)) path = os.path.join(BASE, 'dist', f'beets-{version}.tar.gz')
subprocess.check_call(['twine', 'upload', path]) subprocess.check_call(['twine', 'upload', path])
@ -335,12 +334,12 @@ def ghrelease():
'github-release', 'release', 'github-release', 'release',
'-u', GITHUB_USER, '-r', GITHUB_REPO, '-u', GITHUB_USER, '-r', GITHUB_REPO,
'--tag', tag, '--tag', tag,
'--name', '{} {}'.format(GITHUB_REPO, version), '--name', f'{GITHUB_REPO} {version}',
'--description', cl_md, '--description', cl_md,
]) ])
# Attach the release tarball. # Attach the release tarball.
tarball = os.path.join(BASE, 'dist', 'beets-{}.tar.gz'.format(version)) tarball = os.path.join(BASE, 'dist', f'beets-{version}.tar.gz')
subprocess.check_call([ subprocess.check_call([
'github-release', 'upload', 'github-release', 'upload',
'-u', GITHUB_USER, '-r', GITHUB_REPO, '-u', GITHUB_USER, '-r', GITHUB_REPO,

View file

@ -1,14 +1,10 @@
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function
from beets.plugins import BeetsPlugin from beets.plugins import BeetsPlugin
from beets import ui from beets import ui
class TestPlugin(BeetsPlugin): class TestPlugin(BeetsPlugin):
def __init__(self): def __init__(self):
super(TestPlugin, self).__init__() super().__init__()
self.is_test_plugin = True self.is_test_plugin = True
def commands(self): def commands(self):
@ -16,7 +12,7 @@ class TestPlugin(BeetsPlugin):
test.func = lambda *args: None test.func = lambda *args: None
# Used in CompletionTest # Used in CompletionTest
test.parser.add_option(u'-o', u'--option', dest='my_opt') test.parser.add_option('-o', '--option', dest='my_opt')
plugin = ui.Subcommand('plugin') plugin = ui.Subcommand('plugin')
plugin.func = lambda *args: None plugin.func = lambda *args: None

View file

@ -1,11 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""A tiny tool used to test the `convert` plugin. It copies a file and appends """A tiny tool used to test the `convert` plugin. It copies a file and appends
a specified text tag. a specified text tag.
""" """
from __future__ import division, absolute_import, print_function
import sys import sys
import platform import platform
import locale import locale