Skip to content

Commit 4c094ee

Browse files
committed
moved the not implemented versions of Checked* classes in the beginning of checked.py otherwise PyCharm do not provide auto-completion for methods imported from Session
1 parent 848fe17 commit 4c094ee

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

larray/core/checked.py

+14-15
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,20 @@ class NotLoaded:
2222
except ImportError:
2323
pydantic = None
2424

25-
if pydantic:
25+
if not pydantic:
26+
def CheckedArray(axes: AxisCollection, dtype: np.dtype = float) -> Type[Array]:
27+
raise NotImplementedError("CheckedArray cannot be used because pydantic is not installed")
28+
29+
class CheckedSession:
30+
def __init__(self, *args, **kwargs):
31+
raise NotImplementedError("CheckedSession class cannot be instantiated "
32+
"because pydantic is not installed")
33+
34+
class CheckedParameters:
35+
def __init__(self, *args, **kwargs):
36+
raise NotImplementedError("CheckedParameters class cannot be instantiated "
37+
"because pydantic is not installed")
38+
else:
2639
from pydantic.fields import ModelField
2740
from pydantic.class_validators import Validator
2841
from pydantic.main import BaseConfig
@@ -518,17 +531,3 @@ class Config:
518531
# whether or not models are faux-immutable, i.e. whether __setattr__ is allowed.
519532
# (default: True)
520533
allow_mutation = False
521-
522-
else:
523-
def CheckedArray(axes: AxisCollection, dtype: np.dtype = float) -> Type[Array]:
524-
raise NotImplementedError("CheckedArray cannot be used because pydantic is not installed")
525-
526-
class CheckedSession:
527-
def __init__(self, *args, **kwargs):
528-
raise NotImplementedError("CheckedSession class cannot be instantiated "
529-
"because pydantic is not installed")
530-
531-
class CheckedParameters:
532-
def __init__(self, *args, **kwargs):
533-
raise NotImplementedError("CheckedParameters class cannot be instantiated "
534-
"because pydantic is not installed")

0 commit comments

Comments
 (0)