| 352 | return os.path.dirname(full_path) |
| 353 | |
| 354 | def _get_name_from_path(self, path): |
| 355 | if path == self._top_level_dir: |
| 356 | return '.' |
| 357 | path = _splitext(os.path.normpath(path)) |
| 358 | |
| 359 | _relpath = os.path.relpath(path, self._top_level_dir) |
| 360 | assert not os.path.isabs(_relpath), "Path must be within the project" |
| 361 | assert not _relpath.startswith('..'), "Path must be within the project" |
| 362 | |
| 363 | name = _relpath.replace(os.path.sep, '.') |
| 364 | return name |
| 365 | |
| 366 | def _get_module_from_name(self, name): |
| 367 | __import__(name) |