本文整理汇总了Python中sentry.utils.strings.decompress函数的典型用法代码示例。如果您正苦于以下问题:Python decompress函数的具体用法?Python decompress怎么用?Python decompress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了decompress函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: to_python
def to_python(self, value):
if isinstance(value, basestring) and value:
try:
value = pickle.loads(decompress(value))
except Exception, e:
logger.exception(e)
return {}
开发者ID:HengeSense,项目名称:sentry,代码行数:7,代码来源:gzippeddict.py
示例2: to_python
def to_python(self, value):
if isinstance(value, six.string_types) and value:
try:
value = pickle.loads(decompress(value))
except Exception as e:
logger.exception(e)
return {}
elif not value:
return {}
return value
开发者ID:ForkRepo,项目名称:sentry,代码行数:10,代码来源:gzippeddict.py
示例3: decode_and_decompress_data
def decode_and_decompress_data(encoded_data):
try:
try:
return decompress(encoded_data)
except zlib.error:
return base64.b64decode(encoded_data)
except Exception as e:
# This error should be caught as it suggests that there's a
# bug somewhere in the client's code.
logger.info(e, **client_metadata(exception=e))
raise APIForbidden("Bad data decoding request (%s, %s)" % (e.__class__.__name__, e))
开发者ID:achun2080,项目名称:sentry,代码行数:11,代码来源:coreapi.py
示例4: decode_and_decompress_data
def decode_and_decompress_data(encoded_data):
try:
try:
return decompress(encoded_data).decode("utf-8")
except zlib.error:
return base64.b64decode(encoded_data).decode("utf-8")
except Exception as e:
# This error should be caught as it suggests that there's a
# bug somewhere in the client's code.
logger.debug(six.text_type(e), exc_info=True)
raise APIError("Bad data decoding request (%s, %s)" % (type(e).__name__, e))
开发者ID:getsentry,项目名称:sentry,代码行数:11,代码来源:coreapi.py
示例5: save
def save(self, file):
filename = self.get_path(file['filename'])
contents = decompress(file['data'])
del file['data']
file['path'] = default_storage.save(filename, ContentFile(contents))
contents = None
file['size'] = default_storage.size(file['path'])
if not 'type' in file:
file['type'] = None
return file
开发者ID:duaneg,项目名称:sentry-uploads,代码行数:12,代码来源:interfaces.py
示例6: decode_and_decompress_data
def decode_and_decompress_data(self, encoded_data):
try:
try:
return decompress(encoded_data)
except zlib.error:
return base64.b64decode(encoded_data)
except Exception as e:
# This error should be caught as it suggests that there's a
# bug somewhere in the client's code.
self.log.debug(unicode(e), exc_info=True)
raise APIError('Bad data decoding request (%s, %s)' %
(type(e).__name__, e)
)
开发者ID:TonyMistark,项目名称:sentry,代码行数:13,代码来源:coreapi.py
示例7: to_python
def to_python(self, value):
if isinstance(value, six.string_types) and value:
try:
value = pickle.loads(decompress(value))
except Exception as e:
logger.exception(e)
value = {}
elif not value:
value = {}
if 'node_id' in value:
node_id = value.pop('node_id')
data = None
else:
node_id = None
data = value
return NodeData(self, node_id, data)
开发者ID:NuttasitBoonwat,项目名称:sentry,代码行数:18,代码来源:node.py
示例8: to_python
def to_python(self, value):
node_id = None
# If value is a string, we assume this is a value we've loaded from the
# database, it should be decompressed/unpickled, and we should end up
# with a dict.
if value and isinstance(value, six.string_types):
try:
value = pickle.loads(decompress(value))
except Exception as e:
# TODO this is a bit dangerous as a failure to read/decode the
# node_id will end up with this record being replaced with an
# empty value under a new key, potentially orphaning an
# original value in nodestore. OTOH if we can't decode the info
# here, the node was already effectively orphaned.
logger.exception(e)
value = None
if value:
if 'node_id' in value:
node_id = value.pop('node_id')
# If the value is now empty, that means that it only had the
# node_id in it, which means that we should be looking to *load*
# the event body from nodestore. If it does have other stuff in
# it, that means we got an event body with a precomputed id in
# it, and we want to *save* the rest of the body to nodestore.
if value == {}:
value = None
else:
# Either we were passed a null/empty value in the constructor, or
# we failed to decode the value from the database so we have no id
# to load data from, and no data to save.
value = None
if value is not None and self.wrapper is not None:
value = self.wrapper(value)
return NodeData(self, node_id, value)
开发者ID:getsentry,项目名称:sentry,代码行数:37,代码来源:node.py
示例9: import
import warnings
from django.utils.text import slugify
from exam import fixture
from uuid import uuid4
from sentry.models import (
Activity, Event, Group, Organization, OrganizationMember,
OrganizationMemberTeam, Project, Team, User
)
from sentry.utils.compat import pickle
from sentry.utils.strings import decompress
# an example data blog from Sentry 5.4.1 (db level)
LEGACY_DATA = pickle.loads(decompress("""eJy9WW1v20YS/q5fwfqLpECluMvXFSzjgKK9BrikByR3XwyDXpFLmjVFsnxxbAT57zczS0rUS+LGrU8IYu3s2+yzM8/MrGZxxSYfpo0q2vrJzIpW1YmMVGO+U00jUzWdVHwyiysbBm13IgdaH++yxoB/0mhV0xp9p5GqQtWyVbHRNVmRGre3tXxQBQ26vYW57qT5MK1kLbcNtLzJLK/8SQOyVqYoCVAicJB6bGsJEmahBoz0fGpMWacPKOU4kKFiy/80qm6WcQSLqnppPmR128lcFQ/NUp9sucmKJSmCM52JhO1AIWy42Lhr26pZLZdqE9luYtuKucyxWCJiJSPXEcIPNrFkbJXYjmUnAVOMKyfijnB47FpuYgXehkcy/oesKjNVbQ9oVG6XDHfxJhJOlJcylg8pCnzSPpj8YpnC9yzf4SzwQRdoB4FtW5YfMN63bVsEjo29sEYHZ8UFBBy8PzFekkUYbsu4yxXCyBmCxjmMGs7NESvbZCazseXQjNOb/xWwwH6XFvBgTlSW95le1SdhgNfT1TlKUA+ED9F7lNsqV3hq6LEtHHWnZAyXg23SyOZ0tQVeoW2TxEHJH52qn8KmrcFosMuFZafYEcsWjcD2aKyPoq1q78oYhQGM+ufPH/Gr+MpxPrQyugdDishwyZQcNKUEoUO9HDIkh3Rx0LKTrojarETIHFRj02V5HG4b1MvxUAG5acJKtnco8P+cAebZZlk9gd4FN/1lk7XqxwoUA5dptGEuN7JRZvWEaxK+Va3CqISDPKKdOgK1dC2CBSzWGH0QIrOr4I+afUYXYzDiwjj6fBublfH5AmbyczNpdo/XCjy8hXuCiWFWJOVMyxc42T5WbPzJs6YNt/IxBFjS9m7dqDwxj4QLVN4hM3+QZDQuWaGLVlh1mzyLwnuFELn+5D3aEQDXhu1ThZfrBoOxmyQfk5hLjBJ1eVVnCKdn7cY2UZ1VMLjuioJ8yWOTPR15fLR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nVH10GSPar7Arg9Xr/ywmjV8Rz6HJ6Txx+QDi5gN07mXK4p4h+OGd6Y30RJOGEan8ZKLD1kLiMeoEDh+td8GCgu3O7A4S4t3c0zoeYPKeu4FtecHyA2REYmP6VRVPC/fUejiK973yGeQnnu7IJvsimMf8Hr5plBQ=="""))
class Fixtures(object):
@fixture
def projectkey(self):
return self.create_project_key(project=self.project)
@fixture
def user(self):
return self.create_user('[email protected]', is_superuser=True)
@fixture
def organization(self):
# XXX(dcramer): ensure that your org slug doesnt match your team slug
# and the same for your project slug
开发者ID:AyrtonRicardo,项目名称:sentry,代码行数:31,代码来源:fixtures.py
注:本文中的sentry.utils.strings.decompress函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论