"""Cuts at ``#`` outside the reference home: each one is a report, by position, by keyword and unbound.

``document``, ``keyword`` (both calls) and ``unbound`` (both calls) are reports; ``path_parts`` cuts at ``/`` or asks
whether a key starts with ``#``, which are no cuts at ``#``.
"""


def document(ref):
    return ref.rsplit("#", 1)[0]


def keyword(ref):
    return ref.split(sep="#", maxsplit=1)[0], ref.rsplit(maxsplit=1, sep="#")


def unbound(ref):
    return str.split(ref, "#")[0], str.partition(ref, "#")


def path_parts(ref):
    return ref.startswith("#"), ref.split("/"), ref.split(sep="/"), str.split(ref, "/"), ref.find("/")
