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

Fix typing issues in aesara.link.c.lazylinker_c

上级 bfd7f973
......@@ -4,6 +4,8 @@ import os
import sys
import warnings
from importlib import reload
from types import ModuleType
from typing import Optional
import aesara
from aesara.compile.compilelock import lock_ctx
......@@ -15,7 +17,7 @@ _logger = logging.getLogger(__file__)
force_compile = False
version = 0.211 # must match constant returned in function get_version()
lazylinker_ext = None
lazylinker_ext: Optional[ModuleType] = None
def try_import():
......@@ -127,6 +129,7 @@ except ImportError:
code = open(cfile).read()
loc = os.path.join(config.compiledir, dirname)
if not os.path.exists(loc):
try:
os.mkdir(loc)
except OSError as e:
......@@ -149,10 +152,13 @@ except ImportError:
try_reload()
from lazylinker_ext import lazylinker_ext as lazy_c
assert lazylinker_ext._version == lazy_c.get_version()
assert (
lazylinker_ext is not None
and lazylinker_ext._version == lazy_c.get_version()
)
_logger.info(f"New version {lazylinker_ext._version}")
from lazylinker_ext.lazylinker_ext import CLazyLinker # noqa
from lazylinker_ext.lazylinker_ext import CLazyLinker, get_version # noqa
from lazylinker_ext.lazylinker_ext import * # noqa
assert force_compile or (version == get_version()) # noqa
......@@ -115,10 +115,6 @@ check_untyped_defs = False
ignore_errors = True
check_untyped_defs = False
[mypy-aesara.link.c.lazylinker_c]
ignore_errors = True
check_untyped_defs = False
[mypy-aesara.compile.mode]
ignore_errors = True
check_untyped_defs = False
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论