mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
fix #1548
This commit is contained in:
@@ -128,15 +128,6 @@ class Script(object):
|
|||||||
# An empty path (also empty string) should always result in no path.
|
# An empty path (also empty string) should always result in no path.
|
||||||
self.path = os.path.abspath(path) if path else None
|
self.path = os.path.abspath(path) if path else None
|
||||||
|
|
||||||
# TODO deprecate and remove sys_path from the Script API.
|
|
||||||
if sys_path is not None:
|
|
||||||
project._sys_path = sys_path
|
|
||||||
warnings.warn(
|
|
||||||
"Deprecated since version 0.17.0. Use the project API instead, "
|
|
||||||
"which means Script(project=Project(dir, sys_path=sys_path)) instead.",
|
|
||||||
DeprecationWarning,
|
|
||||||
stacklevel=2
|
|
||||||
)
|
|
||||||
if encoding is None:
|
if encoding is None:
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
else:
|
else:
|
||||||
@@ -180,6 +171,15 @@ class Script(object):
|
|||||||
project = get_default_project(
|
project = get_default_project(
|
||||||
os.path.dirname(self.path) if path else None
|
os.path.dirname(self.path) if path else None
|
||||||
)
|
)
|
||||||
|
# TODO deprecate and remove sys_path from the Script API.
|
||||||
|
if sys_path is not None:
|
||||||
|
project._sys_path = sys_path
|
||||||
|
warnings.warn(
|
||||||
|
"Deprecated since version 0.17.0. Use the project API instead, "
|
||||||
|
"which means Script(project=Project(dir, sys_path=sys_path)) instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2
|
||||||
|
)
|
||||||
|
|
||||||
self._inference_state = InferenceState(
|
self._inference_state = InferenceState(
|
||||||
project, environment=environment, script_path=self.path
|
project, environment=environment, script_path=self.path
|
||||||
|
|||||||
Reference in New Issue
Block a user