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:
bobrenjc93
2024-12-28 13:39:25 -08:00
committed by PyTorch MergeBot
parent cf0b72c4ab
commit 7101b8ca35

View File

@ -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)