mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
Using the : syntax leads to non member attributes.
> If an attribute is defined in the class body with a type annotation
> but with no assigned value, a type checker should assume this is a non-member attribute
```
class Pet(Enum):
genus: str # Non-member attribute
species: str # Non-member attribute
CAT = 1 # Member attribute
DOG = 2 # Member attribute
```
https://typing.python.org/en/latest/spec/enums.html#defining-members
17 lines
297 B
Python
17 lines
297 B
Python
from __future__ import annotations
|
|
|
|
import flatbuffers
|
|
import numpy as np
|
|
|
|
import flatbuffers
|
|
import typing
|
|
from typing import cast
|
|
|
|
uoffset: typing.TypeAlias = flatbuffers.number_types.UOffsetTFlags.py_type
|
|
|
|
class TestEnum(object):
|
|
A = cast(int, ...)
|
|
B = cast(int, ...)
|
|
C = cast(int, ...)
|
|
|