mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
remove allow-untyped-defs from onnx/_internal/_lazy_import.py (#143943)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/143943 Approved by: https://github.com/justinchuby
This commit is contained in:
committed by
PyTorch MergeBot
parent
cf0b72c4ab
commit
7101b8ca35
@ -1,6 +1,5 @@
|
||||
"""Utility to lazily import modules."""
|
||||
|
||||
# mypy: allow-untyped-defs
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
@ -17,7 +16,7 @@ class _LazyModule:
|
||||
def __repr__(self) -> str:
|
||||
return f"<lazy module '{self._name}'>"
|
||||
|
||||
def __getattr__(self, attr):
|
||||
def __getattr__(self, attr: str) -> object:
|
||||
if self._module is None:
|
||||
self._module = importlib.import_module(".", self._name)
|
||||
return getattr(self._module, attr)
|
||||
|
Reference in New Issue
Block a user