This class exists only for documentation purposes to explain how to create a resolver. Some examples on how to resolve things: - list: get_dictionary could return a dict with index->item and use the index to resolve it later - set: get_dictionary could return a dict with id(object)
| 17 | # AbstractResolver |
| 18 | # ======================================================================================================================= |
| 19 | class _AbstractResolver(_with_metaclass(abc.ABCMeta)): |
| 20 | """ |
| 21 | This class exists only for documentation purposes to explain how to create a resolver. |
| 22 | |
| 23 | Some examples on how to resolve things: |
| 24 | - list: get_dictionary could return a dict with index->item and use the index to resolve it later |
| 25 | - set: get_dictionary could return a dict with id(object)->object and reiterate in that array to resolve it later |
| 26 | - arbitrary instance: get_dictionary could return dict with attr_name->attr and use getattr to resolve it later |
| 27 | """ |
| 28 | |
| 29 | @abc.abstractmethod |
| 30 | def resolve(self, var, attribute): |
| 31 | """ |
| 32 | In this method, we'll resolve some child item given the string representation of the item in the key |
| 33 | representing the previously asked dictionary. |
| 34 | |
| 35 | :param var: this is the actual variable to be resolved. |
| 36 | :param attribute: this is the string representation of a key previously returned in get_dictionary. |
| 37 | """ |
| 38 | raise NotImplementedError |
| 39 | |
| 40 | @abc.abstractmethod |
| 41 | def get_dictionary(self, var): |
| 42 | """ |
| 43 | :param var: this is the variable that should have its children gotten. |
| 44 | |
| 45 | :return: a dictionary where each pair key, value should be shown to the user as children items |
| 46 | in the variables view for the given var. |
| 47 | """ |
| 48 | raise NotImplementedError |
| 49 | |
| 50 | |
| 51 | class _AbstractProvider(_with_metaclass(abc.ABCMeta)): |
nothing calls this directly
no test coverage detected