Skip to content

Commit

Permalink
fixed issue with Self in python < 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
jobdewitte committed Jan 23, 2025
1 parent 0cf1d22 commit bddede1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
9 changes: 9 additions & 0 deletions traceon/_typing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
from __future__ import annotations
import sys

from typing import TYPE_CHECKING, Any, cast
from collections.abc import Callable, Generator, Iterator, Mapping, Sequence

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self

from ._array_like import(
ArrayFloat, ArrayFloat1D, ArrayFloat2D, ArrayFloat3D, ArrayFloat4D, ArrayFloat5D,
Expand Down
21 changes: 10 additions & 11 deletions traceon/typing.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Self, cast
from collections.abc import Callable, Generator, Iterator, Mapping, Sequence


from ._typing import (
# Array-Like types
# general
TYPE_CHECKING, Any, cast, Self, Callable, Generator, Iterator, Mapping, Sequence,

# Array-like types
ArrayFloat, ArrayFloat1D, ArrayFloat2D, ArrayFloat3D, ArrayFloat4D, ArrayFloat5D,
ArrayLikeFloat, ArrayLikeFloat1D, ArrayLikeFloat2D, ArrayLikeFloat3D, ArrayLikeFloat4D, ArrayLikeFloat5D,
ArrayInt, ArrayInt1D, ArrayInt2D, ArrayInt3D, ArrayInt4D,
Expand All @@ -21,23 +23,20 @@
PointTransformFunction,
Bounds2D, BoundsLike2D, Bounds3D, BoundsLike3D,

# Mesh Types
# Mesh types
Line, LineLike, Lines, LinesLike,
Triangle, TriangleLike, Triangles, TrianglesLike,
Quad, QuadLike, Quads, QuadsLike,
LineVertices, LinesVertices, Triangles, TrianglesVertices,
ActiveLines, ActiveTriangles

ActiveLines, ActiveTriangles,
)

if TYPE_CHECKING:
from .geometry import Path, PathCollection, Surface, SurfaceCollection
from .mesher import Mesh
from .excitation import Excitation
from .field import EffectivePointCharges, Field, FieldBEM, FieldRadialBEM
try:
from traceon_pro.field import Field3DBEM # type: ignore
try:
from traceon_pro.field import Field3DBEM # type: ignore
except ImportError:
Field3DBEM = Any


Field3DBEM = None # Fallback for unavailable import

0 comments on commit bddede1

Please sign in to comment.