MCPcopy Index your code
hub / github.com/nonebot/nonebot2 / exclude_unset

Function exclude_unset

nonebot/utils.py:103–112  ·  view source on GitHub ↗
(data: Any)

Source from the content-addressed store, hash-verified

101
102
103def exclude_unset(data: Any) -> Any:
104 if isinstance(data, dict):
105 return data.__class__(
106 (k, exclude_unset(v)) for k, v in data.items() if v is not UNSET
107 )
108 elif isinstance(data, list):
109 return data.__class__(exclude_unset(i) for i in data if i is not UNSET)
110 elif data is UNSET:
111 return None
112 return data
113
114
115def escape_tag(s: str) -> str:

Callers 7

__init__Method · 0.90
_get_timeoutMethod · 0.90
websocketMethod · 0.90
websocketMethod · 0.90
__init__Method · 0.90
_get_timeoutMethod · 0.90
test_exclude_unsetFunction · 0.90

Calls 1

itemsMethod · 0.45

Tested by 1

test_exclude_unsetFunction · 0.72