mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Project attributes are now read accessible
This commit is contained in:
@@ -16,6 +16,7 @@ Unreleased
|
||||
- Functions with ``@property`` now return ``property`` instead of ``function``
|
||||
in ``Name().type``
|
||||
- Started using annotations
|
||||
- Project attributes are now read accessible
|
||||
|
||||
This is likely going to be the last minor release before 1.0.
|
||||
|
||||
|
||||
@@ -152,6 +152,29 @@ class Project:
|
||||
"""
|
||||
return self._path
|
||||
|
||||
@property
|
||||
def sys_path(self):
|
||||
"""
|
||||
The sys path provided to this project. This can be None and in that
|
||||
case will be auto generated.
|
||||
"""
|
||||
return self._sys_path
|
||||
|
||||
@property
|
||||
def smart_sys_path(self):
|
||||
"""
|
||||
If the sys path is going to be calculated in a smart way, where
|
||||
additional paths are added.
|
||||
"""
|
||||
return self._smart_sys_path
|
||||
|
||||
@property
|
||||
def load_unsafe_extensions(self):
|
||||
"""
|
||||
Wheter the project loads unsafe extensions.
|
||||
"""
|
||||
return self._load_unsafe_extensions
|
||||
|
||||
@inference_state_as_method_param_cache()
|
||||
def _get_base_sys_path(self, inference_state):
|
||||
# The sys path has not been set explicitly.
|
||||
|
||||
@@ -17,7 +17,12 @@ def test_django_default_project(Script):
|
||||
)
|
||||
c, = script.complete()
|
||||
assert c.name == "SomeModel"
|
||||
assert script._inference_state.project._django is True
|
||||
|
||||
project = script._inference_state.project
|
||||
assert project._django is True
|
||||
assert project.sys_path is None
|
||||
assert project.smart_sys_path is True
|
||||
assert project.load_unsafe_extensions is False
|
||||
|
||||
|
||||
def test_django_default_project_of_file(Script):
|
||||
|
||||
Reference in New Issue
Block a user