Skip to content

Commit abb2250

Browse files
committed
Remove all deprecations
1 parent ae2becb commit abb2250

File tree

2 files changed

+1
-138
lines changed

2 files changed

+1
-138
lines changed

jedi/api/__init__.py

Lines changed: 1 addition & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
arguments.
99
"""
1010
import sys
11-
import warnings
1211
from pathlib import Path
1312

1413
import parso
@@ -90,51 +89,23 @@ class Script(object):
9089
9190
:param code: The source code of the current file, separated by newlines.
9291
:type code: str
93-
:param line: Deprecated, please use it directly on e.g. ``.complete``
94-
:type line: int
95-
:param column: Deprecated, please use it directly on e.g. ``.complete``
96-
:type column: int
9792
:param path: The path of the file in the file system, or ``''`` if
9893
it hasn't been saved yet.
9994
:type path: str or pathlib.Path or None
100-
:param sys_path: Deprecated, use the project parameter.
101-
:type sys_path: typing.List[str]
10295
:param Environment environment: Provide a predefined :ref:`Environment <environments>`
10396
to work with a specific Python version or virtualenv.
10497
:param Project project: Provide a :class:`.Project` to make sure finding
10598
references works well, because the right folder is searched. There are
10699
also ways to modify the sys path and other things.
107100
"""
108-
def __init__(self, code=None, line=None, column=None, path=None,
109-
sys_path=None, environment=None, project=None, source=None):
101+
def __init__(self, code=None, *, path=None, environment=None, project=None):
110102
self._orig_path = path
111103
# An empty path (also empty string) should always result in no path.
112104
if isinstance(path, str):
113105
path = Path(path)
114106

115107
self.path = path.absolute() if path else None
116108

117-
if line is not None:
118-
warnings.warn(
119-
"Providing the line is now done in the functions themselves "
120-
"like `Script(...).complete(line, column)`",
121-
DeprecationWarning,
122-
stacklevel=2
123-
)
124-
if column is not None:
125-
warnings.warn(
126-
"Providing the column is now done in the functions themselves "
127-
"like `Script(...).complete(line, column)`",
128-
DeprecationWarning,
129-
stacklevel=2
130-
)
131-
if source is not None:
132-
code = source
133-
warnings.warn(
134-
"Use the code keyword argument instead.",
135-
DeprecationWarning,
136-
stacklevel=2
137-
)
138109
if code is None:
139110
# TODO add a better warning than the traceback!
140111
with open(path, 'rb') as f:
@@ -143,15 +114,6 @@ def __init__(self, code=None, line=None, column=None, path=None,
143114
if project is None:
144115
# Load the Python grammar of the current interpreter.
145116
project = get_default_project(None if self.path is None else self.path.parent)
146-
# TODO deprecate and remove sys_path from the Script API.
147-
if sys_path is not None:
148-
project._sys_path = sys_path
149-
warnings.warn(
150-
"Deprecated since version 0.17.0. Use the project API instead, "
151-
"which means Script(project=Project(dir, sys_path=sys_path)) instead.",
152-
DeprecationWarning,
153-
stacklevel=2
154-
)
155117

156118
self._inference_state = InferenceState(
157119
project, environment=environment, script_path=self.path
@@ -168,7 +130,6 @@ def __init__(self, code=None, line=None, column=None, path=None,
168130
debug.speed('parsed')
169131
self._code_lines = parso.split_lines(code, keepends=True)
170132
self._code = code
171-
self._pos = line, column
172133

173134
cache.clear_time_caches()
174135
debug.reset_time()
@@ -250,14 +211,6 @@ def complete(self, line=None, column=None, *, fuzzy=False):
250211
)
251212
return completion.complete()
252213

253-
def completions(self, fuzzy=False):
254-
warnings.warn(
255-
"Deprecated since version 0.16.0. Use Script(...).complete instead.",
256-
DeprecationWarning,
257-
stacklevel=2
258-
)
259-
return self.complete(*self._pos, fuzzy=fuzzy)
260-
261214
@validate_line_column
262215
def infer(self, line=None, column=None, *, only_stubs=False, prefer_stubs=False):
263216
"""
@@ -297,25 +250,6 @@ def infer(self, line=None, column=None, *, only_stubs=False, prefer_stubs=False)
297250
# the API.
298251
return helpers.sorted_definitions(set(defs))
299252

300-
def goto_definitions(self, **kwargs):
301-
warnings.warn(
302-
"Deprecated since version 0.16.0. Use Script(...).infer instead.",
303-
DeprecationWarning,
304-
stacklevel=2
305-
)
306-
return self.infer(*self._pos, **kwargs)
307-
308-
def goto_assignments(self, follow_imports=False, follow_builtin_imports=False, **kwargs):
309-
warnings.warn(
310-
"Deprecated since version 0.16.0. Use Script(...).goto instead.",
311-
DeprecationWarning,
312-
stacklevel=2
313-
)
314-
return self.goto(*self._pos,
315-
follow_imports=follow_imports,
316-
follow_builtin_imports=follow_builtin_imports,
317-
**kwargs)
318-
319253
@validate_line_column
320254
def goto(self, line=None, column=None, *, follow_imports=False, follow_builtin_imports=False,
321255
only_stubs=False, prefer_stubs=False):
@@ -446,14 +380,6 @@ def need_pydoc():
446380
return [classes.Name(self._inference_state, name)]
447381
return []
448382

449-
def usages(self, **kwargs):
450-
warnings.warn(
451-
"Deprecated since version 0.16.0. Use Script(...).get_references instead.",
452-
DeprecationWarning,
453-
stacklevel=2
454-
)
455-
return self.get_references(*self._pos, **kwargs)
456-
457383
@validate_line_column
458384
def get_references(self, line=None, column=None, **kwargs):
459385
"""
@@ -484,14 +410,6 @@ def _references(include_builtins=True, scope='project'):
484410
return helpers.sorted_definitions(definitions)
485411
return _references(**kwargs)
486412

487-
def call_signatures(self):
488-
warnings.warn(
489-
"Deprecated since version 0.16.0. Use Script(...).get_signatures instead.",
490-
DeprecationWarning,
491-
stacklevel=2
492-
)
493-
return self.get_signatures(*self._pos)
494-
495413
@validate_line_column
496414
def get_signatures(self, line=None, column=None):
497415
"""
@@ -817,21 +735,6 @@ def _get_module_context(self):
817735
)
818736

819737

820-
def names(source=None, path=None, all_scopes=False,
821-
definitions=True, references=False, environment=None):
822-
warnings.warn(
823-
"Deprecated since version 0.16.0. Use Script(...).get_names instead.",
824-
DeprecationWarning,
825-
stacklevel=2
826-
)
827-
828-
return Script(source, path=path).get_names(
829-
all_scopes=all_scopes,
830-
definitions=definitions,
831-
references=references,
832-
)
833-
834-
835738
def preload_module(*modules):
836739
"""
837740
Preloading modules tells Jedi to load a module now, instead of lazy parsing

jedi/api/classes.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
the interesting information about all operations.
1515
"""
1616
import re
17-
import warnings
1817
from typing import Optional
1918

2019
from parso.python.tree import search_ancestor
@@ -453,14 +452,6 @@ def goto(self, *, follow_imports=False, follow_builtin_imports=False,
453452
return [self if n == self._name else Name(self._inference_state, n)
454453
for n in names]
455454

456-
def goto_assignments(self, **kwargs):
457-
warnings.warn(
458-
"Deprecated since version 0.16.0. Use .goto.",
459-
DeprecationWarning,
460-
stacklevel=2
461-
)
462-
return self.goto(**kwargs)
463-
464455
@debug.increase_indent_cm('infer on name')
465456
def infer(self, *, only_stubs=False, prefer_stubs=False):
466457
"""
@@ -497,28 +488,6 @@ def infer(self, *, only_stubs=False, prefer_stubs=False):
497488
return [self if n == self._name else Name(self._inference_state, n)
498489
for n in resulting_names]
499490

500-
@property
501-
@memoize_method
502-
def params(self):
503-
warnings.warn(
504-
"Deprecated since version 0.16.0. Use get_signatures()[...].params",
505-
DeprecationWarning,
506-
stacklevel=2
507-
)
508-
# Only return the first one. There might be multiple one, especially
509-
# with overloading.
510-
for signature in self._get_signatures():
511-
return [
512-
Name(self._inference_state, n)
513-
for n in signature.get_param_names(resolve_stars=True)
514-
]
515-
516-
if self.type == 'function' or self.type == 'class':
517-
# Fallback, if no signatures were defined (which is probably by
518-
# itself a bug).
519-
return []
520-
raise AttributeError('There are no params defined on this.')
521-
522491
def parent(self):
523492
"""
524493
Returns the parent scope of this identifier.
@@ -763,15 +732,6 @@ class Name(BaseName):
763732
def __init__(self, inference_state, definition):
764733
super().__init__(inference_state, definition)
765734

766-
@property
767-
def desc_with_module(self):
768-
warnings.warn(
769-
"Deprecated since version 0.17.0. No replacement for now, maybe .full_name helps",
770-
DeprecationWarning,
771-
stacklevel=2
772-
)
773-
return "%s:%s" % (self.module_name, self.description)
774-
775735
@memoize_method
776736
def defined_names(self):
777737
"""

0 commit comments

Comments
 (0)