From 34d6c54a1757fcd26612dc040df5f70fd7933198 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 16 Aug 2023 10:39:01 -0400 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#669) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.0) - [github.com/asottile/pyupgrade: v2.37.3 → v3.10.1](https://github.com/asottile/pyupgrade/compare/v2.37.3...v3.10.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: jscarlett --- .pre-commit-config.yaml | 4 ++-- push_notifications/api/rest_framework.py | 6 +++--- push_notifications/conf/app.py | 2 +- push_notifications/fields.py | 4 ++-- push_notifications/migrations/0001_initial.py | 1 - push_notifications/migrations/0002_auto_20160106_0850.py | 1 - push_notifications/migrations/0003_wnsdevice.py | 1 - push_notifications/migrations/0004_fcm.py | 1 - push_notifications/migrations/0005_applicationid.py | 1 - push_notifications/migrations/0006_webpushdevice.py | 1 - tests/test_models.py | 4 ++-- tests/test_rest_framework.py | 4 ++-- 12 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 112681a3..459e6fe4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/push_notifications/api/rest_framework.py b/push_notifications/api/rest_framework.py index 6efff4ae..676c9022 100644 --- a/push_notifications/api/rest_framework.py +++ b/push_notifications/api/rest_framework.py @@ -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 @@ -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: diff --git a/push_notifications/conf/app.py b/push_notifications/conf/app.py index 6f0f027f..224e1f20 100644 --- a/push_notifications/conf/app.py +++ b/push_notifications/conf/app.py @@ -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: diff --git a/push_notifications/fields.py b/push_notifications/fields.py index 0b42d182..ef1425d0 100644 --- a/push_notifications/fields.py +++ b/push_notifications/fields.py @@ -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 @@ -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 """ diff --git a/push_notifications/migrations/0001_initial.py b/push_notifications/migrations/0001_initial.py index 14033f16..eca6aefd 100644 --- a/push_notifications/migrations/0001_initial.py +++ b/push_notifications/migrations/0001_initial.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from django.conf import settings from django.db import migrations, models diff --git a/push_notifications/migrations/0002_auto_20160106_0850.py b/push_notifications/migrations/0002_auto_20160106_0850.py index 37bb9f8f..8c0373dd 100644 --- a/push_notifications/migrations/0002_auto_20160106_0850.py +++ b/push_notifications/migrations/0002_auto_20160106_0850.py @@ -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 diff --git a/push_notifications/migrations/0003_wnsdevice.py b/push_notifications/migrations/0003_wnsdevice.py index 6c6b5c3a..2ac1dad9 100644 --- a/push_notifications/migrations/0003_wnsdevice.py +++ b/push_notifications/migrations/0003_wnsdevice.py @@ -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 diff --git a/push_notifications/migrations/0004_fcm.py b/push_notifications/migrations/0004_fcm.py index be35f4c4..c08c28c1 100644 --- a/push_notifications/migrations/0004_fcm.py +++ b/push_notifications/migrations/0004_fcm.py @@ -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 diff --git a/push_notifications/migrations/0005_applicationid.py b/push_notifications/migrations/0005_applicationid.py index 79b5919e..443c173d 100644 --- a/push_notifications/migrations/0005_applicationid.py +++ b/push_notifications/migrations/0005_applicationid.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from django.conf import settings from django.db import migrations, models diff --git a/push_notifications/migrations/0006_webpushdevice.py b/push_notifications/migrations/0006_webpushdevice.py index c63c2490..524cf6bc 100644 --- a/push_notifications/migrations/0006_webpushdevice.py +++ b/push_notifications/migrations/0006_webpushdevice.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from django.conf import settings from django.db import migrations, models diff --git a/tests/test_models.py b/tests/test_models.py index 89285310..b28d5725 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -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): @@ -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 ) diff --git a/tests/test_rest_framework.py b/tests/test_rest_framework.py index 5844ea8b..b1b46a2f 100644 --- a/tests/test_rest_framework.py +++ b/tests/test_rest_framework.py @@ -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):