From 4cbc8550d64bc4c3b92998662f125b9c242e4dbe Mon Sep 17 00:00:00 2001 From: ZanSara Date: Wed, 11 Jan 2023 20:08:19 +0100 Subject: [PATCH] chore: enable `trailing-whitespace` and cleanup (#3847) * enable trailing-whitespace * remove trailing whitespace on rest api too --- haystack/modeling/visual.py | 58 +++++++++++++------------- haystack/nodes/file_converter/image.py | 6 +-- haystack/nodes/file_converter/pdf.py | 6 +-- pyproject.toml | 1 - rest_api/rest_api/application.py | 6 +-- 5 files changed, 37 insertions(+), 40 deletions(-) diff --git a/haystack/modeling/visual.py b/haystack/modeling/visual.py index d2084bdc5..8368f38dc 100644 --- a/haystack/modeling/visual.py +++ b/haystack/modeling/visual.py @@ -1,50 +1,50 @@ FLOWERS = r""" - - vVVVv vVVVv + + vVVVv vVVVv (___) vVVVv (___) vVVVv ~Y~ (___) ~Y~ (___) \| \~Y~/ \| \~Y~/ \\|// \\|// \\|// \\|// - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ """ SAMPLE = r""" - .--. _____ _ - .'_\/_'. / ____| | | - '. /\ .' | (___ __ _ _ __ ___ _ __ | | ___ - "||" \___ \ / _` | '_ ` _ \| '_ \| |/ _ \ + .--. _____ _ + .'_\/_'. / ____| | | + '. /\ .' | (___ __ _ _ __ ___ _ __ | | ___ + "||" \___ \ / _` | '_ ` _ \| '_ \| |/ _ \ || /\ ____) | (_| | | | | | | |_) | | __/ /\ ||//\) |_____/ \__,_|_| |_| |_| .__/|_|\___| - (/\\||/ |_| -______\||/___________________________________________ + (/\\||/ |_| +______\||/___________________________________________ """ FENCE = r""" - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_ -| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |- | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | _| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_ -| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |- - |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| + |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, """ -TRACTOR_SMALL = r""" +TRACTOR_SMALL = r""" ______ |o | ! __ |:`_|---'-. - |__|______.-/ _ \-----.| - (o)(o)------'\ _ / ( ) + |__|______.-/ _ \-----.| + (o)(o)------'\ _ / ( ) """ -TRACTOR_WITH_SILO_LINE = r""" +TRACTOR_WITH_SILO_LINE = r""" ____ /____\ ______ | | - |o | ! | | + |o | ! | | __ |:`_|---'-. | | |__|______.-/ _ \-----.| |______| (o)(o)------'\ _ / ( ) | | @@ -81,23 +81,23 @@ BUSH_SEP = r"""\\|// \\|// \\|// \\|// \\|// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^""" WATERING_CAN = r""" - ______ - _ ,',----.`. -'.`-. .-' '----. || - `.`-'--------| ;; - `.|--------|// - \ / - '--------' + ______ + _ ,',----.`. +'.`-. .-' '----. || + `.`-'--------| ;; + `.|--------|// + \ / + '--------' """ -WORKER_M = r""" 0 -/|\ +WORKER_M = r""" 0 # pylint: disable=trailing-whitespace +/|\ /'\ """ -WORKER_F = r""" 0 -/w\ +WORKER_F = r""" 0 # pylint: disable=trailing-whitespace +/w\ / \ """ -WORKER_X = r""" 0 -/w\ +WORKER_X = r""" 0 # pylint: disable=trailing-whitespace +/w\ /'\ """ diff --git a/haystack/nodes/file_converter/image.py b/haystack/nodes/file_converter/image.py index 7d9eadf12..0d5d69c50 100644 --- a/haystack/nodes/file_converter/image.py +++ b/haystack/nodes/file_converter/image.py @@ -53,13 +53,13 @@ class ImageToTextConverter(BaseConverter): if verify_installation.returncode == 127: raise Exception( """tesseract is not installed. - + Installation on Linux: apt-get install tesseract-ocr libtesseract-dev poppler-utils - + Installation on MacOS: brew install tesseract - + For installing specific language packs check here: https://tesseract-ocr.github.io/tessdoc/Installation.html """ ) diff --git a/haystack/nodes/file_converter/pdf.py b/haystack/nodes/file_converter/pdf.py index a1f3e16b0..3baa1b8d5 100644 --- a/haystack/nodes/file_converter/pdf.py +++ b/haystack/nodes/file_converter/pdf.py @@ -58,14 +58,14 @@ class PDFToTextConverter(BaseConverter): except FileNotFoundError: raise FileNotFoundError( """pdftotext is not installed. It is part of xpdf or poppler-utils software suite. - + Installation on Linux: wget --no-check-certificate https://dl.xpdfreader.com/xpdf-tools-linux-4.04.tar.gz && tar -xvf xpdf-tools-linux-4.04.tar.gz && sudo cp xpdf-tools-linux-4.04/bin64/pdftotext /usr/local/bin - + Installation on MacOS: brew install xpdf - + You can find more details here: https://www.xpdfreader.com """ ) diff --git a/pyproject.toml b/pyproject.toml index 2e1be3c56..d2c726a19 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -277,7 +277,6 @@ disable = [ "f-string-without-interpolation", "abstract-method", "too-many-branches", - "trailing-whitespace", "unspecified-encoding", "unidiomatic-typecheck", "no-name-in-module", diff --git a/rest_api/rest_api/application.py b/rest_api/rest_api/application.py index 3ad672a18..c7921b216 100644 --- a/rest_api/rest_api/application.py +++ b/rest_api/rest_api/application.py @@ -16,10 +16,8 @@ pipelines = get_pipelines() # Unused here, called to init the pipelines early logger.info("Open http://127.0.0.1:8000/docs to see Swagger API Documentation.") logger.info( - """ - Or just try it out directly: curl --request POST --url 'http://127.0.0.1:8000/query' - -H "Content-Type: application/json" --data '{"query": "Who is the father of Arya Stark?"}' - """ + "Or just try it out directly: curl --request POST --url 'http://127.0.0.1:8000/query' " + '-H "Content-Type: application/json" --data \'{"query": "Who is the father of Arya Stark?"}\'' )