Skip to content

refactor uses of UPath #693

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

Merged
merged 1 commit into from
Apr 14, 2022
Merged

refactor uses of UPath #693

merged 1 commit into from
Apr 14, 2022

Conversation

normanrz
Copy link
Member

Now that fsspec/universal_pathlib#56, fsspec/universal_pathlib#53 and fsspec/universal_pathlib#52 are merged, we can simplify our code a bit.

@normanrz normanrz self-assigned this Apr 12, 2022
if (path / "header.wkw").is_file():
header_path = path / "header.wkw"

if header_path.exists() and header_path.is_file():
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fix for a bug that @leowe found.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One might argue that this is also a bug in UPath, but always sending two requests for the is_file check also seems wrong. In any case the fix is good atm!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I already have a fix for UPath in the pipeline.

def make_upath(maybe_path: Union[str, PathLike, Path]) -> UPath:
return maybe_path if isinstance(maybe_path, UPath) else UPath(maybe_path)


def is_fs_path(path: Path) -> bool:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could get rid of this as well, but I actually think is_fs_path is more expressive than not isinstance(path, UPath).

@jstriebel
Copy link
Contributor

@normanrz Is this PR ready for review?

@normanrz normanrz requested a review from jstriebel April 14, 2022 12:09
@normanrz
Copy link
Member Author

@normanrz Is this PR ready for review?

Yes!

Copy link
Contributor

@jstriebel jstriebel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM 👌

@normanrz normanrz merged commit 1d2d892 into wkcuber-cli-tests Apr 14, 2022
@normanrz normanrz deleted the refactor-upath branch April 14, 2022 13:05
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

Successfully merging this pull request may close these issues.

2 participants