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

TYP: upgrade mypy to 0.930 (enable TypeAlias) #3729

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ install_requires =
toml>=0.10.2
tqdm>=3.4.0
unyt>=2.8.0
typing-extensions>=4.0.1;python_version < "3.10"
python_requires = >=3.7,<3.12
include_package_data = True
scripts = scripts/iyt
Expand Down Expand Up @@ -100,6 +101,7 @@ minimal =
more-itertools==8.4
numpy==1.14.5
unyt==2.8.0
typing-extensions==4.0.1;python_version < "3.10"
test =
codecov~=2.0.15
coverage~=4.5.1
Expand All @@ -109,7 +111,7 @@ test =
pytest>=6.1
pytest-xdist~=2.1.0
typecheck =
mypy==0.910
mypy==0.930
types-PyYAML==5.4.10
types-chardet==4.0.0
types-requests==2.25.9
Expand Down
11 changes: 9 additions & 2 deletions yt/_typing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import sys
from typing import List, Optional, Tuple

FieldDescT = Tuple[str, Tuple[str, List[str], Optional[str]]]
KnownFieldsT = Tuple[FieldDescT, ...]
if sys.version_info >= (3, 10):
from typing import TypeAlias
else:
from typing_extensions import TypeAlias


FieldDescT: TypeAlias = Tuple[str, Tuple[str, List[str], Optional[str]]]
KnownFieldsT: TypeAlias = Tuple[FieldDescT, ...]
6 changes: 4 additions & 2 deletions yt/frontends/gadget_fof/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@


class GadgetFOFFieldInfo(FieldInfoContainer):
known_particle_fields = _particle_fields
# https://github.com/python/mypy/issues/11836
known_particle_fields = _particle_fields # type: ignore

# these are extra fields to be created for the "all" particle type
extra_union_fields = (
Expand All @@ -91,4 +92,5 @@ class GadgetFOFFieldInfo(FieldInfoContainer):


class GadgetFOFHaloFieldInfo(FieldInfoContainer):
known_particle_fields = _particle_fields + (("ID", ("", ["member_ids"], None)),)
# https://github.com/python/mypy/issues/11836
known_particle_fields = _particle_fields + (("ID", ("", ["member_ids"], None)),) # type: ignore
8 changes: 6 additions & 2 deletions yt/visualization/plot_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,9 @@ def __new__( # type: ignore
else:
cls = OffAxisSlicePlot
self = object.__new__(cls)
return self

# https://github.com/python/mypy/issues/11835
return self # type: ignore


class ProjectionPlot(NormalPlot):
Expand Down Expand Up @@ -1749,7 +1751,9 @@ def __new__( # type: ignore
else:
cls = OffAxisProjectionPlot
self = object.__new__(cls)
return self

# https://github.com/python/mypy/issues/11835
return self # type: ignore


class AxisAlignedSlicePlot(SlicePlot, PWViewerMPL):
Expand Down