Conversation
# Conflicts: # transparentpath/gcsutils/transparentpath.py
comment : test not ssh in pull-request.yml
ghost
suggested changes
Nov 24, 2022
| @@ -0,0 +1,76 @@ | |||
| import importlib.util | |||
| @@ -0,0 +1,16 @@ | |||
| #!/usr/bin/expect -f | |||
There was a problem hiding this comment.
change suffix to .exp : it is not bash
or remove if useless
| "If using a path starting with 'gs://', you must include the bucket name in it unless it" | ||
| f"If using a path starting with {TransparentPath.remote_prefix[prefix]}, you must include the bucket " | ||
| f"name in it unless it " | ||
| "is specified with bucket= or if TransparentPath already has been set to use a specified bucket" |
There was a problem hiding this comment.
This error message does not make sense if using SSH : no bucket
| path: Pathlib.Path | ||
| Only relevant if the method was called from TransparentPath.__init__() : will attempts to fetch the bucket | ||
| from the path if bucket is not given | ||
| fs_kind: str Returns GCSFileSystem if 'gcs_*', LocalFilsSystem if 'local', `fsspec.implementations.local.SFTPFileSystem`. |
| ------- | ||
| Tuple[Union[gcsfs.GCSFileSystem, LocalFileSystem], Union[None, str], Union[None, str], Union[None, str]] | ||
| The FileSystem object, the project if on GCS else None, and the bucket if on GCS. | ||
| Tuple[Union[gcsfs.GCSFileSystem, LocalFileSystem, |
There was a problem hiding this comment.
The returned tuple is of size 3, but the doc indicates 4. Fix the doc. Plus, the typing hint and the doc do not match. Fix both.
| @property | ||
| def buckets(self) -> List[str]: | ||
| if self.fs_kind == "local": | ||
| if self.fs_kind == "local" or self.fs_kind == "ssh": |
| if self.fs_kind.startswith("gcs") and self.is_file(): | ||
| obj = str(self).replace(TransparentPath.remote_prefix, "").replace(" ", "%20") | ||
| return f"https://storage.cloud.google.com/{obj}" | ||
| if self.fs_kind != "local" and self.fs_kind != "ssh" and self.is_file(): |
| @property | ||
| def download(self) -> Union[None, str]: | ||
| """Returns a clickable link to download the file from GCS. | ||
| """Returns a clickable link to download the file from remote. |
There was a problem hiding this comment.
is it not implementable for ssh ? Maybe not, but it is worth checking
| postfix = f";tab=objects?project={project}" | ||
| else: | ||
| return None | ||
| if self.fs_kind != "local" and self.fs_kind != "ssh": |
There was a problem hiding this comment.
why not replace
if self.fs_kind != "local" and self.fs_kind != "ssh":
if self.fs_kind == "gcs":by simply
if self.fs_kind == "gcs":?
| raise ValueError("open method needs arguments.") | ||
| thefile = args[0] | ||
| if type(thefile) == str and "gs://" in thefile: | ||
| if type(thefile) == str and ("gs://" in thefile): |
There was a problem hiding this comment.
mabye this condition should also handle ssh : I do not think doing open("sftp://...") actually works, you would here too need to use a transparentpath
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add ssh