Iterate over all rules and check if the endpoint expects the arguments provided. This is for example useful if you have some URLs that expect a language code and others that do not and you want to wrap the builder a bit so that the current language code is automatica
(self, endpoint: t.Any, *arguments: str)
| 132 | self._matcher.merge_slashes = value |
| 133 | |
| 134 | def is_endpoint_expecting(self, endpoint: t.Any, *arguments: str) -> bool: |
| 135 | """Iterate over all rules and check if the endpoint expects |
| 136 | the arguments provided. This is for example useful if you have |
| 137 | some URLs that expect a language code and others that do not and |
| 138 | you want to wrap the builder a bit so that the current language |
| 139 | code is automatically added if not provided but endpoints expect |
| 140 | it. |
| 141 | |
| 142 | :param endpoint: the endpoint to check. |
| 143 | :param arguments: this function accepts one or more arguments |
| 144 | as positional arguments. Each one of them is |
| 145 | checked. |
| 146 | """ |
| 147 | self.update() |
| 148 | arguments_set = set(arguments) |
| 149 | for rule in self._rules_by_endpoint[endpoint]: |
| 150 | if arguments_set.issubset(rule.arguments): |
| 151 | return True |
| 152 | return False |
| 153 | |
| 154 | @property |
| 155 | def _rules(self) -> list[Rule]: |