Skip to content

Commit

Permalink
Merge pull request #182 from corenting/dependabot/pip/development-dep…
Browse files Browse the repository at this point in the history
…endencies-4efabfe7c4

chore(deps-dev): bump ruff from 0.5.0 to 0.5.2 in the development-dependencies group across 1 directory
  • Loading branch information
corenting committed Jul 15, 2024
2 parents d6373d9 + 5844edb commit e0f6a6f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
8 changes: 4 additions & 4 deletions eddrit/reddit/content_parser/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def get_post_video_content(

# Sort: best resolution + non-embed first
parsed_results.sort(
key=lambda x: (x.width * x.height, type(x) != models.EmbedPostContent),
key=lambda x: (x.width * x.height, type(x) is not models.EmbedPostContent),
reverse=True,
)
logger.debug(
Expand All @@ -160,20 +160,20 @@ def get_post_video_content(
# display the embed as it may have sound
if (
embed_content := next(
(x for x in parsed_results if type(x) == models.EmbedPostContent), None
(x for x in parsed_results if type(x) is models.EmbedPostContent), None
)
) and any(getattr(x, "is_gif", False) for x in parsed_results):
return embed_content

# If the best content is an embed, just return it as the frontend
# doesn't handle mix of embed and non embed sources
best_content = parsed_results[0]
if type(best_content) == models.EmbedPostContent:
if type(best_content) is models.EmbedPostContent:
return best_content

# Else return the list of non-embed sources
videos = [
item for item in parsed_results if type(item) != models.EmbedPostContent
item for item in parsed_results if type(item) is not models.EmbedPostContent
]
return models.VideoPostContent(
videos=videos # type: ignore
Expand Down
42 changes: 23 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e0f6a6f

Please sign in to comment.