Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Photologue on Python 3.11 #226

Merged
merged 1 commit into from
Oct 23, 2023
Merged

Conversation

emirisman
Copy link
Contributor

Photologue on Python 3.11 fails with:

   File "/usr/local/lib/python3.11/dist-packages/photologue/models.py", line 216, in sample
    return random.sample(set(photo_set), count)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.11/random.py", line 439, in sample
    raise TypeError("Population must be a sequence.  "
TypeError: Population must be a sequence.  For dicts or sets, use sorted(d).

This PR fixes the issue by wrapping converting the set into a list.

@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2023

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.22%. Comparing base (95c8112) to head (18a7b05).
Report is 8 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #226   +/-   ##
=======================================
  Coverage   72.22%   72.22%           
=======================================
  Files          29       29           
  Lines        1163     1163           
=======================================
  Hits          840      840           
  Misses        323      323           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@richardbarran richardbarran merged commit 743c2e3 into richardbarran:master Oct 23, 2023
3 checks passed
@richardbarran
Copy link
Owner

Thanks for the PR, looks good to me.
My machine is fairly old and I don't have 3.11 installed :-( so thanks for the debugging.
Do you want a new release of Photologue with your bugfix?

@emirisman
Copy link
Contributor Author

Thanks for the PR, looks good to me.

My machine is fairly old and I don't have 3.11 installed :-( so thanks for the debugging.

Do you want a new release of Photologue with your bugfix?

Yes please, would be great :)

@richardbarran
Copy link
Owner

Thanks for the PR, looks good to me.
My machine is fairly old and I don't have 3.11 installed :-( so thanks for the debugging.
Do you want a new release of Photologue with your bugfix?

Yes please, would be great :)

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants