Upgrade flake8-print to resolve CircleCI failures

pull/8943/head
Matt Westcott 2022-08-03 15:08:28 +02:00 zatwierdzone przez Matt Westcott
rodzic 2a7b0f6328
commit 6429f8d40b
11 zmienionych plików z 30 dodań i 29 usunięć

Wyświetl plik

@ -14,13 +14,13 @@ for path in Path(__file__).parent.resolve().parent.rglob("LC_MESSAGES/*.po"):
expected_placeholders = set(placeholder_regexp.findall(entry.msgid))
actual_placeholders = set(placeholder_regexp.findall(entry.msgstr))
if expected_placeholders != actual_placeholders:
print("Invalid string at %s line %d:" % (path, entry.linenum))
print(
print("Invalid string at %s line %d:" % (path, entry.linenum)) # noqa
print( # noqa
"\toriginal string %r has placeholders: %r"
% (entry.msgid, expected_placeholders)
)
print(
) # noqa
print( # noqa
"\ttranslated string %r has placeholders: %r"
% (entry.msgstr, actual_placeholders)
)
print()
) # noqa
print() # noqa

Wyświetl plik

@ -60,8 +60,8 @@ language_names = [
language_names.sort()
for (language_name, locale) in language_names:
print(("%s - %s" % (language_name, locale)))
print("-----")
print(("%s - %s" % (language_name, locale))) # noqa
print("-----") # noqa
for author in sorted(authors_by_locale[locale]):
print(author)
print("")
print(author) # noqa
print("") # noqa

Wyświetl plik

@ -22,7 +22,7 @@ __semver__ = get_semver_version(VERSION)
"""
print(
print( # noqa
INIT_TEMPLATE.format(
major=VERSION[0],
minor=VERSION[1],

Wyświetl plik

@ -9,10 +9,10 @@ dist_folder = pathlib.Path.cwd() / "dist"
try:
f = next(dist_folder.glob("*.whl"))
except StopIteration:
print("No .whl files found in ./dist!")
print("No .whl files found in ./dist!") # noqa
sys.exit()
print("Uploading", f.name)
print("Uploading", f.name) # noqa
s3 = boto3.client("s3")
s3.upload_file(
str(f),
@ -21,7 +21,7 @@ s3.upload_file(
ExtraArgs={"ACL": "public-read"},
)
print("Updating latest.json")
print("Updating latest.json") # noqa
boto3.resource("s3").Object("releases.wagtail.io", "nightly/latest.json").put(
ACL="public-read",

Wyświetl plik

@ -59,7 +59,7 @@ testing_extras = [
"isort==5.6.4", # leave this pinned - it tends to change rules between patch releases
"flake8-blind-except==0.1.1",
"flake8-comprehensions==3.8.0",
"flake8-print==2.0.2",
"flake8-print==5.0.0",
"doc8==0.8.1",
"flake8-assertive==2.0.0",
# For templates linting

Wyświetl plik

@ -79,7 +79,7 @@ class CreateProject(Command):
"name. Please try another name." % project_name
)
print(
print( # noqa
"Creating a Wagtail project called %(project_name)s"
% {"project_name": project_name}
) # noqa
@ -108,7 +108,7 @@ class CreateProject(Command):
utility = ManagementUtility(utility_args)
utility.execute()
print(
print( # noqa
"Success! %(project_name)s has been created"
% {"project_name": project_name}
) # noqa
@ -239,7 +239,7 @@ class UpdateModulePaths(Command):
else: # actually update
change_count = self._rewrite_file(path)
if change_count:
print(
print( # noqa
"%s - %d change%s"
% (relative_path, change_count, pluralize(change_count))
) # NOQA
@ -248,7 +248,7 @@ class UpdateModulePaths(Command):
changed_file_count += 1
if diff or list_files:
print(
print( # noqa
"\nChecked %d .py file%s, %d file%s to update."
% (
checked_file_count,
@ -258,7 +258,7 @@ class UpdateModulePaths(Command):
)
) # NOQA
else:
print(
print( # noqa
"\nChecked %d .py file%s, %d file%s updated."
% (
checked_file_count,
@ -374,7 +374,7 @@ class Version(Command):
version = wagtail.get_version(wagtail.VERSION)
print("You are using Wagtail %(version)s" % {"version": version})
print("You are using Wagtail %(version)s" % {"version": version}) # noqa
COMMANDS = {
@ -389,7 +389,7 @@ def prog_name():
def help_index():
print(
print( # noqa
"Type '%s help <subcommand>' for help on a specific subcommand.\n" % prog_name()
) # NOQA
print("Available subcommands:\n") # NOQA

Wyświetl plik

@ -1,4 +1,5 @@
import re
import warnings
from io import StringIO
from django.core import management
@ -33,7 +34,7 @@ class TestUpdateImageRenditions(TestCase):
rendition_image = rendition.image
rendition.delete()
except Exception:
print(f"Could not delete rendition for {rendition_image}")
warnings.warn(f"Could not delete rendition for {rendition_image}")
def run_command(self, **options):
output = StringIO()

Wyświetl plik

@ -247,6 +247,6 @@ class MatchExpression(Expression):
) # Substitute the params in the query
column_list = ", ".join(
["`{}`".format(column) for column in self.columns]
) #  ['title', 'body'] becomes '`title`, `body`'
) # ['title', 'body'] becomes '`title`, `body`'
params = [formatted_query]
return (self.template % (column_list, "%s"), params)

Wyświetl plik

@ -27,7 +27,7 @@ class Benchmark:
)
)
print(
print( # noqa
"time min:",
min(timings),
"max:",
@ -35,7 +35,7 @@ class Benchmark:
"avg:",
sum(timings) / len(timings),
) # NOQA
print(
print( # noqa
"memory min:",
min(memory_usage),
"max:",

Wyświetl plik

@ -56,7 +56,7 @@ STATICFILES_FINDERS = (
USE_TZ = not os.environ.get("DISABLE_TIMEZONE")
if not USE_TZ:
print("Timezone support disabled")
print("Timezone support disabled") # noqa
LANGUAGE_CODE = "en"
@ -179,7 +179,7 @@ EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
if os.environ.get("USE_EMAIL_USER_MODEL"):
INSTALLED_APPS.append("wagtail.test.emailuser")
AUTH_USER_MODEL = "emailuser.EmailUser"
print("EmailUser (no username) user model active")
print("EmailUser (no username) user model active") # noqa
else:
INSTALLED_APPS.append("wagtail.test.customuser")
AUTH_USER_MODEL = "customuser.CustomUser"

Wyświetl plik

@ -77,7 +77,7 @@ class check_bdist_egg(bdist_egg):
def run(self):
bdist_egg.run(self)
if not os.path.isdir(self.sentinel_dir):
print(
print( # noqa
"\n".join(
[ # noqa
"************************************************************",