-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Fix ObjectStoragePath compatible with universal-pathlib 0.3.0 to avoid maximum recursion depth exceeded #56270
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -294,7 +294,7 @@ def _cp_file(self, dst: ObjectStoragePath, **kwargs): | |
| # make use of system dependent buffer size | ||
| shutil.copyfileobj(f1, f2, **kwargs) | ||
|
|
||
| def copy(self, dst: str | ObjectStoragePath, recursive: bool = False, **kwargs) -> None: | ||
| def copy(self, dst: str | ObjectStoragePath, recursive: bool = False, **kwargs) -> None: # type: ignore[override] | ||
| """ | ||
| Copy file(s) from this path to another location. | ||
|
|
||
|
|
@@ -307,6 +307,8 @@ def copy(self, dst: str | ObjectStoragePath, recursive: bool = False, **kwargs) | |
|
|
||
| kwargs: Additional keyword arguments to be passed to the underlying implementation. | ||
| """ | ||
| # TODO: change dst arg to target when we bump major version for task-sdk and remove type: ignore in copy method | ||
|
|
||
| from airflow.lineage.hook import get_hook_lineage_collector | ||
|
|
||
| if isinstance(dst, str): | ||
|
|
@@ -413,5 +415,5 @@ def deserialize(cls, data: dict, version: int) -> ObjectStoragePath: | |
| def __str__(self): | ||
| conn_id = self.storage_options.get("conn_id") | ||
| if self._protocol and conn_id: | ||
| return f"{self._protocol}://{conn_id}@{self.path}" | ||
gopidesupavan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return f"{self._protocol}://{conn_id}@{self.parser.join(*self._raw_urlpaths)}" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really the only options? Relying on a private method doesn't feel great. Could we do this instead:
It's much more verbose, and opaque, yes, but it doesn't depend on accessing a "private" method?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per your comment below, we should likely restrict 0.3.0 and use this library properly |
||
| return super().__str__() | ||
Uh oh!
There was an error while loading. Please reload this page.