MCPcopy Create free account
hub / github.com/hunvreus/devpush / _parse_environment_ids

Function _parse_environment_ids

app/forms/storage.py:20–41  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

18
19
20def _parse_environment_ids(value):
21 if value in (None, "", []):
22 return []
23 if isinstance(value, list):
24 parsed = value
25 else:
26 try:
27 parsed = json.loads(value)
28 except (TypeError, json.JSONDecodeError):
29 return None
30 if parsed is None:
31 return []
32 if not isinstance(parsed, list):
33 return None
34 environment_ids = []
35 for item in parsed:
36 if item in (None, ""):
37 continue
38 if not isinstance(item, str):
39 return None
40 environment_ids.append(item)
41 return list(dict.fromkeys(environment_ids))
42
43
44class StorageCreateForm(StarletteForm):

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected