Skip to content

Commit

Permalink
ObjectDB: add repr (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry authored Dec 30, 2023
1 parent f943de0 commit bbc8538
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/dvc_objects/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def wrap_iter(iterable, callback):


class ObjectDB:
def __init__(self, fs: "FileSystem", path: str, **config):
def __init__(self, fs: "FileSystem", path: str, read_only: bool = False, **config):
self.fs = fs
self.path = path
self.read_only = config.get("read_only", False)
self.read_only = read_only
self._dirs: Optional[set] = None

def __eq__(self, other: object):
Expand All @@ -55,6 +55,12 @@ def __eq__(self, other: object):
def __hash__(self):
return hash((self.fs.protocol, self.path, self.read_only))

def __repr__(self):
fs = self.fs
path = self.path
read_only = self.read_only
return f"{self.__class__.__name__}({fs=!r}, {path=!r}, {read_only=!r})"

def _init(self, dname: str) -> None:
if self.read_only:
return
Expand Down

0 comments on commit bbc8538

Please sign in to comment.