MCPcopy
hub / github.com/nonebot/nonebot2 / path_to_module_name

Function path_to_module_name

nonebot/utils.py:350–356  ·  view source on GitHub ↗

转换路径为模块名

(path: Path)

Source from the content-addressed store, hash-verified

348
349
350def 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
359def resolve_dot_notation(

Callers 2

load_pluginFunction · 0.90
_prepare_pluginsMethod · 0.90

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected