Skip to content

Commit

Permalink
fixed linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jarno-knaw committed Jul 23, 2024
1 parent 7ec3bd2 commit f4bdfe0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/import/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This is a test import script which imports data from zipped
Usenet news files.
"""
from elasticsearch.helpers import BulkIndexError

import os
import sys
Expand All @@ -14,6 +13,7 @@
import concurrent.futures
from article import Article
from elasticsearch import Elasticsearch, helpers
from elasticsearch.helpers import BulkIndexError
import yaml


Expand Down
5 changes: 5 additions & 0 deletions src/service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@

@app.after_request
def after_request(response):
"""
Add CORS headers.
:param response:
:return:
"""
response.headers["Access-Control-Allow-Origin"] = "*"
response.headers["Access-Control-Allow-Headers"] = "*"
response.headers["Access-Control-Allow-Methods"] = "POST, GET, OPTIONS"
Expand Down
8 changes: 4 additions & 4 deletions src/service/elastic_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
Contains methods for finding articles.
"""

import math
import yaml
from elasticsearch import Elasticsearch
import math
from werkzeug.exceptions import NotFound


Expand Down Expand Up @@ -210,8 +210,8 @@ def get_min_max(self, fields):
)['aggregations']

for key, value in response.items():
type, field = key.split('-')
tmp[field][type] = value['value']
agg_type, field = key.split('-')
tmp[field][agg_type] = value['value']

return tmp

Expand Down Expand Up @@ -258,7 +258,7 @@ def get_facets(self):
what facets are available.
:return:
"""
with open("fields.yaml", 'r') as stream:
with open("fields.yaml", 'r', encoding='utf-8') as stream:
data = yaml.safe_load(stream)
tmp = {}
number_fields = []
Expand Down

0 comments on commit f4bdfe0

Please sign in to comment.