Bläddra i källkod

Move EmptyFileException to dulwich.objects.

Jelmer Vernooij 4 år sedan
förälder
incheckning
24986435b8
2 ändrade filer med 7 tillägg och 6 borttagningar
  1. 0 4
      dulwich/errors.py
  2. 7 2
      dulwich/objects.py

+ 0 - 4
dulwich/errors.py

@@ -162,10 +162,6 @@ class ObjectFormatException(FileFormatException):
     """Indicates an error parsing an object."""
 
 
-class EmptyFileException(FileFormatException):
-    """An unexpectedly empty file was encountered."""
-
-
 class NoIndexPresent(Exception):
     """No index is present."""
 

+ 7 - 2
dulwich/objects.py

@@ -39,7 +39,7 @@ from dulwich.errors import (
     NotTagError,
     NotTreeError,
     ObjectFormatException,
-    EmptyFileException,
+    FileFormatException,
     )
 from dulwich.file import GitFile
 
@@ -70,6 +70,11 @@ MAX_TIME = 9223372036854775807  # (2**63) - 1 - signed long int max
 BEGIN_PGP_SIGNATURE = b"-----BEGIN PGP SIGNATURE-----"
 
 
+class EmptyFileException(FileFormatException):
+    """An unexpectedly empty file was encountered."""
+
+
+
 def S_ISGITLINK(m):
     """Check if a mode indicates a submodule.
 
@@ -382,7 +387,7 @@ class ShaFile(object):
     def _parse_file(cls, f):
         map = f.read()
         if not map:
-            raise EmptyFileException('Corrupted empty file %r detected' % f)
+            raise EmptyFileException('Corrupted empty file detected')
 
         if cls._is_legacy_object(map):
             obj = cls._parse_legacy_object_header(map, f)