Returns a FlagValue instance when needed. Internal method, to be used in *2i() and i2*() methods.
(self, x)
| 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 |
| 3249 | used 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] |