(value: Any)
| 108 | visited = set() |
| 109 | |
| 110 | def recurse_container(value: Any) -> bool: |
| 111 | if is_primitive(value): |
| 112 | return True |
| 113 | |
| 114 | if id(value) in visited: |
| 115 | return True |
| 116 | |
| 117 | if isinstance(value, dict): |
| 118 | visited.add(id(value)) |
| 119 | return all(map(predicate, value.items())) |
| 120 | # Tuple has to be considered too, since a tuple can contain containers. |
| 121 | if isinstance(value, (set, list, tuple)): |
| 122 | visited.add(id(value)) |
| 123 | return all(map(predicate, value)) |
| 124 | |
| 125 | return False |
| 126 | |
| 127 | return recurse_container(value) |
| 128 |
no test coverage detected
searching dependent graphs…