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

Fix typing issues in aesara.graph.basic

上级 90c4ce82
差异被折叠。
......@@ -8,7 +8,7 @@ from typing import List, Optional, Sequence, Tuple
def simple_extract_stack(
f=None, limit: Optional[int] = None, skips: Optional[Sequence[str]] = None
) -> List[Tuple[Optional[str], int, str, str]]:
) -> List[Tuple[Optional[str], int, str, Optional[str]]]:
"""This is traceback.extract_stack from python 2.7 with this change:
- Comment the update of the cache.
......@@ -28,14 +28,12 @@ def simple_extract_stack(
skips = []
if f is None:
try:
raise ZeroDivisionError
except ZeroDivisionError:
f = sys.exc_info()[2].tb_frame.f_back
f = sys._getframe().f_back
if limit is None:
if hasattr(sys, "tracebacklimit"):
limit = sys.tracebacklimit
trace: List[Tuple[Optional[str], int, str, str]] = []
trace: List[Tuple[Optional[str], int, str, Optional[str]]] = []
n = 0
while f is not None and (limit is None or n < limit):
lineno = f.f_lineno
......@@ -43,7 +41,7 @@ def simple_extract_stack(
filename = co.co_filename
name = co.co_name
# linecache.checkcache(filename)
line = linecache.getline(filename, lineno, f.f_globals)
line: Optional[str] = linecache.getline(filename, lineno, f.f_globals)
if line:
line = line.strip()
else:
......
......@@ -115,14 +115,6 @@ check_untyped_defs = False
ignore_errors = True
check_untyped_defs = False
[mypy-aesara.graph.utils]
ignore_errors = True
check_untyped_defs = False
[mypy-aesara.graph.basic]
ignore_errors = True
check_untyped_defs = False
[mypy-aesara.graph.op]
ignore_errors = True
check_untyped_defs = False
......@@ -179,6 +171,10 @@ check_untyped_defs = False
ignore_errors = True
check_untyped_defs = False
[mypy-aesara.compile.builders]
ignore_errors = True
check_untyped_defs = False
[mypy-aesara.compile.sharedvalue]
ignore_errors = True
check_untyped_defs = False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论