mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
With typeshed OsPathName is no longer needed
This commit is contained in:
@@ -6,7 +6,7 @@ from jedi.evaluate.filters import GlobalNameFilter, ContextNameMixin, \
|
|||||||
AbstractNameDefinition, ParserTreeFilter, DictFilter, MergedFilter
|
AbstractNameDefinition, ParserTreeFilter, DictFilter, MergedFilter
|
||||||
from jedi.evaluate import compiled
|
from jedi.evaluate import compiled
|
||||||
from jedi.evaluate.base_context import TreeContext
|
from jedi.evaluate.base_context import TreeContext
|
||||||
from jedi.evaluate.names import SubModuleName, OsPathName
|
from jedi.evaluate.names import SubModuleName
|
||||||
|
|
||||||
|
|
||||||
class _ModuleAttributeName(AbstractNameDefinition):
|
class _ModuleAttributeName(AbstractNameDefinition):
|
||||||
@@ -208,15 +208,6 @@ class ModuleContext(ModuleMixin, TreeContext):
|
|||||||
assert file is not None # Shouldn't be a package in the first place.
|
assert file is not None # Shouldn't be a package in the first place.
|
||||||
return [os.path.dirname(file)]
|
return [os.path.dirname(file)]
|
||||||
|
|
||||||
def sub_modules_dict(self):
|
|
||||||
dct = super(ModuleContext, self).sub_modules_dict()
|
|
||||||
if ('os',) == self.string_names:
|
|
||||||
dct = dict(dct)
|
|
||||||
# os.path is a hardcoded exception, because it's a
|
|
||||||
# ``sys.modules`` modification.
|
|
||||||
dct['path'] = OsPathName(self, 'path')
|
|
||||||
return dct
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def py__path__(self):
|
def py__path__(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -32,8 +32,3 @@ class ImportName(AbstractNameDefinition):
|
|||||||
|
|
||||||
class SubModuleName(ImportName):
|
class SubModuleName(ImportName):
|
||||||
_level = 1
|
_level = 1
|
||||||
|
|
||||||
|
|
||||||
class OsPathName(ImportName):
|
|
||||||
def infer(self):
|
|
||||||
return self.parent_context.evaluator.import_module(('os', 'path'))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user