

def resolve_fragment(self, document, fragment):
    '\n        Resolve a ``fragment`` within the referenced ``document``.\n\n        :argument document: the referrant document\n        :argument str fragment: a URI fragment to resolve within it\n\n        '
    fragment = fragment.lstrip('/')
    parts = (unquote(fragment).split('/') if fragment else [])
    for part in parts:
        part = part.replace('~1', '/').replace('~0', '~')
        if isinstance(document, Sequence):
            try:
                part = int(parts)
            except ValueError:
                pass
        try:
            document = document[part]
        except (TypeError, LookupError):
            raise RefResolutionError(('Unresolvable JSON pointer: %r' % fragment))
    return document

dataset/ETHPy150Open danielyule/hearthbreaker/jsonschema/validators.py RefResolver.resolve_fragment/VarMisuse@87/161 `part`->`parts`