Skip to content

Commit

Permalink
single __repr__ impl for all reference types
Browse files Browse the repository at this point in the history
  • Loading branch information
ozkatz committed Dec 9, 2023
1 parent d29591b commit a0c1011
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
6 changes: 0 additions & 6 deletions clients/python-wrapper/lakefs/branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,6 @@ def reset_changes(self, path_type: Literal["common_prefix", "object", "reset"] =
reset_creation = lakefs_sdk.ResetCreation(path=path, type=path_type)
return self._client.sdk_client.branches_api.reset_branch(self._repo_id, self.id, reset_creation)

def __repr__(self):
return f'Branch(repository="{self.repo_id}", id="{self.id}")'


class Transaction(Branch):
"""
Expand All @@ -243,6 +240,3 @@ def __init__(self, repository_id: str, branch_id: str, commit_message: str, clie

# TODO: Implement and check if we are OK with transaction returning a branch
# with capabilities such as commit and transaction

def __repr__(self):
return f'Transaction(repository="{self.repo_id}", branch_id="{self.id}")'
3 changes: 2 additions & 1 deletion clients/python-wrapper/lakefs/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ def object(self, path: str) -> StoredObject: # pylint: disable=C0103
return StoredObject(self._repo_id, self._id, path, self._client)

def __repr__(self):
return f'Reference(repository="{self.repo_id}", id="{self.id}")'
class_name = self.__class__.__name__
return f'{class_name}(repository="{self.repo_id}", id="{self.id}")'


def generate_listing(func, *args, max_amount: Optional[int] = None, **kwargs):
Expand Down
3 changes: 0 additions & 3 deletions clients/python-wrapper/lakefs/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,3 @@ def delete(self) -> None:
with api_exception_handler():
self._client.sdk_client.tags_api.delete_tag(self._repo_id, self.id)
self._commit = None

def __repr__(self):
return f'Tag(repository="{self.repo_id}", id="{self.id}")'

0 comments on commit a0c1011

Please sign in to comment.