mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Convert more things to Python 3 idioms
This commit is contained in:
@@ -106,7 +106,16 @@ class Project:
|
|||||||
with open(self._get_json_path(self._path), 'w') as f:
|
with open(self._get_json_path(self._path), 'w') as f:
|
||||||
return json.dump((_SERIALIZER_VERSION, data), f)
|
return json.dump((_SERIALIZER_VERSION, data), f)
|
||||||
|
|
||||||
def __init__(self, path, **kwargs):
|
def __init__(
|
||||||
|
self,
|
||||||
|
path,
|
||||||
|
*,
|
||||||
|
environment_path=None,
|
||||||
|
load_unsafe_extensions=False,
|
||||||
|
sys_path=None,
|
||||||
|
added_sys_path=(),
|
||||||
|
smart_sys_path=True,
|
||||||
|
) -> None:
|
||||||
"""
|
"""
|
||||||
:param path: The base path for this project.
|
:param path: The base path for this project.
|
||||||
:param environment_path: The Python executable path, typically the path
|
:param environment_path: The Python executable path, typically the path
|
||||||
@@ -125,8 +134,7 @@ class Project:
|
|||||||
local directories. Otherwise you will have to rely on your packages
|
local directories. Otherwise you will have to rely on your packages
|
||||||
being properly configured on the ``sys.path``.
|
being properly configured on the ``sys.path``.
|
||||||
"""
|
"""
|
||||||
def py2_comp(path, environment_path=None, load_unsafe_extensions=False,
|
|
||||||
sys_path=None, added_sys_path=(), smart_sys_path=True):
|
|
||||||
if isinstance(path, str):
|
if isinstance(path, str):
|
||||||
path = Path(path).absolute()
|
path = Path(path).absolute()
|
||||||
self._path = path
|
self._path = path
|
||||||
@@ -143,8 +151,6 @@ class Project:
|
|||||||
self.added_sys_path = list(map(str, added_sys_path))
|
self.added_sys_path = list(map(str, added_sys_path))
|
||||||
"""The sys path that is going to be added at the end of the """
|
"""The sys path that is going to be added at the end of the """
|
||||||
|
|
||||||
py2_comp(path, **kwargs)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def path(self):
|
def path(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -106,10 +106,7 @@ def dbg(message, *args, color='GREEN'):
|
|||||||
debug_function(color, i + 'dbg: ' + message % tuple(repr(a) for a in args))
|
debug_function(color, i + 'dbg: ' + message % tuple(repr(a) for a in args))
|
||||||
|
|
||||||
|
|
||||||
def warning(message, *args, **kwargs):
|
def warning(message, *args, format=True):
|
||||||
format = kwargs.pop('format', True)
|
|
||||||
assert not kwargs
|
|
||||||
|
|
||||||
if debug_function and enable_warning:
|
if debug_function and enable_warning:
|
||||||
i = ' ' * _debug_indent
|
i = ' ' * _debug_indent
|
||||||
if format:
|
if format:
|
||||||
|
|||||||
Reference in New Issue
Block a user