Utility Functions¶
Utility functions for the library
-
modio.utils.
find
(iterable, **fields)[source]¶ Finds the first item in the :attrs: iterable that has the :attrs: attr equal to :attrs: value. For example:
game = find(client.get_all_games(), id=2)would find the first :class: Game whose id is 2 and return it. If no entry is found then None is returned.
game = find(client.get_all_games(), name=”John”)would find the first :class: Game whose name is ‘John’. If not entry is found then None is returned
-
modio.utils.
get
(iterable, **fields)[source]¶ Returns a list of items in the :attrs: iterable that have the :attrs: attr equal to :attrs: value. For example:
game = get(client.get_all_games(), id=2)would find the all :class: Game whose id is 2 and return them as a list. If no entry is found then the empty list is returned.
game = find(client.get_all_games(), name=”John”)would find all :class: Game whose name is ‘John’. If not entry is found then an empty list is returned