<commit_before>from django.conf import settings
import urbanairship
from .models import AirshipToken
from .resources import AirshipTokenResource, NotificationSettingResource


# Registers this library's resources
def register_api(api):
    api.register(AirshipTokenResource())
    api.register(NotificationSettingResource())


def send_push_notification(receiver, message):
    if AirshipToken.objects.filter(user=receiver, expired=False).exists():
        try:
            device_tokens = list(AirshipToken.objects.filter(user=receiver, expired=False).values_list('token', flat=True))
            airship = urbanairship.Airship(settings.AIRSHIP_APP_KEY, settings.AIRSHIP_APP_MASTER_SECRET)

            for device_token in device_tokens:
                push = airship.create_push()
                push.audience = urbanairship.device_token(device_token)
                push.notification = urbanairship.notification(ios=urbanairship.ios(alert=message, badge='+1'))
                push.device_types = urbanairship.device_types('ios')
                push.send()
        except urbanairship.AirshipFailure:
            pass<commit_msg>fixing register_api return<commit_after>from django.conf import settings
import urbanairship
from .models import AirshipToken
from .resources import AirshipTokenResource, NotificationSettingResource


# Registers this library's resources
def register_api(api):
    api.register(AirshipTokenResource())
    api.register(NotificationSettingResource())
    return api


def send_push_notification(receiver, message):
    if AirshipToken.objects.filter(user=receiver, expired=False).exists():
        try:
            device_tokens = list(AirshipToken.objects.filter(user=receiver, expired=False).values_list('token', flat=True))
            airship = urbanairship.Airship(settings.AIRSHIP_APP_KEY, settings.AIRSHIP_APP_MASTER_SECRET)

            for device_token in device_tokens:
                push = airship.create_push()
                push.audience = urbanairship.device_token(device_token)
                push.notification = urbanairship.notification(ios=urbanairship.ios(alert=message, badge='+1'))
                push.device_types = urbanairship.device_types('ios')
                push.send()
        except urbanairship.AirshipFailure:
            pass
{'fraction_non_alphanumeric': 0.08608695652173913, 'fraction_numerical': 0.0008695652173913044, 'mean_word_length': 3.6112224448897794, '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': '4656196', 'n_tokens_mistral': 638, 'n_tokens_neox': 609, 'n_words': 111}