Skip to content

Commit b4a21c0

Browse files
committed
trivial: Apply ruff fixes
Signed-off-by: Stephen Finucane <stephen@that.guru>
1 parent fd98bd4 commit b4a21c0

29 files changed

Lines changed: 81 additions & 81 deletions

manage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import os
33
import sys
44

5-
if __name__ == "__main__":
5+
if __name__ == '__main__':
66
os.environ.setdefault(
7-
"DJANGO_SETTINGS_MODULE", "patchwork.settings.production"
7+
'DJANGO_SETTINGS_MODULE', 'patchwork.settings.production'
88
)
99

1010
import django

patchwork/api/check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CheckSerializer(HyperlinkedModelSerializer):
3636

3737
def run_validation(self, data):
3838
if 'state' not in data or data['state'] == '':
39-
raise ValidationError({'state': ["A check must have a state."]})
39+
raise ValidationError({'state': ['A check must have a state.']})
4040

4141
for val, label in Check.STATE_CHOICES:
4242
if label != data['state']:

patchwork/forms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class BundleForm(forms.ModelForm):
6565
min_length=1,
6666
max_length=50,
6767
label='Name',
68-
error_messages={'invalid': 'Bundle names can\'t contain slashes'},
68+
error_messages={'invalid': "Bundle names can't contain slashes"},
6969
)
7070

7171
class Meta:
@@ -203,7 +203,7 @@ def save(self, instance, commit=True):
203203
opts = instance.__class__._meta
204204
if self.errors:
205205
raise ValueError(
206-
"The %s could not be changed because the data "
206+
'The %s could not be changed because the data '
207207
"didn't validate." % opts.object_name
208208
)
209209
data = self.cleaned_data

patchwork/management/commands/cron.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def handle(self, *args, **kwargs):
1919
errors = send_notifications()
2020
for recipient, error in errors:
2121
self.stderr.write(
22-
"Failed sending to %s: %s" % (recipient.email, error)
22+
'Failed sending to %s: %s' % (recipient.email, error)
2323
)
2424

2525
expire_notifications()

patchwork/management/commands/parsemail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def handle(self, *args, **options):
4444
logger.info('Parsing mail loaded from stdin')
4545
mail = email.message_from_binary_file(sys.stdin.buffer)
4646
except AttributeError:
47-
logger.warning("Broken email ignored")
47+
logger.warning('Broken email ignored')
4848
return
4949

5050
# it's important to get exit codes correct here. The key is to allow

patchwork/migrations/0001_squashed_0040_add_related_patches.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ class Migration(migrations.Migration):
248248
models.CharField(
249249
blank=True,
250250
help_text=b"URL format for the list archive's "
251-
b"Message-ID redirector. {} will be "
252-
b"replaced by the Message-ID.",
251+
b'Message-ID redirector. {} will be '
252+
b'replaced by the Message-ID.',
253253
max_length=2000,
254254
),
255255
),
@@ -424,7 +424,7 @@ class Migration(migrations.Migration):
424424
models.BooleanField(
425425
default=True,
426426
help_text=b"Show a column displaying this tag's count "
427-
b"in the patch list view",
427+
b'in the patch list view',
428428
),
429429
),
430430
],

patchwork/migrations/0007_move_comment_content_to_patch_content.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
def copy_comment_field(apps, schema_editor):
55
if connection.vendor == 'postgresql':
66
schema_editor.execute(
7-
'''
7+
"""
88
UPDATE patchwork_patch
99
SET content = patchwork_comment.content
1010
FROM patchwork_comment
1111
WHERE patchwork_patch.id=patchwork_comment.patch_id
1212
AND patchwork_patch.msgid=patchwork_comment.msgid
13-
'''
13+
"""
1414
)
1515
elif connection.vendor == 'mysql':
1616
schema_editor.execute(
17-
'''
17+
"""
1818
UPDATE patchwork_patch, patchwork_comment
1919
SET patchwork_patch.content = patchwork_comment.content
2020
WHERE patchwork_patch.id=patchwork_comment.patch_id
2121
AND patchwork_patch.msgid=patchwork_comment.msgid
22-
'''
22+
"""
2323
)
2424
else:
2525
Comment = apps.get_model('patchwork', 'Comment')
@@ -41,21 +41,21 @@ def copy_comment_field(apps, schema_editor):
4141
def remove_duplicate_comments(apps, schema_editor):
4242
if connection.vendor == 'postgresql':
4343
schema_editor.execute(
44-
'''
44+
"""
4545
DELETE FROM patchwork_comment
4646
USING patchwork_patch
4747
WHERE patchwork_patch.id=patchwork_comment.patch_id
4848
AND patchwork_patch.msgid=patchwork_comment.msgid
49-
'''
49+
"""
5050
)
5151
elif connection.vendor == 'mysql':
5252
schema_editor.execute(
53-
'''
53+
"""
5454
DELETE FROM patchwork_comment
5555
USING patchwork_patch, patchwork_comment
5656
WHERE patchwork_patch.id=patchwork_comment.patch_id
5757
AND patchwork_patch.msgid=patchwork_comment.msgid
58-
'''
58+
"""
5959
)
6060
else:
6161
Comment = apps.get_model('patchwork', 'Comment')

patchwork/migrations/0010_migrate_data_from_submission_to_patch.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ class Migration(migrations.Migration):
88

99
operations = [
1010
migrations.RunSQL(
11-
'''INSERT INTO patchwork_patch
11+
"""INSERT INTO patchwork_patch
1212
(submission_ptr_id, diff2, commit_ref2, pull_url2,
1313
delegate2_id, state2_id, archived2, hash2)
1414
SELECT id, diff, commit_ref, pull_url, delegate_id, state_id,
1515
archived, hash
1616
FROM patchwork_submission
17-
''',
18-
'''UPDATE patchwork_submission SET
17+
""",
18+
"""UPDATE patchwork_submission SET
1919
diff=diff2, commit_ref=commit_ref2, pull_url=pull_url2,
2020
delegate_id=delegate2_id, state_id=state2_id,
2121
archived=archived2, hash=hash2
2222
FROM patchwork_patch WHERE
2323
patchwork_submission.id = patchwork_patch.submission_ptr_id
24-
''',
24+
""",
2525
),
2626
]

patchwork/migrations/0020_tag_show_column.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Migration(migrations.Migration):
1313
field=models.BooleanField(
1414
default=True,
1515
help_text=b"Show a column displaying this tag's count in the "
16-
b"patch list view",
16+
b'patch list view',
1717
),
1818
),
1919
]

patchwork/migrations/0024_patch_patch_project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ class Migration(migrations.Migration):
2626
),
2727
# as with 10, this will break if you use non-default table names
2828
migrations.RunSQL(
29-
'''UPDATE patchwork_patch SET patch_project_id =
29+
"""UPDATE patchwork_patch SET patch_project_id =
3030
(SELECT project_id FROM patchwork_submission
3131
WHERE patchwork_submission.id =
32-
patchwork_patch.submission_ptr_id);'''
32+
patchwork_patch.submission_ptr_id);"""
3333
),
3434
migrations.AlterField(
3535
model_name='patch',

0 commit comments

Comments
 (0)