提交 3a764edd authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Fix typing issues in aesara.graph.type

上级 6aa7541a
...@@ -223,7 +223,7 @@ class Type(MetaObject): ...@@ -223,7 +223,7 @@ class Type(MetaObject):
return utils.add_tag_trace(self.make_variable(name)) return utils.add_tag_trace(self.make_variable(name))
@classmethod @classmethod
def values_eq(cls, a: Any, b: Any) -> bool: def values_eq(cls, a: "Type", b: "Type") -> bool:
"""Return ``True`` if `a` and `b` can be considered exactly equal. """Return ``True`` if `a` and `b` can be considered exactly equal.
`a` and `b` are assumed to be valid values of this `Type`. `a` and `b` are assumed to be valid values of this `Type`.
......
...@@ -3,7 +3,13 @@ import sys ...@@ -3,7 +3,13 @@ import sys
import traceback import traceback
from abc import ABCMeta from abc import ABCMeta
from io import StringIO from io import StringIO
from typing import List, Optional, Sequence, Tuple from typing import TYPE_CHECKING, List, Optional, Sequence, Tuple, TypeVar, Union
if TYPE_CHECKING:
from aesara.graph.basic import Apply, Variable
T = TypeVar("T", bound=Union["Apply", "Variable"])
def simple_extract_stack( def simple_extract_stack(
...@@ -67,7 +73,7 @@ def simple_extract_stack( ...@@ -67,7 +73,7 @@ def simple_extract_stack(
return trace return trace
def add_tag_trace(thing, user_line: Optional[int] = None): def add_tag_trace(thing: T, user_line: Optional[int] = None) -> T:
"""Add tag.trace to a node or variable. """Add tag.trace to a node or variable.
The argument is returned after being affected (inplace). The argument is returned after being affected (inplace).
......
...@@ -123,10 +123,6 @@ check_untyped_defs = False ...@@ -123,10 +123,6 @@ check_untyped_defs = False
ignore_errors = True ignore_errors = True
check_untyped_defs = False check_untyped_defs = False
[mypy-aesara.graph.type]
ignore_errors = True
check_untyped_defs = False
[mypy-aesara.graph.optdb] [mypy-aesara.graph.optdb]
ignore_errors = True ignore_errors = True
check_untyped_defs = False check_untyped_defs = False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论