MCPcopy Create free account
hub / github.com/miguelgrinberg/python-socketio / data_is_binary

Method data_is_binary

src/socketio/packet.py:170–184  ·  view source on GitHub ↗

Check if the data contains binary components.

(cls, data)

Source from the content-addressed store, hash-verified

168
169 @classmethod
170 def data_is_binary(cls, data):
171 """Check if the data contains binary components."""
172 if isinstance(data, (bytes, bytearray)):
173 return True
174 elif isinstance(data, list):
175 return functools.reduce(
176 lambda a, b: a or b, [cls.data_is_binary(item)
177 for item in data], False)
178 elif isinstance(data, dict):
179 return functools.reduce(
180 lambda a, b: a or b, [cls.data_is_binary(item)
181 for item in data.values()],
182 False)
183 else:
184 return False
185
186 def _to_dict(self):
187 d = {

Callers 5

__init__Method · 0.95
emitMethod · 0.80
emitMethod · 0.80

Calls

no outgoing calls

Tested by 2