瀏覽代碼

Fix formatting, add type check.

Jelmer Vernooij 16 年之前
父節點
當前提交
eddb45bcf0
共有 2 個文件被更改,包括 4 次插入1 次删除
  1. 2 0
      dulwich/objects.py
  2. 2 1
      dulwich/pack.py

+ 2 - 0
dulwich/objects.py

@@ -127,6 +127,8 @@ class ShaFile(object):
             self._parse_text()
 
     def set_raw_string(self, text):
+        if type(text) != str:
+            raise TypeError(text)
         self._text = text
         self._sha = None
         self._needs_parsing = True

+ 2 - 1
dulwich/pack.py

@@ -616,7 +616,8 @@ class PackData(object):
         entries = self.sorted_entries(resolve_ext_ref, progress=progress)
         write_pack_index_v2(filename, entries, self.calculate_checksum())
 
-    def create_index(self, filename, resolve_ext_ref=None, progress=None, version=2):
+    def create_index(self, filename, resolve_ext_ref=None, progress=None,
+                     version=2):
         """Create an  index file for this data file.
 
         :param filename: Index filename.