From 68ae7b04f2e1e000bf061262540e077e0a965ddd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 22:59:17 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 23.11.0 → 24.10.0](https://github.com/psf/black/compare/23.11.0...24.10.0) - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v5.0.0) - [github.com/pycqa/isort: 5.12.0 → 5.13.2](https://github.com/pycqa/isort/compare/5.12.0...5.13.2) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e2b4a2d..92cd5d3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,12 @@ exclude: .+/migrations/.+\.py repos: - repo: https://github.com/psf/black - rev: 23.11.0 + rev: 24.10.0 hooks: - id: black - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-yaml - id: trailing-whitespace @@ -15,7 +15,7 @@ repos: - id: requirements-txt-fixer - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort args: [ "--profile", "black" ] From 832ae815da36d1c802d34abb641e244616636eef Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 22:59:32 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- HisabKitab/settings.py | 1 + HisabKitab/test_settings.py | 1 + HisabKitab/urls.py | 1 + HisabKitab/wsgi.py | 1 + users/tests/test_managers.py | 1 + users/tests/test_utils.py | 1 + users/utils.py | 12 ++++++------ 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/HisabKitab/settings.py b/HisabKitab/settings.py index 71fd1d4..434ed98 100644 --- a/HisabKitab/settings.py +++ b/HisabKitab/settings.py @@ -9,6 +9,7 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ + import os from .custom_settings import * diff --git a/HisabKitab/test_settings.py b/HisabKitab/test_settings.py index 19dfe28..f224ea1 100644 --- a/HisabKitab/test_settings.py +++ b/HisabKitab/test_settings.py @@ -1,6 +1,7 @@ """ With these settings, tests run faster. """ + import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) diff --git a/HisabKitab/urls.py b/HisabKitab/urls.py index 4f56f8f..e40814a 100644 --- a/HisabKitab/urls.py +++ b/HisabKitab/urls.py @@ -13,6 +13,7 @@ 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: path(r'^blog/', include('blog.urls')) """ + from django.contrib import admin from django.contrib.auth.views import LoginView from django.urls import include, path, re_path diff --git a/HisabKitab/wsgi.py b/HisabKitab/wsgi.py index da9374d..956e4ef 100644 --- a/HisabKitab/wsgi.py +++ b/HisabKitab/wsgi.py @@ -6,6 +6,7 @@ For more information on this file, see https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ """ + import os from django.core.wsgi import get_wsgi_application diff --git a/users/tests/test_managers.py b/users/tests/test_managers.py index 6e3cf1a..e455a0f 100644 --- a/users/tests/test_managers.py +++ b/users/tests/test_managers.py @@ -1,4 +1,5 @@ """Tests for drf_user/managers.py module""" + from django.contrib.auth import get_user_model from django.test import TestCase from faker import Faker diff --git a/users/tests/test_utils.py b/users/tests/test_utils.py index 2861ad4..4d9b337 100644 --- a/users/tests/test_utils.py +++ b/users/tests/test_utils.py @@ -1,4 +1,5 @@ """Tests for drf_user/utils.py module""" + import datetime from unittest.mock import ANY, MagicMock, patch diff --git a/users/utils.py b/users/utils.py index d1ae9da..393ae3d 100644 --- a/users/utils.py +++ b/users/utils.py @@ -170,9 +170,9 @@ def validate_otp(value, otp): data["OTP"] = "Attempt exceeded! OTP has been reset!" else: otp_object.save() - data[ - "OTP" - ] = f"OTP Validation failed! {otp_object.validate_attempt} attempts left!" + data["OTP"] = ( + f"OTP Validation failed! {otp_object.validate_attempt} attempts left!" + ) status_code = status.HTTP_401_UNAUTHORIZED except OTPValidation.DoesNotExist: # If OTP object doesn't exist set proper message and status_code @@ -205,9 +205,9 @@ def send_otp(prop: str, value: str, otpobj: OTPValidation, recip: str) -> dict: rdata = {"success": False, "message": None} if otpobj.reactive_at > datetime.datetime.now(): - rdata[ - "message" - ] = f"OTP sending not allowed until: {otpobj.reactive_at.strftime('%d-%h-%Y %H:%M:%S')}" + rdata["message"] = ( + f"OTP sending not allowed until: {otpobj.reactive_at.strftime('%d-%h-%Y %H:%M:%S')}" + ) return rdata message = (