/usr/share/pyshared/celery/db/dfd042c7.py is in python-celery 2.5.3-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # -*- coding: utf-8 -*-
"""
dfd042c7
SQLAlchemy 0.5.8 version of a805d4bd, see the docstring of that module
for an explanation of this workaround.
"""
from __future__ import absolute_import
from sqlalchemy.types import PickleType as _PickleType
from sqlalchemy import util
class PickleType(_PickleType):
def process_bind_param(self, value, dialect):
dumps = self.pickler.dumps
protocol = self.protocol
if value is not None:
return dumps(value, protocol)
def process_result_value(self, value, dialect):
loads = self.pickler.loads
if value is not None:
return loads(str(value))
def copy_value(self, value):
if self.mutable:
return self.pickler.loads(self.pickler.dumps(value, self.protocol))
else:
return value
def compare_values(self, x, y):
if self.comparator:
return self.comparator(x, y)
elif self.mutable and not hasattr(x, '__eq__') and x is not None:
util.warn_deprecated(
"Objects stored with PickleType when mutable=True "
"must implement __eq__() for reliable comparison.")
a = self.pickler.dumps(x, self.protocol)
b = self.pickler.dumps(y, self.protocol)
return a == b
else:
return x == y
def is_mutable(self):
return self.mutable
|