def _splitSpec(spec):
    parts = spec.split(".")
    dirOffset = 0
    fileOffset = 0
    for i in range(1, len(parts) + 1):
        if os.path.isdir(".".join(parts[:i])):
            dirOffset = i
        elif os.path.isfile(".".join(parts[:i]) + ".py"):
            fileOffset = i
    if dirOffset > fileOffset:
        target = ".".join(parts[:dirOffset])
        pattern = ".".join(parts[dirOffset:])
    elif fileOffset:
        target = ".".join(parts[:fileOffset]) + ".py"
        pattern = ".".join(parts[fileOffset:])
    else:
        target = ""
        pattern = ".".join(parts)
    if target and pattern == "py":
        pattern = ""
    return target, pattern



# begin nocover
Takes an input specification, and returns a (path, pattern) tuple.
dataset/ETHPy150Open cortesi/pry/libpry/utils.py/_splitSpec