@@ -183,7 +183,7 @@ class TypeMethod:
183
183
kind : int # 0: member method, 1: static method
184
184
185
185
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
187
187
188
188
func = self .func
189
189
if self .kind == 0 : # member method
@@ -219,14 +219,16 @@ class TypeInfo:
219
219
d_fields : tuple [Field , ...] = ()
220
220
221
221
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
+ )
223
225
224
226
type_index = self .type_ancestors [- 1 ]
225
227
return type_index2cached_py_type_info (type_index )
226
228
227
229
228
230
def 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
230
232
231
233
def _kind () -> bytes :
232
234
kind : str = exception .__class__ .__name__
@@ -256,7 +258,7 @@ def _bytes_info() -> bytes:
256
258
257
259
258
260
def 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
260
262
261
263
kind , info = err .kind , err ._info
262
264
if info :
@@ -306,7 +308,7 @@ def dtype_normalize(dtype: typing.Any) -> str | DataType:
306
308
def _torch_dtype_to_str () -> str | None :
307
309
if "torch" not in sys .modules :
308
310
return None
309
- import torch
311
+ import torch # noqa: PLC0415
310
312
311
313
if not isinstance (dtype , torch .dtype ):
312
314
return None
@@ -324,7 +326,7 @@ def _numpy_dtype_to_str() -> str | None:
324
326
return np_dtype
325
327
if (torch_dtype := _torch_dtype_to_str ()) is not None :
326
328
return torch_dtype
327
- from mlc .core .dtype import DataType
329
+ from mlc .core .dtype import DataType # noqa: PLC0415
328
330
329
331
return dtype if isinstance (dtype , DataType ) else str (dtype )
330
332
@@ -333,7 +335,7 @@ def device_normalize(device: typing.Any) -> str | Device:
333
335
def _torch_device_to_str () -> str | None :
334
336
if "torch" not in sys .modules :
335
337
return None
336
- import torch
338
+ import torch # noqa: PLC0415
337
339
338
340
if not isinstance (device , torch .device ):
339
341
return None
@@ -416,7 +418,7 @@ def attach_method(
416
418
417
419
def c_class_core (type_key : str ) -> Callable [[type [ClsType ]], type [ClsType ]]:
418
420
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
420
422
type_index2type_methods ,
421
423
type_key2py_type_info ,
422
424
)
0 commit comments