<commit_before>from django.conf import settings

from social_auth.models import UserSocialAuth
from firebase_token_generator import create_token


class RdioTokens(object):

    def __init__(self, rdio_oauth2):
        rdio_user_key = rdio_oauth2.extra_data['rdio_id']
        custom_data = {
            'rdio_user_key': rdio_user_key,
        }
        options = {
            'admin': True,
            'debug': True,
        }
        firebase_token = create_token(settings.FIREBASE_TOKEN, custom_data, options)

        extra_data = rdio_oauth2.extra_data
        self.username = extra_data['rdio_username']
        self.stream_region = extra_data['rdio_stream_region']
        self.id = extra_data['rdio_id']
        self.icon_url = extra_data['rdio_icon_url']
        self.profile_url = 'http://rdio.com%s' % extra_data['rdio_profile_url']
        self.access_token = extra_data['access_token']
        self.refresh_token = extra_data['refresh_token']
        self.client_id = settings.RDIO_OAUTH2_KEY
        self.firebase_token = firebase_token


def rdio(request):
    if request.user.is_authenticated():
        try:
            rdio_auth = request.user.social_auth.filter(provider='rdio-oauth2').get()
            rdio = RdioTokens(rdio_auth)<commit_msg>Map Firebase debug to Django DEBUG<commit_after>from django.conf import settings

from social_auth.models import UserSocialAuth
from firebase_token_generator import create_token


class RdioTokens(object):

    def __init__(self, rdio_oauth2):
        rdio_user_key = rdio_oauth2.extra_data['rdio_id']
        custom_data = {
            'rdio_user_key': rdio_user_key,
        }
        options = {
            'admin': True,
            'debug': settings.DEBUG,
        }
        firebase_token = create_token(settings.FIREBASE_TOKEN, custom_data, options)

        extra_data = rdio_oauth2.extra_data
        self.username = extra_data['rdio_username']
        self.stream_region = extra_data['rdio_stream_region']
        self.id = extra_data['rdio_id']
        self.icon_url = extra_data['rdio_icon_url']
        self.profile_url = 'http://rdio.com%s' % extra_data['rdio_profile_url']
        self.access_token = extra_data['access_token']
        self.refresh_token = extra_data['refresh_token']
        self.client_id = settings.RDIO_OAUTH2_KEY
        self.firebase_token = firebase_token


def rdio(request):
    if request.user.is_authenticated():
        try:
            rdio_auth = request.user.social_auth.filter(provider='rdio-oauth2').get()
            rdio = RdioTokens(rdio_auth)
{'fraction_non_alphanumeric': 0.09715177526336324, 'fraction_numerical': 0.0039016777214202106, 'mean_word_length': 3.0, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4598535', 'n_tokens_mistral': 850, 'n_tokens_neox': 823, 'n_words': 126}