Skip to content

Commit 10556eb

Browse files
committed
Use pyupgrade to remove old Python syntax
1 parent 3960f43 commit 10556eb

File tree

6 files changed

+10
-13
lines changed

6 files changed

+10
-13
lines changed

src/fluentdemo/apps/blog/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class CommentForm(CompactLabelsCommentForm):
77
"""
88

99
def __init__(self, *args, **kwargs):
10-
super(CommentForm, self).__init__(*args, **kwargs)
10+
super().__init__(*args, **kwargs)
1111

1212
# Fix translations of the labels
1313
self.fields['url'].label = "Website"

src/fluentdemo/apps/blog/migrations/0001_initial.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.db import migrations, models
52
import slug_preview.models
63
import taggit_selectize.managers

src/fluentdemo/apps/sentry/versioning.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ def fetch_git_sha(path, head=None):
1616
head_path = os.path.join(path, '.git', 'HEAD')
1717
if not os.path.exists(head_path):
1818
raise InvalidGitRepository(
19-
'Cannot identify HEAD for git repository at %s' % (path,))
19+
f'Cannot identify HEAD for git repository at {path}')
2020

21-
with open(head_path, 'r') as fp:
21+
with open(head_path) as fp:
2222
head = str(fp.read()).strip()
2323

2424
if head.startswith('ref: '):
@@ -34,7 +34,7 @@ def fetch_git_sha(path, head=None):
3434
if not os.path.exists(revision_file):
3535
if not os.path.exists(os.path.join(path, '.git')):
3636
raise InvalidGitRepository(
37-
'%s does not seem to be the root of a git repository' % (path,))
37+
f'{path} does not seem to be the root of a git repository')
3838

3939
# Check for our .git/packed-refs' file since a `git gc` may have run
4040
# https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery
@@ -52,7 +52,7 @@ def fetch_git_sha(path, head=None):
5252
return str(revision)
5353

5454
raise InvalidGitRepository(
55-
'Unable to find ref to head "%s" in repository' % (head,))
55+
f'Unable to find ref to head "{head}" in repository')
5656

5757
with open(revision_file) as fh:
5858
return str(fh.read()).strip()

src/fluentdemo/settings/defaults.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,10 @@
247247
'disable_existing_loggers': False,
248248
'formatters': {
249249
'verbose': {
250-
'format': u'%(levelname)s: %(asctime)s %(process)d %(thread)d %(module)s: %(message)s',
250+
'format': '%(levelname)s: %(asctime)s %(process)d %(thread)d %(module)s: %(message)s',
251251
},
252252
'simple': {
253-
'format': u'%(levelname)s:\t%(message)s',
253+
'format': '%(levelname)s:\t%(message)s',
254254
},
255255
},
256256
'filters': {
@@ -313,7 +313,7 @@
313313
'Document': ['.pdf', '.doc', '.xls', '.csv', '.docx', '.xlsx'],
314314
'Video': ['.swf', '.mp4', '.flv', '.f4v', '.mov', '.3gp'],
315315
}
316-
FILEBROWSER_EXCLUDE = ('cache', '_versions', '_admin_thumbnail\.', '_big\.', '_large\.', '_medium\.', '_small\.', '_thumbnail\.')
316+
FILEBROWSER_EXCLUDE = ('cache', '_versions', r'_admin_thumbnail\.', r'_big\.', r'_large\.', r'_medium\.', r'_small\.', r'_thumbnail\.')
317317
FILEBROWSER_MAX_UPLOAD_SIZE = 100 * 1024 * 1024 # in bytes
318318
FILEBROWSER_STRICT_PIL = True
319319
FILEBROWSER_ADMIN_VERSIONS = [

src/fluentdemo/settings/docker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
try:
1111
with open(SRC_DIR + '/.docker-git-version') as f:
1212
GIT_VERSION = f.read().strip()
13-
except IOError:
13+
except OSError:
1414
pass
1515

1616
SILENCED_SYSTEM_CHECKS = (

src/frontend/context_processors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ def frontend(request):
1111

1212
return {
1313
'site': site,
14-
'site_root': SimpleLazyObject(lambda: "{0}{1}".format(http_scheme, site.domain)),
14+
'site_root': SimpleLazyObject(lambda: f"{http_scheme}{site.domain}"),
1515
}

0 commit comments

Comments
 (0)