forked from VimPlug/jedi
Remove hasattr/next from _compatibility (not used anymore), thanks @dongweiming for noticing.
This commit is contained in:
@@ -65,23 +65,6 @@ or the name of the module if it is a builtin one and a boolean indicating
|
||||
if the module is contained in a package.
|
||||
"""
|
||||
|
||||
# next was defined in python 2.6, in python 3 obj.next won't be possible
|
||||
# anymore
|
||||
try:
|
||||
next = next
|
||||
except NameError:
|
||||
_raiseStopIteration = object()
|
||||
|
||||
def next(iterator, default=_raiseStopIteration):
|
||||
if not hasattr(iterator, 'next'):
|
||||
raise TypeError("not an iterator")
|
||||
try:
|
||||
return iterator.next()
|
||||
except StopIteration:
|
||||
if default is _raiseStopIteration:
|
||||
raise
|
||||
else:
|
||||
return default
|
||||
|
||||
# unicode function
|
||||
try:
|
||||
@@ -125,18 +108,6 @@ Usage::
|
||||
|
||||
"""
|
||||
|
||||
# hasattr function used because python
|
||||
if is_py3:
|
||||
hasattr = hasattr
|
||||
else:
|
||||
def hasattr(obj, name):
|
||||
try:
|
||||
getattr(obj, name)
|
||||
return True
|
||||
except AttributeError:
|
||||
return False
|
||||
|
||||
|
||||
class Python3Method(object):
|
||||
def __init__(self, func):
|
||||
self.func = func
|
||||
|
||||
@@ -12,7 +12,7 @@ import warnings
|
||||
import sys
|
||||
from itertools import chain
|
||||
|
||||
from jedi._compatibility import next, unicode, builtins
|
||||
from jedi._compatibility import unicode, builtins
|
||||
from jedi.parser import Parser, load_grammar
|
||||
from jedi.parser.tokenize import source_tokens
|
||||
from jedi.parser import tree as pr
|
||||
|
||||
@@ -5,7 +5,7 @@ import functools
|
||||
import re
|
||||
from ast import literal_eval
|
||||
|
||||
from jedi._compatibility import unicode, next, reraise
|
||||
from jedi._compatibility import unicode, reraise
|
||||
from jedi import settings
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user