-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: typing module re-organization
Type safe types are no longer called strict, but type_safe; typing namespace free of type files, but submodules, and the type files are now in the loading submodule.
- Loading branch information
Showing
20 changed files
with
846 additions
and
773 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
from pydantic_numpy.helper.annotation import np_array_pydantic_annotated_typing | ||
from pydantic_numpy.typing.n_dimensional import * | ||
|
||
__all__ = ["np_array_pydantic_annotated_typing", "model", "typing"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
from pydantic_numpy.typing.i_dimensional import * | ||
from pydantic_numpy.typing.ii_dimensional import * | ||
from pydantic_numpy.typing.iii_dimensional import * | ||
from pydantic_numpy.typing.n_dimensional import * | ||
from pydantic_numpy.typing.strict_data_type.i_dimensional import * | ||
from pydantic_numpy.typing.strict_data_type.ii_dimensional import * | ||
from pydantic_numpy.typing.strict_data_type.iii_dimensional import * | ||
from pydantic_numpy.typing.strict_data_type.n_dimensional import * | ||
from pydantic_numpy.typing.type_safe.i_dimensional import * | ||
from pydantic_numpy.typing.type_safe.ii_dimensional import * | ||
from pydantic_numpy.typing.type_safe.iii_dimensional import * | ||
from pydantic_numpy.typing.type_safe.n_dimensional import * |
File renamed without changes.
80 changes: 43 additions & 37 deletions
80
.../typing/strict_data_type/i_dimensional.py → ...c_numpy/typing/type_safe/i_dimensional.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,122 @@ | ||
from typing import Annotated | ||
from typing import Annotated, Any, TypeAlias | ||
|
||
import numpy as np | ||
|
||
from pydantic_numpy.helper.annotation import NpArrayPydanticAnnotation | ||
|
||
NpStrict1DArrayInt64 = Annotated[ | ||
Np1DArray: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[Any]], | ||
NpArrayPydanticAnnotation.factory(data_type=None, dimensions=1, strict_data_typing=False), | ||
] | ||
|
||
Np1DArrayInt64: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.int64]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.int64, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayInt32 = Annotated[ | ||
Np1DArrayInt32: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.int32]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.int32, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayInt16 = Annotated[ | ||
Np1DArrayInt16: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.int16]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.int16, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayInt8 = Annotated[ | ||
Np1DArrayInt8: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.int8]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.int8, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayUint64 = Annotated[ | ||
Np1DArrayUint64: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.uint64]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.uint64, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayUint32 = Annotated[ | ||
Np1DArrayUint32: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.uint32]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.uint32, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayUint16 = Annotated[ | ||
Np1DArrayUint16: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.uint16]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.uint16, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayUint8 = Annotated[ | ||
Np1DArrayUint8: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.uint8]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.uint8, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayFpLongDouble = Annotated[ | ||
Np1DArrayFpLongDouble: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.longdouble]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.longdouble, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayFp64 = Annotated[ | ||
Np1DArrayFp64: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.float64]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.float64, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayFp32 = Annotated[ | ||
Np1DArrayFp32: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.float32]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.float32, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayFp16 = Annotated[ | ||
Np1DArrayFp16: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.float16]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.float16, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayComplexLongDouble = Annotated[ | ||
Np1DArrayComplexLongDouble: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.clongdouble]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.clongdouble, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayComplex128 = Annotated[ | ||
Np1DArrayComplex128: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.complex128]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.complex128, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayComplex64 = Annotated[ | ||
Np1DArrayComplex64: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.complex64]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.complex64, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayBool = Annotated[ | ||
Np1DArrayBool: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.bool_]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.bool_, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayDatetime64 = Annotated[ | ||
Np1DArrayDatetime64: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.datetime64]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.datetime64, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
NpStrict1DArrayTimedelta64 = Annotated[ | ||
Np1DArrayTimedelta64: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int], np.dtype[np.timedelta64]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.timedelta64, dimensions=1, strict_data_typing=True), | ||
] | ||
|
||
__all__ = [ | ||
"NpStrict1DArrayInt64", | ||
"NpStrict1DArrayInt32", | ||
"NpStrict1DArrayInt16", | ||
"NpStrict1DArrayInt8", | ||
"NpStrict1DArrayUint64", | ||
"NpStrict1DArrayUint32", | ||
"NpStrict1DArrayUint16", | ||
"NpStrict1DArrayUint8", | ||
"NpStrict1DArrayFpLongDouble", | ||
"NpStrict1DArrayFp64", | ||
"NpStrict1DArrayFp32", | ||
"NpStrict1DArrayFp16", | ||
"NpStrict1DArrayComplexLongDouble", | ||
"NpStrict1DArrayComplex128", | ||
"NpStrict1DArrayComplex64", | ||
"NpStrict1DArrayBool", | ||
"NpStrict1DArrayDatetime64", | ||
"NpStrict1DArrayTimedelta64", | ||
"Np1DArray", | ||
"Np1DArrayInt64", | ||
"Np1DArrayInt32", | ||
"Np1DArrayInt16", | ||
"Np1DArrayInt8", | ||
"Np1DArrayUint64", | ||
"Np1DArrayUint32", | ||
"Np1DArrayUint16", | ||
"Np1DArrayUint8", | ||
"Np1DArrayFpLongDouble", | ||
"Np1DArrayFp64", | ||
"Np1DArrayFp32", | ||
"Np1DArrayFp16", | ||
"Np1DArrayComplexLongDouble", | ||
"Np1DArrayComplex128", | ||
"Np1DArrayComplex64", | ||
"Np1DArrayBool", | ||
"Np1DArrayDatetime64", | ||
"Np1DArrayTimedelta64", | ||
] |
80 changes: 43 additions & 37 deletions
80
...typing/strict_data_type/ii_dimensional.py → ..._numpy/typing/type_safe/ii_dimensional.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,122 @@ | ||
from typing import Annotated | ||
from typing import Annotated, Any, TypeAlias | ||
|
||
import numpy as np | ||
|
||
from pydantic_numpy.helper.annotation import NpArrayPydanticAnnotation | ||
|
||
NpStrict2DArrayInt64 = Annotated[ | ||
Np2DArray: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[Any]], | ||
NpArrayPydanticAnnotation.factory(data_type=None, dimensions=2, strict_data_typing=False), | ||
] | ||
|
||
Np2DArrayInt64: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.int64]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.int64, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayInt32 = Annotated[ | ||
Np2DArrayInt32: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.int32]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.int32, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayInt16 = Annotated[ | ||
Np2DArrayInt16: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.int16]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.int16, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayInt8 = Annotated[ | ||
Np2DArrayInt8: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.int8]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.int8, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayUint64 = Annotated[ | ||
Np2DArrayUint64: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.uint64]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.uint64, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayUint32 = Annotated[ | ||
Np2DArrayUint32: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.uint32]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.uint32, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayUint16 = Annotated[ | ||
Np2DArrayUint16: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.uint16]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.uint16, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayUint8 = Annotated[ | ||
Np2DArrayUint8: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.uint8]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.uint8, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayFpLongDouble = Annotated[ | ||
Np2DArrayFpLongDouble: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.longdouble]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.longdouble, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayFp64 = Annotated[ | ||
Np2DArrayFp64: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.float64]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.float64, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayFp32 = Annotated[ | ||
Np2DArrayFp32: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.float32]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.float32, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayFp16 = Annotated[ | ||
Np2DArrayFp16: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.float16]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.float16, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayComplexLongDouble = Annotated[ | ||
Np2DArrayComplexLongDouble: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.clongdouble]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.clongdouble, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayComplex128 = Annotated[ | ||
Np2DArrayComplex128: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.complex128]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.complex128, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayComplex64 = Annotated[ | ||
Np2DArrayComplex64: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.complex64]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.complex64, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayBool = Annotated[ | ||
Np2DArrayBool: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.bool_]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.bool_, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayDatetime64 = Annotated[ | ||
Np2DArrayDatetime64: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.datetime64]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.datetime64, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
NpStrict2DArrayTimedelta64 = Annotated[ | ||
Np2DArrayTimedelta64: TypeAlias = Annotated[ | ||
np.ndarray[tuple[int, int], np.dtype[np.timedelta64]], | ||
NpArrayPydanticAnnotation.factory(data_type=np.timedelta64, dimensions=2, strict_data_typing=True), | ||
] | ||
|
||
__all__ = [ | ||
"NpStrict2DArrayInt64", | ||
"NpStrict2DArrayInt32", | ||
"NpStrict2DArrayInt16", | ||
"NpStrict2DArrayInt8", | ||
"NpStrict2DArrayUint64", | ||
"NpStrict2DArrayUint32", | ||
"NpStrict2DArrayUint16", | ||
"NpStrict2DArrayUint8", | ||
"NpStrict2DArrayFpLongDouble", | ||
"NpStrict2DArrayFp64", | ||
"NpStrict2DArrayFp32", | ||
"NpStrict2DArrayFp16", | ||
"NpStrict2DArrayComplexLongDouble", | ||
"NpStrict2DArrayComplex128", | ||
"NpStrict2DArrayComplex64", | ||
"NpStrict2DArrayBool", | ||
"NpStrict2DArrayDatetime64", | ||
"NpStrict2DArrayTimedelta64", | ||
"Np2DArray", | ||
"Np2DArrayInt64", | ||
"Np2DArrayInt32", | ||
"Np2DArrayInt16", | ||
"Np2DArrayInt8", | ||
"Np2DArrayUint64", | ||
"Np2DArrayUint32", | ||
"Np2DArrayUint16", | ||
"Np2DArrayUint8", | ||
"Np2DArrayFpLongDouble", | ||
"Np2DArrayFp64", | ||
"Np2DArrayFp32", | ||
"Np2DArrayFp16", | ||
"Np2DArrayComplexLongDouble", | ||
"Np2DArrayComplex128", | ||
"Np2DArrayComplex64", | ||
"Np2DArrayBool", | ||
"Np2DArrayDatetime64", | ||
"Np2DArrayTimedelta64", | ||
] |
Oops, something went wrong.