Jelmer Vernooij 5 mesi fa
parent
commit
83d3116540
7 ha cambiato i file con 42 aggiunte e 15 eliminazioni
  1. 3 1
      dulwich/bundle.py
  2. 10 5
      dulwich/config.py
  3. 3 3
      dulwich/file.py
  4. 7 1
      dulwich/greenthreads.py
  5. 6 1
      dulwich/lfs_server.py
  6. 3 1
      dulwich/notes.py
  7. 10 3
      dulwich/objectspec.py

+ 3 - 1
dulwich/bundle.py

@@ -63,7 +63,9 @@ class Bundle:
         return True
 
     def store_objects(
-        self, object_store: "BaseObjectStore", progress: Optional[Callable[[str], None]] = None
+        self,
+        object_store: "BaseObjectStore",
+        progress: Optional[Callable[[str], None]] = None,
     ) -> None:
         """Store all objects from this bundle into an object store.
 

+ 10 - 5
dulwich/config.py

@@ -177,8 +177,11 @@ class CaseInsensitiveOrderedMultiDict(MutableMapping[K, V], Generic[K, V]):
 
     @classmethod
     def make(
-        cls, dict_in: Optional[Union[MutableMapping[K, V], "CaseInsensitiveOrderedMultiDict[K, V]"]] = None, 
-        default_factory: Optional[Callable[[], V]] = None
+        cls,
+        dict_in: Optional[
+            Union[MutableMapping[K, V], "CaseInsensitiveOrderedMultiDict[K, V]"]
+        ] = None,
+        default_factory: Optional[Callable[[], V]] = None,
     ) -> "CaseInsensitiveOrderedMultiDict[K, V]":
         if isinstance(dict_in, cls):
             return dict_in
@@ -396,7 +399,7 @@ class ConfigDict(Config):
     def __init__(
         self,
         values: Union[
-            MutableMapping[Section, MutableMapping[Name, Value]], None
+            MutableMapping[Section, CaseInsensitiveOrderedMultiDict[Name, Value]], None
         ] = None,
         encoding: Union[str, None] = None,
     ) -> None:
@@ -419,7 +422,9 @@ class ConfigDict(Config):
     def __getitem__(self, key: Section) -> CaseInsensitiveOrderedMultiDict[Name, Value]:
         return self._values.__getitem__(key)
 
-    def __setitem__(self, key: Section, value: CaseInsensitiveOrderedMultiDict[Name, Value]) -> None:
+    def __setitem__(
+        self, key: Section, value: CaseInsensitiveOrderedMultiDict[Name, Value]
+    ) -> None:
         return self._values.__setitem__(key, value)
 
     def __delitem__(self, key: Section) -> None:
@@ -741,7 +746,7 @@ class ConfigFile(ConfigDict):
     def __init__(
         self,
         values: Union[
-            MutableMapping[Section, MutableMapping[Name, Value]], None
+            MutableMapping[Section, CaseInsensitiveOrderedMultiDict[Name, Value]], None
         ] = None,
         encoding: Union[str, None] = None,
     ) -> None:

+ 3 - 3
dulwich/file.py

@@ -266,15 +266,15 @@ class _GitFile:
         if name in self.PROXY_PROPERTIES:
             return getattr(self._file, name)
         raise AttributeError(name)
-    
+
     def readable(self) -> bool:
         """Return whether the file is readable."""
         return self._file.readable()
-    
+
     def writable(self) -> bool:
         """Return whether the file is writable."""
         return self._file.writable()
-    
+
     def seekable(self) -> bool:
         """Return whether the file is seekable."""
         return self._file.seekable()

+ 7 - 1
dulwich/greenthreads.py

@@ -37,7 +37,13 @@ from .object_store import (
 from .objects import Commit, ObjectID, Tag
 
 
-def _split_commits_and_tags(obj_store: BaseObjectStore, lst: list[ObjectID], *, ignore_unknown: bool = False, pool: pool.Pool) -> tuple[set[ObjectID], set[ObjectID]]:
+def _split_commits_and_tags(
+    obj_store: BaseObjectStore,
+    lst: list[ObjectID],
+    *,
+    ignore_unknown: bool = False,
+    pool: pool.Pool,
+) -> tuple[set[ObjectID], set[ObjectID]]:
     """Split object id list into two list with commit SHA1s and tag SHA1s.
 
     Same implementation as object_store._split_commits_and_tags

+ 6 - 1
dulwich/lfs_server.py

@@ -240,7 +240,12 @@ class LFSRequestHandler(BaseHTTPRequestHandler):
 class LFSServer(HTTPServer):
     """Simple LFS server for testing."""
 
-    def __init__(self, server_address: tuple[str, int], lfs_store: LFSStore, log_requests: bool = False) -> None:
+    def __init__(
+        self,
+        server_address: tuple[str, int],
+        lfs_store: LFSStore,
+        log_requests: bool = False,
+    ) -> None:
         super().__init__(server_address, LFSRequestHandler)
         self.lfs_store = lfs_store
         self.log_requests = log_requests

+ 3 - 1
dulwich/notes.py

@@ -514,7 +514,9 @@ def create_notes_tree(object_store: "BaseObjectStore") -> Tree:
 class Notes:
     """High-level interface for Git notes operations."""
 
-    def __init__(self, object_store: "BaseObjectStore", refs_container: "RefsContainer") -> None:
+    def __init__(
+        self, object_store: "BaseObjectStore", refs_container: "RefsContainer"
+    ) -> None:
         """Initialize Notes.
 
         Args:

+ 10 - 3
dulwich/objectspec.py

@@ -289,7 +289,10 @@ def parse_reftuples(
     return ret
 
 
-def parse_refs(container: Union["Repo", "RefsContainer"], refspecs: Union[bytes, str, list[Union[bytes, str]]]) -> list["Ref"]:
+def parse_refs(
+    container: Union["Repo", "RefsContainer"],
+    refspecs: Union[bytes, str, list[Union[bytes, str]]],
+) -> list["Ref"]:
     """Parse a list of refspecs to a list of refs.
 
     Args:
@@ -349,7 +352,9 @@ class AmbiguousShortId(Exception):
         self.options = options
 
 
-def scan_for_short_id(object_store: "BaseObjectStore", prefix: bytes, tp: type[ShaFile]) -> ShaFile:
+def scan_for_short_id(
+    object_store: "BaseObjectStore", prefix: bytes, tp: type[ShaFile]
+) -> ShaFile:
     """Scan an object store for a short id."""
     ret = []
     for object_id in object_store.iter_prefix(prefix):
@@ -385,7 +390,9 @@ def parse_commit(repo: "Repo", committish: Union[str, bytes, Commit, Tag]) -> "C
                 # Tag points to a missing object
                 raise KeyError(obj_sha)
         if not isinstance(obj, Commit):
-            raise ValueError(f"Expected commit, got {obj.type_name.decode('ascii', 'replace')}")
+            raise ValueError(
+                f"Expected commit, got {obj.type_name.decode('ascii', 'replace')}"
+            )
         return obj
 
     # If already a Commit object, return it directly