Skip to content

chore: make code PEP597 compliant #2201

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

Merged
merged 1 commit into from
Jul 29, 2022
Merged

chore: make code PEP597 compliant #2201

merged 1 commit into from
Jul 29, 2022

Conversation

JohnVillalovos
Copy link
Member

Use encoding="utf-8" in open() and open-like functions.

https://peps.python.org/pep-0597/

Use `encoding="utf-8"` in `open()` and open-like functions.

https://peps.python.org/pep-0597/
@codecov-commenter
Copy link

Codecov Report

Merging #2201 (433dba0) into main (8ba97aa) will increase coverage by 4.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2201      +/-   ##
==========================================
+ Coverage   91.56%   95.56%   +4.00%     
==========================================
  Files          81       81              
  Lines        5344     5344              
==========================================
+ Hits         4893     5107     +214     
+ Misses        451      237     -214     
Flag Coverage Δ
api_func_v4 81.41% <100.00%> (?)
cli_func_v4 83.06% <100.00%> (-0.10%) ⬇️
unit 87.31% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/config.py 100.00% <100.00%> (ø)
gitlab/utils.py 98.59% <0.00%> (+1.40%) ⬆️
gitlab/v4/objects/members.py 94.82% <0.00%> (+1.72%) ⬆️
gitlab/client.py 98.70% <0.00%> (+3.44%) ⬆️
gitlab/types.py 98.21% <0.00%> (+3.57%) ⬆️
gitlab/v4/objects/notes.py 94.28% <0.00%> (+3.80%) ⬆️
gitlab/v4/objects/groups.py 89.40% <0.00%> (+3.97%) ⬆️
gitlab/v4/objects/pages.py 100.00% <0.00%> (+5.00%) ⬆️
gitlab/v4/objects/events.py 98.73% <0.00%> (+5.06%) ⬆️
gitlab/mixins.py 92.30% <0.00%> (+5.49%) ⬆️
... and 22 more

@nejch
Copy link
Member

nejch commented Jul 29, 2022

Thanks @JohnVillalovos!

Slightly related to this, I've seen some linters suggest to always use the standard with open() ... as f: pattern as suggested in https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files, to avoid arbitrary file descriptor names and shadowing file. Also discourages creating nested managers I assume. But I can't find an example now.

@nejch nejch merged commit 1b7cd31 into main Jul 29, 2022
@nejch nejch deleted the jlvillal/encoding_warning branch July 29, 2022 08:31
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