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

Function issubtype

scapy/utils.py:93–107  ·  view source on GitHub ↗

issubtype(C, B) -> bool Return whether C is a class and if it is a subclass of class B. When using a tuple as the second argument issubtype(X, (A, B, ...)), is a shortcut for issubtype(X, A) or issubtype(X, B) or ... (etc.).

(x,  # type: Any
              t,  # type: Union[type, str]
              )

Source from the content-addressed store, hash-verified

91
92
93def issubtype(x, # type: Any
94 t, # type: Union[type, str]
95 ):
96 # type: (...) -> bool
97 """issubtype(C, B) -> bool
98
99 Return whether C is a class and if it is a subclass of class B.
100 When using a tuple as the second argument issubtype(X, (A, B, ...)),
101 is a shortcut for issubtype(X, A) or issubtype(X, B) or ... (etc.).
102 """
103 if isinstance(t, str):
104 return t in (z.__name__ for z in x.__bases__)
105 if isinstance(x, type) and issubclass(x, t):
106 return True
107 return False
108
109
110_Decimal = Union[Decimal, int]

Callers 3

__getitem__Method · 0.90
do_dissect_payloadMethod · 0.90
_pkt_lsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected