aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/plugins
diff options
context:
space:
mode:
authorBen Sturmfels <ben@sturm.com.au>2021-09-23 11:51:04 +1000
committerBen Sturmfels <ben@sturm.com.au>2021-09-23 11:51:04 +1000
commit6f48143f4c60c555b3f571007cdc929ce90920b1 (patch)
tree2a2333a365379d4c4c42faf79bcd9db20aaa8626 /mediagoblin/plugins
parentf90707e22c0380bd0f17e2e724e58ecf91abd5a3 (diff)
downloadmediagoblin-6f48143f4c60c555b3f571007cdc929ce90920b1.tar.lz
mediagoblin-6f48143f4c60c555b3f571007cdc929ce90920b1.tar.xz
mediagoblin-6f48143f4c60c555b3f571007cdc929ce90920b1.zip
Apply pyupgrade --py36-plus.
This removes some 'u' prefixes and converts simple format() calls to f-strings.
Diffstat (limited to 'mediagoblin/plugins')
-rw-r--r--mediagoblin/plugins/api/__init__.py2
-rw-r--r--mediagoblin/plugins/api/tools.py2
-rw-r--r--mediagoblin/plugins/basic_auth/tools.py4
-rw-r--r--mediagoblin/plugins/flatpagesfile/__init__.py2
-rw-r--r--mediagoblin/plugins/openid/models.py4
-rw-r--r--mediagoblin/plugins/piwigo/tools.py2
-rw-r--r--mediagoblin/plugins/piwigo/views.py2
-rw-r--r--mediagoblin/plugins/trim_whitespace/__init__.py2
8 files changed, 10 insertions, 10 deletions
diff --git a/mediagoblin/plugins/api/__init__.py b/mediagoblin/plugins/api/__init__.py
index 51e22e85..ca7843f4 100644
--- a/mediagoblin/plugins/api/__init__.py
+++ b/mediagoblin/plugins/api/__init__.py
@@ -28,7 +28,7 @@ def setup_plugin():
config = pluginapi.get_config(__name__)
- _log.debug('API config: {}'.format(config))
+ _log.debug(f'API config: {config}')
routes = [
('mediagoblin.plugins.api.test',
diff --git a/mediagoblin/plugins/api/tools.py b/mediagoblin/plugins/api/tools.py
index 954b6e8b..79c63435 100644
--- a/mediagoblin/plugins/api/tools.py
+++ b/mediagoblin/plugins/api/tools.py
@@ -115,7 +115,7 @@ def api_auth(controller):
for auth in PluginManager().get_hook_callables('auth'):
if auth.trigger(request):
- _log.debug('{} believes it is capable of authenticating this request.'.format(auth))
+ _log.debug(f'{auth} believes it is capable of authenticating this request.')
auth_candidates.append(auth)
# If we can't find any authentication methods, we should not let them
diff --git a/mediagoblin/plugins/basic_auth/tools.py b/mediagoblin/plugins/basic_auth/tools.py
index 3e807297..5b89e51b 100644
--- a/mediagoblin/plugins/basic_auth/tools.py
+++ b/mediagoblin/plugins/basic_auth/tools.py
@@ -38,7 +38,7 @@ def bcrypt_check_password(raw_pass, stored_hash, extra_salt=None):
True or False depending on success.
"""
if extra_salt:
- raw_pass = "{}:{}".format(extra_salt, raw_pass)
+ raw_pass = f"{extra_salt}:{raw_pass}"
hashed_pass = bcrypt.hashpw(raw_pass.encode('utf-8'), stored_hash)
@@ -64,7 +64,7 @@ def bcrypt_gen_password_hash(raw_pass, extra_salt=None):
non-database extra salt
"""
if extra_salt:
- raw_pass = "{}:{}".format(extra_salt, raw_pass)
+ raw_pass = f"{extra_salt}:{raw_pass}"
return str(
bcrypt.hashpw(raw_pass.encode('utf-8'), bcrypt.gensalt()))
diff --git a/mediagoblin/plugins/flatpagesfile/__init__.py b/mediagoblin/plugins/flatpagesfile/__init__.py
index 5f267f07..d760137b 100644
--- a/mediagoblin/plugins/flatpagesfile/__init__.py
+++ b/mediagoblin/plugins/flatpagesfile/__init__.py
@@ -34,7 +34,7 @@ _log = logging.getLogger(__name__)
def print_context(c):
s = []
for key, val in c.items():
- s.append('{}: {}'.format(key, repr(val)))
+ s.append(f'{key}: {val!r}')
return '\n'.join(s)
diff --git a/mediagoblin/plugins/openid/models.py b/mediagoblin/plugins/openid/models.py
index e51b401c..433f0493 100644
--- a/mediagoblin/plugins/openid/models.py
+++ b/mediagoblin/plugins/openid/models.py
@@ -41,7 +41,7 @@ class Nonce(Base):
salt = Column(Unicode, primary_key=True)
def __unicode__(self):
- return 'Nonce: {!r}, {!r}'.format(self.server_url, self.salt)
+ return f'Nonce: {self.server_url!r}, {self.salt!r}'
class Association(Base):
@@ -55,7 +55,7 @@ class Association(Base):
assoc_type = Column(Unicode)
def __unicode__(self):
- return 'Association: {!r}, {!r}'.format(self.server_url, self.handle)
+ return f'Association: {self.server_url!r}, {self.handle!r}'
MODELS = [
diff --git a/mediagoblin/plugins/piwigo/tools.py b/mediagoblin/plugins/piwigo/tools.py
index dadd3e77..795beb1c 100644
--- a/mediagoblin/plugins/piwigo/tools.py
+++ b/mediagoblin/plugins/piwigo/tools.py
@@ -130,7 +130,7 @@ def check_form(form):
raise BadRequest()
dump = []
for f in form:
- dump.append("{}={!r}".format(f.name, f.data))
+ dump.append(f"{f.name}={f.data!r}")
_log.debug("form: %s", " ".join(dump))
diff --git a/mediagoblin/plugins/piwigo/views.py b/mediagoblin/plugins/piwigo/views.py
index bd1265c5..5294a386 100644
--- a/mediagoblin/plugins/piwigo/views.py
+++ b/mediagoblin/plugins/piwigo/views.py
@@ -119,7 +119,7 @@ def pwg_images_addSimple(request):
raise BadRequest()
dump = []
for f in form:
- dump.append("{}={!r}".format(f.name, f.data))
+ dump.append(f"{f.name}={f.data!r}")
_log.info("addSimple: %r %s %r", request.form, " ".join(dump),
request.files)
diff --git a/mediagoblin/plugins/trim_whitespace/__init__.py b/mediagoblin/plugins/trim_whitespace/__init__.py
index 6f67218c..713d13d5 100644
--- a/mediagoblin/plugins/trim_whitespace/__init__.py
+++ b/mediagoblin/plugins/trim_whitespace/__init__.py
@@ -64,7 +64,7 @@ class TrimWhiteSpaceMeddleware(meddleware.BaseMeddleware):
# Append ourselves to the list of enabled Meddlewares
meddleware.ENABLED_MEDDLEWARE.append(
- '{}:{}'.format(cls.__module__, cls.__name__))
+ f'{cls.__module__}:{cls.__name__}')
hooks = {