转换路径为模块名
(path: Path)
| 348 | |
| 349 | |
| 350 | def path_to_module_name(path: Path) -> str: |
| 351 | """转换路径为模块名""" |
| 352 | rel_path = path.resolve().relative_to(Path.cwd().resolve()) |
| 353 | if rel_path.stem == "__init__": |
| 354 | return ".".join(rel_path.parts[:-1]) |
| 355 | else: |
| 356 | return ".".join((*rel_path.parts[:-1], rel_path.stem)) |
| 357 | |
| 358 | |
| 359 | def resolve_dot_notation( |
no test coverage detected