(self, name: str, reason: str,
*, condition: str | None = None)
| 280 | return True |
| 281 | |
| 282 | def add_include(self, name: str, reason: str, |
| 283 | *, condition: str | None = None) -> None: |
| 284 | try: |
| 285 | existing = self._includes[name] |
| 286 | except KeyError: |
| 287 | pass |
| 288 | else: |
| 289 | if existing.condition and not condition: |
| 290 | # If the previous include has a condition and the new one is |
| 291 | # unconditional, override the include. |
| 292 | pass |
| 293 | else: |
| 294 | # Already included, do nothing. Only mention a single reason, |
| 295 | # no need to list all of them. |
| 296 | return |
| 297 | |
| 298 | self._includes[name] = Include(name, reason, condition) |
| 299 | |
| 300 | def get_includes(self) -> list[Include]: |
| 301 | return sorted(self._includes.values(), |
no test coverage detected