Skip to content

Commit

Permalink
Fix: Annotation is not a valid type with union field enum type
Browse files Browse the repository at this point in the history
Summary:
# What?

The current Pyre architecture does not recognize nested type aliases as types for annotation purposes.  Below is the pattern that will cause the error

```
import abc
import enum

# Consider a thrift file with the definition below
#
# union MyUnion {}
#
#
# Defined as MyUnion in thrift_abstract_types.py
# Named MyUnionAbstract for illustration.
class MyUnionAbstract(abc.ABC):
    class FbThriftUnionFieldEnum(enum.Enum):
        EMPTY = 0

# Defined as MyUnion in thrift_types.py
# Named MyUnionImmutable for illustration.
class MyUnionImmutable(MyUnionAbstract):
    Type = MyUnionAbstract.FbThriftUnionFieldEnum

# The line below is the one with the failure
my_var: MyUnionImmutable.Type = MyUnionImmutable.Type.EMPTY
```

This results in the error
```
22,8: Undefined or invalid type [11]: Annotation `MyUnionImmutable.Type` is not defined as a type.
```

# Why?
Pyre does not recognize nested type aliases as a type.

# What to do?

Change the implementation as follows:

```
import abc
import enum

# Consider a thrift file with the definition below
#
# union MyUnion {}
#
#
# Defined as MyUnion in thrift_abstract_types.py
# Named MyUnionAbstract for illustration.
class MyUnionAbstract(abc.ABC):
    class FbThriftUnionFieldEnum(enum.Enum):
        EMPTY = 0

# Defined as MyUnion in thrift_types.py
# Named MyUnionImmutable for illustration.
class MyUnionImmutable(MyUnionAbstract):
    class Type(enum.Enum):
        EMPTY = 0

    class FbThriftUnionFieldEnum(enum.Enum):
        EMPTY = 0

# This line no longer fails
my_var: MyUnionImmutable.Type = MyUnionImmutable.Type.EMPTY
```

For the sake of completeness, Mutable types look like below:
```
# Defined as MyUnion in thrift_mutable_types.py
# Named MyUnionMutable for illustration.
class MyUnionMutable(MyUnionAbstract):
    class FbThriftUnionFieldEnum(enum.Enum):
        EMPTY = 0

my_mutable_var: MyUnionMutable.FbThriftUnionFieldEnum = MyUnionMutable.FbThriftUnionFieldEnum.EMPTY
```

Reviewed By: ahilger

Differential Revision: D66786497

fbshipit-source-id: 302510ec09bc5ac33357dee8572b13dcb494ea40
  • Loading branch information
Satish Kumar authored and facebook-github-bot committed Dec 6, 2024
1 parent 8457ed2 commit e76a862
Show file tree
Hide file tree
Showing 39 changed files with 667 additions and 176 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{!
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.
}}{{!
Generate union field and value related items.
}}
{{!
Generate the FbThriftUnionFieldEnum:
For Immutable:
abstract enabled OR mutable enabled
For Mutable:
always
}}
{{#program:generate_immutable_types}}
{{#program:enable_abstract_types?}}
{{> structs/union_field_and_value}}
{{/program:enable_abstract_types?}}
{{^program:enable_abstract_types?}}
{{#program:generate_to_mutable_python_conversion_methods?}}
{{> structs/union_field_and_value}}
{{/program:generate_to_mutable_python_conversion_methods?}}
{{/program:enable_abstract_types?}}
{{/program:generate_immutable_types}}
{{#program:generate_mutable_types}}
{{> structs/union_field_and_value}}
{{/program:generate_mutable_types}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{!
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.
}}
class FbThriftUnionFieldEnum(enum.Enum):
EMPTY: {{> structs/unadapted_name}}.FbThriftUnionFieldEnum = ...
{{#struct:fields_ordered_by_id}}
{{field:py_name}}: {{> structs/unadapted_name}}.FbThriftUnionFieldEnum = ...
{{/struct:fields_ordered_by_id}}

fbthrift_current_value: _typing.Final[{{> types/field_value_pep484_union_type}}]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ class {{> structs/unadapted_name}}({{!
used in immutable thrift-python, which is the name
of the Union (sigh!)
}}FbThriftUnionFieldEnum.__name__ = "{{struct:py_name}}"

fbthrift_current_value: _typing.Final[{{> types/field_value_pep484_union_type}}]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
@_fbthrift_property
{{> fields/maybe_abstract_method_annotation}}
def fbthrift_current_value(self) -> _typing.Final[{{> types/field_value_pep484_union_type}}]: ...
@_fbthrift_property
{{> fields/maybe_abstract_method_annotation}}
def fbthrift_current_field(self) -> _typing.Final[FbThriftUnionFieldEnum]: ...

{{/struct:union?}}
{{#struct:has_adapter?}}
Expand Down
30 changes: 2 additions & 28 deletions thrift/compiler/generate/templates/python/types/types_pyi.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -97,51 +97,25 @@ class {{> structs/unadapted_name}}({{!
{{/struct:plain?}}
{{#struct:union?}}

{{^program:enable_abstract_types?}}
{{#program:generate_immutable_types}}
class Type(enum.Enum):
EMPTY: {{> structs/unadapted_name}}.Type = ...
{{#struct:fields_ordered_by_id}}
{{field:py_name}}: {{> structs/unadapted_name}}.Type = ...
{{/struct:fields_ordered_by_id}}
{{/program:generate_immutable_types}}
{{#program:generate_mutable_types}}
class FbThriftUnionFieldEnum(enum.Enum):
EMPTY: {{> structs/unadapted_name}}.FbThriftUnionFieldEnum = ...
{{#struct:fields_ordered_by_id}}
{{field:py_name}}: {{> structs/unadapted_name}}.FbThriftUnionFieldEnum = ...
{{/struct:fields_ordered_by_id}}
{{/program:generate_mutable_types}}

{{#program:generate_immutable_types}}
FbThriftUnionFieldEnum = Type
{{/program:generate_immutable_types}}
{{/program:enable_abstract_types?}}
{{#program:enable_abstract_types?}}
{{#program:generate_immutable_types}}
Type = _fbthrift_python_abstract_types.{{> structs/unadapted_name}}.FbThriftUnionFieldEnum
{{/program:generate_immutable_types}}
{{/program:enable_abstract_types?}}
{{> structs/maybe_union_field_and_value}}

{{#program:generate_immutable_types}}
@classmethod
def fromValue(cls, value: {{> types/field_value_pep484_union_type}}) -> {{> structs/unadapted_name}}: ...
value: _typing.Final[{{> types/field_value_pep484_union_type}}]
{{^program:enable_abstract_types?}}
type: _typing.Final[Type]
def get_type(self) -> Type: ...
{{/program:enable_abstract_types?}}
{{#program:enable_abstract_types?}}
type: _typing.Final[_fbthrift_python_abstract_types.{{> structs/unadapted_name}}.FbThriftUnionFieldEnum]
def get_type(self) -> _fbthrift_python_abstract_types.{{> structs/unadapted_name}}.FbThriftUnionFieldEnum: ...
{{/program:enable_abstract_types?}}
{{/program:generate_immutable_types}}
{{#program:generate_mutable_types}}
{{^program:enable_abstract_types?}}
fbthrift_current_value: _typing.Final[{{> types/field_value_pep484_union_type}}]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
{{/program:enable_abstract_types?}}
def get_type(self) -> {{#program:enable_abstract_types?}}_fbthrift_python_abstract_types.{{> structs/unadapted_name}}.{{/program:enable_abstract_types?}}FbThriftUnionFieldEnum: ...
def get_type(self) -> FbThriftUnionFieldEnum: ...
{{/program:generate_mutable_types}}
{{/struct:union?}}
{{^struct:union?}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ class MyUnion(_fbthrift_python_types.Union, _fbthrift_compatible_with_MyUnion):
myDataItem: MyUnion.Type = ...
floatSet: MyUnion.Type = ...

FbThriftUnionFieldEnum = Type

@classmethod
def fromValue(cls, value: _typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _typing.AbstractSet[float]]) -> MyUnion: ...
Expand Down Expand Up @@ -231,7 +230,6 @@ class UnionToBeRenamed(_fbthrift_python_types.Union, _fbthrift_compatible_with_U
EMPTY: UnionToBeRenamed.Type = ...
reserved_field: UnionToBeRenamed.Type = ...

FbThriftUnionFieldEnum = Type

@classmethod
def fromValue(cls, value: _typing.Union[None, int]) -> UnionToBeRenamed: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,12 @@ class FbThriftUnionFieldEnum(_enum.Enum):
floatSet = 4

FbThriftUnionFieldEnum.__name__ = "MyUnion"

fbthrift_current_value: _typing.Final[_typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _typing.AbstractSet[float]]]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
@_fbthrift_property
@_abc.abstractmethod
def fbthrift_current_value(self) -> _typing.Final[_typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _typing.AbstractSet[float]]]: ...
@_fbthrift_property
@_abc.abstractmethod
def fbthrift_current_field(self) -> _typing.Final[FbThriftUnionFieldEnum]: ...


class MyException(_fbthrift_python_abstract_types.AbstractGeneratedError):
Expand Down Expand Up @@ -196,9 +199,12 @@ class FbThriftUnionFieldEnum(_enum.Enum):
reserved_field = 1

FbThriftUnionFieldEnum.__name__ = "UnionToBeRenamed"

fbthrift_current_value: _typing.Final[_typing.Union[None, int]]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
@_fbthrift_property
@_abc.abstractmethod
def fbthrift_current_value(self) -> _typing.Final[_typing.Union[None, int]]: ...
@_fbthrift_property
@_abc.abstractmethod
def fbthrift_current_field(self) -> _typing.Final[FbThriftUnionFieldEnum]: ...


MyEnumAlias = _fbthrift_current_module.MyEnum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,16 @@ class MyUnion(_fbthrift_python_mutable_types.MutableUnion, _fbthrift_compatible_



def get_type(self) -> _fbthrift_python_abstract_types.MyUnion.FbThriftUnionFieldEnum: ...
class FbThriftUnionFieldEnum(enum.Enum):
EMPTY: MyUnion.FbThriftUnionFieldEnum = ...
myEnum: MyUnion.FbThriftUnionFieldEnum = ...
myStruct: MyUnion.FbThriftUnionFieldEnum = ...
myDataItem: MyUnion.FbThriftUnionFieldEnum = ...
floatSet: MyUnion.FbThriftUnionFieldEnum = ...

fbthrift_current_value: _typing.Final[_typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _fbthrift_python_mutable_containers.MutableSet[float]]]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
def get_type(self) -> FbThriftUnionFieldEnum: ...
def _to_python(self) -> "test.fixtures.basic.module.thrift_types.MyUnion": ... # type: ignore
def _to_mutable_python(self) -> _typing.Self: ...
def _to_py3(self) -> "test.fixtures.basic.module.types.MyUnion": ... # type: ignore
Expand Down Expand Up @@ -369,7 +378,13 @@ class UnionToBeRenamed(_fbthrift_python_mutable_types.MutableUnion, _fbthrift_co



def get_type(self) -> _fbthrift_python_abstract_types.UnionToBeRenamed.FbThriftUnionFieldEnum: ...
class FbThriftUnionFieldEnum(enum.Enum):
EMPTY: UnionToBeRenamed.FbThriftUnionFieldEnum = ...
reserved_field: UnionToBeRenamed.FbThriftUnionFieldEnum = ...

fbthrift_current_value: _typing.Final[_typing.Union[None, int]]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
def get_type(self) -> FbThriftUnionFieldEnum: ...
def _to_python(self) -> "test.fixtures.basic.module.thrift_types.UnionToBeRenamed": ... # type: ignore
def _to_mutable_python(self) -> _typing.Self: ...
def _to_py3(self) -> "test.fixtures.basic.module.types.UnionToBeRenamed": ... # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,27 @@ class MyUnion(_fbthrift_python_types.Union, _fbthrift_compatible_with_MyUnion, _
) -> None: ...


Type = _fbthrift_python_abstract_types.MyUnion.FbThriftUnionFieldEnum

class Type(enum.Enum):
EMPTY: MyUnion.Type = ...
myEnum: MyUnion.Type = ...
myStruct: MyUnion.Type = ...
myDataItem: MyUnion.Type = ...
floatSet: MyUnion.Type = ...

class FbThriftUnionFieldEnum(enum.Enum):
EMPTY: MyUnion.FbThriftUnionFieldEnum = ...
myEnum: MyUnion.FbThriftUnionFieldEnum = ...
myStruct: MyUnion.FbThriftUnionFieldEnum = ...
myDataItem: MyUnion.FbThriftUnionFieldEnum = ...
floatSet: MyUnion.FbThriftUnionFieldEnum = ...

fbthrift_current_value: _typing.Final[_typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _typing.AbstractSet[float]]]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
@classmethod
def fromValue(cls, value: _typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _typing.AbstractSet[float]]) -> MyUnion: ...
value: _typing.Final[_typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _typing.AbstractSet[float]]]
type: _typing.Final[_fbthrift_python_abstract_types.MyUnion.FbThriftUnionFieldEnum]
def get_type(self) -> _fbthrift_python_abstract_types.MyUnion.FbThriftUnionFieldEnum: ...
type: _typing.Final[Type]
def get_type(self) -> Type: ...
def _to_python(self) -> _typing.Self: ...
def _to_mutable_python(self) -> "test.fixtures.basic.module.thrift_mutable_types.MyUnion": ... # type: ignore
def _to_py3(self) -> "test.fixtures.basic.module.types.MyUnion": ... # type: ignore
Expand Down Expand Up @@ -228,13 +242,21 @@ class UnionToBeRenamed(_fbthrift_python_types.Union, _fbthrift_compatible_with_U
) -> None: ...


Type = _fbthrift_python_abstract_types.UnionToBeRenamed.FbThriftUnionFieldEnum
class Type(enum.Enum):
EMPTY: UnionToBeRenamed.Type = ...
reserved_field: UnionToBeRenamed.Type = ...

class FbThriftUnionFieldEnum(enum.Enum):
EMPTY: UnionToBeRenamed.FbThriftUnionFieldEnum = ...
reserved_field: UnionToBeRenamed.FbThriftUnionFieldEnum = ...

fbthrift_current_value: _typing.Final[_typing.Union[None, int]]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
@classmethod
def fromValue(cls, value: _typing.Union[None, int]) -> UnionToBeRenamed: ...
value: _typing.Final[_typing.Union[None, int]]
type: _typing.Final[_fbthrift_python_abstract_types.UnionToBeRenamed.FbThriftUnionFieldEnum]
def get_type(self) -> _fbthrift_python_abstract_types.UnionToBeRenamed.FbThriftUnionFieldEnum: ...
type: _typing.Final[Type]
def get_type(self) -> Type: ...
def _to_python(self) -> _typing.Self: ...
def _to_mutable_python(self) -> "test.fixtures.basic.module.thrift_mutable_types.UnionToBeRenamed": ... # type: ignore
def _to_py3(self) -> "test.fixtures.basic.module.types.UnionToBeRenamed": ... # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ class MyUnion(_fbthrift_python_mutable_types.MutableUnion, _fbthrift_compatible_
) -> None: ...



class FbThriftUnionFieldEnum(enum.Enum):
EMPTY: MyUnion.FbThriftUnionFieldEnum = ...
myEnum: MyUnion.FbThriftUnionFieldEnum = ...
myStruct: MyUnion.FbThriftUnionFieldEnum = ...
myDataItem: MyUnion.FbThriftUnionFieldEnum = ...
floatSet: MyUnion.FbThriftUnionFieldEnum = ...


fbthrift_current_value: _typing.Final[_typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _fbthrift_python_mutable_containers.MutableSet[float]]]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
def get_type(self) -> FbThriftUnionFieldEnum: ...
Expand Down Expand Up @@ -376,11 +376,11 @@ class UnionToBeRenamed(_fbthrift_python_mutable_types.MutableUnion, _fbthrift_co
) -> None: ...



class FbThriftUnionFieldEnum(enum.Enum):
EMPTY: UnionToBeRenamed.FbThriftUnionFieldEnum = ...
reserved_field: UnionToBeRenamed.FbThriftUnionFieldEnum = ...


fbthrift_current_value: _typing.Final[_typing.Union[None, int]]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
def get_type(self) -> FbThriftUnionFieldEnum: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,15 @@ class MyUnion(_fbthrift_python_types.Union, _fbthrift_compatible_with_MyUnion):
myDataItem: MyUnion.Type = ...
floatSet: MyUnion.Type = ...

FbThriftUnionFieldEnum = Type

class FbThriftUnionFieldEnum(enum.Enum):
EMPTY: MyUnion.FbThriftUnionFieldEnum = ...
myEnum: MyUnion.FbThriftUnionFieldEnum = ...
myStruct: MyUnion.FbThriftUnionFieldEnum = ...
myDataItem: MyUnion.FbThriftUnionFieldEnum = ...
floatSet: MyUnion.FbThriftUnionFieldEnum = ...

fbthrift_current_value: _typing.Final[_typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _typing.AbstractSet[float]]]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
@classmethod
def fromValue(cls, value: _typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _typing.AbstractSet[float]]) -> MyUnion: ...
value: _typing.Final[_typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _typing.AbstractSet[float]]]
Expand Down Expand Up @@ -238,8 +245,12 @@ class UnionToBeRenamed(_fbthrift_python_types.Union, _fbthrift_compatible_with_U
EMPTY: UnionToBeRenamed.Type = ...
reserved_field: UnionToBeRenamed.Type = ...

FbThriftUnionFieldEnum = Type
class FbThriftUnionFieldEnum(enum.Enum):
EMPTY: UnionToBeRenamed.FbThriftUnionFieldEnum = ...
reserved_field: UnionToBeRenamed.FbThriftUnionFieldEnum = ...

fbthrift_current_value: _typing.Final[_typing.Union[None, int]]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
@classmethod
def fromValue(cls, value: _typing.Union[None, int]) -> UnionToBeRenamed: ...
value: _typing.Final[_typing.Union[None, int]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@ class MyUnion(_fbthrift_python_types.Union, _fbthrift_compatible_with_MyUnion):
longValue: MyUnion.Type = ...
intValue: MyUnion.Type = ...

FbThriftUnionFieldEnum = Type

@classmethod
def fromValue(cls, value: _typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _fbthrift_current_module.ComplexNestedStruct, int, int]) -> MyUnion: ...
Expand Down Expand Up @@ -415,7 +414,6 @@ class MyUnionFloatFieldThrowExp(_fbthrift_python_types.Union, _fbthrift_compatib
myDataItem: MyUnionFloatFieldThrowExp.Type = ...
complexNestedStruct: MyUnionFloatFieldThrowExp.Type = ...

FbThriftUnionFieldEnum = Type

@classmethod
def fromValue(cls, value: _typing.Union[None, _fbthrift_current_module.MyEnum, _typing.Sequence[_typing.Sequence[float]], _fbthrift_current_module.MyDataItem, _fbthrift_current_module.ComplexNestedStruct]) -> MyUnionFloatFieldThrowExp: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,12 @@ class FbThriftUnionFieldEnum(_enum.Enum):
intValue = 6

FbThriftUnionFieldEnum.__name__ = "MyUnion"

fbthrift_current_value: _typing.Final[_typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _fbthrift_current_module.ComplexNestedStruct, int, int]]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
@_fbthrift_property
@_abc.abstractmethod
def fbthrift_current_value(self) -> _typing.Final[_typing.Union[None, _fbthrift_current_module.MyEnum, _fbthrift_current_module.MyStruct, _fbthrift_current_module.MyDataItem, _fbthrift_current_module.ComplexNestedStruct, int, int]]: ...
@_fbthrift_property
@_abc.abstractmethod
def fbthrift_current_field(self) -> _typing.Final[FbThriftUnionFieldEnum]: ...


class MyUnionFloatFieldThrowExp(_abc.ABC):
Expand Down Expand Up @@ -383,9 +386,12 @@ class FbThriftUnionFieldEnum(_enum.Enum):
complexNestedStruct = 4

FbThriftUnionFieldEnum.__name__ = "MyUnionFloatFieldThrowExp"

fbthrift_current_value: _typing.Final[_typing.Union[None, _fbthrift_current_module.MyEnum, _typing.Sequence[_typing.Sequence[float]], _fbthrift_current_module.MyDataItem, _fbthrift_current_module.ComplexNestedStruct]]
fbthrift_current_field: _typing.Final[FbThriftUnionFieldEnum]
@_fbthrift_property
@_abc.abstractmethod
def fbthrift_current_value(self) -> _typing.Final[_typing.Union[None, _fbthrift_current_module.MyEnum, _typing.Sequence[_typing.Sequence[float]], _fbthrift_current_module.MyDataItem, _fbthrift_current_module.ComplexNestedStruct]]: ...
@_fbthrift_property
@_abc.abstractmethod
def fbthrift_current_field(self) -> _typing.Final[FbThriftUnionFieldEnum]: ...


class ComplexNestedStruct(_abc.ABC):
Expand Down
Loading

0 comments on commit e76a862

Please sign in to comment.