Skip to content

Commit fdaad92

Browse files
committed
Fix annotations and imports for mypy checks
1 parent 9bb5bca commit fdaad92

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modello.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
"""Module for symbolic modeling of systems."""
33
import typing
44

5-
from sympy import Basic, Dummy, Eq, simplify, solve
5+
from sympy import Basic, Dummy, Eq, solve
6+
# more verbose path as mypy sees sympy.simplify as a module
7+
from sympy.simplify.simplify import simplify
68

79

810
class ModelloSentinelClass:
@@ -13,7 +15,7 @@ class InstanceDummy(Dummy):
1315
"""Dummy which will create a bound bummy on Modello instantiation."""
1416

1517
def bound(self, model_name: str) -> "BoundInstanceDummy":
16-
"""Return an dummy bound to a modello instance."""
18+
"""Return a dummy bound to a modello instance."""
1719
return BoundInstanceDummy(model_name + "_" + self.name, **self.assumptions0)
1820

1921

@@ -35,7 +37,7 @@ def __init__(self, name: str, bases: typing.Tuple[type, ...]) -> None:
3537
# map of attributes to sympy Basic (e.g expression, value) objects
3638
self.attrs: typing.Dict[str, Basic] = {}
3739
# map of attributes to InstanceDummy instances - metadata used by derived classes
38-
self.dummies: typing.Dict[str, Dummy] = {}
40+
self.dummies: typing.Dict[str, InstanceDummy] = {}
3941
# map of attributes to non-modello managed objects
4042
self.other_attrs: typing.Dict[str, object] = {}
4143
# map of dummies to dummies that override them - metadata used by derived classes
@@ -124,7 +126,7 @@ class Modello(ModelloSentinelClass, metaclass=ModelloMeta):
124126
)
125127
_modello_class_constraints: typing.Dict[InstanceDummy, Basic] = {}
126128

127-
def __init__(self, name: str, **value_map: typing.Dict[str, Basic]) -> None:
129+
def __init__(self, name: str, **value_map: Basic) -> None:
128130
"""Initialise a model instance and solve for each attribute."""
129131
instance_dummies = {
130132
class_dummy: class_dummy.bound(name)

0 commit comments

Comments
 (0)