Skip to content

Commit

Permalink
fix: fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 committed Sep 20, 2023
1 parent 25ef3e7 commit bd2c82a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
11 changes: 9 additions & 2 deletions app/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations

import json
from typing import Annotated

Expand All @@ -8,8 +9,14 @@
from app.config import CONFIG
from app.models.product import Product
from app.models.request import AdvancedSearchRequest, AutocompleteRequest
from app.utils import connection, constants, dict_utils, query_utils, response
from app.utils import get_logger
from app.utils import (
connection,
constants,
dict_utils,
get_logger,
query_utils,
response,
)

logger = get_logger()

Expand Down
2 changes: 1 addition & 1 deletion app/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ def import_data(
"""Import data into Elasticsearch."""
import time

from app.cli.perform_import import perform_import
from app.config import CONFIG
from app.utils import get_logger
from app.cli.perform_import import perform_import

logger = get_logger()

Expand Down
3 changes: 1 addition & 2 deletions app/cli/perform_import.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path
import time
from datetime import datetime
from multiprocessing import Pool
from pathlib import Path

import tqdm
from elasticsearch.helpers import bulk, parallel_bulk
Expand All @@ -13,7 +13,6 @@
from app.utils import connection, constants, get_logger
from app.utils.io import jsonl_iter


logger = get_logger(__name__)


Expand Down
6 changes: 5 additions & 1 deletion app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ class FieldConfig(BaseModel):
def multi_should_be_used_for_selected_type_only(self):
"""Validator that checks that `multi` flag is only True for fields
with specific types."""
if self.type not in (FieldType.keyword, FieldType.text, FieldType.double, FieldType.date) and self.multi:
if (
self.type
not in (FieldType.keyword, FieldType.text, FieldType.double, FieldType.date)
and self.multi
):
raise ValueError(f"multi=True is not compatible with type={self.type}")
return self

Expand Down
1 change: 1 addition & 0 deletions app/dsl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Iterable

from elasticsearch_dsl import Date, Double, Keyword, Object, Text, analyzer

from app.config import FieldConfig, FieldType
Expand Down

0 comments on commit bd2c82a

Please sign in to comment.