[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.227.79.208: ~ $
try:
    import bz2
except ImportError:
    bz2 = None
try:
    import zlib
except ImportError:
    zlib = None
try:
    import cPickle as pickle
except ImportError:
    import pickle

from peewee import BlobField
from peewee import buffer_type


class CompressedField(BlobField):
    ZLIB = 'zlib'
    BZ2 = 'bz2'
    algorithm_to_import = {
        ZLIB: zlib,
        BZ2: bz2,
    }

    def __init__(self, compression_level=6, algorithm=ZLIB, *args,
                 **kwargs):
        self.compression_level = compression_level
        if algorithm not in self.algorithm_to_import:
            raise ValueError('Unrecognized algorithm %s' % algorithm)
        compress_module = self.algorithm_to_import[algorithm]
        if compress_module is None:
            raise ValueError('Missing library required for %s.' % algorithm)

        self.algorithm = algorithm
        self.compress = compress_module.compress
        self.decompress = compress_module.decompress
        super(CompressedField, self).__init__(*args, **kwargs)

    def python_value(self, value):
        if value is not None:
            return self.decompress(value)

    def db_value(self, value):
        if value is not None:
            return self._constructor(
                self.compress(value, self.compression_level))


class PickleField(BlobField):
    def python_value(self, value):
        if value is not None:
            if isinstance(value, buffer_type):
                value = bytes(value)
            return pickle.loads(value)

    def db_value(self, value):
        if value is not None:
            pickled = pickle.dumps(value, pickle.HIGHEST_PROTOCOL)
            return self._constructor(pickled)

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 0 B 0644
apsw_ext.py File 4.82 KB 0644
cockroachdb.py File 9 KB 0644
dataset.py File 14.09 KB 0644
db_url.py File 4.15 KB 0644
fields.py File 1.66 KB 0644
flask_utils.py File 8 KB 0644
hybrid.py File 1.49 KB 0644
kv.py File 5.48 KB 0644
migrate.py File 30.11 KB 0644
mysql_ext.py File 3.17 KB 0644
pool.py File 11.21 KB 0644
postgres_ext.py File 14.41 KB 0644
psycopg3_ext.py File 1.15 KB 0644
reflection.py File 30.2 KB 0644
shortcuts.py File 11.25 KB 0644
signals.py File 2.46 KB 0644
sqlcipher_ext.py File 3.55 KB 0644
sqlite_changelog.py File 4.68 KB 0644
sqlite_ext.py File 45.65 KB 0644
sqlite_udf.py File 13.34 KB 0644
sqliteq.py File 9.75 KB 0644
test_utils.py File 1.81 KB 0644