Skip to content

Commit

Permalink
Merge pull request #1 from DaBeIDS/david_20240129
Browse files Browse the repository at this point in the history
Fixed additional linting warnings
  • Loading branch information
DaBeIDS authored Jan 29, 2024
2 parents 569675c + 8fb0859 commit 243dc44
Show file tree
Hide file tree
Showing 15 changed files with 428 additions and 13,975 deletions.
71 changes: 38 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ exclude: |
dco-signoffs/$
)$
repos:

# - repo: https://gitlab.com/vojko.pribudic/pre-commit-update
Expand All @@ -20,15 +21,16 @@ repos:
# - id: pre-commit-update
# args: [--dry-run]

- repo: local
hooks:
- id: tomllint
name: "Script: scripts/tomllint.sh"
language: script
# pass_filenames: false
files: \^*.toml
types: [file]
entry: scripts/tomllint.sh .
# WINDOWS ISSUE: On Windows machine this has to be commented out
# - repo: local
# hooks:
# - id: tomllint
# name: "Script: scripts/tomllint.sh"
# language: script
# # pass_filenames: false
# files: \^*.toml
# types: [file]
# entry: scripts/tomllint.sh .

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand Down Expand Up @@ -58,20 +60,22 @@ repos:
- id: requirements-txt-fixer
- id: trailing-whitespace

# Autoformat: YAML, JSON, Markdown, etc.
- repo: https://github.com/prettier/pre-commit
rev: v2.2.0
hooks:
- id: prettier
args:
['--ignore-unknown']

# Lint: Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.38.0
hooks:
- id: markdownlint
args: ["--fix"]
# Currently facing proxy issue with that. Is not a general issue.
# # Autoformat: YAML, JSON, Markdown, etc.
# - repo: https://github.com/prettier/pre-commit
# rev: v2.2.0
# hooks:
# - id: prettier
# args:
# ['--ignore-unknown']

# Currently facing proxy issue with that. Is not a general issue.
# # Lint: Markdown
# - repo: https://github.com/igorshubovych/markdownlint-cli
# rev: v0.38.0
# hooks:
# - id: markdownlint
# args: ["--fix --proxy={env:HTTP_PROXY}'"]

# - repo: https://github.com/asottile/pyupgrade
# rev: v3.15.0
Expand Down Expand Up @@ -124,23 +128,24 @@ repos:
- id: isort
args: ["--profile", "black"]

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.33.0
hooks:
- id: yamllint
args: [--strict]
# Currently facing proxy issue with that. Is not a general issue.
# - repo: https://github.com/adrienverge/yamllint.git
# rev: v1.33.0
# hooks:
# - id: yamllint
# args: ['--strict --proxy={{env:HTTP_PROXY}}']

- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: v1.6.26.11
hooks:
- id: actionlint

# If like to embrace black styles even in the docs:
# - repo: https://github.com/asottile/blacken-docs
# rev: v1.13.0
# hooks:
# - id: blacken-docs
# additional_dependencies: [black]
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
additional_dependencies: [black]

- repo: https://github.com/pycqa/flake8
rev: "6.1.0"
Expand Down
18 changes: 12 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,20 @@ Notes

For adding new dependencies use pdm. First install via pip:

.. code-block:: python
.. code-block:: shell
$ pip install pdm
And then you could add new packages via pdm add. For example numpy via:

.. code-block:: shell
$ pdm add numpy
pip install pdm
pdm add <new_package>==<version>
For running linting tools just to the following:

.. code-block:: python
.. code-block:: shell
pip install tox
tox -e lint
$ pip install tox
$ tox -e lint
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import os
import shutil
import sys
from typing import Dict

# -- Path setup --------------------------------------------------------------

Expand Down Expand Up @@ -231,7 +232,7 @@

# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
latex_elements: Dict[str, str] = {
# The paper size ("letterpaper" or "a4paper").
# "papersize": "letterpaper",
# The font size ("10pt", "11pt" or "12pt").
Expand Down
10 changes: 5 additions & 5 deletions src/demo/extraction_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ def specify_root_logger(log_level: str):
"""
formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")

log_level = log_levels[log_level.upper()]
log_level_value = log_levels[log_level.upper()]

handler = logging.StreamHandler()
handler.setLevel(log_level)
handler.setLevel(log_level_value)
handler.setFormatter(formatter)

logging.root.handlers = [handler]
logging.root.setLevel(log_level)
logging.root.setLevel(log_level_value)


def extract_main(
Expand Down Expand Up @@ -82,7 +82,7 @@ def extract_main(
if not extractor.check_for_skip_files(input_file_path, output_file_path):
extractor.extract(input_file_path=input_file_path)

if extractor.get_settings()["store_to_file"]:
if extractor.get_settings()["store_to_file"] and output_file_path is not None:
extractor.save_extraction_to_file(output_file_path=output_file_path)

return extractor.get_extractions()
Expand All @@ -98,7 +98,7 @@ def extract_main(

input_file_path_main = input_folder / file_name
output_file_path_main = output_folder / input_file_path_main.with_suffix(".json").name
settings_main = {"skip_extracted_files": False, "store_to_file": False}
settings_main: Optional[Dict[str, Union[str, bool]]] = {"skip_extracted_files": False, "store_to_file": False}

_logger.info(f"Input file path is :\n {input_file_path_main}.")
extraction_dict = extract_main(
Expand Down
Loading

0 comments on commit 243dc44

Please sign in to comment.