MCPcopy
hub / github.com/django/django / _contains_subclass

Function _contains_subclass

django/contrib/admin/checks.py:30–44  ·  view source on GitHub ↗

Return whether or not a dotted class path (or a subclass of that class) is found in a list of candidate paths.

(class_path, candidate_paths)

Source from the content-addressed store, hash-verified

28
29
30def _contains_subclass(class_path, candidate_paths):
31 """
32 Return whether or not a dotted class path (or a subclass of that class) is
33 found in a list of candidate paths.
34 """
35 cls = import_string(class_path)
36 for path in candidate_paths:
37 try:
38 candidate_cls = import_string(path)
39 except ImportError:
40 # ImportErrors are raised elsewhere.
41 continue
42 if _issubclass(candidate_cls, cls):
43 return True
44 return False
45
46
47def check_admin_app(app_configs, **kwargs):

Callers 1

check_dependenciesFunction · 0.85

Calls 2

import_stringFunction · 0.90
_issubclassFunction · 0.85

Tested by

no test coverage detected