@@ -30,68 +30,62 @@ import thrift.py3.common
3030import typing as _typing
3131from types import TracebackType
3232
33- import { {#program: py3Namespaces} }{ {. } }.{ {/program:py3Namespaces } }{ {program: name} }.types as _{ {#program: py3Namespaces} }{ {. } }_{ {/program:py3Namespaces } }{ {program: name} }_types
34- { {#each program: includeNamespaces as |include |} }
33+ import { {#each program. py3Namespaces as |ns| } }{ {ns } }.{ {/each } }{ {program. name} }.types as _{ {#each program. py3Namespaces as |ns| } }{ {ns } }_{ {/each } }{ {program. name} }_types
34+ { {#each program. includeNamespaces as |include |} }
3535 { {#if include .has_types?} }
3636import { {include .modulePathPeriodSeparated} }.types as _{ {include .modulePathUnderscoreSeparated} }_types
3737 { {/if include .has_types?} }
3838 { {#if include .import_services?} }
3939import { {include .modulePathPeriodSeparated} }.clients as _{ {include .modulePathUnderscoreSeparated} }_clients
4040 { {/if include .import_services?} }
4141{ {/each} }
42- { {#program: services} }
42+ { {#each program. services as |service| } }
4343
4444
45- _{ {service: name} }T = _typing.TypeVar('_{ {service: name} }T', bound='{ {service: name} }')
45+ _{ {service. name} }T = _typing.TypeVar('_{ {service. name} }T', bound='{ {service. name} }')
4646
4747
48- class { {service: name} }({ {#service: extends} }{ {#service: externalProgram?} }{ {!
49- } }_{ {#each service: program.py3Namespaces as |ns|} }{ {ns} }_{ {/each} }{ {!
50- } }{ {service: program.name} }_clients.{ {/service: externalProgram?} }{ {service: name} }{ {!
51- } }{ {/service:extends } } { {^service:extends? } } thrift.py3.client.Client{ {/service:extends? } }):
48+ class { {service. name} }({ {#let parent = service. extends} }{ {#if (object.notnull? parent) } } { {# if parent. externalProgram?} }{ {!
49+ } }_{ {#each parent. program.py3Namespaces as |ns|} }{ {ns} }_{ {/each} }{ {!
50+ } }{ {parent. program.name} }_clients.{ {/if parent. externalProgram?} }{ {parent. name} }{ {!
51+ } }{ {# else } } thrift.py3.client.Client{ {/if (object.notnull? parent) } }):
5252
53- { {#service: supportedFunctions} }
54- async def { {function: name} }(
55- self{ {#function:args } },
56- { {field: py_name} }: { {#partial pep484.type_name type= field:self .type} }{ {/function:args } },
53+ { {#each service. supportedFunctions as |function| } }
54+ async def { {function. name} }(
55+ self{ {#each function.params.fields as |field| } },
56+ { {field. py_name} }: { {#partial pep484.type_name type= field.type} }{ {/each } },
5757 *,
5858 rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None
59- ) -> { {#if function:stream?} }{ {#partial clients.stream_response_class_name function= function:self} }{ {!
60- } }{ {#else } }{ {#partial pep484.type_name type= function:self.return_type} }{ {/if function:stream?} }: ...
61-
62- { {/service:supportedFunctions} }
63- { {#let parent_service_name=service:name} }
64- { {#service:supportedInteractions} }
65- def create{ {service:name} }(self) -> { {parent_service_name} }_{ {service:name} }: ...
66- def async_create{ {service:name} }(self) -> { {parent_service_name} }_{ {service:name} }: ...
67- { {/service:supportedInteractions} }
68- { {^service:supportedInteractions} }
69- { {^service:supportedFunctions} }
59+ ) -> { {#if function.stream?} }{ {#partial clients.stream_response_class_name function= function} }{ {!
60+ } }{ {#else } }{ {#partial pep484.type_name type= function.return_type} }{ {/if function.stream?} }: ...
61+
62+ { {/each} }
63+ { {#each service.supportedInteractions as |interaction|} }
64+ def create{ {interaction.name} }(self) -> { {service.name} }_{ {interaction.name} }: ...
65+ def async_create{ {interaction.name} }(self) -> { {service.name} }_{ {interaction.name} }: ...
66+ { {/each} }
67+ { {#if (and (array.empty? service.supportedInteractions) (array.empty? service.supportedFunctions))} }
7068 pass
71- { {/service:supportedFunctions} }
72- { {/service:supportedInteractions} }
73- { {#service:supportedInteractions} }
69+ { {/if (and (array.empty? service.supportedInteractions) (array.empty? service.supportedFunctions))} }
70+ { {#each service.supportedInteractions as |interaction|} }
7471
75- _{ {parent_service_name } }_{ {service: name} } = _typing.TypeVar('_{ {parent_service_name } }_{ {service: name} }', bound='{ {parent_service_name } }_{ {service: name} }')
72+ _{ {service.name } }_{ {interaction. name} } = _typing.TypeVar('_{ {service.name } }_{ {interaction. name} }', bound='{ {service.name } }_{ {interaction. name} }')
7673
7774
78- class { {parent_service_name} }_{ {service:name} }({ {#service:extends} }{ {#service:externalProgram?} }{ {!
79- } }_{ {#each service:program.py3Namespaces as |ns|} }{ {ns} }_{ {/each} }{ {!
80- } }{ {service:program.name} }_clients.{ {/service:externalProgram?} }{ {service:name} }{ {!
81- } }{ {/service:extends} }{ {^service:extends?} }thrift.py3.client.Client{ {/service:extends?} }):
75+ class { {service.name} }_{ {interaction.name} }(thrift.py3.client.Client):
8276
83- { {#service: supportedFunctions} }
84- async def { {function: name} }(
85- self{ {#function:args } },
86- { {field: py_name} }: { {#partial pep484.type_name type= field:self .type} }{ {/function:args } },
77+ { {#each interaction. supportedFunctions as |function| } }
78+ async def { {function. name} }(
79+ self{ {#each function.params.fields as |field| } },
80+ { {field. py_name} }: { {#partial pep484.type_name type= field.type} }{ {/each } },
8781 *,
8882 rpc_options: _typing.Optional[thrift.py3.common.RpcOptions]=None
89- ) -> { {#if function: stream?} }{ {#partial clients.stream_response_class_name function= function:self } }{ {!
90- } }{ {#else } }{ {#partial pep484.type_name type= function:self .return_type} }{ {/if function: stream?} }: ...
83+ ) -> { {#if function. stream?} }{ {#partial clients.stream_response_class_name function= function} }{ {!
84+ } }{ {#else } }{ {#partial pep484.type_name type= function.return_type} }{ {/if function. stream?} }: ...
9185
92- { {/service:supportedFunctions } }
93- { {^service: supportedFunctions} }
86+ { {/each } }
87+ { {# if (array.empty? interaction. supportedFunctions) } }
9488 pass
95- { {/service: supportedFunctions} }
96- { {/service:supportedInteractions } }
97- { {/program:services } }
89+ { {/if (array.empty? interaction. supportedFunctions) } }
90+ { {/each } }
91+ { {/each } }
0 commit comments