Update utils.py (#455)

Name that thing should not use a metaclass to name a thing.
This commit is contained in:
scryver 2016-12-30 10:44:03 +01:00 committed by Andrew Godwin
parent f4c9b02ae3
commit 7230708f6f

View File

@ -14,7 +14,7 @@ def name_that_thing(thing):
# Other named thing
if hasattr(thing, "__name__"):
if hasattr(thing, "__class__") and not isinstance(thing, (types.FunctionType, types.MethodType)):
if thing.__class__ is not type:
if thing.__class__ is not type and not issubclass(thing.__class__, type):
return name_that_thing(thing.__class__)
if hasattr(thing, "__self__"):
return "%s.%s" % (thing.__self__.__module__, thing.__self__.__name__)