# Path: lazysignup/constants.py
# USER_AGENT_BLACKLIST = []
# 
# Path: lazysignup/utils.py
# def is_lazy_user(user):
#     """ Return True if the passed user is a lazy user. """
#     # Anonymous users are not lazy.
# 
#     if user.is_anonymous:
#         return False
# 
#     # Check the user backend. If the lazy signup backend
#     # authenticated them, then the user is lazy.
#     backend = getattr(user, 'backend', None)
#     if backend == 'lazysignup.backends.LazySignupBackend':
#         return True
# 
#     # Otherwise, we have to fall back to checking the database.
#     from lazysignup.models import LazyUser
#     return bool(LazyUser.objects.filter(user=user).count() > 0)


from functools import wraps
from django.conf import settings
from django.contrib.auth import SESSION_KEY
from django.contrib.auth import authenticate
from django.contrib.auth import get_user
from django.contrib.auth import login
from django.shortcuts import redirect
from functools import WRAPPER_ASSIGNMENTS
from lazysignup.constants import USER_AGENT_BLACKLIST
from lazysignup.utils import is_lazy_user
                from lazysignup.models import LazyUser
                user = authenticate(username=username)
                assert user, ("Lazy user creation and authentication "
                              "failed. Have you got "
                              "lazysignup.backends.LazySignupBackend in "
                              "AUTHENTICATION_BACKENDS?")
                # Set the user id in the session here to prevent the login
                # call cycling the session key.
                request.session[SESSION_KEY] = user.id
                login(request, user)
        return func(request, *args, **kwargs)

    return wraps(func)(wrapped)


def require_lazy_user(*redirect_args, **redirect_kwargs):
    def decorator(func):
        @wraps(func, assigned=WRAPPER_ASSIGNMENTS)
        def inner(request, *args, **kwargs):
            if is_lazy_user(request.user):
                return func(request, *args, **kwargs)
            else:
                return redirect(*redirect_args, **redirect_kwargs)
        return inner
    return decorator


def require_nonlazy_user(*redirect_args, **redirect_kwargs):
    def decorator(func):
        @wraps(func, assigned=WRAPPER_ASSIGNMENTS)
        def inner(request, *args, **kwargs):

# Path: lazysignup/constants.py
# USER_AGENT_BLACKLIST = []
# 
# Path: lazysignup/utils.py
# def is_lazy_user(user):
#     """ Return True if the passed user is a lazy user. """
#     # Anonymous users are not lazy.
# 
#     if user.is_anonymous:
#         return False
# 
#     # Check the user backend. If the lazy signup backend
#     # authenticated them, then the user is lazy.
#     backend = getattr(user, 'backend', None)
#     if backend == 'lazysignup.backends.LazySignupBackend':
#         return True
# 
#     # Otherwise, we have to fall back to checking the database.
#     from lazysignup.models import LazyUser
#     return bool(LazyUser.objects.filter(user=user).count() > 0)


# Path: lazysignup/decorators.py
from functools import wraps
from django.conf import settings
from django.contrib.auth import SESSION_KEY
from django.contrib.auth import authenticate
from django.contrib.auth import get_user
from django.contrib.auth import login
from django.shortcuts import redirect
from functools import WRAPPER_ASSIGNMENTS
from lazysignup.constants import USER_AGENT_BLACKLIST
from lazysignup.utils import is_lazy_user
                from lazysignup.models import LazyUser

                user = authenticate(username=username)
                assert user, ("Lazy user creation and authentication "
                              "failed. Have you got "
                              "lazysignup.backends.LazySignupBackend in "
                              "AUTHENTICATION_BACKENDS?")
                # Set the user id in the session here to prevent the login
                # call cycling the session key.
                request.session[SESSION_KEY] = user.id
                login(request, user)
        return func(request, *args, **kwargs)

    return wraps(func)(wrapped)


def require_lazy_user(*redirect_args, **redirect_kwargs):
    def decorator(func):
        @wraps(func, assigned=WRAPPER_ASSIGNMENTS)
        def inner(request, *args, **kwargs):
            if is_lazy_user(request.user):
                return func(request, *args, **kwargs)
            else:
                return redirect(*redirect_args, **redirect_kwargs)
        return inner
    return decorator


def require_nonlazy_user(*redirect_args, **redirect_kwargs):
    def decorator(func):
        @wraps(func, assigned=WRAPPER_ASSIGNMENTS)
        def inner(request, *args, **kwargs):

            if not is_lazy_user(request.user):