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

STYLE: Fix boolean variable negation warnings #2983

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

jhlegarreta
Copy link
Contributor

Fix boolean variable negation warnings: use the not operator instead of the ~ opertor.

Fixes:

reconst/tests/test_csdeconv.py::test_odfdeconv
reconst/tests/test_csdeconv.py::test_odf_sh_to_sharp
reconst/tests/test_csdeconv.py::test_r2_term_odf_sharp
  dipy/venv/lib/python3.12/site-packages/dipy/reconst/csdeconv.py:768:
 DeprecationWarning: Bitwise inversion '~' on bool is deprecated.
 This returns the bitwise inversion of the underlying int object and is
 usually not what you expect from negating a bool. Use the 'not'
 operator for boolean negation or ~int(x) if you really want the bitwise
 inversion of the underlying int.
    if ~r2_term:

and

tracking/streamline.py: 9 warnings
tracking/tests/test_streamline.py: 18 warnings
  dipy/venv/lib/python3.12/site-packages/dipy/tracking/streamline.py:327:
 DeprecationWarning: Bitwise inversion '~' on bool is deprecated.
 This returns the bitwise inversion of the underlying int object and is
 usually not what you expect from negating a bool. Use the 'not'
 operator for boolean negation or ~int(x) if you really want the bitwise
 inversion of the underlying int.
    if include & ~exclude:

raised for example at:
https://github.com/dipy/dipy/actions/runs/7024094921/job/19112083400?pr=2981#step:9:4599 https://github.com/dipy/dipy/actions/runs/7024094921/job/19112083400?pr=2981#step:9:4621

Fix boolean variable negation warnings: use the `not` operator instead
of the `~` opertor.

Fixes:
```
reconst/tests/test_csdeconv.py::test_odfdeconv
reconst/tests/test_csdeconv.py::test_odf_sh_to_sharp
reconst/tests/test_csdeconv.py::test_r2_term_odf_sharp
  dipy/venv/lib/python3.12/site-packages/dipy/reconst/csdeconv.py:768:
 DeprecationWarning: Bitwise inversion '~' on bool is deprecated.
 This returns the bitwise inversion of the underlying int object and is
 usually not what you expect from negating a bool. Use the 'not'
 operator for boolean negation or ~int(x) if you really want the bitwise
 inversion of the underlying int.
    if ~r2_term:
```

and
```
tracking/streamline.py: 9 warnings
tracking/tests/test_streamline.py: 18 warnings
  dipy/venv/lib/python3.12/site-packages/dipy/tracking/streamline.py:327:
 DeprecationWarning: Bitwise inversion '~' on bool is deprecated.
 This returns the bitwise inversion of the underlying int object and is
 usually not what you expect from negating a bool. Use the 'not'
 operator for boolean negation or ~int(x) if you really want the bitwise
 inversion of the underlying int.
    if include & ~exclude:
```

raised for example at:
https://github.com/dipy/dipy/actions/runs/7024094921/job/19112083400?pr=2981#step:9:4599
https://github.com/dipy/dipy/actions/runs/7024094921/job/19112083400?pr=2981#step:9:4621
Copy link

codecov bot commented Nov 30, 2023

Codecov Report

Merging #2983 (013833f) into master (618b395) will increase coverage by 0.00%.
Report is 96 commits behind head on master.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2983   +/-   ##
=======================================
  Coverage   81.71%   81.72%           
=======================================
  Files         147      147           
  Lines       20484    20569   +85     
  Branches     3277     3279    +2     
=======================================
+ Hits        16739    16809   +70     
- Misses       2913     2932   +19     
+ Partials      832      828    -4     
Files Coverage Δ
dipy/reconst/csdeconv.py 87.26% <100.00%> (+0.31%) ⬆️
dipy/tracking/streamline.py 93.83% <100.00%> (ø)

... and 16 files with indirect coverage changes

@skoudoro
Copy link
Member

Great! thank you @jhlegarreta, merging

@skoudoro skoudoro merged commit 2a7d824 into dipy:master Nov 30, 2023
31 checks passed
@jhlegarreta
Copy link
Contributor Author

Down to 192 warnings:

========== 989 passed, 59 skipped, 192 warnings in 2563.84s (0:42:43) ==========

at https://github.com/dipy/dipy/actions/runs/7039694223/job/19159201183#step:9:4562

from 226 warnings:

========== 989 passed, 59 skipped, 226 warnings in 2532.19s (0:42:12) ==========

at https://github.com/dipy/dipy/actions/runs/7024094921/job/19112083400?pr=2981#step:9:4635

@jhlegarreta jhlegarreta deleted the FixBooleanNotWarnings branch November 30, 2023 15:32
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

2 participants