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

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

Merged
merged 1 commit into from
Jun 27, 2024

Conversation

jhlegarreta
Copy link
Contributor

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

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
Copy link

codecov bot commented Jun 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@            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              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jhlegarreta
Copy link
Contributor Author

doctest build failures are unrelated.

@effigies effigies merged commit adedf7b into nipy:master Jun 27, 2024
49 of 51 checks passed
@jhlegarreta jhlegarreta deleted the FixAstWarnings branch June 27, 2024 12:52
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.

2 participants