MCPcopy
hub / github.com/raiden-network/raiden / search_for_item

Function search_for_item

raiden/tests/utils/events.py:73–85  ·  view source on GitHub ↗

Search for the first item of type `item_type` with `attributes` in `item_list`. `attributes` are compared using the utility `check_nested_attrs`.

(
    item_list: Iterable[T], item_type: Type[T], attributes: Mapping
)

Source from the content-addressed store, hash-verified

71
72
73def search_for_item(
74 item_list: Iterable[T], item_type: Type[T], attributes: Mapping
75) -> Optional[T]:
76 """Search for the first item of type `item_type` with `attributes` in
77 `item_list`.
78
79 `attributes` are compared using the utility `check_nested_attrs`.
80 """
81 for item in item_list:
82 if isinstance(item, item_type) and check_nested_attrs(item, attributes):
83 return item
84
85 return None
86
87
88def raiden_events_search_for_item(

Calls 1

check_nested_attrsFunction · 0.85