MCPcopy Create free account
hub / github.com/TimMcCool/scratchattach / parse_prim_fields

Function parse_prim_fields

scratchattach/editor/backpack_json.py:9–23  ·  view source on GitHub ↗

Function for reading the fields in a backpack **primitive**

(_fields: dict[str, dict[str, str]])

Source from the content-addressed store, hash-verified

7
8
9def parse_prim_fields(_fields: dict[str, dict[str, str]]) -> tuple[str | None, str | None, str | None]:
10 """
11 Function for reading the fields in a backpack **primitive**
12 """
13 for key, value in _fields.items():
14 prim_value, prim_name, prim_id = (None,) * 3
15 if key == "NUM":
16 prim_value = value.get("value")
17 else:
18 prim_name = value.get("value")
19 prim_id = value.get("id")
20
21 # There really should only be 1 item, and this function can only return for that item
22 return prim_value, prim_name, prim_id
23 return (None,) * 3
24
25
26class BpField(field.Field):

Callers 1

from_jsonMethod · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected