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 Report

Merging #226 (18a7b05) into master (95c8112) will not change coverage.
The diff coverage is 100.00%.

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

@@           Coverage Diff           @@
##           master     #226   +/-   ##
=======================================
  Coverage   72.22%   72.22%           
=======================================
  Files          29       29           
  Lines        1163     1163           
=======================================
  Hits          840      840           
  Misses        323      323           
Files Coverage Δ
photologue/models.py 85.11% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@richardbarran richardbarran merged commit 743c2e3 into richardbarran:master Oct 23, 2023
5 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.

None yet

3 participants