lazy_isinstance(): use .__class__ for type check (#6974)
This commit is contained in:
parent
29c942f2a8
commit
81bdfb835d
@ -20,9 +20,13 @@ def py_str(x):
|
||||
|
||||
|
||||
def lazy_isinstance(instance, module, name):
|
||||
'''Use string representation to identify a type.'''
|
||||
module = type(instance).__module__ == module
|
||||
name = type(instance).__name__ == name
|
||||
"""Use string representation to identify a type."""
|
||||
|
||||
# Notice, we use .__class__ as opposed to type() in order
|
||||
# to support object proxies such as weakref.proxy
|
||||
cls = instance.__class__
|
||||
module = cls.__module__ == module
|
||||
name = cls.__name__ == name
|
||||
return module and name
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user