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

Method __getattr__

scapy/fields.py:3147–3162  ·  view source on GitHub ↗
(self, attr)

Source from the content-addressed store, hash-verified

3145 return self.__class__(int(self), self.names)
3146
3147 def __getattr__(self, attr):
3148 # type: (str) -> Any
3149 if attr in self.__slots__:
3150 return super(FlagValue, self).__getattribute__(attr)
3151 try:
3152 if self.multi:
3153 return bool((2 ** self.names.index(attr)) & int(self))
3154 return all(bool((2 ** self.names.index(flag)) & int(self))
3155 for flag in attr)
3156 except ValueError:
3157 if '_' in attr:
3158 try:
3159 return self.__getattr__(attr.replace('_', '-'))
3160 except AttributeError:
3161 pass
3162 return super(FlagValue, self).__getattribute__(attr)
3163
3164 def __setattr__(self, attr, value):
3165 # type: (str, Union[List[str], int, str]) -> None

Callers

nothing calls this directly

Calls 2

__getattribute__Method · 0.80
replaceMethod · 0.80

Tested by

no test coverage detected