MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / _normalize_data

Method _normalize_data

astrbot/dashboard/asgi_runtime.py:285–303  ·  view source on GitHub ↗
(cls, data: Any)

Source from the content-addressed store, hash-verified

283
284 @classmethod
285 def _normalize_data(cls, data: Any):
286 if not isinstance(data, dict):
287 return data, None
288
289 form: dict[str, Any] = {}
290 files: list[tuple[str, tuple]] = []
291 for key, value in data.items():
292 if cls._is_file_storage(value):
293 files.append((key, cls._file_tuple(value)))
294 continue
295 if isinstance(value, Iterable) and not isinstance(
296 value, str | bytes | dict
297 ):
298 values = list(value)
299 if values and all(cls._is_file_storage(item) for item in values):
300 files.extend((key, cls._file_tuple(item)) for item in values)
301 continue
302 form[key] = value
303 return form, files or None
304
305 @classmethod
306 def _normalize_files(cls, files: Any):

Callers 1

requestMethod · 0.95

Calls 5

_is_file_storageMethod · 0.80
_file_tupleMethod · 0.80
listFunction · 0.50
itemsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected