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

Apply pyupgrade suggestions #2891

Merged
merged 5 commits into from
Sep 20, 2023
Merged

Conversation

DimitriPapadopoulos
Copy link
Contributor

@DimitriPapadopoulos DimitriPapadopoulos commented Sep 14, 2023

  • In Python 3, string literals are Unicode by default.
  • Use yield from instead of a loop with yield.
  • Delete empty 1st line.
  • In subprocess.check_output arguments., replace universal_newlines with text.

I tried to replace stdout=subprocess.PIPE/stderr=subprocess.PIPE with capture_output=True, but it doesn't work. Yet capture_output is documented to be available in Python >= 3.7:
https://docs.python.org/3/library/subprocess.html#subprocess.run

Copy link
Contributor

@arokem arokem left a comment

Choose a reason for hiding this comment

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

LGTM!

@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as ready for review September 14, 2023 18:54
@DimitriPapadopoulos DimitriPapadopoulos changed the title Apply pyupgrade suggestion Apply pyupgrade suggestions Sep 15, 2023
@codecov
Copy link

codecov bot commented Sep 15, 2023

Codecov Report

Merging #2891 (dca4498) into master (a46138c) will decrease coverage by 0.02%.
The diff coverage is 66.66%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2891      +/-   ##
==========================================
- Coverage   81.41%   81.40%   -0.02%     
==========================================
  Files         145      145              
  Lines       20147    20146       -1     
  Branches     3217     3216       -1     
==========================================
- Hits        16402    16399       -3     
- Misses       2929     2931       +2     
  Partials      816      816              
Files Changed Coverage Δ
dipy/align/__init__.py 100.00% <ø> (ø)
dipy/core/ndindex.py 83.33% <0.00%> (+6.41%) ⬆️
dipy/core/sphere.py 94.04% <ø> (ø)
dipy/denoise/gibbs.py 97.39% <ø> (ø)
dipy/denoise/nlmeans.py 100.00% <ø> (ø)
dipy/denoise/noise_estimate.py 78.88% <ø> (ø)
dipy/denoise/non_local_means.py 100.00% <ø> (ø)
dipy/direction/__init__.py 100.00% <ø> (ø)
dipy/io/bvectxt.py 37.50% <ø> (ø)
dipy/io/image.py 76.31% <ø> (ø)
... and 19 more

... and 1 file with indirect coverage changes

In Python 3, string literals are Unicode by default.
Use "yield from" instead of a loop with  "yield".
Copy link
Member

@skoudoro skoudoro left a comment

Choose a reason for hiding this comment

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

Thanks @DimitriPapadopoulos,

I am going ahead and merge this PR

@skoudoro skoudoro merged commit 9f68e2b into dipy:master Sep 20, 2023
24 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants