MCPcopy
hub / github.com/pallets/werkzeug / iter_rules

Method iter_rules

src/werkzeug/routing/map.py:158–168  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 2

__repr__Method · 0.95
test_rule_templatesFunction · 0.95

Calls 1

updateMethod · 0.95

Tested by 1

test_rule_templatesFunction · 0.76