@@ -183,7 +183,7 @@ class TypeMethod:
183183 kind : int # 0: member method, 1: static method
184184
185185 def as_callable (self ) -> Callable [..., typing .Any ]:
186- from .core import func_call # type: ignore[import-not-found]
186+ from .core import func_call # type: ignore[import-not-found] # noqa: PLC0415
187187
188188 func = self .func
189189 if self .kind == 0 : # member method
@@ -219,14 +219,16 @@ class TypeInfo:
219219 d_fields : tuple [Field , ...] = ()
220220
221221 def get_parent (self ) -> TypeInfo :
222- from .core import type_index2cached_py_type_info # type: ignore[import-not-found]
222+ from .core import ( # type: ignore[import-not-found] # noqa: PLC0415
223+ type_index2cached_py_type_info ,
224+ )
223225
224226 type_index = self .type_ancestors [- 1 ]
225227 return type_index2cached_py_type_info (type_index )
226228
227229
228230def translate_exception_to_c (exception : Exception ) -> tuple [bytes , int , bytes ]:
229- from .core import str_py2c # type: ignore[import-not-found]
231+ from .core import str_py2c # type: ignore[import-not-found] # noqa: PLC0415
230232
231233 def _kind () -> bytes :
232234 kind : str = exception .__class__ .__name__
@@ -256,7 +258,7 @@ def _bytes_info() -> bytes:
256258
257259
258260def translate_exception_from_c (err : Error ) -> Exception :
259- from .core import error_pycode_fake # type: ignore[import-not-found]
261+ from .core import error_pycode_fake # type: ignore[import-not-found] # noqa: PLC0415
260262
261263 kind , info = err .kind , err ._info
262264 if info :
@@ -306,7 +308,7 @@ def dtype_normalize(dtype: typing.Any) -> str | DataType:
306308 def _torch_dtype_to_str () -> str | None :
307309 if "torch" not in sys .modules :
308310 return None
309- import torch
311+ import torch # noqa: PLC0415
310312
311313 if not isinstance (dtype , torch .dtype ):
312314 return None
@@ -324,7 +326,7 @@ def _numpy_dtype_to_str() -> str | None:
324326 return np_dtype
325327 if (torch_dtype := _torch_dtype_to_str ()) is not None :
326328 return torch_dtype
327- from mlc .core .dtype import DataType
329+ from mlc .core .dtype import DataType # noqa: PLC0415
328330
329331 return dtype if isinstance (dtype , DataType ) else str (dtype )
330332
@@ -333,7 +335,7 @@ def device_normalize(device: typing.Any) -> str | Device:
333335 def _torch_device_to_str () -> str | None :
334336 if "torch" not in sys .modules :
335337 return None
336- import torch
338+ import torch # noqa: PLC0415
337339
338340 if not isinstance (device , torch .device ):
339341 return None
@@ -416,7 +418,7 @@ def attach_method(
416418
417419def c_class_core (type_key : str ) -> Callable [[type [ClsType ]], type [ClsType ]]:
418420 def decorator (super_type_cls : type [ClsType ]) -> type [ClsType ]:
419- from .core import ( # type: ignore[import-not-found]
421+ from .core import ( # type: ignore[import-not-found] # noqa: PLC0415
420422 type_index2type_methods ,
421423 type_key2py_type_info ,
422424 )
0 commit comments