Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #669

Merged
merged 3 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
rev: v3.10.1
hooks:
- id: pyupgrade
6 changes: 3 additions & 3 deletions push_notifications/api/rest_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def to_internal_value(self, data):
data = int(data, 16) if type(data) != int else data
except ValueError:
raise ValidationError("Device ID is not a valid hex number")
return super(HexIntegerField, self).to_internal_value(data)
return super().to_internal_value(data)

def to_representation(self, value):
return value
Expand Down Expand Up @@ -160,12 +160,12 @@ def create(self, request, *args, **kwargs):
def perform_create(self, serializer):
if self.request.user.is_authenticated:
serializer.save(user=self.request.user)
return super(DeviceViewSetMixin, self).perform_create(serializer)
return super().perform_create(serializer)

def perform_update(self, serializer):
if self.request.user.is_authenticated:
serializer.save(user=self.request.user)
return super(DeviceViewSetMixin, self).perform_update(serializer)
return super().perform_update(serializer)


class AuthorizedMixin:
Expand Down
2 changes: 1 addition & 1 deletion push_notifications/conf/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _validate_apns_certificate(self, certfile):
"""Validate the APNS certificate at startup."""

try:
with open(certfile, "r") as f:
with open(certfile) as f:
content = f.read()
check_apns_certificate(content)
except Exception as e:
Expand Down
4 changes: 2 additions & 2 deletions push_notifications/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self, *args, **kwargs):
self.default_validators = [
RegexValidator(hex_re, _("Enter a valid hexadecimal number"), "invalid")
]
super(HexadecimalField, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

def prepare_value(self, value):
# converts bigint from db to hex before it is displayed in admin
Expand Down Expand Up @@ -82,7 +82,7 @@ def db_type(self, connection):
elif "sqlite" == connection.vendor:
return "UNSIGNED BIG INT"
else:
return super(HexIntegerField, self).db_type(connection=connection)
return super().db_type(connection=connection)

def get_prep_value(self, value):
""" Return the integer value to be stored from the hex string """
Expand Down
1 change: 0 additions & 1 deletion push_notifications/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations, models

Expand Down
1 change: 0 additions & 1 deletion push_notifications/migrations/0002_auto_20160106_0850.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-06 08:50
from django.db import migrations, models

Expand Down
1 change: 0 additions & 1 deletion push_notifications/migrations/0003_wnsdevice.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-13 20:46
import django.db.models.deletion
from django.conf import settings
Expand Down
1 change: 0 additions & 1 deletion push_notifications/migrations/0004_fcm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-13 20:46
from django.conf import settings
from django.db import migrations, models
Expand Down
1 change: 0 additions & 1 deletion push_notifications/migrations/0005_applicationid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations, models

Expand Down
1 change: 0 additions & 1 deletion push_notifications/migrations/0006_webpushdevice.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations, models

Expand Down
4 changes: 2 additions & 2 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def test_gcm_send_message_with_no_reg_ids(self):
reg_ids = [obj.registration_id for obj in GCMDevice.objects.all()]
send_bulk_message(reg_ids, {"message": "Hello World"}, "GCM")
p.assert_called_once_with(
[u"abc", u"abc1"], {"message": "Hello World"}, cloud_type="GCM", application_id=None
["abc", "abc1"], {"message": "Hello World"}, cloud_type="GCM", application_id=None
)

def test_fcm_send_message(self):
Expand Down Expand Up @@ -506,7 +506,7 @@ def test_fcm_send_message_with_no_reg_ids(self):
reg_ids = [obj.registration_id for obj in GCMDevice.objects.all()]
send_bulk_message(reg_ids, {"message": "Hello World"}, "FCM")
p.assert_called_once_with(
[u"abc", u"abc1"], {"message": "Hello World"}, cloud_type="FCM",
["abc", "abc1"], {"message": "Hello World"}, cloud_type="FCM",
application_id=None
)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_rest_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
)


GCM_DRF_INVALID_HEX_ERROR = {"device_id": [u"Device ID is not a valid hex number"]}
GCM_DRF_OUT_OF_RANGE_ERROR = {"device_id": [u"Device ID is out of range"]}
GCM_DRF_INVALID_HEX_ERROR = {"device_id": ["Device ID is not a valid hex number"]}
GCM_DRF_OUT_OF_RANGE_ERROR = {"device_id": ["Device ID is out of range"]}


class APNSDeviceSerializerTestCase(TestCase):
Expand Down
Loading