commit c89cf2d3318a8247c1329a3ff976d5e7dae5e87b from: Jelmer Vernooij date: Sun Jan 15 17:33:37 2023 UTC Add more typing for server. commit - e9f9d24c4d03f5f9a4c59601be2c992a2ef01be8 commit + c89cf2d3318a8247c1329a3ff976d5e7dae5e87b blob - efb91733e233894cc4d72d26074a4dc108555920 blob + 853321cf35941e2fcc683ef2fb88743e064643a7 --- dulwich/server.py +++ dulwich/server.py @@ -48,7 +48,7 @@ import os import socket import sys import time -from typing import List, Tuple, Dict, Optional, Iterable, Set +from typing import List, Tuple, Dict, Optional, Iterable, Set, Protocol as TypingProtocol import zlib import socketserver @@ -75,6 +75,7 @@ from dulwich.object_store import ( from dulwich.pack import ( write_pack_from_container, ObjectContainer, + PackedObjectContainer, ) from dulwich.protocol import ( BufferedPktLineWriter, @@ -120,6 +121,7 @@ from dulwich.protocol import ( NAK_LINE, ) from dulwich.refs import ( + RefsContainer, ANNOTATED_TAG_SUFFIX, write_info_refs, ) @@ -147,15 +149,15 @@ class Backend: raise NotImplementedError(self.open_repository) -class BackendRepo: +class BackendRepo(TypingProtocol): """Repository abstraction used by the Git server. The methods required here are a subset of those provided by dulwich.repo.Repo. """ - object_store = None - refs = None + object_store: PackedObjectContainer + refs: RefsContainer def get_refs(self) -> Dict[bytes, bytes]: """