Skip to content

Commit 6abe67b

Browse files
committed
sync(docs[SyncResult,update_repo]): Add NumPy-style docstrings
why: Code review identified incomplete docstrings missing Parameters and Returns sections required by project standards. what: - Add Parameters/Returns to SyncResult.__bool__() and add_error() - Add Parameters/Returns to GitSync.update_repo() - Add Returns to HgSync.update_repo() - Add Parameters/Returns to SvnSync.update_repo()
1 parent e082804 commit 6abe67b

4 files changed

Lines changed: 49 additions & 5 deletions

File tree

src/libvcs/sync/base.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ class SyncResult:
6161
errors: list[SyncError] = dataclasses.field(default_factory=list)
6262

6363
def __bool__(self) -> bool:
64-
"""Return True if the sync succeeded without errors."""
64+
"""Return True if the sync succeeded without errors.
65+
66+
Returns
67+
-------
68+
bool
69+
True if no errors were recorded, False otherwise.
70+
"""
6571
return self.ok
6672

6773
def add_error(
@@ -70,7 +76,17 @@ def add_error(
7076
message: str,
7177
exception: Exception | None = None,
7278
) -> None:
73-
"""Record an error and mark the result as failed."""
79+
"""Record an error and mark the result as failed.
80+
81+
Parameters
82+
----------
83+
step : str
84+
Name of the sync step that failed (e.g. ``"fetch"``, ``"checkout"``).
85+
message : str
86+
Human-readable description of the error.
87+
exception : Exception or None, optional
88+
The underlying exception, if available.
89+
"""
7490
self.ok = False
7591
self.errors.append(SyncError(step=step, message=message, exception=exception))
7692

src/libvcs/sync/git.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,18 @@ def update_repo(
382382
*args: t.Any,
383383
**kwargs: t.Any,
384384
) -> SyncResult:
385-
"""Pull latest changes from git remote."""
385+
"""Pull latest changes from git remote.
386+
387+
Parameters
388+
----------
389+
set_remotes : bool
390+
If True, configure remotes before updating.
391+
392+
Returns
393+
-------
394+
SyncResult
395+
Result of the sync operation, with any errors recorded.
396+
"""
386397
result = SyncResult()
387398
self.ensure_dir()
388399

src/libvcs/sync/hg.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ def get_revision(self) -> str:
6666
return self.run(["parents", "--template={rev}"])
6767

6868
def update_repo(self, *args: t.Any, **kwargs: t.Any) -> SyncResult:
69-
"""Pull changes from remote Mercurial repository into this one."""
69+
"""Pull changes from remote Mercurial repository into this one.
70+
71+
Returns
72+
-------
73+
SyncResult
74+
Result of the sync operation, with any errors recorded.
75+
"""
7076
result = SyncResult()
7177
if not pathlib.Path(self.path / ".hg").exists():
7278
self.obtain()

src/libvcs/sync/svn.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,18 @@ def update_repo(
150150
*args: t.Any,
151151
**kwargs: t.Any,
152152
) -> SyncResult:
153-
"""Fetch changes from SVN repository to local working copy."""
153+
"""Fetch changes from SVN repository to local working copy.
154+
155+
Parameters
156+
----------
157+
dest : str or None, optional
158+
Destination path override for the working copy.
159+
160+
Returns
161+
-------
162+
SyncResult
163+
Result of the sync operation, with any errors recorded.
164+
"""
154165
result = SyncResult()
155166
self.ensure_dir()
156167
if pathlib.Path(self.path / ".svn").exists():

0 commit comments

Comments
 (0)