use 'True if COND else False' for bool conversions
faster than 'bool(COND)', especially on older Pythons < 3.11
This commit is contained in:
@@ -109,7 +109,7 @@ class CohostUserExtractor(CohostExtractor):
|
||||
"projectHandle": self.groups[0],
|
||||
"page": 0,
|
||||
"options": {
|
||||
"pinnedPostsAtTop" : bool(self.pinned),
|
||||
"pinnedPostsAtTop" : True if self.pinned else False,
|
||||
"hideReplies" : not self.replies,
|
||||
"hideShares" : not self.shares,
|
||||
"hideAsks" : not self.asks,
|
||||
|
||||
@@ -1301,7 +1301,7 @@ class DeviantartOAuthAPI():
|
||||
|
||||
metadata = extractor.config("metadata", False)
|
||||
if not metadata:
|
||||
metadata = bool(extractor.extra)
|
||||
metadata = True if extractor.extra else False
|
||||
if metadata:
|
||||
self.metadata = True
|
||||
|
||||
|
||||
@@ -63,7 +63,8 @@ class NozomiExtractor(Extractor):
|
||||
yield Message.Directory, post
|
||||
for post["num"], image in enumerate(images, 1):
|
||||
post["filename"] = post["dataid"] = did = image["dataid"]
|
||||
post["is_video"] = video = bool(image.get("is_video"))
|
||||
post["is_video"] = video = \
|
||||
True if image.get("is_video") else False
|
||||
|
||||
ext = image["type"]
|
||||
if video:
|
||||
|
||||
Reference in New Issue
Block a user