File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -289,9 +289,12 @@ def python_format(self) -> bool:
289
289
290
290
:type: `bool`"""
291
291
ids = self .id
292
- if not isinstance (ids , (list , tuple )):
293
- ids = [ids ]
294
- return any (PYTHON_FORMAT .search (id ) for id in ids )
292
+ if isinstance (ids , (list , tuple )):
293
+ for id in ids : # Explicit loop for performance reasons.
294
+ if PYTHON_FORMAT .search (id ):
295
+ return True
296
+ return False
297
+ return bool (PYTHON_FORMAT .search (ids ))
295
298
296
299
@property
297
300
def python_brace_format (self ) -> bool :
@@ -304,9 +307,12 @@ def python_brace_format(self) -> bool:
304
307
305
308
:type: `bool`"""
306
309
ids = self .id
307
- if not isinstance (ids , (list , tuple )):
308
- ids = [ids ]
309
- return any (_has_python_brace_format (id ) for id in ids )
310
+ if isinstance (ids , (list , tuple )):
311
+ for id in ids : # Explicit loop for performance reasons.
312
+ if _has_python_brace_format (id ):
313
+ return True
314
+ return False
315
+ return _has_python_brace_format (ids )
310
316
311
317
312
318
class TranslationError (Exception ):
You can’t perform that action at this time.
0 commit comments