Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
search: linted files
Browse files Browse the repository at this point in the history
  • Loading branch information
DonHaul committed Jun 7, 2024
1 parent 91a9db3 commit 828d794
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .envs/docker/.django
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ CELERY_RESULT_BACKEND=redis://redis:6379/2
CELERY_FLOWER_USER=debug
CELERY_FLOWER_PASSWORD=debug

#OpenSearch
# OpenSearch
OPENSEARCH_HOST=opensearch:9200
OPENSEARCH_INDEX_PREFIX=backoffice-backend-local
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ repos:
rev: "3.9.2"
hooks:
- id: flake8
args: ["--config=.flake8"]
args: ["--config=setup.cfg"]
5 changes: 2 additions & 3 deletions backoffice/utils/pagination.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

#from django_elasticsearch_dsl_drf.pagination import QueryFriendlyPageNumberPagination
from django_elasticsearch_dsl_drf.pagination import QueryFriendlyPageNumberPagination
from rest_framework.pagination import PageNumberPagination


Expand All @@ -9,7 +8,7 @@ class StandardResultsSetPagination(PageNumberPagination):
max_page_size = 100


class OSStandardResultsSetPagination(PageNumberPagination):
class OSStandardResultsSetPagination(QueryFriendlyPageNumberPagination):
page_size = 10
page_size_query_param = "page_size"
max_page_size = 100
3 changes: 2 additions & 1 deletion backoffice/workflows/api/serializers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from rest_framework import serializers
from django_elasticsearch_dsl_drf.serializers import DocumentSerializer
from rest_framework import serializers

from backoffice.workflows.documents import WorkflowDocument
from backoffice.workflows.models import Workflow, WorkflowTicket
Expand All @@ -16,6 +16,7 @@ class Meta:
model = WorkflowTicket
fields = "__all__"


class WorkflowDocumentSerializer(DocumentSerializer):
class Meta:
document = WorkflowDocument
Expand Down
9 changes: 5 additions & 4 deletions backoffice/workflows/api/views.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from django.shortcuts import get_object_or_404
from django_elasticsearch_dsl_drf.viewsets import BaseDocumentViewSet
from rest_framework import status, viewsets
from rest_framework.response import Response
from django_elasticsearch_dsl_drf.viewsets import BaseDocumentViewSet

from backoffice.workflows.models import Workflow, WorkflowTicket
from backoffice.workflows.documents import WorkflowDocument
from backoffice.utils.pagination import OSStandardResultsSetPagination
from .serializers import WorkflowSerializer, WorkflowTicketSerializer, WorkflowDocumentSerializer
from backoffice.workflows.documents import WorkflowDocument
from backoffice.workflows.models import Workflow, WorkflowTicket

from .serializers import WorkflowDocumentSerializer, WorkflowSerializer, WorkflowTicketSerializer


class WorkflowViewSet(viewsets.ModelViewSet):
Expand Down
6 changes: 2 additions & 4 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import platform
from pathlib import Path

from opensearch_dsl import connections
import dj_database_url
import environ
from opensearch_dsl import connections

BASE_DIR = Path(__file__).resolve(strict=True).parent.parent.parent
# backoffice/
Expand Down Expand Up @@ -100,7 +100,7 @@
"allauth.socialaccount.providers.orcid",
"django_prometheus",
"django_opensearch_dsl",
"django_elasticsearch_dsl_drf"
"django_elasticsearch_dsl_drf",
]

LOCAL_APPS = ["backoffice.users", "backoffice.workflows", "backoffice.management"]
Expand Down Expand Up @@ -373,8 +373,6 @@
}




# Opensearch
# ------------------------------------------------------------------------------
# Name of the Opensearch index
Expand Down
2 changes: 1 addition & 1 deletion config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
default="uBCAZjYhsVU3Zg8k96GM2c0GqgnTHyj0L3UhNQd4kQTktLyFztesAqb81jucXSMY",
)
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1", "host.docker.internal"]
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1"]

# CACHES
# ------------------------------------------------------------------------------
Expand Down
8 changes: 5 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
# https://github.com/PyCQA/flake8/issues/234
# https://github.com/PyCQA/pycodestyle/issues/813
[flake8]
max-line-length = 119
# E501 black takes care of the line size
max-line-length = 88
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv,.venv
extend-ignore = E203
ignore = D401,W503,E501,E265,E203
max-complexity = 15

[pycodestyle]
max-line-length = 119
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv,.venv
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv,.venv

0 comments on commit 828d794

Please sign in to comment.