drepr.models.parsers.v1.path_parser#
Classes
A path can either be a JSONPath or our list path |
- class PathParserV1[source]#
Bases:
PathParserA path can either be a JSONPath or our list path
If the path is a JSONPath, then it is a string startswith $. We only support the following type of step: range, index, list of index, and wildcard. However, wildcard is only used for selecting all values of an object
If the path is a normal string
- REG_SRANGE = re.compile('^(\\d+)?\\.\\.(-?\\d+)?(?::(\\d+))?$')#
- REG_SINDEX = re.compile('^(?:\\$\\{([^}]+)})|(\\d+)|(.*)$')#
- REG_SRANGE_EXPR = re.compile('^(?:(\\d+)|(?:\\$\\{([^}]+)}))?\\.\\.(?:(-\\d+)|(?:\\$\\{([^}]+)}))?(?::(\\d+)|(?:\\$\\{([^}]+)}))?$')#
- REG_JPATH_BRACKET = re.compile("(?:\\[(-?\\d+)?\\:(?:(-?\\d+)(?:\\:(-?\\d+))?)?\\])|(?:\\[(-?\\d+)\\])|(?:\\['([^']+)'\\])")#
- REG_JPATH_DOT = re.compile('\\.((?:(?!\\.|\\[).)+)')#