# Path: shrubbery/authentication/exceptions.py
# class AuthenticationError(Exception): pass
# 
# class Http403(Exception): pass
# 
# Path: shrubbery/conf/base.py
# class Setting(object):
# class Registry(object):
# class SettingsBase(type):
# class Settings(object):
#     def __init__(self, validators=None, legacy_setting=None, help=None, resolve_callable=False, **kwargs):
#     def normalize(self, value):
#     def __get__(self, instance, cls=None):
#     def __set__(self, instance, value):
#     def __delete__(self, instance):
#     def __init__(self):
#     def __getitem__(self, module_name):
#     def __getattr__(self, name):
#     def __new__(cls, name, bases, attribs):     
#     def instance(cls):
#     def configure(cls, config):
#     def __init__(self, config=None):
#     def __iter__(self):
#     def __getitem__(self, name):
#     def __setitem__(self, name, value):
#     def __delitem__(self, name):
#     def as_dict(self):
#     def load(self, config):
#     def validate(self):
#     def app_module(self):
#     def app_label(self):
#     def missing_setting(self, setting):


import threading
from functools import wraps
from django.utils.importlib import import_module
from shrubbery.authentication.exceptions import AuthenticationError, Http403
from shrubbery.conf import settings
        elif self.session_key in request.session:
            del request.session[self.session_key]
        
    def get_user(self, request):
        if self.session_key in request.session:
            try:
                return self.get_user_by_id(request.session[self.session_key])
            except (AuthenticationError, ValueError) as e:
                pass
        return self.anonymous
        
    def _set_user(self, user):
        self.stack.user = user
        
    def _get_user(self):
        if callable(self.stack.user):
            self.stack.user = self.stack.user()
        return self.stack.user
        
    def _del_user(self):
        self.stack.user = self.anonymous
        
    user = property(_get_user, _set_user, _del_user)
        
    def required(self, func=None):
        if not func:
            return self.required
        @wraps(func)
        def _decorated(*args, **kwargs):
            if self.is_anonymous(self.user):

# Path: shrubbery/authentication/exceptions.py
# class AuthenticationError(Exception): pass
# 
# class Http403(Exception): pass
# 
# Path: shrubbery/conf/base.py
# class Setting(object):
# class Registry(object):
# class SettingsBase(type):
# class Settings(object):
#     def __init__(self, validators=None, legacy_setting=None, help=None, resolve_callable=False, **kwargs):
#     def normalize(self, value):
#     def __get__(self, instance, cls=None):
#     def __set__(self, instance, value):
#     def __delete__(self, instance):
#     def __init__(self):
#     def __getitem__(self, module_name):
#     def __getattr__(self, name):
#     def __new__(cls, name, bases, attribs):     
#     def instance(cls):
#     def configure(cls, config):
#     def __init__(self, config=None):
#     def __iter__(self):
#     def __getitem__(self, name):
#     def __setitem__(self, name, value):
#     def __delitem__(self, name):
#     def as_dict(self):
#     def load(self, config):
#     def validate(self):
#     def app_module(self):
#     def app_label(self):
#     def missing_setting(self, setting):


# Path: shrubbery/authentication/contexts.py
import threading
from functools import wraps
from django.utils.importlib import import_module
from shrubbery.authentication.exceptions import AuthenticationError, Http403
from shrubbery.conf import settings

        elif self.session_key in request.session:
            del request.session[self.session_key]
        
    def get_user(self, request):
        if self.session_key in request.session:
            try:
                return self.get_user_by_id(request.session[self.session_key])
            except (AuthenticationError, ValueError) as e:
                pass
        return self.anonymous
        
    def _set_user(self, user):
        self.stack.user = user
        
    def _get_user(self):
        if callable(self.stack.user):
            self.stack.user = self.stack.user()
        return self.stack.user
        
    def _del_user(self):
        self.stack.user = self.anonymous
        
    user = property(_get_user, _set_user, _del_user)
        
    def required(self, func=None):
        if not func:
            return self.required
        @wraps(func)
        def _decorated(*args, **kwargs):
            if self.is_anonymous(self.user):

                raise Http403()