| 267 | permit_long_docstring_body = False |
| 268 | |
| 269 | def __init__(self, clinic: Clinic) -> None: |
| 270 | self.clinic = clinic |
| 271 | |
| 272 | self.directives = {} |
| 273 | for name in dir(self): |
| 274 | # functions that start with directive_ are added to directives |
| 275 | _, s, key = name.partition("directive_") |
| 276 | if s: |
| 277 | self.directives[key] = getattr(self, name) |
| 278 | |
| 279 | # functions that start with at_ are too, with an @ in front |
| 280 | _, s, key = name.partition("at_") |
| 281 | if s: |
| 282 | self.directives['@' + key] = getattr(self, name) |
| 283 | |
| 284 | self.reset() |
| 285 | |
| 286 | def reset(self) -> None: |
| 287 | self.function = None |