From faf53af8f35590111f72202122a1310c604d3e98 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 17:56:10 +0000 Subject: [PATCH 1/3] bump[pre-commit.ci]: auto-update pre-commit hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v6.0.0) - https://github.com/psf/black → https://github.com/psf/black-pre-commit-mirror - [github.com/psf/black-pre-commit-mirror: 23.1.0 → 26.1.0](https://github.com/psf/black-pre-commit-mirror/compare/23.1.0...26.1.0) - [github.com/adrienverge/yamllint.git: v1.30.0 → v1.38.0](https://github.com/adrienverge/yamllint.git/compare/v1.30.0...v1.38.0) - [github.com/PyCQA/bandit: 1.7.5 → 1.9.3](https://github.com/PyCQA/bandit/compare/1.7.5...1.9.3) - [github.com/PyCQA/docformatter: v1.5.1 → v1.7.7](https://github.com/PyCQA/docformatter/compare/v1.5.1...v1.7.7) - [github.com/PyCQA/flake8: 6.0.0 → 7.3.0](https://github.com/PyCQA/flake8/compare/6.0.0...7.3.0) - [github.com/pycqa/isort: 5.12.0 → 7.0.0](https://github.com/pycqa/isort/compare/5.12.0...7.0.0) - [github.com/rtts/djhtml: 3.0.6 → 3.0.10](https://github.com/rtts/djhtml/compare/3.0.6...3.0.10) - [github.com/pycqa/pylint: v2.17.1 → v4.0.4](https://github.com/pycqa/pylint/compare/v2.17.1...v4.0.4) - [github.com/pre-commit/mirrors-mypy: v1.1.1 → v1.19.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.1.1...v1.19.1) - [github.com/asottile/pyupgrade: v3.3.1 → v3.21.2](https://github.com/asottile/pyupgrade/compare/v3.3.1...v3.21.2) --- .pre-commit-config.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f1b11df..5b2e82f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ --- exclude: "^docs/|/migrations/" -default_stages: [commit] +default_stages: [pre-commit] default_language_version: python: python3.10 @@ -17,7 +17,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v6.0.0 hooks: - id: check-yaml - id: end-of-file-fixer @@ -31,19 +31,19 @@ repos: - id: check-executables-have-shebangs - id: check-merge-conflict - - repo: https://github.com/psf/black - rev: 23.1.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.1.0 hooks: - id: black - repo: https://github.com/adrienverge/yamllint.git - rev: v1.30.0 + rev: v1.38.0 hooks: - id: yamllint args: [ --format, parsable, --strict ] - repo: https://github.com/PyCQA/bandit - rev: 1.7.5 + rev: 1.9.3 hooks: - id: bandit args: ['-iii', '-ll', '-s', 'B404', 'B602', 'B603', 'B607'] @@ -51,13 +51,13 @@ repos: exclude: ^test/ - repo: https://github.com/PyCQA/docformatter - rev: v1.5.1 + rev: v1.7.7 hooks: - id: docformatter args: [ --in-place, --wrap-summaries=115, --wrap-descriptions=120 ] - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 + rev: 7.3.0 hooks: - id: flake8 args: ["--config=setup.cfg"] @@ -73,13 +73,13 @@ repos: ] - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 7.0.0 hooks: - id: isort name: isort (python) - repo: https://github.com/rtts/djhtml - rev: 3.0.6 + rev: 3.0.10 hooks: - id: djhtml @@ -90,7 +90,7 @@ repos: additional_dependencies: ["toml"] - repo: https://github.com/pycqa/pylint - rev: v2.17.1 + rev: v4.0.4 hooks: - id: pylint exclude: | @@ -127,7 +127,7 @@ repos: - djangorestframework-jsonapi - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.1.1 + rev: v1.19.1 hooks: - id: mypy exclude: "[a-zA-Z]*/(migrations)/(.)*" @@ -159,7 +159,7 @@ repos: ] - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.21.2 hooks: - id: pyupgrade args: [ "--py36-plus", "--py37-plus", "--py38-plus", "--py39-plus" ] From 590062fedbdfc4e04fe9c8433d7a3747b9260f03 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 17:57:41 +0000 Subject: [PATCH 2/3] "refactor[pre-commit.ci]: auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci" --- config/__init__.py | 2 +- config/api_router.py | 1 + config/settings/base.py | 1 + config/settings/local.py | 1 + config/settings/production.py | 1 + config/settings/test.py | 1 + config/wsgi.py | 1 + merge_production_dotenvs_in_dotenv.py | 1 + onebarangay_psql/__init__.py | 1 + onebarangay_psql/announcement/admin.py | 1 + onebarangay_psql/announcement/apps.py | 1 + onebarangay_psql/announcement/factories.py | 1 + onebarangay_psql/announcement/models.py | 1 + onebarangay_psql/announcement/permission.py | 1 + onebarangay_psql/announcement/serializer.py | 1 + .../announcement/tests/test_drf_http_methods.py | 1 + onebarangay_psql/announcement/tests/test_drf_urls.py | 1 + onebarangay_psql/announcement/tests/test_drf_views.py | 1 + onebarangay_psql/announcement/tests/test_model.py | 1 + onebarangay_psql/announcement/viewset.py | 1 + onebarangay_psql/appointment/admin.py | 1 + onebarangay_psql/appointment/apps.py | 1 + onebarangay_psql/appointment/factories.py | 1 + onebarangay_psql/appointment/models.py | 1 + onebarangay_psql/appointment/permissions.py | 1 + onebarangay_psql/appointment/serializer.py | 1 + .../appointment/tests/test_drf_http_methods.py | 1 + onebarangay_psql/appointment/tests/test_drf_urls.py | 1 + onebarangay_psql/appointment/tests/test_drf_views.py | 1 + onebarangay_psql/appointment/tests/test_model.py | 1 + onebarangay_psql/appointment/viewset.py | 1 + onebarangay_psql/log/__init__.py | 1 + onebarangay_psql/log/middleware.py | 1 + onebarangay_psql/log/views.py | 1 + onebarangay_psql/rbi/admin.py | 1 + onebarangay_psql/rbi/apps.py | 1 + onebarangay_psql/rbi/factories.py | 1 + onebarangay_psql/rbi/models.py | 1 + onebarangay_psql/rbi/serializers.py | 1 + onebarangay_psql/rbi/tests/test_drf_http_methods.py | 1 + onebarangay_psql/rbi/tests/test_drf_urls.py | 1 + onebarangay_psql/rbi/tests/test_drf_views.py | 1 + onebarangay_psql/rbi/tests/test_model.py | 1 + onebarangay_psql/rbi/viewset.py | 1 + onebarangay_psql/statistics/admin.py | 1 + onebarangay_psql/statistics/apps.py | 1 + .../statistics/management/commands/setup_test_data.py | 3 ++- onebarangay_psql/statistics/models.py | 1 + onebarangay_psql/statistics/serializers.py | 1 + onebarangay_psql/statistics/tests/test_drf_urls.py | 1 + onebarangay_psql/statistics/tests/test_drf_views.py | 1 + onebarangay_psql/statistics/viewset.py | 7 +++---- onebarangay_psql/users/adapters.py | 1 + onebarangay_psql/users/admin.py | 1 + onebarangay_psql/users/api/serializers.py | 1 + onebarangay_psql/users/api/views.py | 1 + onebarangay_psql/users/apps.py | 1 + onebarangay_psql/users/context_processors.py | 1 + onebarangay_psql/users/factories.py | 1 + onebarangay_psql/users/forms.py | 1 + onebarangay_psql/users/models.py | 1 + onebarangay_psql/users/permissions.py | 1 + onebarangay_psql/users/signals.py | 1 + onebarangay_psql/users/tests/test_admin.py | 1 + onebarangay_psql/users/tests/test_drf_urls.py | 1 + onebarangay_psql/users/tests/test_drf_views.py | 1 + onebarangay_psql/users/tests/test_forms.py | 1 + onebarangay_psql/users/tests/test_models.py | 1 + onebarangay_psql/users/tests/test_permission.py | 1 + onebarangay_psql/users/tests/test_swagger_ui.py | 1 + onebarangay_psql/users/tests/test_urls.py | 1 + onebarangay_psql/users/tests/test_views.py | 1 + onebarangay_psql/users/urls.py | 1 + onebarangay_psql/utils/choice_field.py | 1 + onebarangay_psql/utils/pagination.py | 1 + onebarangay_psql/utils/prometheus.py | 1 + onebarangay_psql/utils/refresh_material_view.py | 7 +++---- onebarangay_psql/utils/storages.py | 1 + 78 files changed, 83 insertions(+), 10 deletions(-) diff --git a/config/__init__.py b/config/__init__.py index 3f8d4fc..1df0d6f 100644 --- a/config/__init__.py +++ b/config/__init__.py @@ -1 +1 @@ -"""init placeholders for config.""" +"""Init placeholders for config.""" diff --git a/config/api_router.py b/config/api_router.py index a1836d4..bdf0089 100644 --- a/config/api_router.py +++ b/config/api_router.py @@ -1,4 +1,5 @@ """Create your user API router here.""" + from django.conf import settings from rest_framework.routers import BaseRouter, DefaultRouter, SimpleRouter diff --git a/config/settings/base.py b/config/settings/base.py index 946aa57..e6648fa 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -1,4 +1,5 @@ """Base settings to build other settings files upon.""" + from pathlib import Path import environ diff --git a/config/settings/local.py b/config/settings/local.py index 62159bb..d4ac5ae 100644 --- a/config/settings/local.py +++ b/config/settings/local.py @@ -1,4 +1,5 @@ """Define your local settings here.""" + # pylint: disable=W0401,W0614 from .base import * # noqa from .base import env diff --git a/config/settings/production.py b/config/settings/production.py index 8a8731a..9fa49df 100644 --- a/config/settings/production.py +++ b/config/settings/production.py @@ -1,4 +1,5 @@ """Define your production settings here.""" + import logging import sentry_sdk diff --git a/config/settings/test.py b/config/settings/test.py index b02bf4f..7b3c4c7 100644 --- a/config/settings/test.py +++ b/config/settings/test.py @@ -1,4 +1,5 @@ """With these settings, tests run faster.""" + # pylint: disable=wildcard-import,unused-wildcard-import from .base import * # noqa from .base import env diff --git a/config/wsgi.py b/config/wsgi.py index e4ece34..e5e57fa 100644 --- a/config/wsgi.py +++ b/config/wsgi.py @@ -11,6 +11,7 @@ middleware here, or combine a Django application with an application of another framework. """ + import os import sys from pathlib import Path diff --git a/merge_production_dotenvs_in_dotenv.py b/merge_production_dotenvs_in_dotenv.py index ac2831f..f09be20 100644 --- a/merge_production_dotenvs_in_dotenv.py +++ b/merge_production_dotenvs_in_dotenv.py @@ -1,4 +1,5 @@ """Merge Environments in .env file.""" + import os from collections.abc import Sequence from pathlib import Path diff --git a/onebarangay_psql/__init__.py b/onebarangay_psql/__init__.py index 22cc60e..9b1cd34 100644 --- a/onebarangay_psql/__init__.py +++ b/onebarangay_psql/__init__.py @@ -1,4 +1,5 @@ """INIT file for module onebarangay_psql.""" + __version__ = "0.1.0" __version_info__ = tuple( int(num) if num.isdigit() else num diff --git a/onebarangay_psql/announcement/admin.py b/onebarangay_psql/announcement/admin.py index 36ed57d..4a9eb8f 100644 --- a/onebarangay_psql/announcement/admin.py +++ b/onebarangay_psql/announcement/admin.py @@ -1,4 +1,5 @@ """Register your announcement models here.""" + from django.contrib import admin from django.utils.html import strip_tags from import_export import resources diff --git a/onebarangay_psql/announcement/apps.py b/onebarangay_psql/announcement/apps.py index e575df4..83fbfde 100644 --- a/onebarangay_psql/announcement/apps.py +++ b/onebarangay_psql/announcement/apps.py @@ -1,4 +1,5 @@ """Create your app config for announcement apps.""" + import contextlib from django.apps import AppConfig diff --git a/onebarangay_psql/announcement/factories.py b/onebarangay_psql/announcement/factories.py index 3e23233..088ee5c 100644 --- a/onebarangay_psql/announcement/factories.py +++ b/onebarangay_psql/announcement/factories.py @@ -1,4 +1,5 @@ """Create your announcement factories here.""" + import factory from django.utils.text import slugify from factory import Faker diff --git a/onebarangay_psql/announcement/models.py b/onebarangay_psql/announcement/models.py index 5eff7f5..2facd71 100644 --- a/onebarangay_psql/announcement/models.py +++ b/onebarangay_psql/announcement/models.py @@ -1,4 +1,5 @@ """Create your announcement models here.""" + from auditlog.registry import auditlog from django.contrib.auth import get_user_model from django.db import models diff --git a/onebarangay_psql/announcement/permission.py b/onebarangay_psql/announcement/permission.py index 5ca6d78..2b10e39 100644 --- a/onebarangay_psql/announcement/permission.py +++ b/onebarangay_psql/announcement/permission.py @@ -1,4 +1,5 @@ """Create your announcement permissions here.""" + from rest_framework import permissions diff --git a/onebarangay_psql/announcement/serializer.py b/onebarangay_psql/announcement/serializer.py index b5035dc..66d4c6f 100644 --- a/onebarangay_psql/announcement/serializer.py +++ b/onebarangay_psql/announcement/serializer.py @@ -1,4 +1,5 @@ """Create your announcement serializer here.""" + from rest_framework_json_api import serializers from rest_framework_json_api.relations import HyperlinkedRelatedField from taggit.serializers import TaggitSerializer, TagListSerializerField diff --git a/onebarangay_psql/announcement/tests/test_drf_http_methods.py b/onebarangay_psql/announcement/tests/test_drf_http_methods.py index 2b7ef16..68794d6 100644 --- a/onebarangay_psql/announcement/tests/test_drf_http_methods.py +++ b/onebarangay_psql/announcement/tests/test_drf_http_methods.py @@ -1,4 +1,5 @@ """Create your announcement drf http methods tests here.""" + from django.contrib.auth import get_user_model from django.test.client import Client from django.urls import reverse diff --git a/onebarangay_psql/announcement/tests/test_drf_urls.py b/onebarangay_psql/announcement/tests/test_drf_urls.py index ffa768e..9bae4d4 100644 --- a/onebarangay_psql/announcement/tests/test_drf_urls.py +++ b/onebarangay_psql/announcement/tests/test_drf_urls.py @@ -1,4 +1,5 @@ """Create your test for the DRF urls.""" + import pytest from django.urls import resolve, reverse diff --git a/onebarangay_psql/announcement/tests/test_drf_views.py b/onebarangay_psql/announcement/tests/test_drf_views.py index 3220832..160b1ba 100644 --- a/onebarangay_psql/announcement/tests/test_drf_views.py +++ b/onebarangay_psql/announcement/tests/test_drf_views.py @@ -1,4 +1,5 @@ """Create your announcement drf viewset tests here.""" + import pytest from _pytest.fixtures import FixtureRequest from django.test import RequestFactory diff --git a/onebarangay_psql/announcement/tests/test_model.py b/onebarangay_psql/announcement/tests/test_model.py index 51c7a78..de106b4 100644 --- a/onebarangay_psql/announcement/tests/test_model.py +++ b/onebarangay_psql/announcement/tests/test_model.py @@ -1,4 +1,5 @@ """Create your announcement model tests here.""" + import pytest from onebarangay_psql.announcement.models import Announcement diff --git a/onebarangay_psql/announcement/viewset.py b/onebarangay_psql/announcement/viewset.py index e2a6c09..39cb308 100644 --- a/onebarangay_psql/announcement/viewset.py +++ b/onebarangay_psql/announcement/viewset.py @@ -1,4 +1,5 @@ """Create your announcement views here.""" + from django.utils.html import strip_tags from push_notifications.models import GCMDevice from rest_framework import viewsets diff --git a/onebarangay_psql/appointment/admin.py b/onebarangay_psql/appointment/admin.py index 3da9c42..bcb3b52 100644 --- a/onebarangay_psql/appointment/admin.py +++ b/onebarangay_psql/appointment/admin.py @@ -1,4 +1,5 @@ """Register your appointment models here.""" + from django.contrib import admin from import_export import resources from import_export.admin import ImportExportModelAdmin diff --git a/onebarangay_psql/appointment/apps.py b/onebarangay_psql/appointment/apps.py index 70394d4..d45cfeb 100644 --- a/onebarangay_psql/appointment/apps.py +++ b/onebarangay_psql/appointment/apps.py @@ -1,4 +1,5 @@ """Create your appointment apps here.""" + from django.apps import AppConfig diff --git a/onebarangay_psql/appointment/factories.py b/onebarangay_psql/appointment/factories.py index bdf93b6..50a0927 100644 --- a/onebarangay_psql/appointment/factories.py +++ b/onebarangay_psql/appointment/factories.py @@ -1,4 +1,5 @@ """Create your appointment factories here.""" + from zoneinfo import ZoneInfo import factory diff --git a/onebarangay_psql/appointment/models.py b/onebarangay_psql/appointment/models.py index ea09c9e..c24f0e5 100644 --- a/onebarangay_psql/appointment/models.py +++ b/onebarangay_psql/appointment/models.py @@ -1,4 +1,5 @@ """Create your appointment models here.""" + from datetime import timedelta from auditlog.registry import auditlog diff --git a/onebarangay_psql/appointment/permissions.py b/onebarangay_psql/appointment/permissions.py index 26f1b95..873c0f4 100644 --- a/onebarangay_psql/appointment/permissions.py +++ b/onebarangay_psql/appointment/permissions.py @@ -1,4 +1,5 @@ """Create your appointment permissions here.""" + from rest_framework import permissions from rest_framework.request import Request from rest_framework.views import APIView diff --git a/onebarangay_psql/appointment/serializer.py b/onebarangay_psql/appointment/serializer.py index 612373b..292e94e 100644 --- a/onebarangay_psql/appointment/serializer.py +++ b/onebarangay_psql/appointment/serializer.py @@ -1,4 +1,5 @@ """Create your appointment serializer here.""" + from rest_framework_json_api import serializers from rest_framework_json_api.relations import HyperlinkedRelatedField diff --git a/onebarangay_psql/appointment/tests/test_drf_http_methods.py b/onebarangay_psql/appointment/tests/test_drf_http_methods.py index 6b78c81..d6a7a53 100644 --- a/onebarangay_psql/appointment/tests/test_drf_http_methods.py +++ b/onebarangay_psql/appointment/tests/test_drf_http_methods.py @@ -1,4 +1,5 @@ """Create your appointment drf http methods tests here.""" + from datetime import datetime from zoneinfo import ZoneInfo diff --git a/onebarangay_psql/appointment/tests/test_drf_urls.py b/onebarangay_psql/appointment/tests/test_drf_urls.py index 74c6da3..d1e8b37 100644 --- a/onebarangay_psql/appointment/tests/test_drf_urls.py +++ b/onebarangay_psql/appointment/tests/test_drf_urls.py @@ -1,4 +1,5 @@ """Create your test for the appointment DRF urls.""" + import pytest from django.urls import resolve, reverse diff --git a/onebarangay_psql/appointment/tests/test_drf_views.py b/onebarangay_psql/appointment/tests/test_drf_views.py index 48f8412..664f2d7 100644 --- a/onebarangay_psql/appointment/tests/test_drf_views.py +++ b/onebarangay_psql/appointment/tests/test_drf_views.py @@ -1,4 +1,5 @@ """Create your appointment drf viewset tests here.""" + from datetime import datetime from zoneinfo import ZoneInfo diff --git a/onebarangay_psql/appointment/tests/test_model.py b/onebarangay_psql/appointment/tests/test_model.py index be19167..37c37a1 100644 --- a/onebarangay_psql/appointment/tests/test_model.py +++ b/onebarangay_psql/appointment/tests/test_model.py @@ -1,4 +1,5 @@ """Create your appointment model tests here.""" + import zoneinfo from datetime import datetime, timedelta diff --git a/onebarangay_psql/appointment/viewset.py b/onebarangay_psql/appointment/viewset.py index eee179e..d81e926 100644 --- a/onebarangay_psql/appointment/viewset.py +++ b/onebarangay_psql/appointment/viewset.py @@ -1,4 +1,5 @@ """Create your appointment views here.""" + from rest_framework import mixins, viewsets from rest_framework.decorators import action from rest_framework.permissions import IsAdminUser, IsAuthenticated diff --git a/onebarangay_psql/log/__init__.py b/onebarangay_psql/log/__init__.py index ad82db5..add0b67 100644 --- a/onebarangay_psql/log/__init__.py +++ b/onebarangay_psql/log/__init__.py @@ -1,2 +1,3 @@ """Default init file for log package.""" + from .views import prometheus_metrics # noqa: F401 diff --git a/onebarangay_psql/log/middleware.py b/onebarangay_psql/log/middleware.py index 0ffd4ba..d12e18d 100644 --- a/onebarangay_psql/log/middleware.py +++ b/onebarangay_psql/log/middleware.py @@ -1,4 +1,5 @@ """Page Views and Time Spent custom middleware for Prometheus.""" + import time from onebarangay_psql.utils.prometheus import PROM_GRAPHQL_REQUEST_TIME, PROM_PAGEVIEWS diff --git a/onebarangay_psql/log/views.py b/onebarangay_psql/log/views.py index 30c1791..4e76e21 100644 --- a/onebarangay_psql/log/views.py +++ b/onebarangay_psql/log/views.py @@ -1,4 +1,5 @@ """Views for Prometheus monitoring.""" + from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from prometheus_client import CONTENT_TYPE_LATEST diff --git a/onebarangay_psql/rbi/admin.py b/onebarangay_psql/rbi/admin.py index d0a5d09..6d27f99 100644 --- a/onebarangay_psql/rbi/admin.py +++ b/onebarangay_psql/rbi/admin.py @@ -1,4 +1,5 @@ """Register your rbi models here.""" + from datetime import datetime from django.contrib import admin diff --git a/onebarangay_psql/rbi/apps.py b/onebarangay_psql/rbi/apps.py index 961de30..12cf62c 100644 --- a/onebarangay_psql/rbi/apps.py +++ b/onebarangay_psql/rbi/apps.py @@ -1,4 +1,5 @@ """Create your rbi apps here.""" + from django.apps import AppConfig diff --git a/onebarangay_psql/rbi/factories.py b/onebarangay_psql/rbi/factories.py index 1bf3a5c..d6f1c8b 100644 --- a/onebarangay_psql/rbi/factories.py +++ b/onebarangay_psql/rbi/factories.py @@ -1,4 +1,5 @@ """Create your rbi factories here.""" + from zoneinfo import ZoneInfo import factory diff --git a/onebarangay_psql/rbi/models.py b/onebarangay_psql/rbi/models.py index 01b72ce..affb06e 100644 --- a/onebarangay_psql/rbi/models.py +++ b/onebarangay_psql/rbi/models.py @@ -1,4 +1,5 @@ """Create your rbi models here.""" + from auditlog.registry import auditlog from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models diff --git a/onebarangay_psql/rbi/serializers.py b/onebarangay_psql/rbi/serializers.py index ecd5873..b83870f 100644 --- a/onebarangay_psql/rbi/serializers.py +++ b/onebarangay_psql/rbi/serializers.py @@ -1,4 +1,5 @@ """Create your rbi serializers here.""" + from rest_framework_json_api import serializers from onebarangay_psql.rbi.models import FamilyMember, HouseRecord diff --git a/onebarangay_psql/rbi/tests/test_drf_http_methods.py b/onebarangay_psql/rbi/tests/test_drf_http_methods.py index e92eca8..6f8129f 100644 --- a/onebarangay_psql/rbi/tests/test_drf_http_methods.py +++ b/onebarangay_psql/rbi/tests/test_drf_http_methods.py @@ -1,4 +1,5 @@ """Create your rbi drf http methods tests here.""" + import datetime from zoneinfo import ZoneInfo diff --git a/onebarangay_psql/rbi/tests/test_drf_urls.py b/onebarangay_psql/rbi/tests/test_drf_urls.py index 5094256..2d280c6 100644 --- a/onebarangay_psql/rbi/tests/test_drf_urls.py +++ b/onebarangay_psql/rbi/tests/test_drf_urls.py @@ -1,4 +1,5 @@ """Create your rbi drf urls tests here.""" + from django.urls import resolve from rest_framework.reverse import reverse diff --git a/onebarangay_psql/rbi/tests/test_drf_views.py b/onebarangay_psql/rbi/tests/test_drf_views.py index 2205def..b5de775 100644 --- a/onebarangay_psql/rbi/tests/test_drf_views.py +++ b/onebarangay_psql/rbi/tests/test_drf_views.py @@ -1,4 +1,5 @@ """Create your rbi drf viewsets test here.""" + import pytest from django.test import RequestFactory from django.urls import reverse diff --git a/onebarangay_psql/rbi/tests/test_model.py b/onebarangay_psql/rbi/tests/test_model.py index 05b8a4a..f7708b4 100644 --- a/onebarangay_psql/rbi/tests/test_model.py +++ b/onebarangay_psql/rbi/tests/test_model.py @@ -1,4 +1,5 @@ """Create your rbi model tests here.""" + import datetime from zoneinfo import ZoneInfo diff --git a/onebarangay_psql/rbi/viewset.py b/onebarangay_psql/rbi/viewset.py index 876c987..a8805de 100644 --- a/onebarangay_psql/rbi/viewset.py +++ b/onebarangay_psql/rbi/viewset.py @@ -1,4 +1,5 @@ """Create your rbi viewsets here.""" + from rest_framework import viewsets from rest_framework.permissions import IsAdminUser diff --git a/onebarangay_psql/statistics/admin.py b/onebarangay_psql/statistics/admin.py index 15ed351..be0a0de 100644 --- a/onebarangay_psql/statistics/admin.py +++ b/onebarangay_psql/statistics/admin.py @@ -1,4 +1,5 @@ """Register your statistics models here.""" + from adminactions import actions from django.contrib import admin diff --git a/onebarangay_psql/statistics/apps.py b/onebarangay_psql/statistics/apps.py index b7358cc..08a2050 100644 --- a/onebarangay_psql/statistics/apps.py +++ b/onebarangay_psql/statistics/apps.py @@ -1,4 +1,5 @@ """Create your statistics apps here.""" + from django.apps import AppConfig diff --git a/onebarangay_psql/statistics/management/commands/setup_test_data.py b/onebarangay_psql/statistics/management/commands/setup_test_data.py index 771c5cc..6d94fa6 100644 --- a/onebarangay_psql/statistics/management/commands/setup_test_data.py +++ b/onebarangay_psql/statistics/management/commands/setup_test_data.py @@ -1,4 +1,5 @@ """Create your custom management commands here.""" + import random from datetime import date, datetime, timedelta from pathlib import Path @@ -143,7 +144,7 @@ def handle(self, *args, **kwargs): def set_sequence( - model: Union[Appointment, Announcement, User, HouseRecord, FamilyMember] + model: Union[Appointment, Announcement, User, HouseRecord, FamilyMember], ) -> None: """Reset the id sequence of a table. diff --git a/onebarangay_psql/statistics/models.py b/onebarangay_psql/statistics/models.py index 8598e8a..6956607 100644 --- a/onebarangay_psql/statistics/models.py +++ b/onebarangay_psql/statistics/models.py @@ -1,4 +1,5 @@ """Create your statistics models here.""" + from django.db import models diff --git a/onebarangay_psql/statistics/serializers.py b/onebarangay_psql/statistics/serializers.py index ee284f0..2bac5db 100644 --- a/onebarangay_psql/statistics/serializers.py +++ b/onebarangay_psql/statistics/serializers.py @@ -1,4 +1,5 @@ """Create your statistics serializers here.""" + from rest_framework_json_api import serializers from onebarangay_psql.statistics import models diff --git a/onebarangay_psql/statistics/tests/test_drf_urls.py b/onebarangay_psql/statistics/tests/test_drf_urls.py index 412aa03..c847559 100644 --- a/onebarangay_psql/statistics/tests/test_drf_urls.py +++ b/onebarangay_psql/statistics/tests/test_drf_urls.py @@ -1,4 +1,5 @@ """Create your statistics drf urls tests here.""" + import pytest from django.urls import resolve, reverse diff --git a/onebarangay_psql/statistics/tests/test_drf_views.py b/onebarangay_psql/statistics/tests/test_drf_views.py index c2d9795..c00af7d 100644 --- a/onebarangay_psql/statistics/tests/test_drf_views.py +++ b/onebarangay_psql/statistics/tests/test_drf_views.py @@ -1,4 +1,5 @@ """Create your statistics drf viewsets test here.""" + import pytest from django.test import RequestFactory from django.urls import reverse diff --git a/onebarangay_psql/statistics/viewset.py b/onebarangay_psql/statistics/viewset.py index e450a44..73cbf9a 100644 --- a/onebarangay_psql/statistics/viewset.py +++ b/onebarangay_psql/statistics/viewset.py @@ -1,4 +1,5 @@ """Create your statistics viewsets here.""" + import datetime import time from typing import Any @@ -104,8 +105,7 @@ def create(self, request: Request, *args: Any, **kwargs: Any) -> Response: """Create a new refresh materialized view.""" start_time = time.monotonic() with connection.cursor() as cursor: - cursor.execute( - """ + cursor.execute(""" REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_total; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_user_signup; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_appointment; @@ -117,8 +117,7 @@ def create(self, request: Request, *args: Any, **kwargs: Any) -> Response: REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_social_class; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_user_signup_monthly; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_user_login_monthly; - """ - ) + """) end_time = time.monotonic() serializer = self.get_serializer( diff --git a/onebarangay_psql/users/adapters.py b/onebarangay_psql/users/adapters.py index d8c54d7..314aea7 100644 --- a/onebarangay_psql/users/adapters.py +++ b/onebarangay_psql/users/adapters.py @@ -1,4 +1,5 @@ """Create your Adapters for user's app.""" + from typing import Any from allauth.account.adapter import DefaultAccountAdapter diff --git a/onebarangay_psql/users/admin.py b/onebarangay_psql/users/admin.py index 6469d9e..fbbe7de 100644 --- a/onebarangay_psql/users/admin.py +++ b/onebarangay_psql/users/admin.py @@ -1,4 +1,5 @@ """Register your user models here..""" + from django.contrib import admin from django.contrib.auth import admin as auth_admin, get_user_model from django.utils.translation import gettext as _ diff --git a/onebarangay_psql/users/api/serializers.py b/onebarangay_psql/users/api/serializers.py index c0396c9..81bb719 100644 --- a/onebarangay_psql/users/api/serializers.py +++ b/onebarangay_psql/users/api/serializers.py @@ -1,4 +1,5 @@ """Create your user and profile serializers here.""" + from django.contrib.auth import get_user_model from rest_framework_json_api import serializers from rest_framework_json_api.relations import HyperlinkedRelatedField diff --git a/onebarangay_psql/users/api/views.py b/onebarangay_psql/users/api/views.py index 58c3af5..019304f 100644 --- a/onebarangay_psql/users/api/views.py +++ b/onebarangay_psql/users/api/views.py @@ -1,4 +1,5 @@ """Create your user API views here.""" + from django.contrib.auth import get_user_model from django.shortcuts import get_object_or_404 from push_notifications.api.rest_framework import ( diff --git a/onebarangay_psql/users/apps.py b/onebarangay_psql/users/apps.py index 68b4103..0589ecc 100644 --- a/onebarangay_psql/users/apps.py +++ b/onebarangay_psql/users/apps.py @@ -1,4 +1,5 @@ """Create your app config for user apps.""" + import contextlib from django.apps import AppConfig diff --git a/onebarangay_psql/users/context_processors.py b/onebarangay_psql/users/context_processors.py index e8917f0..d856d14 100644 --- a/onebarangay_psql/users/context_processors.py +++ b/onebarangay_psql/users/context_processors.py @@ -1,4 +1,5 @@ """Cree your context processors here for user's app.""" + from django.conf import settings diff --git a/onebarangay_psql/users/factories.py b/onebarangay_psql/users/factories.py index 391dc03..5b97bfc 100644 --- a/onebarangay_psql/users/factories.py +++ b/onebarangay_psql/users/factories.py @@ -1,4 +1,5 @@ """Create your test factories here.""" + from collections.abc import Sequence from typing import Any diff --git a/onebarangay_psql/users/forms.py b/onebarangay_psql/users/forms.py index 8c7c008..0f87b5b 100644 --- a/onebarangay_psql/users/forms.py +++ b/onebarangay_psql/users/forms.py @@ -1,4 +1,5 @@ """Create forms for the user's app.""" + from allauth.account.forms import SignupForm from allauth.socialaccount.forms import SignupForm as SocialSignupForm from django.contrib.auth import forms as admin_forms, get_user_model diff --git a/onebarangay_psql/users/models.py b/onebarangay_psql/users/models.py index 30b54fc..aea1f1b 100644 --- a/onebarangay_psql/users/models.py +++ b/onebarangay_psql/users/models.py @@ -1,4 +1,5 @@ """Create your announcement models here.""" + from auditlog.registry import auditlog from django.contrib.auth.models import AbstractUser from django.core.validators import MaxValueValidator, MinValueValidator, RegexValidator diff --git a/onebarangay_psql/users/permissions.py b/onebarangay_psql/users/permissions.py index 7dd59b2..5ef8007 100644 --- a/onebarangay_psql/users/permissions.py +++ b/onebarangay_psql/users/permissions.py @@ -1,4 +1,5 @@ """Create your custom permissions for user's app.""" + from django.views import View from rest_framework import permissions from rest_framework.request import Request diff --git a/onebarangay_psql/users/signals.py b/onebarangay_psql/users/signals.py index 2622e64..a11cbc4 100644 --- a/onebarangay_psql/users/signals.py +++ b/onebarangay_psql/users/signals.py @@ -1,4 +1,5 @@ """Create your own signals for your user's model.""" + from django.contrib.auth import get_user_model from django.db.models.signals import post_save from django.dispatch import receiver diff --git a/onebarangay_psql/users/tests/test_admin.py b/onebarangay_psql/users/tests/test_admin.py index ba4c9ac..6f8b276 100644 --- a/onebarangay_psql/users/tests/test_admin.py +++ b/onebarangay_psql/users/tests/test_admin.py @@ -1,4 +1,5 @@ """Create your tests for the admin app here.""" + import pytest from django.contrib.auth import get_user_model from django.urls import reverse diff --git a/onebarangay_psql/users/tests/test_drf_urls.py b/onebarangay_psql/users/tests/test_drf_urls.py index 39499ad..814e25a 100644 --- a/onebarangay_psql/users/tests/test_drf_urls.py +++ b/onebarangay_psql/users/tests/test_drf_urls.py @@ -1,4 +1,5 @@ """Create your test for the DRF urls.""" + import pytest from django.urls import resolve, reverse diff --git a/onebarangay_psql/users/tests/test_drf_views.py b/onebarangay_psql/users/tests/test_drf_views.py index 0831a40..14dd889 100644 --- a/onebarangay_psql/users/tests/test_drf_views.py +++ b/onebarangay_psql/users/tests/test_drf_views.py @@ -1,4 +1,5 @@ """Create your test for the DRF views.""" + import pytest from django.test import RequestFactory diff --git a/onebarangay_psql/users/tests/test_forms.py b/onebarangay_psql/users/tests/test_forms.py index 560865f..cdc29e0 100644 --- a/onebarangay_psql/users/tests/test_forms.py +++ b/onebarangay_psql/users/tests/test_forms.py @@ -1,4 +1,5 @@ """Module for all Form Tests.""" + import pytest from django.utils.translation import gettext_lazy as _ diff --git a/onebarangay_psql/users/tests/test_models.py b/onebarangay_psql/users/tests/test_models.py index 920d303..90140b1 100644 --- a/onebarangay_psql/users/tests/test_models.py +++ b/onebarangay_psql/users/tests/test_models.py @@ -1,4 +1,5 @@ """Create your user and profile test models here.""" + import pytest from onebarangay_psql.users.models import User diff --git a/onebarangay_psql/users/tests/test_permission.py b/onebarangay_psql/users/tests/test_permission.py index 835561f..c3295b5 100644 --- a/onebarangay_psql/users/tests/test_permission.py +++ b/onebarangay_psql/users/tests/test_permission.py @@ -1,4 +1,5 @@ """Create your test for permissions.""" + from datetime import datetime import pytest diff --git a/onebarangay_psql/users/tests/test_swagger_ui.py b/onebarangay_psql/users/tests/test_swagger_ui.py index 84a7c5a..d593085 100644 --- a/onebarangay_psql/users/tests/test_swagger_ui.py +++ b/onebarangay_psql/users/tests/test_swagger_ui.py @@ -1,4 +1,5 @@ """Create your swagger-ui test here.""" + import pytest from django.test import Client from django.urls import reverse diff --git a/onebarangay_psql/users/tests/test_urls.py b/onebarangay_psql/users/tests/test_urls.py index 5e12ad8..cfe2c8f 100644 --- a/onebarangay_psql/users/tests/test_urls.py +++ b/onebarangay_psql/users/tests/test_urls.py @@ -1,4 +1,5 @@ """Create your test for user urls.""" + import pytest from django.urls import resolve, reverse diff --git a/onebarangay_psql/users/tests/test_views.py b/onebarangay_psql/users/tests/test_views.py index e0d5db3..cfc6886 100644 --- a/onebarangay_psql/users/tests/test_views.py +++ b/onebarangay_psql/users/tests/test_views.py @@ -1,4 +1,5 @@ """Create your test for the user views here.""" + import pytest from django.conf import settings from django.contrib import messages diff --git a/onebarangay_psql/users/urls.py b/onebarangay_psql/users/urls.py index 3346c30..7a5707b 100644 --- a/onebarangay_psql/users/urls.py +++ b/onebarangay_psql/users/urls.py @@ -1,4 +1,5 @@ """Create your URL for the user's app.""" + from django.urls import path from onebarangay_psql.users.views import ( diff --git a/onebarangay_psql/utils/choice_field.py b/onebarangay_psql/utils/choice_field.py index 2565c3e..41b8197 100644 --- a/onebarangay_psql/utils/choice_field.py +++ b/onebarangay_psql/utils/choice_field.py @@ -1,4 +1,5 @@ """Create your custom choice field here.""" + from rest_framework_json_api import serializers diff --git a/onebarangay_psql/utils/pagination.py b/onebarangay_psql/utils/pagination.py index 9a80a3f..e00c3c0 100644 --- a/onebarangay_psql/utils/pagination.py +++ b/onebarangay_psql/utils/pagination.py @@ -1,4 +1,5 @@ """Custom pagination for onebarangay_psql.""" + from rest_framework.pagination import PageNumberPagination diff --git a/onebarangay_psql/utils/prometheus.py b/onebarangay_psql/utils/prometheus.py index 9232397..7b18ceb 100644 --- a/onebarangay_psql/utils/prometheus.py +++ b/onebarangay_psql/utils/prometheus.py @@ -1,4 +1,5 @@ """Util for getting the prometheus metrics.""" + from prometheus_client import CollectorRegistry, Counter, Histogram, generate_latest diff --git a/onebarangay_psql/utils/refresh_material_view.py b/onebarangay_psql/utils/refresh_material_view.py index 155fc13..c5ddcd2 100644 --- a/onebarangay_psql/utils/refresh_material_view.py +++ b/onebarangay_psql/utils/refresh_material_view.py @@ -1,4 +1,5 @@ """Refreshes Material Views.""" + import datetime import time @@ -11,8 +12,7 @@ def refresh_mv(): """Refresh Materialized Views in the Database.""" start_time = time.monotonic() with connection.cursor() as cursor: - cursor.execute( - """ + cursor.execute(""" REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_total; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_user_signup; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_user_signup_monthly; @@ -24,8 +24,7 @@ def refresh_mv(): REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_civil_status; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_average; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_social_class; - """ - ) + """) end_time = time.monotonic() RefreshMaterializedView.objects.create( diff --git a/onebarangay_psql/utils/storages.py b/onebarangay_psql/utils/storages.py index a1db531..633f89a 100644 --- a/onebarangay_psql/utils/storages.py +++ b/onebarangay_psql/utils/storages.py @@ -1,4 +1,5 @@ """Utility for storing static files in Google Cloud Storage.""" + from storages.backends.gcloud import GoogleCloudStorage From afc98844e066622f1120b871feefa552b33b7d66 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 17:57:59 +0000 Subject: [PATCH 3/3] style: format code with Black and isort This commit fixes the style issues introduced in 590062f according to the output from Black and isort. Details: https://github.com/PrynsTag/oneBarangay-REST-API/pull/369 --- onebarangay_psql/statistics/viewset.py | 6 ++++-- onebarangay_psql/utils/refresh_material_view.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/onebarangay_psql/statistics/viewset.py b/onebarangay_psql/statistics/viewset.py index 73cbf9a..a98d227 100644 --- a/onebarangay_psql/statistics/viewset.py +++ b/onebarangay_psql/statistics/viewset.py @@ -105,7 +105,8 @@ def create(self, request: Request, *args: Any, **kwargs: Any) -> Response: """Create a new refresh materialized view.""" start_time = time.monotonic() with connection.cursor() as cursor: - cursor.execute(""" + cursor.execute( + """ REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_total; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_user_signup; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_appointment; @@ -117,7 +118,8 @@ def create(self, request: Request, *args: Any, **kwargs: Any) -> Response: REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_social_class; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_user_signup_monthly; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_user_login_monthly; - """) + """ + ) end_time = time.monotonic() serializer = self.get_serializer( diff --git a/onebarangay_psql/utils/refresh_material_view.py b/onebarangay_psql/utils/refresh_material_view.py index c5ddcd2..96a8fe9 100644 --- a/onebarangay_psql/utils/refresh_material_view.py +++ b/onebarangay_psql/utils/refresh_material_view.py @@ -12,7 +12,8 @@ def refresh_mv(): """Refresh Materialized Views in the Database.""" start_time = time.monotonic() with connection.cursor() as cursor: - cursor.execute(""" + cursor.execute( + """ REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_total; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_user_signup; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_user_signup_monthly; @@ -24,7 +25,8 @@ def refresh_mv(): REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_civil_status; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_average; REFRESH MATERIALIZED VIEW CONCURRENTLY materialized_statistics_social_class; - """) + """ + ) end_time = time.monotonic() RefreshMaterializedView.objects.create(