Skip to content

Commit dea30ff

Browse files
Fix typing
1 parent e1f491d commit dea30ff

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

src/aiida/cmdline/commands/cmd_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def create_code(ctx: click.Context, cls: Code, **kwargs) -> None:
4141
"""Create a new `Code` instance."""
4242
try:
4343
model = cls.InputModel(**kwargs)
44-
instance = cls.from_model(model) # type: ignore[arg-type]
44+
instance = cls.from_model(model)
4545
except (TypeError, ValueError) as exception:
4646
echo.echo_critical(f'Failed to create instance `{cls}`: {exception}')
4747

src/aiida/orm/nodes/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
'List',
4444
'Node',
4545
'NodeAttributes',
46+
'NodeModelType',
4647
'NodeRepository',
48+
'NodeType',
4749
'NumericType',
4850
'OrbitalData',
4951
'PortableCode',

src/aiida/orm/nodes/data/bool.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from aiida.common.pydantic import MetadataField
1414

1515
from . import base
16+
from .base import to_aiida_type
1617

1718
__all__ = ('Bool',)
1819

@@ -38,8 +39,8 @@ def __bool__(self):
3839
return self.value
3940

4041

41-
@base.to_aiida_type.register(bool)
42-
@base.to_aiida_type.register(numpy.bool_)
42+
@to_aiida_type.register(bool)
43+
@to_aiida_type.register(numpy.bool_)
4344
def _(value):
4445
return Bool(value)
4546

src/aiida/orm/nodes/data/str.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from aiida.common.pydantic import MetadataField
1212

1313
from . import base
14+
from .base import to_aiida_type
1415

1516
__all__ = ('Str',)
1617

@@ -30,6 +31,6 @@ class Str(base.BaseType):
3031
_type = str
3132

3233

33-
@base.to_aiida_type.register(str)
34+
@to_aiida_type.register(str)
3435
def _(value):
3536
return Str(value)

src/aiida/orm/nodes/node.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@
6464
from ..implementation.nodes import BackendNode
6565
from .repository import NodeRepository
6666

67-
__all__ = ('Node',)
67+
__all__ = (
68+
'Node',
69+
'NodeModelType',
70+
'NodeType',
71+
)
6872

6973
NodeType = TypeVar('NodeType', bound='Node')
7074
NodeModelType = TypeVar('NodeModelType', bound='Model')
@@ -374,7 +378,7 @@ def __init__(
374378
self.base.extras.set_many(extras)
375379

376380
@classmethod
377-
def from_model(cls, model: Model) -> Self: # type: ignore[override]
381+
def from_model(cls, model: NodeModelType) -> Self:
378382
"""Return an entity instance from an instance of its model."""
379383
fields = cls.model_to_orm_field_values(model)
380384

0 commit comments

Comments
 (0)