mypy 抱怨重复模块,即使它是具有相同名称但不同文件夹/命名空间的不同模块

问题描述 投票:0回答:0

Mypy 不断抱怨重复模块,即使没有重复模块,而是在不同文件夹中具有相同名称的模块。

示例树:

.
├── catalog
│   ├── __init__.py
│   └── k8s_pvc
│       ├── implementation.py
│       └── integration.py
├── executor
│   ├── __init__.py
│   ├── argo
│   │   ├── implementation.py
│   │   └── integration.py
│   └── k8s_job
│       ├── implementation.py
│       └── integration.py
├── experiment_tracker
│   ├── __init__.py
│   └── mlflow
│       └── implementation.py
├── run_log_store
│   ├── __init__.py
│   ├── chunked_k8s_pvc
│   │   ├── implementation.py
│   │   └── integration.py
│   └── k8s_pvc
│       ├── implementation.py
│       └── integration.py
└── secrets

MyPy 错误: 错误:名为“implementation”的重复模块(也在“magnus/extensions/catalog/k8s_pvc/implementation.py”)

我的 mypy 配置:

[mypy]
implicit_optional = True
ignore_missing_imports = True
plugins = pydantic.mypy
show_error_codes = True

follow_imports = silent
warn_redundant_casts = True
warn_unused_ignores = True
check_untyped_defs = True
implicit_reexport = True

我们可以不在不同的包中使用相同的名称并满足mypy吗?

干杯,

python mypy
© www.soinside.com 2019 - 2024. All rights reserved.