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 #4

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
README.md
LICENSE
LICENSE
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
default_stages: [commit, merge-commit, push]
default_stages: [pre-commit, pre-merge-commit, pre-push]
exclude: |
(?x)(
^docs/|
Expand All @@ -10,7 +10,7 @@ exclude: |

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -19,13 +19,13 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.0.277
rev: v0.9.4
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.6"
rev: "v4.0.0-alpha.8"
hooks:
- id: prettier
files: ^frontend/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
#### Run tests
```shell
docker-compose run django python manage.py test
```
```
2 changes: 1 addition & 1 deletion commands/dev/django_loaddata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ set -o pipefail
# exits if any of your variables is not set
set -o nounset

python manage.py loaddata roles.yaml
python manage.py loaddata roles.yaml
2 changes: 1 addition & 1 deletion commands/dev/django_run_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ else
docker-compose exec -it django \
sh -c "python manage.py runscript $filename"

fi
fi
6 changes: 0 additions & 6 deletions core/apps/auth/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
OpenApiResponse,
extend_schema,
)
from apps.auth.serializers import (
LoginRefreshSerializer,
LoginSerializer,
RegisterMailSerializer,
RegisterSerializer,
)
from rest_framework import status

templates = {
Expand Down
2 changes: 1 addition & 1 deletion core/apps/auth/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from django.contrib.auth import authenticate, login, logout
from django.core.cache import cache
from django.http import HttpRequest
from redis.exceptions import RedisError
from rest_framework import exceptions

from apps.api.tokens import encode_token
from apps.users.models import User
from redis.exceptions import RedisError


def access_token(user: Optional[User] = None) -> str:
Expand Down
17 changes: 8 additions & 9 deletions core/apps/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,28 @@

from apps.api.permissions import UnAuthenticated
from apps.api.tokens import decode_token
from apps.auth.schema import (
login_refresh_mail_schema,
login_refresh_schema,
login_schema,
logout_schema,
register_mail_schema,
register_schema,
)
from apps.auth.serializers import (
LoginRefreshSerializer,
LoginSerializer,
RegisterMailSerializer,
RegisterSerializer,
)
from apps.auth.utils import (
auth_headers_jwt,
auth_login,
auth_logout,
auth_refresh,
)
from apps.emails.tasks import send_refresh_token_email, send_register_email
from apps.emails.utils import CreateMail
from apps.users.models import User
from apps.auth.schema import (
register_mail_schema,
register_schema,
login_schema,
login_refresh_mail_schema,
login_refresh_schema,
logout_schema,
)


class RegisterMailView(generics.GenericAPIView):
Expand Down
2 changes: 1 addition & 1 deletion core/apps/users/fixtures/roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
pk: 3
fields:
name: PREMIUM
description: Premium role
description: Premium role
3 changes: 2 additions & 1 deletion core/apps/users/management/commands/make_user_models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.core.management.base import BaseCommand
import logging

from django.core.management.base import BaseCommand
from tests.users.factories import UserFactory

logger = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions core/apps/users/views/roles_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class RolesListView(GenericAPIView):

def get_queryset(self, *args, **kwargs):
queryset = Roles.objects.all()
name = kwargs.get("name", None)
name = kwargs.get("name")
if name is not None:
queryset = Roles.objects.filter(name=name)
return queryset
Expand Down Expand Up @@ -73,7 +73,7 @@ def get(self, request, *args, **kwargs):
responses={status.HTTP_200_OK: None},
)
def delete(self, request, *args, **kwargs):
name = kwargs.get("name", None)
name = kwargs.get("name")
instance = self.get_object()
instance.delete()
return Response(
Expand Down
2 changes: 1 addition & 1 deletion core/fixtures/friendship.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[]
[]
2 changes: 1 addition & 1 deletion core/fixtures/roles.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
"description": "Premium role"
}
}
]
]
2 changes: 1 addition & 1 deletion core/fixtures/users.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
]
}
}
]
]
2 changes: 1 addition & 1 deletion core/fixtures/users_basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"is_premium": false
}
}
]
]
2 changes: 1 addition & 1 deletion core/fixtures/users_premium.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"is_premium": true
}
}
]
]
2 changes: 1 addition & 1 deletion core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ envlist = [
"py311",
"py310",
"py39",
]
]
2 changes: 1 addition & 1 deletion core/schemas/auth.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
"email": "[email protected]"
}
}
}
}
3 changes: 2 additions & 1 deletion core/scripts/my_scripts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.contrib.auth import get_user_model
from pprint import pprint

from django.contrib.auth import get_user_model
from django.db import connection


Expand Down
2 changes: 1 addition & 1 deletion core/templates/emails/login/refresh.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ <h1>
</div>
</div>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion core/templates/emails/register/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ <h1>
</div>
</div>
</body>
</html>
</html>
14 changes: 7 additions & 7 deletions core/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import pytest
from apps.api.tokens import encode_token
from django.db import connections
from pathlib import Path

import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
from config.settings.testing import env
from django.core.management import call_command
import pytest
from config.env import BASE_DIR
from pathlib import Path
from config.settings.testing import env
from django.conf import settings
from django.core.management import call_command
from django.db import connections
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT


def run_sql(sql):
Expand Down
18 changes: 10 additions & 8 deletions core/tests/users/conftest.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import base64
from io import BytesIO

import pytest
from apps.auth.utils import encode_token
from django.contrib.auth.hashers import make_password
from PIL import Image
from pytest_factoryboy import register

from tests.users.factories import (
UserFactory,
FriendshipFactory,
RolesFactory,
UserBasicFactory,
UserFactory,
UserPremiumFactory,
RolesFactory,
FriendshipFactory,
)
from apps.auth.utils import encode_token
import base64
from io import BytesIO
from PIL import Image
from django.contrib.auth.hashers import make_password


@pytest.fixture(scope="function")
Expand Down
13 changes: 6 additions & 7 deletions core/tests/users/factories.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import json
import logging
from enum import Enum
from typing import Optional
from uuid import uuid4
from apps.users.models import ProfileMixin

import factory
from apps.api.tokens import encode_token
from apps.users.models import ProfileMixin, User
from apps.users.types import UserModelType
from django.db.models.signals import post_save
from factory import fuzzy
from apps.users.models import User

from faker import Faker
from faker.providers import internet, misc
from django.db.models.signals import post_save
from apps.api.tokens import encode_token
from apps.users.types import UserModelType
import logging

faker = Faker()
faker.add_provider(internet)
Expand Down
15 changes: 0 additions & 15 deletions core/tests/users/test_models.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
from apps.users.models import (
User,
UserBasic,
UserPremium,
Roles,
Friendship,
)
from tests.users.factories import (
UserFactory,
UserBasicFactory,
UserPremiumFactory,
RolesFactory,
FriendshipFactory,
)
import pytest
from apps.api.tokens import encode_token


@pytest.mark.django_db
Expand Down
1 change: 0 additions & 1 deletion core/tests/users/test_users.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

2 changes: 1 addition & 1 deletion core/tests/users/test_views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from datetime import datetime, timedelta
from uuid import uuid4

from django.urls import reverse
import pytest
from django.contrib.auth.hashers import check_password, make_password
from django.urls import reverse

pytestmark = pytest.mark.django_db

Expand Down
Loading
Loading