forked from VimPlug/jedi
remove NamePart.string, can be done by casting it to unicode
This commit is contained in:
@@ -16,7 +16,7 @@ import pkgutil
|
|||||||
import sys
|
import sys
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
from jedi._compatibility import find_module, use_metaclass
|
from jedi._compatibility import find_module, unicode
|
||||||
from jedi import common
|
from jedi import common
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import cache
|
from jedi import cache
|
||||||
@@ -27,7 +27,7 @@ from jedi.evaluate import helpers
|
|||||||
from jedi import settings
|
from jedi import settings
|
||||||
from jedi.common import source_to_unicode
|
from jedi.common import source_to_unicode
|
||||||
from jedi.evaluate import compiled
|
from jedi.evaluate import compiled
|
||||||
from jedi.evaluate.cache import CachedMetaClass, memoize_default
|
from jedi.evaluate.cache import memoize_default
|
||||||
|
|
||||||
|
|
||||||
class ModuleNotFound(Exception):
|
class ModuleNotFound(Exception):
|
||||||
@@ -167,7 +167,7 @@ class ImportPath(pr.Base):
|
|||||||
# This is not an existing Import statement. Therefore, set position to
|
# This is not an existing Import statement. Therefore, set position to
|
||||||
# 0 (0 is not a valid line number).
|
# 0 (0 is not a valid line number).
|
||||||
zero = (0, 0)
|
zero = (0, 0)
|
||||||
names = [(name_part.string, name_part.start_pos)
|
names = [(unicode(name_part), name_part.start_pos)
|
||||||
for name_part in i.namespace.names[1:]]
|
for name_part in i.namespace.names[1:]]
|
||||||
n = pr.Name(i._sub_module, names, zero, zero, self.import_stmt)
|
n = pr.Name(i._sub_module, names, zero, zero, self.import_stmt)
|
||||||
new = pr.Import(i._sub_module, zero, zero, n)
|
new = pr.Import(i._sub_module, zero, zero, n)
|
||||||
|
|||||||
@@ -1372,22 +1372,22 @@ class NamePart(object):
|
|||||||
# Unfortunately there's no way to use slots for str (non-zero __itemsize__)
|
# Unfortunately there's no way to use slots for str (non-zero __itemsize__)
|
||||||
# -> http://utcc.utoronto.ca/~cks/space/blog/python/IntSlotsPython3k
|
# -> http://utcc.utoronto.ca/~cks/space/blog/python/IntSlotsPython3k
|
||||||
# Therefore don't subclass `str`.
|
# Therefore don't subclass `str`.
|
||||||
__slots__ = ('parent', 'string', '_line', '_column')
|
__slots__ = ('parent', '_string', '_line', '_column')
|
||||||
|
|
||||||
def __init__(self, string, parent, start_pos):
|
def __init__(self, string, parent, start_pos):
|
||||||
self.string = string
|
self._string = string
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self._line = start_pos[0]
|
self._line = start_pos[0]
|
||||||
self._column = start_pos[1]
|
self._column = start_pos[1]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.string
|
return self._string
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.string
|
return self._string
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<%s: %s>" % (type(self).__name__, self.string)
|
return "<%s: %s>" % (type(self).__name__, self._string)
|
||||||
|
|
||||||
def get_parent_until(self, *args, **kwargs):
|
def get_parent_until(self, *args, **kwargs):
|
||||||
return self.parent.get_parent_until(*args, **kwargs)
|
return self.parent.get_parent_until(*args, **kwargs)
|
||||||
@@ -1399,7 +1399,7 @@ class NamePart(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def end_pos(self):
|
def end_pos(self):
|
||||||
return self.start_pos[0], self.start_pos[1] + len(self.string)
|
return self.start_pos[0], self.start_pos[1] + len(self._string)
|
||||||
|
|
||||||
|
|
||||||
class Name(Simple):
|
class Name(Simple):
|
||||||
|
|||||||
Reference in New Issue
Block a user