Split `src` string into two parts: a config file path and component id. The file path should end with `(json|yaml|yml)`. The component id should be separated by `::` if it exists. If no path or no id, return "". Args: src: source string to split.
(cls, src: str)
| 661 | |
| 662 | @classmethod |
| 663 | def split_path_id(cls, src: str) -> tuple[str, str]: |
| 664 | """ |
| 665 | Split `src` string into two parts: a config file path and component id. |
| 666 | The file path should end with `(json|yaml|yml)`. The component id should be separated by `::` if it exists. |
| 667 | If no path or no id, return "". |
| 668 | |
| 669 | Args: |
| 670 | src: source string to split. |
| 671 | |
| 672 | """ |
| 673 | src = ReferenceResolver.normalize_id(src) |
| 674 | result = re.compile(rf"({cls.suffix_match}(?=(?:{ID_SEP_KEY}.*)|$))", re.IGNORECASE).findall(src) |
| 675 | if not result: |
| 676 | return "", src # the src is a pure id |
| 677 | path_name = result[0][0] # at most one path_name |
| 678 | _, ids = src.rsplit(path_name, 1) |
| 679 | return path_name, ids[len(ID_SEP_KEY) :] if ids.startswith(ID_SEP_KEY) else "" |
| 680 | |
| 681 | @classmethod |
| 682 | def resolve_relative_ids(cls, id: str, value: str) -> str: |
no test coverage detected