Skip to content

Commit

Permalink
style: prefer literal syntax as per pre-commit check-builtin-literals
Browse files Browse the repository at this point in the history
Signed-off-by: Rongrong <[email protected]>
  • Loading branch information
Rongronggg9 committed Jun 1, 2024
1 parent ae6f331 commit 3f37a7a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/command/inner/sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ async def unsubs(user_id: int,
return None

coroutines = (
(tuple(unsub(user_id, feed_url=url, lang=lang) for url in feed_urls) if feed_urls else tuple())
+ (tuple(unsub(user_id, sub_id=sub_id, lang=lang) for sub_id in sub_ids) if sub_ids else tuple())
(tuple(unsub(user_id, feed_url=url, lang=lang) for url in feed_urls) if feed_urls else ())
+ (tuple(unsub(user_id, sub_id=sub_id, lang=lang) for sub_id in sub_ids) if sub_ids else ())
)

result = await asyncio.gather(*coroutines)
Expand Down
2 changes: 1 addition & 1 deletion src/command/inner/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def calculate_update(old_hashes: Optional[Sequence[str]], entries: Sequence[dict


def filter_urls(urls: Optional[Iterable[str]]) -> tuple[str, ...]:
return tuple(filter(lambda x: x.startswith('http://') or x.startswith('https://'), urls)) if urls else tuple()
return tuple(filter(lambda x: x.startswith('http://') or x.startswith('https://'), urls)) if urls else ()


# copied from command.utils
Expand Down
8 changes: 4 additions & 4 deletions src/parsing/medium.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,14 +905,14 @@ async def upload_all(
ret = []
allow_in_group = (
((media,) if self.allow_mixing_images_and_videos and not self.consider_videos_as_gifs else (images,))
+ (tuple() if self.consider_videos_as_gifs or self.allow_mixing_images_and_videos else (videos,))
+ (() if self.consider_videos_as_gifs or self.allow_mixing_images_and_videos else (videos,))
+ (audios,)
+ ((files,) if self.allow_files_sent_as_album else tuple())
+ ((files,) if self.allow_files_sent_as_album else ())
)
disallow_in_group = (
((videos,) if self.consider_videos_as_gifs else tuple())
((videos,) if self.consider_videos_as_gifs else ())
+ (gifs,)
+ (tuple() if self.allow_files_sent_as_album else (files,))
+ (() if self.allow_files_sent_as_album else (files,))
)
for list_to_process in allow_in_group:
while list_to_process:
Expand Down

0 comments on commit 3f37a7a

Please sign in to comment.