(path)
| 152 | |
| 153 | |
| 154 | def _path_to_module(path): |
| 155 | if isinstance(path, str): |
| 156 | path = Path(path) |
| 157 | |
| 158 | # Remove .py extension |
| 159 | if path.suffix == '.py': |
| 160 | path = path.with_suffix('') |
| 161 | |
| 162 | # Convert path separators to dots |
| 163 | parts = path.parts |
| 164 | |
| 165 | # Handle __init__ files - they represent the package itself |
| 166 | if parts and parts[-1] == '__init__': |
| 167 | parts = parts[:-1] |
| 168 | |
| 169 | return '.'.join(parts) if parts else path.stem |
| 170 | |
| 171 | |
| 172 | # ============================================================================ |
no test coverage detected
searching dependent graphs…