2
0
Эх сурвалжийг харах

Avoid else for for loops when there is no break in the body.

Jelmer Vernooij 6 жил өмнө
parent
commit
2a818177e4

+ 3 - 6
dulwich/object_store.py

@@ -1319,22 +1319,19 @@ class OverlayObjectStore(BaseObjectStore):
                 return b.get_raw(sha_id)
             except KeyError:
                 pass
-        else:
-            raise KeyError(sha_id)
+        raise KeyError(sha_id)
 
     def contains_packed(self, sha):
         for b in self.bases:
             if b.contains_packed(sha):
                 return True
-        else:
-            return False
+        return False
 
     def contains_loose(self, sha):
         for b in self.bases:
             if b.contains_loose(sha):
                 return True
-        else:
-            return False
+        return False
 
 
 def read_packs_file(f):

+ 1 - 2
dulwich/objectspec.py

@@ -74,8 +74,7 @@ def parse_ref(container, refspec):
     for ref in possible_refs:
         if ref in container:
             return ref
-    else:
-        raise KeyError(refspec)
+    raise KeyError(refspec)
 
 
 def parse_reftuple(lh_container, rh_container, refspec):