Current Path: > > opt > alt > python37 > lib > python3.7 > site-packages > raven
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__pycache__ | Directory | - | - | |
conf | Directory | - | - | |
contrib | Directory | - | - | |
handlers | Directory | - | - | |
scripts | Directory | - | - | |
transport | Directory | - | - | |
utils | Directory | - | - | |
__init__.py | File | 1308 bytes | October 29 2017 17:41:19. | |
base.py | File | 29906 bytes | October 29 2017 17:41:19. | |
breadcrumbs.py | File | 11543 bytes | October 29 2017 17:41:19. | |
context.py | File | 3769 bytes | October 29 2017 17:41:19. | |
events.py | File | 4673 bytes | October 29 2017 17:41:19. | |
exceptions.py | File | 620 bytes | October 29 2017 17:41:19. | |
middleware.py | File | 3594 bytes | October 29 2017 17:41:19. | |
processors.py | File | 4284 bytes | October 29 2017 17:41:19. | |
versioning.py | File | 2600 bytes | October 29 2017 17:41:19. |
""" raven.context ~~~~~~~~~~~~~ :copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from collections import Mapping, Iterable from threading import local from weakref import ref as weakref from raven.utils.compat import iteritems try: from thread import get_ident as get_thread_ident except ImportError: from _thread import get_ident as get_thread_ident _active_contexts = local() def get_active_contexts(): """Returns all the active contexts for the current thread.""" try: return list(_active_contexts.contexts) except AttributeError: return [] class Context(local, Mapping, Iterable): """ Stores context until cleared. >>> def view_handler(view_func, *args, **kwargs): >>> context = Context() >>> context.merge(tags={'key': 'value'}) >>> try: >>> return view_func(*args, **kwargs) >>> finally: >>> context.clear() """ def __init__(self, client=None): breadcrumbs = raven.breadcrumbs.make_buffer( client is None or client.enable_breadcrumbs) if client is not None: client = weakref(client) self._client = client # Because the thread auto activates the thread local this also # means that we auto activate this thing. Only if someone decides # to deactivate manually later another call to activate is # technically necessary. self.activate() self.data = {} self.exceptions_to_skip = set() self.breadcrumbs = breadcrumbs @property def client(self): if self._client is None: return None return self._client() def __hash__(self): return id(self) def __eq__(self, other): return self is other def __ne__(self, other): return not self.__eq__(other) def __getitem__(self, key): return self.data[key] def __iter__(self): return iter(self.data) def __len__(self): return len(self.data) def __repr__(self): return '<%s: %s>' % (type(self).__name__, self.data) def __enter__(self): self.activate() return self def __exit__(self, exc_type, exc_value, tb): self.deactivate() def activate(self, sticky=False): if sticky: self._sticky_thread = get_thread_ident() _active_contexts.__dict__.setdefault('contexts', set()).add(self) def deactivate(self): try: _active_contexts.contexts.discard(self) except AttributeError: pass def merge(self, data, activate=True): if activate: self.activate() d = self.data for key, value in iteritems(data): if key in ('tags', 'extra'): d.setdefault(key, {}) for t_key, t_value in iteritems(value): d[key][t_key] = t_value else: d[key] = value def set(self, data): self.data = data def get(self): return self.data def clear(self, deactivate=None): self.data = {} self.exceptions_to_skip.clear() self.breadcrumbs.clear() # If the caller did not specify if it wants to deactivate the # context for the thread we only deactivate it if we're not the # thread that created the context (main thread). if deactivate is None: client = self.client if client is not None: deactivate = get_thread_ident() != client.main_thread_id if deactivate: self.deactivate() import raven.breadcrumbs
SILENT KILLER Tool