-
Notifications
You must be signed in to change notification settings - Fork 0
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
Core: Implement exists api #19
Conversation
tosfs/core.py
Outdated
@@ -413,6 +416,200 @@ def _try_dir_info(self, bucket: str, key: str, path: str, fullpath: str) -> dict | |||
except Exception as e: | |||
raise TosfsError(f"Tosfs failed with unknown error: {e}") from e | |||
|
|||
def exists(self, path: str, **kwargs: Union[str, bool, float, None]) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this **kwargs: Union[str, bool, float, None]
mean ? What's the value that people should pass ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Souds like it's not quite clear for me to construct the argumenst when i call this method....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**kwargs
is the dynamic parameter mechanism in Python. It can be used for future expansion without changing the method signature. Add it's type Union[str, bool, float, None]
is for code style check rule. The Union[str, bool, float, None]
means: it can be str
, bool
, number
or object
type.
Adding this to align with fsspec#exists(**kwargs)
, it has this parameter due to it calls fsspe#info(**kwargs)
.
If removed will cause code style warnning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually **kwargs is a dict. You could also set **kwargs: Any.
tosfs/core.py
Outdated
**kwargs : dict, optional | ||
Additional arguments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pydoc says it will be a dict, while the declared arg is a Union
? Is this correct ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, it should be cleaner in pydoc, will update.
295af56
to
1c6db07
Compare
1840c03
to
5a482dd
Compare
Summary 📝
Write an overview about it.
Details
Describe more what you did on changes.
Bugfixes 🐛 (delete if dind't have any)
Checks