Skip to content

Commit da1cbe5

Browse files
committed
run: find Allura* Forge* fuse/ scripts/ -name '*.py' | xargs pyupgrade --py39-plus --keep-mock && git co scripts/ApacheAccessHandler.py
1 parent c5eb829 commit da1cbe5

File tree

9 files changed

+36
-36
lines changed

9 files changed

+36
-36
lines changed

Allura/allura/lib/markdown_extensions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
r'''\(\s*(<.*?>|((?:(?:\(.*?\))|[^\(\)]))*?)\s*((['"])(.*?)\12\s*)?\)'''
6161

6262

63-
def clear_markdown_registry(reg: markdown.util.Registry, keep: List[str] = []):
63+
def clear_markdown_registry(reg: markdown.util.Registry, keep: list[str] = []):
6464
keep_items = {}
6565
for name in keep:
6666
keep_items[name] = reg[name]

Allura/allura/lib/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ class AdminExtension:
18831883

18841884
project_admin_controllers = {}
18851885

1886-
def update_project_sidebar_menu(self, sidebar_links: list['SitemapEntry']) -> list['SitemapEntry']:
1886+
def update_project_sidebar_menu(self, sidebar_links: list[SitemapEntry]) -> list[SitemapEntry]:
18871887
"""
18881888
Implement this function to modify the project sidebar.
18891889
Check `c.project` if you want to limit when this displays

Allura/allura/lib/widgets/form_fields.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,10 @@ def resources(self):
380380
k: getattr(self, k)
381381
for k in self.js_params}
382382
yield onready('''
383-
$(document).on('clone', function () {
384-
$('.%s').%s(%s); });
383+
$(document).on('clone', function () {{
384+
$('.{}').{}({}); }});
385385
$(document).trigger('clone');
386-
''' % (self.container_cls, self.js_widget_name, json.dumps(opts)))
386+
'''.format(self.container_cls, self.js_widget_name, json.dumps(opts)))
387387

388388

389389
class SortableRepeatedMixin(JQueryMixin):
@@ -503,16 +503,16 @@ class Lightbox(ew_core.Widget):
503503
def resources(self):
504504
yield ew.JSLink('js/jquery.lightbox_me.js')
505505
yield onready('''
506-
var $lightbox = $('#lightbox_%s');
507-
$('body').on('click', '%s', function(e) {
506+
var $lightbox = $('#lightbox_{}');
507+
$('body').on('click', '{}', function(e) {{
508508
e.preventDefault();
509-
$lightbox.lightbox_me(%s);
510-
});
511-
$lightbox.on('click', '.close', function(e) {
509+
$lightbox.lightbox_me({});
510+
}});
511+
$lightbox.on('click', '.close', function(e) {{
512512
e.preventDefault();
513513
$lightbox.trigger('close');
514-
});
515-
''' % (self.name, self.trigger, self.options))
514+
}});
515+
'''.format(self.name, self.trigger, self.options))
516516

517517

518518
class DisplayOnlyField(ew.HiddenField):

Allura/allura/model/artifact.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def before_save(data):
8787
if c.project and not skip_last_updated:
8888
c.project.last_updated = datetime.utcnow()
8989

90-
query: 'Query[Artifact]'
90+
query: Query[Artifact]
9191

9292
type_s = 'Generic Artifact'
9393

@@ -548,7 +548,7 @@ class __mongometa__:
548548
'author.id',
549549
]
550550

551-
query: 'Query[Snapshot]'
551+
query: Query[Snapshot]
552552

553553
_id = FieldProperty(S.ObjectId)
554554
artifact_id = FieldProperty(S.ObjectId)
@@ -623,7 +623,7 @@ class __mongometa__:
623623
name = 'versioned_artifact'
624624
history_class = Snapshot
625625

626-
query: 'Query[VersionedArtifact]'
626+
query: Query[VersionedArtifact]
627627

628628
version = FieldProperty(S.Int, if_missing=0)
629629

@@ -743,7 +743,7 @@ class __mongometa__:
743743
session = artifact_orm_session
744744
name = 'message'
745745

746-
query: 'Query[Message]'
746+
query: Query[Message]
747747

748748
type_s = 'Generic Message'
749749

@@ -794,7 +794,7 @@ class __mongometa__:
794794
session = main_orm_session
795795
name = 'award_file'
796796

797-
query: 'Query[AwardFile]'
797+
query: Query[AwardFile]
798798

799799
award_id = FieldProperty(S.ObjectId)
800800

@@ -806,7 +806,7 @@ class __mongometa__:
806806
name = 'award'
807807
indexes = ['short']
808808

809-
query: 'Query[Award]'
809+
query: Query[Award]
810810

811811
type_s = 'Generic Award'
812812

@@ -852,7 +852,7 @@ class __mongometa__:
852852
name = 'grant'
853853
indexes = ['short']
854854

855-
query: 'Query[AwardGrant]'
855+
query: Query[AwardGrant]
856856

857857
type_s = 'Generic Award Grant'
858858

@@ -941,7 +941,7 @@ class __mongometa__:
941941
('pubdate', pymongo.DESCENDING)),
942942
]
943943

944-
query: 'Query[Feed]'
944+
query: Query[Feed]
945945

946946
_id = FieldProperty(S.ObjectId)
947947
ref_id: str = ForeignIdProperty('ArtifactReference')
@@ -1068,7 +1068,7 @@ class __mongometa__:
10681068
session = main_orm_session
10691069
name = 'vote'
10701070

1071-
query: 'Query[VotableArtifact]'
1071+
query: Query[VotableArtifact]
10721072

10731073
votes = FieldProperty(int, if_missing=0)
10741074
votes_up = FieldProperty(int, if_missing=0)
@@ -1198,7 +1198,7 @@ class __mongometa__:
11981198
session = artifact_orm_session
11991199
name = 'moved_artifact'
12001200

1201-
query: 'Query[MovedArtifact]'
1201+
query: Query[MovedArtifact]
12021202

12031203
_id = FieldProperty(S.ObjectId)
12041204
app_config_id = ForeignIdProperty(
@@ -1216,7 +1216,7 @@ class __mongometa__:
12161216
('user_id', 'result'),
12171217
]
12181218

1219-
query: 'Query[SpamCheckResult]'
1219+
query: Query[SpamCheckResult]
12201220

12211221
_id = FieldProperty(S.ObjectId)
12221222
ref_id: str = ForeignIdProperty('ArtifactReference')

Allura/allura/model/auth.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ def send_verification_link(self):
172172
self.set_nonce_hash()
173173
log.info('Sending verification link to %s', self.email)
174174
text = '''
175-
To verify the email address %s belongs to the user %s,
175+
To verify the email address {} belongs to the user {},
176176
please visit the following URL:
177177
178-
%s
179-
''' % (self.email,
178+
{}
179+
'''.format(self.email,
180180
self.claimed_by_user(include_pending=True).username,
181181
h.absurl(f'/auth/verify_addr?a={h.urlquote(self.nonce)}'),
182182
)

Allura/allura/model/discuss.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Discussion(Artifact, ActivityObject):
5757
class __mongometa__:
5858
name = 'discussion'
5959

60-
query: 'Query[Discussion]'
60+
query: Query[Discussion]
6161

6262
type_s = 'Discussion'
6363

@@ -168,7 +168,7 @@ class __mongometa__:
168168
('discussion_id',),
169169
]
170170

171-
query: 'Query[Thread]'
171+
query: Query[Thread]
172172

173173
type_s = 'Thread'
174174

@@ -492,7 +492,7 @@ class PostHistory(Snapshot):
492492
class __mongometa__:
493493
name = 'post_history'
494494

495-
query: 'Query[PostHistory]'
495+
query: Query[PostHistory]
496496

497497
artifact_id = ForeignIdProperty('Post')
498498

@@ -540,7 +540,7 @@ class __mongometa__:
540540
('deleted', 'discussion_id', 'thread_id', 'full_slug'),
541541
]
542542

543-
query: 'Query[Post]'
543+
query: Query[Post]
544544

545545
type_s = 'Post'
546546

@@ -862,7 +862,7 @@ class __mongometa__:
862862
polymorphic_identity = 'DiscussionAttachment'
863863
indexes = ['filename', 'discussion_id', 'thread_id', 'post_id']
864864

865-
query: 'Query[DiscussionAttachment]'
865+
query: Query[DiscussionAttachment]
866866

867867
discussion_id = FieldProperty(schema.ObjectId)
868868
thread_id = FieldProperty(str)

Allura/allura/model/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ def parent_security_context(self):
14441444
'''ACL processing should terminate at the AppConfig'''
14451445
return None
14461446

1447-
def load(self) -> typing.Type[Application]:
1447+
def load(self) -> type[Application]:
14481448
"""
14491449
:returns: the related :class:`Application <allura.app.Application>` class
14501450
"""

Allura/allura/tests/functional/test_auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,9 +1725,9 @@ def test_password_reset(self, gen_message_id, sendsimplemail):
17251725
# confirm email sent
17261726
text = '''Your username is test-admin
17271727
1728-
To update your password on %s, please visit the following URL:
1728+
To update your password on {}, please visit the following URL:
17291729
1730-
%s/auth/forgotten_password/%s''' % (config['site_name'], config['base_url'], hash)
1730+
{}/auth/forgotten_password/{}'''.format(config['site_name'], config['base_url'], hash)
17311731
sendsimplemail.post.assert_called_once_with(
17321732
sender='noreply@localhost',
17331733
toaddr=email.email,

Allura/allura/tests/functional/test_site_admin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,9 +720,9 @@ def test_send_password_reset_link(self, gen_message_id, sendmail):
720720
hash = user.get_tool_data('AuthPasswordReset', 'hash')
721721
text = '''Your username is test-user
722722
723-
To update your password on %s, please visit the following URL:
723+
To update your password on {}, please visit the following URL:
724724
725-
%s/auth/forgotten_password/%s''' % (config['site_name'], config['base_url'], hash)
725+
{}/auth/forgotten_password/{}'''.format(config['site_name'], config['base_url'], hash)
726726
sendmail.post.assert_called_once_with(
727727
sender='noreply@localhost',
728728
toaddr='test-user@example.org',

0 commit comments

Comments
 (0)