Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into task/modify-lakefs-…
Browse files Browse the repository at this point in the history
…python-docs-7120

# Conflicts:
#	clients/python-wrapper/lakefs/repository.py
  • Loading branch information
N-o-Z committed Dec 10, 2023
2 parents 8a0bad8 + 0787698 commit b71f044
Show file tree
Hide file tree
Showing 36 changed files with 12,936 additions and 1,565 deletions.
3 changes: 3 additions & 0 deletions api/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -585,14 +585,17 @@ components:

TagCreation:
type: object
description: Make tag ID point at this REF.
required:
- id
- ref
properties:
id:
type: string
description: ID of tag to create
ref:
type: string
description: the commit to tag

TaskInfo:
type: object
Expand Down
3 changes: 3 additions & 0 deletions clients/java-legacy/api/openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions clients/java-legacy/docs/TagCreation.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions clients/java/api/openapi.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions clients/java/docs/TagCreation.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions clients/python-legacy/docs/TagCreation.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions clients/python-legacy/lakefs_client/model/tag_creation.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions clients/python-wrapper/lakefs/branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ def handle_conflict(e: LakeFSException):
if isinstance(e, ConflictException) and exist_ok:
return None
return e

branch_creation = lakefs_sdk.BranchCreation(name=self._id, source=str(source_reference_id))
if isinstance(source_reference_id, Reference):
source_reference_id = source_reference_id.id
branch_creation = lakefs_sdk.BranchCreation(name=self._id, source=source_reference_id)
with api_exception_handler(handle_conflict):
self._client.sdk_client.branches_api.create_branch(self._repo_id, branch_creation)
return self
Expand Down Expand Up @@ -192,10 +193,12 @@ def delete_objects(self, object_paths: str | StoredObject | Iterable[str | Store
:raise NotAuthorizedException: if user is not authorized to perform this operation
:raise ServerException: for any other errors
"""
if isinstance(object_paths, (str, StoredObject)):
object_paths = [str(object_paths)]
if isinstance(object_paths, str):
object_paths = [object_paths]
elif isinstance(object_paths, StoredObject):
object_paths = [object_paths.path]
elif isinstance(object_paths, Iterable):
object_paths = {str(o) for o in object_paths}
object_paths = [o.path if isinstance(o, StoredObject) else o for o in object_paths]
with api_exception_handler():
return self._client.sdk_client.objects_api.delete_objects(
self._repo_id,
Expand Down
9 changes: 9 additions & 0 deletions clients/python-wrapper/lakefs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class Change(LenientNamedTuple):
path_type: Literal["common_prefix", "object"]
size_bytes: Optional[int]

def __repr__(self):
return f'Change(type="{self.type}", path="{self.path}", path_type="{self.path_type}")'


class ImportStatus(LenientNamedTuple):
"""
Expand Down Expand Up @@ -90,13 +93,19 @@ class ObjectInfo(LenientNamedTuple):
metadata: Optional[dict[str, str]] = None
content_type: Optional[str] = None

def __repr__(self):
return f'ObjectInfo(path="{self.path}")'


class CommonPrefix(LenientNamedTuple):
"""
Represents a common prefix in lakeFS
"""
path: str

def __repr__(self):
return f'CommonPrefix(path="{self.path}")'


class RepositoryProperties(LenientNamedTuple):
"""
Expand Down
6 changes: 6 additions & 0 deletions clients/python-wrapper/lakefs/namedtuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ def __init__(self, **kwargs):
self.__initialized = True
super().__init__()

def __repr__(self):
class_name = self.__class__.__name__
if hasattr(self, 'id'):
return f'{class_name}(id="{self.id}")'
return f'{class_name}()'

def __setattr__(self, name, value):
if self.__initialized:
raise AttributeError("can't set attribute")
Expand Down
Loading

0 comments on commit b71f044

Please sign in to comment.