iris icon indicating copy to clipboard operation
iris copied to clipboard

[pre-commit.ci] pre-commit autoupdate

Open pre-commit-ci[bot] opened this issue 1 year ago • 3 comments

Codecov Report

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

Project coverage is 89.81%. Comparing base (2609afb) to head (f83b9d5). Report is 74 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6033   +/-   ##
=======================================
  Coverage   89.81%   89.81%           
=======================================
  Files          88       88           
  Lines       23174    23174           
  Branches     5045     5045           
=======================================
  Hits        20814    20814           
  Misses       1623     1623           
  Partials      737      737           

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

codecov[bot] avatar Jul 08 '24 18:07 codecov[bot]

This is a bit weird.

(1) The ruff errors are clear enough : it now doesn't like file.readlines(), so can be removed. see : https://github.com/SciTools/iris/pull/6033/commits/a7db47f424ea8a72629bcd7ce050df19f97ac3c8

but (2) MyPy is complaining about Missing positional argument "self" in call to "__call__" of "_Wrapped", applying in various places where iris-something.name() is called.

This seems like a bug in MyPy, either that or "wraps" is not doing its job properly ? I think it may be https://github.com/python/mypy/issues/17166 A prototype fix : https://github.com/SciTools/iris/pull/6033/commits/bd142d37d6390f4fe8eb8314046dceb46c8b568d

pp-mo avatar Jul 23 '24 10:07 pp-mo

@bjlittle can you re-review this + let me know what you think ?

Hint : you might think the MyPy workaround is a bit nasty. But right now I'm not really sure what would be better (!)

pp-mo avatar Jul 23 '24 10:07 pp-mo

We are being bitten here by a MyPy problem which seems generic + unresolved

  • previously seen in #6063
  • my comment on the problem in MyPy itself in this comment on mypy#17166
  • ... which is still open as-of today 2024-10-02

When I run the MyPy checks locally on all files, there are quite a few occurrences :

$ pre-commit run mypy -a 
mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

lib/iris/fileformats/netcdf/saver.py:957: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/iris/fileformats/netcdf/saver.py:958: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/iris/fileformats/netcdf/saver.py:960: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/iris/analysis/__init__.py:2463: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/analysis/__init__.py:2533: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/analysis/__init__.py:2557: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/analysis/__init__.py:2558: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:1430: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:1540: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:1554: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:1561: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:1643: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:1787: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:1969: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:1995: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2027: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2075: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2095: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2377: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2384: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2569: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2612: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2619: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2673: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2716: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2724: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2894: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2907: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:2918: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:3746: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:4316: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:4320: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:4537: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:4544: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:4845: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:4872: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/cube.py:4880: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/mesh/utils.py:99: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/mesh/utils.py:150: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/mesh/utils.py:154: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/tests/integration/test_netcdf__loadsaveattrs.py:417: error: Missing positional argument "self" in call to "__call__" of "_Wrapped"  [call-arg]
lib/iris/tests/stock/__init__.py:778: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/iris/tests/stock/__init__.py:779: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/iris/tests/test_coding_standards.py:88: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/iris/tests/test_coding_standards.py:157: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lib/iris/tests/test_coding_standards.py:163: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
Found 38 errors in 4 files (checked 663 source files)

So, I think the only reason we haven't seen a long list of errors here is that the check is only run on modified files.

The specific problems here all seem to relate to the definition of 'name()' for a CFVariableMixin - derived Iris object (i.e. an object with CF-type standard_name/long_name/attributes etc) That is declared here

pp-mo avatar Oct 02 '24 15:10 pp-mo

It's very kind of you to look into this @pp-mo but feel free to leave it with me if you have other priorities (we assigned it to me last week)

trexfeathers avatar Oct 02 '24 15:10 trexfeathers

It's very kind of you to look into this @pp-mo but feel free to leave it with me if you have other priorities (we assigned it to me last week)

OK that makes sense -- I had forgotten. I'll leave it to you, as it seems to involve strategic choices !

pp-mo avatar Oct 02 '24 15:10 pp-mo