Skip to content

Commit 025ddef

Browse files
committed
updated jedi to 0.9.0
1 parent 5bf923b commit 025ddef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+19
-93
lines changed

pythonFiles/jedi/__init__.py

100644100755
File mode changed.

pythonFiles/jedi/__main__.py

100644100755
File mode changed.

pythonFiles/jedi/_compatibility.py

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def find_module_py33(string, path=None):
2525
except ValueError as e:
2626
# See #491. Importlib might raise a ValueError, to avoid this, we
2727
# just raise an ImportError to fix the issue.
28-
raise ImportError("Originally " + repr(e))
28+
raise ImportError("Originally ValueError: " + e.message)
2929

3030
if loader is None:
3131
raise ImportError("Couldn't find a loader for {0}".format(string))

pythonFiles/jedi/api/__init__.py

100644100755
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class Script(object):
6262
:type source: str
6363
:param line: The line to perform actions on (starting with 1).
6464
:type line: int
65-
:param column: The column of the cursor (starting with 0).
66-
:type column: int
65+
:param col: The column of the cursor (starting with 0).
66+
:type col: int
6767
:param path: The path of the file in the file system, or ``''`` if
6868
it hasn't been saved yet.
6969
:type path: str or None
@@ -157,7 +157,7 @@ def get_completions(user_stmt, bs):
157157
if unfinished_dotted:
158158
return completion_names
159159
else:
160-
return set([keywords.keyword('import').name])
160+
return keywords.keyword_names('import')
161161

162162
if isinstance(user_stmt, tree.Import):
163163
module = self._parser.module()
@@ -168,11 +168,7 @@ def get_completions(user_stmt, bs):
168168
if names is None and not isinstance(user_stmt, tree.Import):
169169
if not path and not dot:
170170
# add keywords
171-
completion_names += keywords.completion_names(
172-
self._evaluator,
173-
user_stmt,
174-
self._pos,
175-
module)
171+
completion_names += keywords.keyword_names(all=True)
176172
# TODO delete? We should search for valid parser
177173
# transformations.
178174
completion_names += self._simple_complete(path, dot, like)

pythonFiles/jedi/api/classes.py

100644100755
File mode changed.

pythonFiles/jedi/api/helpers.py

100644100755
File mode changed.

pythonFiles/jedi/api/interpreter.py

100644100755
File mode changed.

pythonFiles/jedi/api/keywords.py

100644100755
Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from jedi import common
66
from jedi.evaluate import compiled
77
from jedi.evaluate.helpers import FakeName
8-
from jedi.parser.tree import Leaf
8+
99
try:
1010
from pydoc_data import topics as pydoc_topics
1111
except ImportError:
@@ -18,49 +18,22 @@
1818
keys = keyword.kwlist + ['None', 'False', 'True']
1919

2020

21-
def has_inappropriate_leaf_keyword(pos, module):
22-
relevant_errors = filter(
23-
lambda error: error.first_pos[0] == pos[0],
24-
module.error_statement_stacks)
25-
26-
for error in relevant_errors:
27-
if error.next_token in keys:
28-
return True
29-
30-
return False
31-
32-
def completion_names(evaluator, stmt, pos, module):
33-
keyword_list = all_keywords()
34-
35-
if not isinstance(stmt, Leaf) or has_inappropriate_leaf_keyword(pos, module):
36-
keyword_list = filter(
37-
lambda keyword: not keyword.only_valid_as_leaf,
38-
keyword_list
39-
)
40-
return [keyword.name for keyword in keyword_list]
41-
42-
43-
def all_keywords(pos=(0,0)):
44-
return set([Keyword(k, pos) for k in keys])
21+
def keywords(string='', pos=(0, 0), all=False):
22+
if all:
23+
return set([Keyword(k, pos) for k in keys])
24+
if string in keys:
25+
return set([Keyword(string, pos)])
26+
return set()
4527

4628

47-
def keyword(string, pos=(0,0)):
48-
if string in keys:
49-
return Keyword(string, pos)
50-
else:
51-
return None
29+
def keyword_names(*args, **kwargs):
30+
return [k.name for k in keywords(*args, **kwargs)]
5231

5332

5433
def get_operator(string, pos):
5534
return Keyword(string, pos)
5635

5736

58-
keywords_only_valid_as_leaf = (
59-
'continue',
60-
'break',
61-
)
62-
63-
6437
class Keyword(object):
6538
def __init__(self, name, pos):
6639
self.name = FakeName(name, self, pos)
@@ -70,10 +43,6 @@ def __init__(self, name, pos):
7043
def get_parent_until(self):
7144
return self.parent
7245

73-
@property
74-
def only_valid_as_leaf(self):
75-
return self.name.value in keywords_only_valid_as_leaf
76-
7746
@property
7847
def names(self):
7948
""" For a `parsing.Name` like comparision """

pythonFiles/jedi/api/replstartup.py

100644100755
File mode changed.

pythonFiles/jedi/api/usages.py

100644100755
File mode changed.

pythonFiles/jedi/cache.py

100644100755
File mode changed.

pythonFiles/jedi/common.py

100644100755
File mode changed.

pythonFiles/jedi/debug.py

100644100755
Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@
33
import os
44
import time
55

6-
def _lazy_colorama_init():
7-
"""lazily init colorama if necessary, not to screw up stdout is debug not enabled.
8-
9-
This version of the function does nothing.
10-
"""
11-
pass
12-
13-
_inited=False
14-
156
try:
167
if os.name == 'nt':
178
# does not work on Windows, as pyreadline and colorama interfere
@@ -20,19 +11,10 @@ def _lazy_colorama_init():
2011
# Use colorama for nicer console output.
2112
from colorama import Fore, init
2213
from colorama import initialise
23-
def _lazy_colorama_init():
24-
"""lazily init colorama if necessary, not to screw up stdout is debug not enabled.
25-
26-
This version of the function does init colorama.
27-
"""
28-
global _inited
29-
if not _inited:
30-
# pytest resets the stream at the end - causes troubles. Since after
31-
# every output the stream is reset automatically we don't need this.
32-
initialise.atexit_done = True
33-
init()
34-
_inited = True
35-
14+
# pytest resets the stream at the end - causes troubles. Since after
15+
# every output the stream is reset automatically we don't need this.
16+
initialise.atexit_done = True
17+
init()
3618
except ImportError:
3719
class Fore(object):
3820
RED = ''
@@ -81,7 +63,6 @@ def dbg(message, *args):
8163
mod = inspect.getmodule(frm[0])
8264
if not (mod.__name__ in ignored_modules):
8365
i = ' ' * _debug_indent
84-
_lazy_colorama_init()
8566
debug_function(NOTICE, i + 'dbg: ' + message % tuple(u(repr(a)) for a in args))
8667

8768

@@ -100,7 +81,6 @@ def speed(name):
10081

10182
def print_to_stdout(level, str_out):
10283
""" The default debug function """
103-
_lazy_colorama_init()
10484
if level == NOTICE:
10585
col = Fore.GREEN
10686
elif level == WARNING:

pythonFiles/jedi/evaluate/__init__.py

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def _eval_atom(self, atom):
242242
except (IndexError, AttributeError):
243243
pass
244244
else:
245-
if isinstance(comp_for, tree.CompFor) and c[0] != '{':
245+
if isinstance(comp_for, tree.CompFor):
246246
return [iterable.Comprehension.from_atom(self, atom)]
247247
return [iterable.Array(self, atom)]
248248

pythonFiles/jedi/evaluate/analysis.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/cache.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/compiled/__init__.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/compiled/fake.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/compiled/fake/_functools.pym

100644100755
File mode changed.

pythonFiles/jedi/evaluate/compiled/fake/_sqlite3.pym

100644100755
File mode changed.

pythonFiles/jedi/evaluate/compiled/fake/_sre.pym

100644100755
File mode changed.

pythonFiles/jedi/evaluate/compiled/fake/_weakref.pym

100644100755
File mode changed.

pythonFiles/jedi/evaluate/compiled/fake/builtins.pym

100644100755
Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -207,21 +207,6 @@ class dict():
207207
return d
208208

209209

210-
class enumerate():
211-
def __init__(self, sequence, start=0):
212-
self.__sequence = sequence
213-
214-
def __iter__(self):
215-
for i in self.__sequence:
216-
yield 1, i
217-
218-
def __next__(self):
219-
return next(self.__iter__())
220-
221-
def next(self):
222-
return next(self.__iter__())
223-
224-
225210
class reversed():
226211
def __init__(self, sequence):
227212
self.__sequence = sequence

pythonFiles/jedi/evaluate/compiled/fake/datetime.pym

100644100755
File mode changed.

pythonFiles/jedi/evaluate/compiled/fake/io.pym

100644100755
File mode changed.

pythonFiles/jedi/evaluate/compiled/fake/posix.pym

100644100755
File mode changed.

pythonFiles/jedi/evaluate/docstrings.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/dynamic.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/finder.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/flow_analysis.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/helpers.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/imports.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/iterable.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/param.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/precedence.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/recursion.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/representation.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/stdlib.py

100644100755
File mode changed.

pythonFiles/jedi/evaluate/sys_path.py

100644100755
File mode changed.

pythonFiles/jedi/parser/__init__.py

100644100755
File mode changed.

pythonFiles/jedi/parser/fast.py

100644100755
File mode changed.

pythonFiles/jedi/parser/grammar2.7.txt

100644100755
File mode changed.

pythonFiles/jedi/parser/grammar3.4.txt

100644100755
File mode changed.

pythonFiles/jedi/parser/pgen2/__init__.py

100644100755
File mode changed.

pythonFiles/jedi/parser/pgen2/grammar.py

100644100755
File mode changed.

pythonFiles/jedi/parser/pgen2/parse.py

100644100755
File mode changed.

pythonFiles/jedi/parser/pgen2/pgen.py

100644100755
File mode changed.

pythonFiles/jedi/parser/token.py

100644100755
File mode changed.

pythonFiles/jedi/parser/tokenize.py

100644100755
File mode changed.

pythonFiles/jedi/parser/tree.py

100644100755
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,6 @@ def end_pos(self):
248248
return end_pos_line, end_pos_col
249249

250250

251-
@utf8_repr
252-
def __repr__(self):
253-
return "<%s: %r>" % (type(self).__name__, self.value)
254-
255251
class Whitespace(LeafWithNewLines):
256252
"""Contains NEWLINE and ENDMARKER tokens."""
257253
__slots__ = ()

pythonFiles/jedi/parser/user_context.py

100644100755
File mode changed.

pythonFiles/jedi/refactoring.py

100644100755
File mode changed.

pythonFiles/jedi/settings.py

100644100755
File mode changed.

pythonFiles/jedi/utils.py

100644100755
File mode changed.

0 commit comments

Comments
 (0)