MCPcopy Index your code
hub / github.com/secdev/scapy / _fixup_val

Method _fixup_val

scapy/fields.py:3246–3256  ·  view source on GitHub ↗

Returns a FlagValue instance when needed. Internal method, to be used in *2i() and i2*() methods.

(self, x)

Source from the content-addressed store, hash-verified

3244 super(FlagsField, self).__init__(name, default, size, **kwargs)
3245
3246 def _fixup_val(self, x):
3247 # type: (Any) -> Optional[FlagValue]
3248 """Returns a FlagValue instance when needed. Internal method, to be
3249used in *2i() and i2*() methods.
3250
3251 """
3252 if isinstance(x, (FlagValue, VolatileValue)):
3253 return x # type: ignore
3254 if x is None:
3255 return None
3256 return FlagValue(x, self.names)
3257
3258 def any2i(self, pkt, x):
3259 # type: (Optional[Packet], Any) -> Optional[FlagValue]

Callers 4

any2iMethod · 0.95
m2iMethod · 0.95
i2hMethod · 0.95
i2reprMethod · 0.95

Calls 1

FlagValueClass · 0.85

Tested by

no test coverage detected