Return the index of dotted class path (or a subclass of that class) in a list of candidate paths. If it does not exist, return -1.
(class_path, candidate_paths)
| 9 | |
| 10 | |
| 11 | def _subclass_index(class_path, candidate_paths): |
| 12 | """ |
| 13 | Return the index of dotted class path (or a subclass of that class) in a |
| 14 | list of candidate paths. If it does not exist, return -1. |
| 15 | """ |
| 16 | cls = import_string(class_path) |
| 17 | for index, path in enumerate(candidate_paths): |
| 18 | try: |
| 19 | candidate_cls = import_string(path) |
| 20 | if issubclass(candidate_cls, cls): |
| 21 | return index |
| 22 | except (ImportError, TypeError): |
| 23 | continue |
| 24 | return -1 |
| 25 | |
| 26 | |
| 27 | def check_user_model(app_configs, **kwargs): |
no test coverage detected