1
0
forked from VimPlug/jedi

Have all py__file__ methods return a Path

This commit is contained in:
Peter Law
2020-08-30 18:03:03 +01:00
parent 25a3e31ca8
commit aa265a44e1
4 changed files with 19 additions and 14 deletions
+4 -2
View File
@@ -8,6 +8,8 @@ import warnings
import re
import builtins
import typing
from pathlib import Path
from typing import Optional
from jedi.inference.compiled.getattr_static import getattr_static
@@ -179,9 +181,9 @@ class DirectObjectAccess:
def py__bool__(self):
return bool(self._obj)
def py__file__(self):
def py__file__(self) -> Optional[Path]:
try:
return self._obj.__file__
return Path(self._obj.__file__)
except AttributeError:
return None