(schema: Schema, domain: str)
| 836 | |
| 837 | |
| 838 | def build_module(schema: Schema, domain: str) -> ModuleIR: |
| 839 | schema._pending_refs = set() |
| 840 | records, unions = schema.types_for(domain) |
| 841 | commands = [build_command(schema, c) for c in schema.commands_for(domain)] |
| 842 | events = [build_event(schema, e) for e in schema.events_for(domain)] |
| 843 | imports = _cross_domain_imports(schema, domain) |
| 844 | return ModuleIR( |
| 845 | domain=domain, |
| 846 | class_name=snake_to_class(camel_to_snake(domain)), |
| 847 | filename=camel_to_snake(domain), |
| 848 | enums=schema.enums_for(domain), |
| 849 | records=records, |
| 850 | unions=unions, |
| 851 | commands=commands, |
| 852 | events=events, |
| 853 | imports=imports, |
| 854 | spec_href=schema._domain_links.get(domain, {}).get("specHref"), |
| 855 | ) |
| 856 | |
| 857 | |
| 858 | def _cross_domain_imports(schema: Schema, domain: str) -> dict[str, set[str]]: |
no test coverage detected