Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
compress.py41 linesDownload Raw Back to paramiko
1# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>2#3# This file is part of paramiko.4#5# Paramiko is free software; you can redistribute it and/or modify it under the6# terms of the GNU Lesser General Public License as published by the Free7# Software Foundation; either version 2.1 of the License, or (at your option)8# any later version.9#10# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY11# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR12# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more13# details.14#15# You should have received a copy of the GNU Lesser General Public License16# along with Paramiko; if not, write to the Free Software Foundation, Inc.,17# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.18 19"""20Compression implementations for a Transport.21"""22 23import zlib24 25 26class ZlibCompressor:27    def __init__(self):28        # Use the default level of zlib compression29        self.z = zlib.compressobj()30 31    def __call__(self, data):32        return self.z.compress(data) + self.z.flush(zlib.Z_FULL_FLUSH)33 34 35class ZlibDecompressor:36    def __init__(self):37        self.z = zlib.decompressobj()38 39    def __call__(self, data):40        return self.z.decompress(data)41 
codekingpro/portable-devtools · Team Ai