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

View file

@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""A utility script for automating the beets release process.
"""
@ -110,14 +109,14 @@ def bump_version(version):
out_lines.append(line)
if not found:
print("No pattern found in {}".format(filename))
print(f"No pattern found in {filename}")
# Write the file back.
with open(filename, 'w') as f:
f.write(''.join(out_lines))
# 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 += 'Changelog goes here!\n'
@ -277,7 +276,7 @@ def prep():
cur_version = get_version()
# Tag.
subprocess.check_output(['git', 'tag', 'v{}'.format(cur_version)])
subprocess.check_output(['git', 'tag', f'v{cur_version}'])
# Build.
with chdir(BASE):
@ -292,7 +291,7 @@ def prep():
# FIXME It should be possible to specify this as an argument.
version_parts = [int(n) for n in cur_version.split('.')]
version_parts[-1] += 1
next_version = u'.'.join(map(str, version_parts))
next_version = '.'.join(map(str, version_parts))
bump_version(next_version)
@ -311,7 +310,7 @@ def publish():
subprocess.check_call(['git', 'push', '--tags'])
# 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])
@ -335,12 +334,12 @@ def ghrelease():
'github-release', 'release',
'-u', GITHUB_USER, '-r', GITHUB_REPO,
'--tag', tag,
'--name', '{} {}'.format(GITHUB_REPO, version),
'--name', f'{GITHUB_REPO} {version}',
'--description', cl_md,
])
# 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([
'github-release', 'upload',
'-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 import ui
class TestPlugin(BeetsPlugin):
def __init__(self):
super(TestPlugin, self).__init__()
super().__init__()
self.is_test_plugin = True
def commands(self):
@ -16,7 +12,7 @@ class TestPlugin(BeetsPlugin):
test.func = lambda *args: None
# 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.func = lambda *args: None

View file

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