1
0
forked from VimPlug/jedi

Implement all remaining Path issues and use it instead of strings

This commit is contained in:
Dave Halter
2020-07-12 01:14:00 +02:00
parent db0e90763b
commit 480a464179
23 changed files with 131 additions and 97 deletions

View File

@@ -15,6 +15,7 @@ the interesting information about all operations.
"""
import re
import warnings
from typing import Optional
from parso.python.tree import search_ancestor
@@ -92,7 +93,7 @@ class BaseName(object):
return self._name.get_root_context()
@property
def module_path(self):
def module_path(self) -> Optional[str]:
"""
Shows the file path of a module. e.g. ``/usr/lib/python3.9/os.py``
@@ -102,7 +103,9 @@ class BaseName(object):
if module.is_stub() or not module.is_compiled():
# Compiled modules should not return a module path even if they
# have one.
return self._get_module_context().py__file__()
path = self._get_module_context().py__file__()
if path is not None:
return path
return None