|
11 | 11 | SAFE_VALUE, |
12 | 12 | ) |
13 | 13 | from .node import InfrahubNode, InfrahubNodeBase, InfrahubNodeSync |
| 14 | +from .parsers import parse_human_friendly_id |
14 | 15 | from .property import NodeProperty |
15 | 16 | from .related_node import RelatedNode, RelatedNodeBase, RelatedNodeSync |
16 | 17 | from .relationship import RelationshipManager, RelationshipManagerBase, RelationshipManagerSync |
|
19 | 20 | "ARTIFACT_DEFINITION_GENERATE_FEATURE_NOT_SUPPORTED_MESSAGE", |
20 | 21 | "ARTIFACT_FETCH_FEATURE_NOT_SUPPORTED_MESSAGE", |
21 | 22 | "ARTIFACT_GENERATE_FEATURE_NOT_SUPPORTED_MESSAGE", |
| 23 | + "HFID_STR_SEPARATOR", |
22 | 24 | "IP_TYPES", |
23 | 25 | "PROPERTIES_FLAG", |
24 | 26 | "PROPERTIES_OBJECT", |
|
33 | 35 | "RelationshipManager", |
34 | 36 | "RelationshipManagerBase", |
35 | 37 | "RelationshipManagerSync", |
| 38 | + "parse_human_friendly_id", |
36 | 39 | ] |
37 | | - |
38 | | - |
39 | | -def parse_human_friendly_id(hfid: str | list[str]) -> tuple[str | None, list[str]]: |
40 | | - """Parse a human friendly ID into a kind and an identifier.""" |
41 | | - if isinstance(hfid, str): |
42 | | - hfid_parts = hfid.split(HFID_STR_SEPARATOR) |
43 | | - if len(hfid_parts) == 1: |
44 | | - return None, hfid_parts |
45 | | - return hfid_parts[0], hfid_parts[1:] |
46 | | - if isinstance(hfid, list): |
47 | | - return None, hfid |
48 | | - raise ValueError(f"Invalid human friendly ID: {hfid}") |
0 commit comments