Skip to content

Commit a84ffa5

Browse files
committed
Add typing and fix mypy
1 parent 192aa65 commit a84ffa5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/nomad_simulations/schema_packages/physical_property.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import TYPE_CHECKING
2+
13
from nomad import utils
24
from nomad.datamodel.metainfo.basesections.v2 import Entity
35
from nomad.datamodel.metainfo.plot import PlotlyFigure, PlotSection
@@ -7,6 +9,9 @@
79

810
logger = utils.get_logger(__name__)
911

12+
if TYPE_CHECKING:
13+
from nomad.datamodel.metainfo import BoundLogger
14+
1015

1116
class PhysicalProperty(PlotSection):
1217
"""
@@ -145,7 +150,7 @@ def _is_contribution(self) -> bool:
145150
return True
146151
return False
147152

148-
def _validate_contributions_structure(self, logger) -> bool:
153+
def _validate_contributions_structure(self, logger: 'BoundLogger') -> bool:
149154
"""
150155
Validates that contributions do not contain nested contributions.
151156
This prevents recursive contribution structures which are not intended.

tests/test_physical_properties.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import numpy as np
22
import pytest
3+
from typing import Callable
34
from nomad.datamodel import EntryArchive
45
from nomad.datamodel.metainfo.plot import PlotlyFigure
56
from nomad.metainfo import Quantity
@@ -101,7 +102,7 @@ def test_plotting_and_contributions(self):
101102
],
102103
)
103104
def test_name_setting_during_normalization(
104-
self, instantiator: callable, reference: str
105+
self, instantiator: Callable, reference: str
105106
):
106107
"""
107108
Test that the name is set during normalization for PhysicalProperty.

0 commit comments

Comments
 (0)