Skip to content

Commit

Permalink
Name file to make it obvious what it does
Browse files Browse the repository at this point in the history
Summary:
While the name of the file was `python_types_module_path`, it generated the `thrift_types` module path. This was not obvious until you opened the file.

Change the name of the file to `thrift_types_module_path` make it (a little) more obvious about what it generates.

Reviewed By: ahilger, praihan

Differential Revision: D63353369

fbshipit-source-id: 1761d79bc92ce930017d51d9544d308c051514e8
  • Loading branch information
Satish Kumar authored and facebook-github-bot committed Oct 1, 2024
1 parent 5f9a3b4 commit ab4f277
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions thrift/compiler/generate/templates/py3/types.pyi.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {{#includeNamespace}}{{value}}.{{/includeNamespace}}types as _{{#includeN
{{/hasTypes?}}
{{/program:includeNamespaces}}
{{#program:intercompatible?}}
import {{> common/python_types_module_path}}
import {{> common/thrift_types_module_path}}
{{/program:intercompatible?}}


Expand All @@ -48,12 +48,12 @@ __property__ = property

{{#program:enums}}
class {{enum:name}}(thrift.py3.types.{{^enum:flags?}}Enum{{/enum:flags?}}{{#enum:flags?}}Flag{{/enum:flags?}}{{!
}}{{#program:intercompatible?}}, {{> common/python_types_module_path}}._fbthrift_compatible_with_{{enum:name}}{{/program:intercompatible?}}):
}}{{#program:intercompatible?}}, {{> common/thrift_types_module_path}}._fbthrift_compatible_with_{{enum:name}}{{/program:intercompatible?}}):
{{#enum:values}}
{{enum_value:py_name}}: {{enum:name}} = ...
{{/enum:values}}
{{!TODO: accommodate root_module_prefix}}
def _to_python(self) -> "{{> common/python_types_module_path}}.{{enum:name}}": ... # type: ignore
def _to_python(self) -> "{{> common/thrift_types_module_path}}.{{enum:name}}": ... # type: ignore
def _to_py3(self) -> {{enum:name}}: ...
def _to_py_deprecated(self) -> int: ...

Expand All @@ -65,7 +65,7 @@ _{{struct:name}}ValueType = _typing.Union[None, {{#struct:py3_fields}}{{^first?}

{{/struct:union?}}
class {{struct:name}}({{> types/python_struct_class}}, _typing.Hashable{{!
}}{{#program:intercompatible?}}, {{> common/python_types_module_path}}._fbthrift_compatible_with_{{struct:name}}{{/program:intercompatible?}}):
}}{{#program:intercompatible?}}, {{> common/thrift_types_module_path}}._fbthrift_compatible_with_{{struct:name}}{{/program:intercompatible?}}):
class __fbthrift_IsSet:
{{#struct:py3_fields}}
{{#field:has_ref_accessor?}}
Expand Down Expand Up @@ -122,10 +122,10 @@ class {{struct:name}}({{> types/python_struct_class}}, _typing.Hashable{{!

{{#program:python_capi_converter?}}
@staticmethod
def from_python(obj: "{{> common/python_types_module_path}}.{{struct:name}}") -> _typing.Self: ... # type: ignore
def from_python(obj: "{{> common/thrift_types_module_path}}.{{struct:name}}") -> _typing.Self: ... # type: ignore
{{/program:python_capi_converter?}}
{{!TODO: accommodate root_module_prefix}}
def _to_python(self) -> "{{> common/python_types_module_path}}.{{struct:name}}": ... # type: ignore
def _to_python(self) -> "{{> common/thrift_types_module_path}}.{{struct:name}}": ... # type: ignore
def _to_py3(self) -> {{struct:name}}: ...
def _to_py_deprecated(self) -> "{{program:py_deprecated_module_path}}.ttypes.{{struct:name}}": ... # type: ignore

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ thrift-py3 specific container types.
}}{{^type:iobufWrapper?}}bytes{{/type:iobufWrapper?}}{{!
}}{{/type:binary?}}{{!
}}{{#type:struct}}{{!
}}{{> common/python_types_module_path}}._fbthrift_compatible_with_{{struct:name}}{{!
}}{{> common/thrift_types_module_path}}._fbthrift_compatible_with_{{struct:name}}{{!
}}{{/type:struct}}{{!
}}{{#type:container?}}{{!
}}{{> types/compatible_pep484_containers}}{{!
}}{{/type:container?}}{{!
}}{{#type:void?}}None{{/type:void?}}{{!
}}{{#type:enum}}{{!
}}{{> common/python_types_module_path}}._fbthrift_compatible_with_{{enum:name}}{{!
}}{{> common/thrift_types_module_path}}._fbthrift_compatible_with_{{enum:name}}{{!
}}{{/type:enum}}{{!
}}{{/program:intercompatible?}}{{!
}}{{^program:intercompatible?}}{{!
Expand Down

0 comments on commit ab4f277

Please sign in to comment.