MCPcopy Index your code
hub / github.com/RustPython/RustPython / _int_to_enum

Function _int_to_enum

Lib/signal.py:24–33  ·  view source on GitHub ↗

Convert a possible numeric value to an IntEnum member. If it's not a known member, return the value itself.

(value, enum_klass)

Source from the content-addressed store, hash-verified

22
23
24def _int_to_enum(value, enum_klass):
25 """Convert a possible numeric value to an IntEnum member.
26 If it's not a known member, return the value itself.
27 """
28 if not isinstance(value, int):
29 return value
30 try:
31 return enum_klass(value)
32 except ValueError:
33 return value
34
35
36def _enum_to_int(value):

Callers 6

signalFunction · 0.85
getsignalFunction · 0.85
pthread_sigmaskFunction · 0.85
sigpendingFunction · 0.85
sigwaitFunction · 0.85
valid_signalsFunction · 0.85

Calls 1

isinstanceFunction · 0.85

Tested by

no test coverage detected