mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-30 20:25:23 +08:00
added an own implementation for hasattr (python 2, python 3 is fine)
This commit is contained in:
@@ -77,3 +77,14 @@ try:
|
||||
from cStringIO import StringIO as BytesIO
|
||||
except ImportError:
|
||||
from io import BytesIO
|
||||
|
||||
# hasattr function used because python
|
||||
if sys.hexversion >= 0x03000000:
|
||||
hasattr = hasattr
|
||||
else:
|
||||
def hasattr(obj, name):
|
||||
try:
|
||||
getattr(obj, name)
|
||||
return True
|
||||
except AttributeError:
|
||||
return False
|
||||
|
||||
@@ -20,7 +20,7 @@ TODO descriptors (also for classes, for instances it should work)
|
||||
TODO @staticmethod @classmethod (implement descriptors, builtins are done)
|
||||
TODO variable assignments in classes (see test/completion/classes @230) +1
|
||||
"""
|
||||
from _compatibility import next, property
|
||||
from _compatibility import next, property, hasattr
|
||||
import sys
|
||||
|
||||
import itertools
|
||||
|
||||
Reference in New Issue
Block a user