Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring some utility functions to fsspec.FUNC #478

Open
hadim opened this issue Nov 18, 2020 · 1 comment
Open

Bring some utility functions to fsspec.FUNC #478

hadim opened this issue Nov 18, 2020 · 1 comment

Comments

@hadim
Copy link

hadim commented Nov 18, 2020

There are plenty of small utility functions that could be applied from a URI without having to instantiate a filespec object. It makes life much easier when you want to deal with different types of filesystem transparently.

Here are two examples:

def is_valid_file(path):
    """Check whether a file is a valid path"""
    mapper = fsspec.get_mapper(path)
    return mapper.fs.isfile(path)


def is_local_path(path):
    """Check whether a path point to a local filesystem."""
    mapper = fsspec.get_mapper(path)
    return mapper.fs.protocol == "file"

I guess the idea is similar to what fsspec.open already provides.

@martindurant
Copy link
Member

This is essentially the same idea as #41
But I do welcome the addition of utility functions in general.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants