Просмотр исходного кода

Add type annotations to dulwich/attrs.py

Jelmer Vernooij 5 месяцев назад
Родитель
Сommit
54bad4e09a
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      dulwich/attrs.py

+ 3 - 3
dulwich/attrs.py

@@ -23,7 +23,7 @@
 
 
 import os
 import os
 import re
 import re
-from collections.abc import Generator, Mapping
+from collections.abc import Generator, Iterator, Mapping
 from typing import (
 from typing import (
     IO,
     IO,
     Optional,
     Optional,
@@ -168,7 +168,7 @@ class Pattern:
         self._regex: Optional[re.Pattern[bytes]] = None
         self._regex: Optional[re.Pattern[bytes]] = None
         self._compile()
         self._compile()
 
 
-    def _compile(self):
+    def _compile(self) -> None:
         """Compile the pattern to a regular expression."""
         """Compile the pattern to a regular expression."""
         regex_pattern = _translate_pattern(self.pattern)
         regex_pattern = _translate_pattern(self.pattern)
         # Add anchors
         # Add anchors
@@ -305,7 +305,7 @@ class GitAttributes:
         """Return the number of patterns."""
         """Return the number of patterns."""
         return len(self._patterns)
         return len(self._patterns)
 
 
-    def __iter__(self):
+    def __iter__(self) -> Iterator[tuple["Pattern", Mapping[bytes, AttributeValue]]]:
         """Iterate over patterns."""
         """Iterate over patterns."""
         return iter(self._patterns)
         return iter(self._patterns)