Iterate over all rules or the rules of an endpoint. :param endpoint: if provided only the rules for that endpoint are returned. :return: an iterator
(self, endpoint: t.Any | None = None)
| 156 | return [rule for rules in self._rules_by_endpoint.values() for rule in rules] |
| 157 | |
| 158 | def iter_rules(self, endpoint: t.Any | None = None) -> t.Iterator[Rule]: |
| 159 | """Iterate over all rules or the rules of an endpoint. |
| 160 | |
| 161 | :param endpoint: if provided only the rules for that endpoint |
| 162 | are returned. |
| 163 | :return: an iterator |
| 164 | """ |
| 165 | self.update() |
| 166 | if endpoint is not None: |
| 167 | return iter(self._rules_by_endpoint[endpoint]) |
| 168 | return iter(self._rules) |
| 169 | |
| 170 | def add(self, rulefactory: RuleFactory) -> None: |
| 171 | """Add a new rule or factory to the map and bind it. Requires that the |