mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
unicode issues in usage matching
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from jedi._compatibility import unicode
|
||||
from jedi._compatibility import u
|
||||
from jedi import common
|
||||
from jedi.api import classes
|
||||
from jedi.parser import representation as pr
|
||||
@@ -33,7 +33,7 @@ def usages(evaluator, definitions, search_name, mods):
|
||||
call_path = list(call.generate_call_path())
|
||||
for i, name in enumerate(call_path):
|
||||
# name is `pr.NamePart`.
|
||||
if unicode(name) == search_name:
|
||||
if u(name) == search_name:
|
||||
follow.append(call_path[:i + 1])
|
||||
|
||||
for call_path in follow:
|
||||
|
||||
@@ -182,8 +182,7 @@ def _literals_to_types(evaluator, result):
|
||||
# Literals are only valid as long as the operations are
|
||||
# correct. Otherwise add a value-free instance.
|
||||
cls = builtin.get_by_name(r.name)
|
||||
from jedi.evaluate import representation as er
|
||||
result[i] = er.Instance(evaluator, cls)
|
||||
result[i] = evaluator.execute(cls)[0]
|
||||
return list(set(result))
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ def abc(): pass
|
||||
abc.d.a.bsaasd.abc.d
|
||||
|
||||
abc
|
||||
# unicode chars shouldn't be a problem.
|
||||
x['smörbröd'].abc
|
||||
|
||||
if 1:
|
||||
abc =
|
||||
|
||||
Reference in New Issue
Block a user