forked from VimPlug/jedi
Fix a python3 issue with py__file__.
This commit is contained in:
@@ -85,7 +85,10 @@ class CompiledObject(Context):
|
|||||||
return bool(self.obj)
|
return bool(self.obj)
|
||||||
|
|
||||||
def py__file__(self):
|
def py__file__(self):
|
||||||
return self.obj.__file__
|
try:
|
||||||
|
return self.obj.__file__
|
||||||
|
except AttributeError:
|
||||||
|
return None
|
||||||
|
|
||||||
def is_class(self):
|
def is_class(self):
|
||||||
return inspect.isclass(self.obj)
|
return inspect.isclass(self.obj)
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ py__iter__() Returns a generator of a set of types.
|
|||||||
py__class__() Returns the class of an instance.
|
py__class__() Returns the class of an instance.
|
||||||
py__getitem__(index: int/str) Returns a a set of types of the index.
|
py__getitem__(index: int/str) Returns a a set of types of the index.
|
||||||
Can raise an IndexError/KeyError.
|
Can raise an IndexError/KeyError.
|
||||||
py__file__() Only on modules.
|
py__file__() Only on modules. Returns None if does
|
||||||
|
not exist.
|
||||||
py__package__() Only on modules. For the import system.
|
py__package__() Only on modules. For the import system.
|
||||||
py__path__() Only on modules. For the import system.
|
py__path__() Only on modules. For the import system.
|
||||||
====================================== ========================================
|
====================================== ========================================
|
||||||
|
|||||||
Reference in New Issue
Block a user