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

Code style as refactored by Sourcery #131

Merged
merged 7 commits into from Oct 28, 2021
Merged

Code style as refactored by Sourcery #131

merged 7 commits into from Oct 28, 2021

Conversation

adbar
Copy link
Contributor

@adbar adbar commented Oct 25, 2021

Hi @Ousret, as I was looking for other things that could be made more efficient in the code I tried Sourcery on it.

The reasons why the code was changed are listed in the conversation here: https://github.com/adbar/charset_normalizer/pull/1

I just corrected the mypy type hints, otherwise I left it untouched. I have recently made good experiences with this kind of refactoring.

I particularly like the sum() operators introduced, the simplified if clauses, the yield from and the optimized range(). Concerning the any() I'm not sure if I prefer that style or the original.

Anyway, please have a look and make any changes you like, it's just machine work ;)

@codecov-commenter
Copy link

Codecov Report

Merging #131 (1450470) into master (b89913a) will decrease coverage by 0.15%.
The diff coverage is 81.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #131      +/-   ##
==========================================
- Coverage   90.35%   90.19%   -0.16%     
==========================================
  Files          11       11              
  Lines        1171     1153      -18     
==========================================
- Hits         1058     1040      -18     
  Misses        113      113              
Impacted Files Coverage Δ
charset_normalizer/constant.py 100.00% <ø> (ø)
charset_normalizer/cli/normalizer.py 73.91% <20.00%> (ø)
charset_normalizer/utils.py 84.44% <80.00%> (-0.26%) ⬇️
charset_normalizer/md.py 96.65% <92.30%> (-0.04%) ⬇️
charset_normalizer/api.py 90.05% <100.00%> (-0.16%) ⬇️
charset_normalizer/cd.py 96.31% <100.00%> (-0.18%) ⬇️
charset_normalizer/models.py 86.66% <100.00%> (-0.07%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b89913a...1450470. Read the comment docs.

@Ousret Ousret self-requested a review October 25, 2021 20:25
@Ousret Ousret added the flourish Not really needed but nice to have! label Oct 25, 2021
Copy link
Owner

@Ousret Ousret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will do another review later,

@Ousret Ousret merged commit 4c69feb into Ousret:master Oct 28, 2021
@Ousret Ousret mentioned this pull request Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flourish Not really needed but nice to have!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants