소스 검색

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.