<s> from __future__ import absolute_import , division , print_function <EOL> import os <EOL> import socket <EOL> import threading <EOL> from distutils . sysconfig import get_python_lib <EOL> from bugsnag . middleware import DefaultMiddleware , MiddlewareStack <EOL> from bugsnag . utils import fully_qualified_class_name <EOL> threadlocal = threading . local ( ) <EOL> class _BaseConfiguration ( object ) : <EOL> def get ( self , name , overrides = None ) : <EOL> """<STR_LIT>""" <EOL> if overrides : <EOL> return overrides . get ( name , getattr ( self , name ) ) <EOL> else : <EOL> return getattr ( self , name ) <EOL> def configure ( self , ** options ) : <EOL> """<STR_LIT>""" <EOL> for name , value in options . items ( ) : <EOL> setattr ( self , name , value ) <EOL> return self <EOL> class Configuration ( _BaseConfiguration ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> self . api_key = os . environ . get ( '<STR_LIT>' , None ) <EOL> self . release_stage = os . environ . get ( "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> self . notify_release_stages = None <EOL> self . auto_notify = True <EOL> self . send_code = True <EOL> self . asynchronous = True <EOL> self . use_ssl = True <EOL> self . lib_root = get_python_lib ( ) <EOL> self . project_root = os . getcwd ( ) <EOL> self . app_version = None <EOL> self . params_filters = [ "<STR_LIT:password>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" ] <EOL> self . ignore_classes = [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> self . endpoint = "<STR_LIT>" <EOL> self . traceback_exclude_modules = [ ] <EOL> self . middleware = MiddlewareStack ( ) <EOL> self . middleware . append ( DefaultMiddleware ) <EOL> self . proxy_host = None <EOL> if not os . getenv ( "<STR_LIT>" ) : <EOL> self . hostname = socket . gethostname ( ) <EOL> else : <EOL> self . hostname = None <EOL> def should_notify ( self ) : <EOL> return self . notify_release_stages is None or self . release_stage in self . notify_release_stages <EOL> def should_ignore ( self , exception ) : <EOL> return self . ignore_classes is not None and fully_qualified_class_name ( exception ) in self . ignore_classes <EOL> def get_endpoint ( self ) : <EOL> proto = "<STR_LIT>" if self . use_ssl else "<STR_LIT:http>" <EOL> return "<STR_LIT>" % ( proto , self . endpoint ) <EOL> class RequestConfiguration ( _BaseConfiguration ) : <EOL> """<STR_LIT>""" <EOL> @ classmethod <EOL> def get_instance ( cls ) : <EOL> """<STR_LIT>""" <EOL> instance = getattr ( threadlocal , "<STR_LIT>" , None ) <EOL> if not instance : <EOL> instance = RequestConfiguration ( ) <EOL> setattr ( threadlocal , "<STR_LIT>" , instance ) <EOL> return instance <EOL> @ classmethod <EOL> def clear ( cls ) : <EOL> """<STR_LIT>""" <EOL> if hasattr ( threadlocal , "<STR_LIT>" ) : <EOL> delattr ( threadlocal , "<STR_LIT>" ) <EOL> def __init__ ( self ) : <EOL> self . context = None <EOL> self . grouping_hash = None <EOL> self . user = { } <EOL> self . meta_data = { } <EOL> self . user_id = None <EOL> self . extra_data = { } <EOL> self . request_data = { } <EOL> self . environment_data = { } <EOL> self . session_data = { } </s>
