{{! Copyright (c) Meta Platforms, Inc. and affiliates. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. }}{{! This template should always mirror builder.pyx but for python typing }} {{> common/auto_generated_py}} import typing as _typing import folly.iobuf as _fbthrift_iobuf import thrift.py3.builder {{#program:includeNamespaces}} {{#hasTypes?}} import {{#includeNamespace}}{{value}}.{{/includeNamespace}}types as _{{#includeNamespace}}{{value}}_{{/includeNamespace}}types import {{#includeNamespace}}{{value}}.{{/includeNamespace}}builders as _{{#includeNamespace}}{{value}}_{{/includeNamespace}}builders {{/hasTypes?}} {{/program:includeNamespaces}} import {{#program:py3Namespaces}}{{value}}.{{/program:py3Namespaces}}{{program:name}}.types as _{{#program:py3Namespaces}}{{value}}_{{/program:py3Namespaces}}{{program:name}}_types {{#program:filtered_structs}} class {{struct:name}}_Builder(thrift.py3.builder.StructBuilder): {{#struct:py3_fields}} {{field:py_name}}: {{#field:type}}{{! }}{{#type:list?}}_typing.Optional[list]{{/type:list?}}{{! }}{{#type:map?}}_typing.Optional[dict]{{/type:map?}}{{! }}{{#type:set?}}_typing.Optional[set]{{/type:set?}}{{! }}{{#type:integer?}}_typing.Optional[int]{{/type:integer?}}{{! }}{{#type:floating_point?}}_typing.Optional[float]{{/type:floating_point?}}{{! }}{{#type:cythonTypeNoneable?}}{{^type:struct?}}{{! }}_typing.Optional[{{> types/pep484_type}}]{{! }}{{/type:struct?}}{{/type:cythonTypeNoneable?}}{{! }}{{#type:struct?}}_typing.Any{{/type:struct?}}{{! }}{{/field:type}} {{/struct:py3_fields}} def __iter__(self) -> _typing.Iterator[_typing.Tuple[str, _typing.Any]]: ... {{/program:filtered_structs}}