forked from VimPlug/jedi
Remove force_unicode
This commit is contained in:
@@ -8,7 +8,7 @@ import warnings
|
||||
import re
|
||||
import builtins
|
||||
|
||||
from jedi._compatibility import unicode, is_py3, py_version, force_unicode
|
||||
from jedi._compatibility import unicode, is_py3, py_version
|
||||
from jedi.inference.compiled.getattr_static import getattr_static
|
||||
|
||||
ALLOWED_GETITEM_TYPES = (str, list, tuple, unicode, bytes, bytearray, dict)
|
||||
@@ -159,10 +159,6 @@ def create_access_path(inference_state, obj):
|
||||
return AccessPath(access.get_access_path_tuples())
|
||||
|
||||
|
||||
def _force_unicode_decorator(func):
|
||||
return lambda *args, **kwargs: force_unicode(func(*args, **kwargs))
|
||||
|
||||
|
||||
def get_api_type(obj):
|
||||
if inspect.isclass(obj):
|
||||
return u'class'
|
||||
@@ -199,7 +195,7 @@ class DirectObjectAccess(object):
|
||||
return None
|
||||
|
||||
def py__doc__(self):
|
||||
return force_unicode(inspect.getdoc(self._obj)) or u''
|
||||
return inspect.getdoc(self._obj) or ''
|
||||
|
||||
def py__name__(self):
|
||||
if not _is_class_instance(self._obj) or \
|
||||
@@ -214,7 +210,7 @@ class DirectObjectAccess(object):
|
||||
return None
|
||||
|
||||
try:
|
||||
return force_unicode(cls.__name__)
|
||||
return cls.__name__
|
||||
except AttributeError:
|
||||
return None
|
||||
|
||||
@@ -264,7 +260,6 @@ class DirectObjectAccess(object):
|
||||
return None
|
||||
return paths
|
||||
|
||||
@_force_unicode_decorator
|
||||
@shorten_repr
|
||||
def get_repr(self):
|
||||
if inspect.ismodule(self._obj):
|
||||
@@ -308,10 +303,10 @@ class DirectObjectAccess(object):
|
||||
name = try_to_get_name(type(self._obj))
|
||||
if name is None:
|
||||
return ()
|
||||
return tuple(force_unicode(n) for n in name.split('.'))
|
||||
return tuple(name.split('.'))
|
||||
|
||||
def dir(self):
|
||||
return list(map(force_unicode, dir(self._obj)))
|
||||
return dir(self._obj)
|
||||
|
||||
def has_iter(self):
|
||||
try:
|
||||
@@ -539,7 +534,7 @@ class DirectObjectAccess(object):
|
||||
objects of an objects
|
||||
"""
|
||||
tuples = dict(
|
||||
(force_unicode(name), self.is_allowed_getattr(name))
|
||||
(name, self.is_allowed_getattr(name))
|
||||
for name in self.dir()
|
||||
)
|
||||
return self.needs_type_completions(), tuples
|
||||
|
||||
@@ -18,7 +18,7 @@ import weakref
|
||||
from functools import partial
|
||||
from threading import Thread
|
||||
|
||||
from jedi._compatibility import is_py3, force_unicode, \
|
||||
from jedi._compatibility import is_py3, \
|
||||
pickle_dump, pickle_load, GeneralizedPopen
|
||||
from jedi import debug
|
||||
from jedi.cache import memoize_method
|
||||
@@ -236,10 +236,6 @@ class CompiledSubprocess(object):
|
||||
if self.is_crashed:
|
||||
raise InternalError("The subprocess %s has crashed." % self._executable)
|
||||
|
||||
if not is_py3:
|
||||
# Python 2 compatibility
|
||||
kwargs = {force_unicode(key): value for key, value in kwargs.items()}
|
||||
|
||||
data = inference_state_id, function, args, kwargs
|
||||
try:
|
||||
pickle_dump(data, self._get_process().stdin, PICKLE_PROTOCOL)
|
||||
@@ -389,9 +385,8 @@ class AccessHandle(object):
|
||||
if name in ('id', 'access') or name.startswith('_'):
|
||||
raise AttributeError("Something went wrong with unpickling")
|
||||
|
||||
# if not is_py3: print >> sys.stderr, name
|
||||
# print('getattr', name, file=sys.stderr)
|
||||
return partial(self._workaround, force_unicode(name))
|
||||
return partial(self._workaround, name)
|
||||
|
||||
def _workaround(self, name, *args, **kwargs):
|
||||
"""
|
||||
|
||||
@@ -4,7 +4,7 @@ import os
|
||||
import re
|
||||
import inspect
|
||||
|
||||
from jedi._compatibility import find_module, cast_path, force_unicode, \
|
||||
from jedi._compatibility import find_module, cast_path, \
|
||||
all_suffixes
|
||||
from jedi.inference.compiled import access
|
||||
from jedi import debug
|
||||
@@ -44,7 +44,7 @@ def get_module_info(inference_state, sys_path=None, full_name=None, **kwargs):
|
||||
|
||||
|
||||
def get_builtin_module_names(inference_state):
|
||||
return list(map(force_unicode, sys.builtin_module_names))
|
||||
return sys.builtin_module_names
|
||||
|
||||
|
||||
def _test_raise_error(inference_state, exception_type):
|
||||
|
||||
@@ -7,7 +7,7 @@ from inspect import Parameter
|
||||
|
||||
from jedi import debug
|
||||
from jedi.inference.utils import to_list
|
||||
from jedi._compatibility import force_unicode, cast_path
|
||||
from jedi._compatibility import cast_path
|
||||
from jedi.cache import memoize_method
|
||||
from jedi.inference.filters import AbstractFilter
|
||||
from jedi.inference.names import AbstractNameDefinition, ValueNameMixin, \
|
||||
@@ -30,7 +30,7 @@ class CheckAttribute(object):
|
||||
def __call__(self, func):
|
||||
self.func = func
|
||||
if self.check_name is None:
|
||||
self.check_name = force_unicode(func.__name__[2:])
|
||||
self.check_name = func.__name__[2:]
|
||||
return self
|
||||
|
||||
def __get__(self, instance, owner):
|
||||
@@ -457,9 +457,6 @@ class CompiledValueFilter(AbstractFilter):
|
||||
"""
|
||||
To remove quite a few access calls we introduced the callback here.
|
||||
"""
|
||||
# Always use unicode objects in Python 2 from here.
|
||||
name = force_unicode(name)
|
||||
|
||||
if self._inference_state.allow_descriptor_getattr:
|
||||
pass
|
||||
|
||||
@@ -535,7 +532,6 @@ def _parse_function_doc(doc):
|
||||
TODO docstrings like utime(path, (atime, mtime)) and a(b [, b]) -> None
|
||||
TODO docstrings like 'tuple of integers'
|
||||
"""
|
||||
doc = force_unicode(doc)
|
||||
# parse round parentheses: def func(a, (b,c))
|
||||
try:
|
||||
count = 0
|
||||
|
||||
Reference in New Issue
Block a user