| 297 | |
| 298 | |
| 299 | def _render_classbody(method_blocks: list[OpsType]) -> Iterator[str]: |
| 300 | environment = jinja2.Environment() |
| 301 | |
| 302 | for method_func_pairs, template, extra in method_blocks: |
| 303 | if template: |
| 304 | for method, func in method_func_pairs: |
| 305 | yield environment.from_string(template).render( |
| 306 | method=method, func=func, **extra |
| 307 | ) |
| 308 | |
| 309 | yield "" |
| 310 | for method_func_pairs, *_ in method_blocks: |
| 311 | for method, func in method_func_pairs: |
| 312 | if method and func: |
| 313 | yield COPY_DOCSTRING.format(method=method, func=func) |
| 314 | |
| 315 | |
| 316 | if __name__ == "__main__": |