Преглед на файлове

Add more missing docstrings part 3

Jelmer Vernooij преди 5 месеца
родител
ревизия
09b839ff36
променени са 3 файла, в които са добавени 66 реда и са изтрити 19 реда
  1. 4 0
      dulwich/object_store.py
  2. 41 19
      dulwich/repo.py
  3. 21 0
      dulwich/web.py

+ 4 - 0
dulwich/object_store.py

@@ -161,6 +161,7 @@ def get_depth(
     returned.
 
     Args:
+        store: Object store to search in
         head: commit to start from
         get_parents: optional function for getting the parents of a commit
         max_depth: maximum depth to search
@@ -273,6 +274,7 @@ class BaseObjectStore:
 
         Args:
           objects: Iterable over a list of (object, path) tuples
+          progress: Optional progress callback
         """
         raise NotImplementedError(self.add_objects)
 
@@ -585,6 +587,8 @@ class PackBasedObjectStore(BaseObjectStore, PackedObjectContainer):
 
         Args:
           count: Number of items to add
+          unpacked_objects: Iterator of UnpackedObject instances
+          progress: Optional progress callback
         """
         if count == 0:
             # Don't bother writing an empty pack file

+ 41 - 19
dulwich/repo.py

@@ -139,6 +139,11 @@ class InvalidUserIdentity(Exception):
     """User identity is not of the format 'user <email>'."""
 
     def __init__(self, identity) -> None:
+        """Initialize InvalidUserIdentity exception.
+
+        Args:
+            identity: The invalid identity string
+        """
         self.identity = identity
 
 
@@ -200,6 +205,7 @@ def get_user_identity(config: "StackedConfig", kind: Optional[str] = None) -> by
     system (e.g. the gecos field, $EMAIL, $USER@$(hostname -f).
 
     Args:
+      config: Configuration stack to read from
       kind: Optional kind to return identity for,
         usually either "AUTHOR" or "COMMITTER".
 
@@ -334,6 +340,13 @@ class ParentsProvider:
     """Provides parents for commits, handling grafts and shallow commits."""
 
     def __init__(self, store, grafts={}, shallows=[]) -> None:
+        """Initialize ParentsProvider.
+
+        Args:
+            store: Object store to get commits from
+            grafts: Dictionary mapping commit ids to parent ids
+            shallows: List of shallow commit ids
+        """
         self.store = store
         self.grafts = grafts
         self.shallows = set(shallows)
@@ -888,25 +901,24 @@ class BaseRepo:
         Args:
           include: Iterable of SHAs of commits to include along with their
             ancestors. Defaults to [HEAD]
-
-        Keyword Args:
-          exclude: Iterable of SHAs of commits to exclude along with their
-            ancestors, overriding includes.
-          order: ORDER_* constant specifying the order of results.
-            Anything other than ORDER_DATE may result in O(n) memory usage.
-          reverse: If True, reverse the order of output, requiring O(n)
-            memory.
-          max_entries: The maximum number of entries to yield, or None for
-            no limit.
-          paths: Iterable of file or subtree paths to show entries for.
-          rename_detector: diff.RenameDetector object for detecting
-            renames.
-          follow: If True, follow path across renames/copies. Forces a
-            default rename_detector.
-          since: Timestamp to list commits after.
-          until: Timestamp to list commits before.
-          queue_cls: A class to use for a queue of commits, supporting the
-            iterator protocol. The constructor takes a single argument, the
+          **kwargs: Additional keyword arguments including:
+            exclude: Iterable of SHAs of commits to exclude along with their
+              ancestors, overriding includes.
+            order: ORDER_* constant specifying the order of results.
+              Anything other than ORDER_DATE may result in O(n) memory usage.
+            reverse: If True, reverse the order of output, requiring O(n)
+              memory.
+            max_entries: The maximum number of entries to yield, or None for
+              no limit.
+            paths: Iterable of file or subtree paths to show entries for.
+            rename_detector: diff.RenameDetector object for detecting
+              renames.
+            follow: If True, follow path across renames/copies. Forces a
+              default rename_detector.
+            since: Timestamp to list commits after.
+            until: Timestamp to list commits before.
+            queue_cls: A class to use for a queue of commits, supporting the
+              iterator protocol. The constructor takes a single argument, the
             Walker.
 
         Returns: A `Walker` object
@@ -1116,6 +1128,11 @@ class UnsupportedVersion(Exception):
     """Unsupported repository version."""
 
     def __init__(self, version) -> None:
+        """Initialize UnsupportedVersion exception.
+
+        Args:
+            version: The unsupported repository version
+        """
         self.version = version
 
 
@@ -1123,6 +1140,11 @@ class UnsupportedExtension(Exception):
     """Unsupported repository extension."""
 
     def __init__(self, extension) -> None:
+        """Initialize UnsupportedExtension exception.
+
+        Args:
+            extension: The unsupported repository extension
+        """
         self.extension = extension
 
 

+ 21 - 0
dulwich/web.py

@@ -351,6 +351,11 @@ class ChunkReader:
     """Reader for chunked transfer encoding streams."""
 
     def __init__(self, f: BinaryIO) -> None:
+        """Initialize ChunkReader.
+
+        Args:
+            f: Binary file-like object to read from
+        """
         self._iter = _chunk_iter(f)
         self._buffer: list[bytes] = []
 
@@ -452,6 +457,14 @@ class HTTPGitRequest:
     def __init__(
         self, environ, start_response, dumb: bool = False, handlers=None
     ) -> None:
+        """Initialize HTTPGitRequest.
+
+        Args:
+            environ: WSGI environment dictionary
+            start_response: WSGI start_response callable
+            dumb: Whether to use dumb HTTP protocol
+            handlers: Optional handler overrides
+        """
         self.environ = environ
         self.dumb = dumb
         self.handlers = handlers
@@ -545,6 +558,14 @@ class HTTPGitApplication:
     def __init__(
         self, backend, dumb: bool = False, handlers=None, fallback_app=None
     ) -> None:
+        """Initialize HTTPGitApplication.
+
+        Args:
+            backend: Backend object for git operations
+            dumb: Whether to use dumb HTTP protocol
+            handlers: Optional handler overrides
+            fallback_app: Optional fallback WSGI application
+        """
         self.backend = backend
         self.dumb = dumb
         self.handlers = dict(DEFAULT_HANDLERS)