[#3] Added generate proto script create container method
Signed-off-by: Ilyas Niyazov <i.niyazov@yadro.com>
This commit is contained in:
parent
f8465e5b99
commit
fba6eaaa9c
34 changed files with 547 additions and 108 deletions
|
@ -1,26 +1,14 @@
|
|||
class SelectorClause:
|
||||
"""
|
||||
Enum for selector clauses with integer value mapping
|
||||
"""
|
||||
from enum import Enum, unique
|
||||
|
||||
@unique
|
||||
class SelectorClause(Enum):
|
||||
CLAUSE_UNSPECIFIED = 0
|
||||
SAME = 1
|
||||
DISTINCT = 2
|
||||
|
||||
_value_map = {
|
||||
0: CLAUSE_UNSPECIFIED,
|
||||
1: SAME,
|
||||
2: DISTINCT
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def get(cls, value: int) -> 'SelectorClause':
|
||||
"""
|
||||
Get enum instance by integer value
|
||||
|
||||
Args:
|
||||
value: Integer value of the clause
|
||||
|
||||
Returns:
|
||||
Corresponding SelectorClause instance
|
||||
"""
|
||||
return cls._value_map.get(value)
|
||||
def get(cls, value: int):
|
||||
try:
|
||||
return cls(value)
|
||||
except ValueError:
|
||||
raise KeyError(f"Unknown enum value: {value}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue