from typing import Union
from typing import Sequence
import fsspec


def _get_fs_sep_prefix_paths(path: Union[str, Sequence[str]]):
    """Identify separator and prefix for various filesystems.

    In the case of local files, prefix is set to "" if original input path
    is not prefixed with the file:// prefix.
    """
    fs, _, paths = fsspec.get_fs_token_paths(path)
    protocol = fs.protocol
    if not isinstance(protocol, str):
        protocol, *_ = protocol
    prefix = protocol + "://"
    if isinstance(path, str):
        first_path = path
    else:
        first_path = path[0]
    if protocol == "file" and not first_path.startswith(prefix):  # local file notation
        prefix = ""
    try:
        sep = fs.pathsep
    except AttributeError:
        sep = "/"
    return fs, sep, prefix, paths