mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Allow tweaking Interpreter sys_path (#1734)
This commit is contained in:
@@ -707,7 +707,7 @@ class Interpreter(Script):
|
||||
"""
|
||||
_allow_descriptor_getattr_default = True
|
||||
|
||||
def __init__(self, code, namespaces, **kwds):
|
||||
def __init__(self, code, namespaces, *, project=None, **kwds):
|
||||
try:
|
||||
namespaces = [dict(n) for n in namespaces]
|
||||
except Exception:
|
||||
@@ -720,8 +720,11 @@ class Interpreter(Script):
|
||||
if not isinstance(environment, InterpreterEnvironment):
|
||||
raise TypeError("The environment needs to be an InterpreterEnvironment subclass.")
|
||||
|
||||
super().__init__(code, environment=environment,
|
||||
project=Project(Path.cwd()), **kwds)
|
||||
if project is None:
|
||||
project = Project(Path.cwd())
|
||||
|
||||
super().__init__(code, environment=environment, project=project, **kwds)
|
||||
|
||||
self.namespaces = namespaces
|
||||
self._inference_state.allow_descriptor_getattr = self._allow_descriptor_getattr_default
|
||||
|
||||
|
||||
Reference in New Issue
Block a user