nipy / nibabel

Python package to access a cacophony of neuro-imaging file formats
http://nipy.org/nibabel/
Other
649 stars 258 forks source link

RF: Fix `ast` library type and attribute deprecation warnings #1332

Closed jhlegarreta closed 3 months ago

jhlegarreta commented 3 months ago

Fix ast library type and attribute deprecation warnings.

Fixes:

/home/runner/work/nibabel/nibabel/nibabel/nicom/ascconv.py:177:
 DeprecationWarning: ast.Num is deprecated and will be removed in Python 3.14; use ast.Constant instead
  if isinstance(value, ast.Num):

/home/runner/work/nibabel/nibabel/nibabel/nicom/ascconv.py:179:
 DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
  if isinstance(value, ast.Str):

/home/runner/work/nibabel/nibabel/nibabel/nicom/ascconv.py:180:
 DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  return value.s

/home/runner/work/nibabel/nibabel/nibabel/nicom/ascconv.py:94:
 DeprecationWarning: Attribute n is deprecated and will be removed in Python 3.14; use value instead
  index = target.slice.n

/home/runner/work/nibabel/nibabel/nibabel/nicom/ascconv.py:182:
 DeprecationWarning: Attribute n is deprecated and will be removed in Python 3.14; use value instead
  return -value.operand.n

raised for example in: https://github.com/nipy/nibabel/actions/runs/9637811213/job/26577586721#step:7:207

Documentation: https://docs.python.org/3/library/ast.html

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.20%. Comparing base (d18022d) to head (94e3e83).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1332 +/- ## ========================================== - Coverage 92.20% 92.20% -0.01% ========================================== Files 98 98 Lines 12400 12398 -2 Branches 2557 2556 -1 ========================================== - Hits 11433 11431 -2 Misses 644 644 Partials 323 323 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jhlegarreta commented 3 months ago

doctest build failures are unrelated.