pyupgrade
This commit is contained in:
@@ -54,7 +54,7 @@ A total of %d pull requests were merged for this release.
|
||||
|
||||
def get_authors(revision_range):
|
||||
pat = '^.*\\t(.*)$'
|
||||
lst_release, cur_release = [r.strip() for r in revision_range.split('..')]
|
||||
lst_release, cur_release = (r.strip() for r in revision_range.split('..'))
|
||||
|
||||
# authors, in current release and previous to current release.
|
||||
cur = set(re.findall(pat, this_repo.git.shortlog('-s', revision_range),
|
||||
@@ -94,7 +94,7 @@ def get_pull_requests(repo, revision_range):
|
||||
|
||||
|
||||
def main(token, revision_range):
|
||||
lst_release, cur_release = [r.strip() for r in revision_range.split('..')]
|
||||
lst_release, cur_release = (r.strip() for r in revision_range.split('..'))
|
||||
|
||||
github = Github(token)
|
||||
github_repo = github.get_repo('saimn/sigal')
|
||||
|
||||
@@ -170,14 +170,14 @@ def build(source, destination, debug, verbose, quiet, force, config, theme,
|
||||
for subtype in ('skipped', 'failed')
|
||||
if stats[_type + '_' + subtype] > 0]
|
||||
opt = ' ({})'.format(', '.join(opt)) if opt else ''
|
||||
return '{} {}s{}'.format(stats[_type], _type, opt)
|
||||
return f'{stats[_type]} {_type}s{opt}'
|
||||
|
||||
if not quiet:
|
||||
stats_str = ''
|
||||
types = sorted(set(t.rsplit('_', 1)[0] for t in stats))
|
||||
types = sorted({t.rsplit('_', 1)[0] for t in stats})
|
||||
for t in types[:-1]:
|
||||
stats_str += '{} and '.format(format_stats(t))
|
||||
stats_str += '{}'.format(format_stats(types[-1]))
|
||||
stats_str += f'{format_stats(t)} and '
|
||||
stats_str += f'{format_stats(types[-1])}'
|
||||
print('Done, processed {} in {:.2f} seconds.'
|
||||
.format(stats_str, time.time() - start_time))
|
||||
|
||||
@@ -278,4 +278,4 @@ def set_meta(target, keys, overwrite=False):
|
||||
for i in range(len(keys) // 2):
|
||||
k, v = keys[i * 2:(i + 1) * 2]
|
||||
fp.write(f"{k.capitalize()}: {v}\n")
|
||||
print("{} metadata key(s) written to {}".format(len(keys) // 2, descfile))
|
||||
print(f"{len(keys) // 2} metadata key(s) written to {descfile}")
|
||||
|
||||
@@ -96,7 +96,7 @@ class Media:
|
||||
signals.media_initialized.send(self)
|
||||
|
||||
def __repr__(self):
|
||||
return "<{}>({!r})".format(self.__class__.__name__, str(self))
|
||||
return f"<{self.__class__.__name__}>({str(self)!r})"
|
||||
|
||||
def __str__(self):
|
||||
return join(self.path, self.src_filename)
|
||||
|
||||
@@ -25,8 +25,8 @@ from logging import Formatter
|
||||
|
||||
# The background is set with 40 plus the number of the color, and the
|
||||
# foreground with 30
|
||||
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = [30 + i
|
||||
for i in range(8)]
|
||||
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = (30 + i
|
||||
for i in range(8))
|
||||
|
||||
COLORS = {
|
||||
'DEBUG': BLUE,
|
||||
|
||||
@@ -43,8 +43,7 @@ def check_subprocess(cmd, source, outname=None):
|
||||
"""
|
||||
logger = logging.getLogger(__name__)
|
||||
try:
|
||||
res = subprocess.run(cmd, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
res = subprocess.run(cmd, capture_output=True)
|
||||
except KeyboardInterrupt:
|
||||
logger.debug('Process terminated, removing file %s', outname)
|
||||
if outname and os.path.isfile(outname):
|
||||
|
||||
@@ -101,7 +101,7 @@ def test_second_pass_video(mock_generate_video_pass, fmt, tmpdir):
|
||||
base, ext = os.path.splitext(TEST_VIDEO)
|
||||
dstfile = str(tmpdir.join(base + '.' + fmt))
|
||||
settings_1 = '-c:v libvpx-vp9 -b:v 0 -crf 30 -pass 1 -an -f null dev/null'
|
||||
settings_2 = '-c:v libvpx-vp9 -b:v 0 -crf 30 -pass 2 -f {}'.format(fmt)
|
||||
settings_2 = f'-c:v libvpx-vp9 -b:v 0 -crf 30 -pass 2 -f {fmt}'
|
||||
settings_opts = {'video_size': (100, 50), 'video_format': fmt,
|
||||
fmt + '_options': settings_1.split(" "),
|
||||
fmt + '_options_second_pass': settings_2.split(" ")}
|
||||
|
||||
Reference in New Issue
Block a user