예제 #1
0
 def assertToGzip(self, chunks):
     bytes = ''.join(chunks)
     gzfromchunks = tuned_gzip.chunks_to_gzip(chunks)
     gzfrombytes = tuned_gzip.bytes_to_gzip(bytes)
     self.assertEqual(gzfrombytes, gzfromchunks)
     decoded = self.applyDeprecated(
         symbol_versioning.deprecated_in((2, 3, 0)),
         tuned_gzip.GzipFile, fileobj=StringIO(gzfromchunks)).read()
     self.assertEqual(bytes, decoded)
예제 #2
0
 def assertToGzip(self, chunks):
     raw_bytes = ''.join(chunks)
     gzfromchunks = tuned_gzip.chunks_to_gzip(chunks)
     gzfrombytes = tuned_gzip.bytes_to_gzip(raw_bytes)
     self.assertEqual(gzfrombytes, gzfromchunks)
     decoded = self.applyDeprecated(
         symbol_versioning.deprecated_in((2, 3, 0)),
         tuned_gzip.GzipFile, fileobj=StringIO(gzfromchunks)).read()
     lraw, ldecoded = len(raw_bytes), len(decoded)
     self.assertEqual(lraw, ldecoded,
                      'Expecting data length %d, got %d' % (lraw, ldecoded))
     self.assertEqual(raw_bytes, decoded)
예제 #3
0
파일: weaverepo.py 프로젝트: c0ns0le/cygwin
 def add_lines(self, key, parents, lines):
     """Add a revision to the store."""
     if not self._is_locked():
         raise errors.ObjectNotLocked(self)
     if not self._can_write():
         raise errors.ReadOnlyError(self)
     if '/' in key[-1]:
         raise ValueError('bad idea to put / in %r' % (key,))
     text = ''.join(lines)
     if self._compressed:
         text = bytes_to_gzip(text)
     path = self._map(key)
     self._transport.put_bytes_non_atomic(path, text, create_parent_dir=True)
예제 #4
0
 def add_lines(self, key, parents, lines):
     """Add a revision to the store."""
     if not self._is_locked():
         raise errors.ObjectNotLocked(self)
     if not self._can_write():
         raise errors.ReadOnlyError(self)
     if '/' in key[-1]:
         raise ValueError('bad idea to put / in %r' % (key, ))
     text = ''.join(lines)
     if self._compressed:
         text = bytes_to_gzip(text)
     path = self._map(key)
     self._transport.put_bytes_non_atomic(path,
                                          text,
                                          create_parent_dir=True)