From 8d945e9010115ad03897a7322cba38f02eda03e6 Mon Sep 17 00:00:00 2001 From: DonHaul Date: Tue, 8 Oct 2024 13:45:58 +0200 Subject: [PATCH] its a test --- .pre-commit-config.yaml | 17 +++++++++++++++++ Dockerfile | 2 +- refextract/documents/text.py | 2 +- refextract/references/regexs.py | 1 - 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..65f0573 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: name-tests-test + args: [ --pytest-test-first ] + exclude: '^(?!factories/)' + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.5.6 + hooks: + - id: ruff + args: [ --fix] diff --git a/Dockerfile b/Dockerfile index 574e1a9..9cb40f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,6 @@ FROM python:3.8 RUN apt update && apt install poppler-utils -y COPY setup.py setup.cfg README.rst ./ COPY refextract refextract/ -RUN python setup.py install +RUN python setup.py install ENV PROMETHEUS_MULTIPROC_DIR='/tmp' ENTRYPOINT exec gunicorn -b :5000 --access-logfile - --error-logfile - refextract.app:app --timeout 650 diff --git a/refextract/documents/text.py b/refextract/documents/text.py index c8022fe..cd6347d 100644 --- a/refextract/documents/text.py +++ b/refextract/documents/text.py @@ -429,7 +429,7 @@ def check_boundary_lines_similar(l_1, l_2): @return: (int) 1/0. """ num_matches = 0 - if (type(l_1) != list) or (type(l_2) != list) or (len(l_1) != len(l_2)): + if not isinstance(l_1,list) or not isinstance(l_2,list) or (len(l_1) != len(l_2)): # these 'boundaries' are not similar return 0 diff --git a/refextract/references/regexs.py b/refextract/references/regexs.py index d7e10de..26d7593 100644 --- a/refextract/references/regexs.py +++ b/refextract/references/regexs.py @@ -193,7 +193,6 @@ def compute_pos_patterns(patterns): r"quan-ph": "quant-ph", r"nlin-cd": "nlin.cd", r"math-sp": "math.sp", - r"atro-ph": "astro-ph", r"ast-ph": "astro-ph", r"asyro-ph": "astro-ph", r"aastro-ph": "astro-ph",