Bladeren bron

Typing/lint fixes

Jelmer Vernooij 1 jaar geleden
bovenliggende
commit
17c4bbc2b7
2 gewijzigde bestanden met toevoegingen van 5 en 5 verwijderingen
  1. 3 3
      dulwich/objects.py
  2. 2 2
      dulwich/pack.py

+ 3 - 3
dulwich/objects.py

@@ -361,9 +361,9 @@ class ShaFile:
         """Return unique hash for this object."""
         return hash(self.id)
 
-    def as_pretty_string(self) -> bytes:
+    def as_pretty_string(self) -> str:
         """Return a string representing this object, fit for display."""
-        return self.as_raw_string()
+        return self.as_raw_string().decode("utf-8", "replace")
 
     def set_raw_string(self, text: bytes, sha: Optional[ObjectID] = None) -> None:
         """Set the contents of this object from a serialized string."""
@@ -1200,7 +1200,7 @@ class Tree(ShaFile):
     def _serialize(self):
         return list(serialize_tree(self.iteritems()))
 
-    def as_pretty_string(self):
+    def as_pretty_string(self) -> str:
         text: List[str] = []
         for name, mode, hexsha in self.iteritems():
             text.append(pretty_format_tree_entry(name, mode, hexsha))

+ 2 - 2
dulwich/pack.py

@@ -2780,8 +2780,8 @@ def extend_pack(
 
 try:
     from dulwich._pack import (  # type: ignore
-        apply_delta,  # type: ignore
-        bisect_find_sha,  # type: ignore
+        apply_delta,  # noqa: F811
+        bisect_find_sha,  # noqa: F811
     )
 except ImportError:
     pass