<commit_before>from django.db import models
from django.forms.models import model_to_dict
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.contenttypes.models import ContentType

from notifications.conf import settings

# Support for python2.7 and 3.4
basestring = (str, basestring)


def load_media_defaults():
    media = []
    defaults = {}
    for key, backend in settings.NOTIFICATIONS_BACKENDS.items():
        # key is a tuple (medium_id, backend_label)
        media.append(key)
        defaults[key[0]] = backend.spam_sensitivity
    return media, defaults
<commit_msg>Python3.4 compat fix<commit_after>from django.db import models
from django.forms.models import model_to_dict
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.contenttypes.models import ContentType

from notifications.conf import settings

# Support for python2.7 and 3.4
basestring = (str, bytes, unicode)


def load_media_defaults():
    media = []
    defaults = {}
    for key, backend in settings.NOTIFICATIONS_BACKENDS.items():
        # key is a tuple (medium_id, backend_label)
        media.append(key)
        defaults[key[0]] = backend.spam_sensitivity
    return media, defaults

{'fraction_non_alphanumeric': 0.07768469154607768, 'fraction_numerical': 0.00913937547600914, 'mean_word_length': 4.27710843373494, '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': '1269465', 'n_tokens_mistral': 388, 'n_tokens_neox': 377, 'n_words': 109}