mirror of
https://github.com/django/daphne.git
synced 2025-07-11 08:22:17 +03:00
Naming consumers that are classmethods (#324)
This commit is contained in:
parent
7de6ff17d6
commit
b62ea7dd0a
|
@ -13,9 +13,11 @@ def name_that_thing(thing):
|
||||||
return name_that_thing(thing.im_class) + "." + thing.im_func.func_name
|
return name_that_thing(thing.im_class) + "." + thing.im_func.func_name
|
||||||
# Other named thing
|
# Other named thing
|
||||||
if hasattr(thing, "__name__"):
|
if hasattr(thing, "__name__"):
|
||||||
if hasattr(thing, "__class__") and not isinstance(thing, types.FunctionType):
|
if hasattr(thing, "__class__") and not isinstance(thing, (types.FunctionType, types.MethodType)):
|
||||||
if thing.__class__ is not type:
|
if thing.__class__ is not type:
|
||||||
return name_that_thing(thing.__class__)
|
return name_that_thing(thing.__class__)
|
||||||
|
if hasattr(thing, "__self__"):
|
||||||
|
return "%s.%s" % (thing.__self__.__module__, thing.__self__.__name__)
|
||||||
if hasattr(thing, "__module__"):
|
if hasattr(thing, "__module__"):
|
||||||
return "%s.%s" % (thing.__module__, thing.__name__)
|
return "%s.%s" % (thing.__module__, thing.__name__)
|
||||||
# Generic instance of a class
|
# Generic instance of a class
|
||||||
|
|
Loading…
Reference in New Issue
Block a user