mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
added a base class to have easier isinstance comparisons
This commit is contained in:
14
parsing.py
14
parsing.py
@@ -52,7 +52,19 @@ def indent_block(text, indention=" "):
|
||||
return '\n'.join(map(lambda s: indention + s, lines)) + temp
|
||||
|
||||
|
||||
class Simple(object):
|
||||
class Base(object):
|
||||
"""
|
||||
This is just here to have an isinstance check, which is also used on
|
||||
evaluate classes. But since they have sometimes a special type of
|
||||
delegation, it is important for those classes to override this method.
|
||||
|
||||
I know that there is a chance to do such things with __instancecheck__, but
|
||||
since Python 2.5 doesn't support it, I decided to do it this way.
|
||||
"""
|
||||
def isinstance(self, *cls):
|
||||
return isinstance(self, cls)
|
||||
|
||||
class Simple(Base):
|
||||
"""
|
||||
The super class for Scope, Import, Name and Statement. Every object in
|
||||
the parser tree inherits from this class.
|
||||
|
||||
Reference in New Issue
Block a user