zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
U
£ý°dQã@sdZdZGdd„deƒZdS)zÆA simple wrapper around enum types to expose utility functions.
 
Instances are created as properties with the same name as the enum they wrap
on proto classes.  For usage, see:
  reflection_test.py
z"rabsatt@google.com (Kevin Rabsatt)csXeZdZdZdZeZdd„Zdd„Zdd„Z    d    d
„Z
d d „Z d d„Z ‡fdd„Z ‡ZS)ÚEnumTypeWrapperz/A utility for finding the names of enum values.NcCs||_||_dS)z-Inits EnumTypeWrapper with an EnumDescriptor.N)Ú
_enum_typeÚ
DESCRIPTOR)ÚselfZ    enum_type©rúad:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\google/protobuf/internal/enum_type_wrapper.pyÚ__init__7szEnumTypeWrapper.__init__cCsdz|jj|jWStk
r$YnXt|tƒsLtd |jjt|ƒ|¡ƒ‚nt    d |jj|¡ƒ‚dS)z6Returns a string containing the name of an enum value.z2Enum value for {} must be an int, but got {} {!r}.z*Enum {} has no name defined for value {!r}N)
rZvalues_by_numberÚnameÚKeyErrorÚ
isinstanceÚintÚ    TypeErrorÚformatÚtypeÚ
ValueError)rÚnumberrrrÚName<s 
ÿÿÿzEnumTypeWrapper.NamecCs>z|jj|jWStk
r$YnXtd |jj|¡ƒ‚dS)ú7Returns the value corresponding to the given enum name.ú*Enum {} has no value defined for name {!r}N)rÚvalues_by_namerr    rr r©rrrrrÚValueLsÿzEnumTypeWrapper.ValuecCsdd„|jjDƒS)zŠReturn a list of the string names in the enum.
 
    Returns:
      A list of strs, in the order they were defined in the .proto file.
    cSsg|]
}|j‘qSr)r©Ú.0Zvalue_descriptorrrrÚ
<listcomp>\sÿz(EnumTypeWrapper.keys.<locals>.<listcomp>©rÚvalues©rrrrÚkeysUsÿzEnumTypeWrapper.keyscCsdd„|jjDƒS)zŒReturn a list of the integer values in the enum.
 
    Returns:
      A list of ints, in the order they were defined in the .proto file.
    cSsg|]
}|j‘qSr)rrrrrrfsÿz*EnumTypeWrapper.values.<locals>.<listcomp>rrrrrr_sÿzEnumTypeWrapper.valuescCsdd„|jjDƒS)z£Return a list of the (name, value) pairs of the enum.
 
    Returns:
      A list of (str, int) pairs, in the order they were defined
      in the .proto file.
    cSsg|]}|j|jf‘qSr)rrrrrrrpsÿz)EnumTypeWrapper.items.<locals>.<listcomp>rrrrrÚitemsisÿzEnumTypeWrapper.itemscsHztt|ƒ d¡j|jWStk
r.YnXtd |jj    |¡ƒ‚dS)rrrN)
ÚsuperrÚ__getattribute__rrr    ÚAttributeErrorr rrr©Ú    __class__rrÚ __getattr__ssþþþÿzEnumTypeWrapper.__getattr__)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rr Z    ValueTyperrrrrrr$Ú __classcell__rrr"rr)s        
 
 
rN)r(Ú
__author__ÚobjectrrrrrÚ<module>s