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

View File

@@ -5,6 +5,7 @@ import re
from functools import partial
from inspect import Parameter
from pathlib import Path
from typing import Optional
from jedi import debug
from jedi.inference.utils import to_list
@@ -305,11 +306,8 @@ class CompiledModule(CompiledValue):
return ()
return tuple(name.split('.'))
def py__file__(self):
path = self.access_handle.py__file__()
if path is None:
return None
return Path(path)
def py__file__(self) -> Optional[Path]:
return self.access_handle.py__file__() # type: ignore[no-any-return]
class CompiledName(AbstractNameDefinition):