Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/flask-gte-1.1.2-and-lt-4.0.0
Browse files Browse the repository at this point in the history
* main:
  drop dark theme
  add bool check back to fix bools being instances of int
  add pylint ignore
  git ignore flakeheaven cache
  autoformatting
  simplify type check code
  fix type ignore
  remove outdated type ignore
  update safety cli option for version 3
  [pre-commit.ci] auto fixes from pre-commit.com hooks
  [pre-commit.ci] pre-commit autoupdate
  • Loading branch information
Cielquan committed Mar 3, 2024
2 parents 346decc + 925209e commit 3d1028f
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 32 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,5 @@ docs/source/autoapidoc


poetry.lock

.flakeheaven_cache
18 changes: 9 additions & 9 deletions .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@
"MD003": "atx", // heading-style
"MD004": {
// ul-style
"style": "dash"
"style": "dash",
},
"MD013": {
// line-length
"line_length": 100
"line_length": 100,
},
"MD014": false, // commands-show-output
"MD024": {
// no-duplicate-heading
"siblings_only": true
"siblings_only": true,
},
"MD035": {
// hr-style
"style": "---"
"style": "---",
},
"MD048": {
// code-fence-style
"style": "backtick"
"style": "backtick",
},
"MD049": {
// emphasis-style
"style": "underscore"
"style": "underscore",
},
"MD050": {
// strong-style
"style": "asterisk"
}
}
"style": "asterisk",
},
},
}
32 changes: 16 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:

# file checking out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9 # frozen: v4.4.0
rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
hooks:
- id: check-case-conflict
- id: check-shebang-scripts-are-executable
Expand All @@ -36,10 +36,10 @@ repos:

# safety - python dependency vulnerability checker
- repo: https://github.com/Lucas-C/pre-commit-hooks-safety
rev: a4a1eb373d8e809534a46855a58be427a0a29219 # frozen: v1.3.1
rev: 3f01891d76160f03e9134ef025fb1eb1d10c85a2 # frozen: v1.3.3
hooks:
- id: python-safety-dependencies-check
args: ["--disable-telemetry", "--full-report", "--ignore=51457"]
args: ["--disable-optional-telemetry", "--full-report", "--ignore=51457"]
files: pyproject.toml
exclude: testing

Expand All @@ -55,27 +55,27 @@ repos:

# pyupgrade - upgrade old syntax to new
- repo: https://github.com/asottile/pyupgrade
rev: 01cee377ba3a5264c7fbe7b6beae7b575f764dc3 # frozen: v3.3.1
rev: df17dfa3911b81b4a27190b0eea5b1debc7ffa0a # frozen: v3.15.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]

# isort - sort imports
- repo: https://github.com/PyCQA/isort
rev: dbf82f2dd09ae41d9355bcd7ab69187a19e6bf2f # frozen: 5.12.0
rev: c235f5e450b4b84e58d114ed4c589cbf454175a3 # frozen: 5.13.2
hooks:
- id: isort

# black - python formatter
- repo: https://github.com/psf/black
rev: bf7a16254ec96b084a6caf3d435ec18f0f245cc7 # frozen: 23.3.0
rev: 6fdf8a4af28071ed1d079c01122b34c5d587207a # frozen: 24.2.0
hooks:
- id: black
args: ["--safe"]

# blacken-docs - black for python code in docs (rst/md/tex)
- repo: https://github.com/asottile/blacken-docs
rev: 1238e1d8f03e96a7ed9ad44937ea4348eb6b11b8 # frozen: 1.13.0
rev: 960ead214cd1184149d366c6d27ca6c369ce46b6 # frozen: 1.16.0
hooks:
- id: blacken-docs
exclude: testing|tests
Expand All @@ -86,7 +86,7 @@ repos:

# prettier - multi formatter
- repo: https://github.com/pre-commit/mirrors-prettier
rev: 6fd1ced85fc139abd7f5ab4f3d78dab37592cd5e # frozen: v3.0.0-alpha.9-for-vscode
rev: f12edd9c7be1c20cfa42420fd0e6df71e42b51ea # frozen: v4.0.0-alpha.8
hooks:
- id: prettier

Expand Down Expand Up @@ -117,7 +117,7 @@ repos:

# code unspecific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9 # frozen: v4.4.0
rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
hooks:
- id: end-of-file-fixer
stages: [commit]
Expand Down Expand Up @@ -147,7 +147,7 @@ repos:

# code unspecific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9 # frozen: v4.4.0
rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
hooks:
- id: check-merge-conflict
- id: detect-private-key
Expand All @@ -158,7 +158,7 @@ repos:

# python specific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9 # frozen: v4.4.0
rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
hooks:
- id: debug-statements
- id: fix-encoding-pragma
Expand Down Expand Up @@ -212,7 +212,7 @@ repos:

# poetry - python dependency management
- repo: https://github.com/Cielquan/mirrors-poetry
rev: c94fcaa1d73e0c66f221e2e9ffc0d85f3c04e5ed # frozen: 1.4.2
rev: 41ef89aac1c244b9592952e5624689909ddadbb7 # frozen: 1.7.1
hooks:
- id: poetry-check

Expand All @@ -222,7 +222,7 @@ repos:

# rstcheck - rst file checker
- repo: https://github.com/rstcheck/rstcheck
rev: 165c37523acb08cc649f44d378c80266ce451c2a # frozen: v6.1.2
rev: 445861c31d8134562e723d77115721038de2e687 # frozen: v6.2.0
hooks:
- id: rstcheck
args: ["--config", "pyproject.toml"]
Expand All @@ -235,7 +235,7 @@ repos:

# markdownlint - md file checker
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: e54fbe250d287fd6f09363395343887a999963c5 # frozen: v0.7.0
rev: 82c791e94c2e2ab2119437d61c722c8e0c20d6c9 # frozen: v0.12.1
hooks:
- id: markdownlint-cli2

Expand All @@ -245,13 +245,13 @@ repos:

# JSON specific out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9 # frozen: v4.4.0
rev: c4a0b883114b00d8d76b479c820ce7950211c99b # frozen: v4.5.0
hooks:
- id: check-toml
- id: check-yaml

# yamllint - yaml linter
- repo: https://github.com/adrienverge/yamllint
rev: 98f2281f56be5503f3851e74556e1122fc18b2a8 # frozen: v1.31.0
rev: 81e9f98ffd059efe8aa9c1b1a42e5cce61b640c6 # frozen: v1.35.1
hooks:
- id: yamllint
3 changes: 2 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Configuration file for the Sphinx documentation builder."""

import os
import re
import shutil
Expand All @@ -8,7 +9,7 @@
from pathlib import Path

import sphinx.ext.autodoc
import sphinx_rtd_theme # type: ignore[import]
import sphinx_rtd_theme # type: ignore[import-untyped]
from sphinx.application import Sphinx

from formelsammlung import __author__, __gh_repository_link__, __project__, __version__
Expand Down
1 change: 1 addition & 0 deletions prep_release.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Script for preparing the repo for a new release."""

import argparse
import re
import subprocess # noqa: S404
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ sphinx = { version = ">=6", optional = true }
sphinx-autobuild = { version = "2021.3.14", optional = true }
m2r2 = { version = ">=0.3.2", optional = true }
# TODO:#i# wait for fix: https://github.com/MrDogeBro/sphinx_rtd_dark_mode/issues/28
sphinx-rtd-theme = { version = "<1", optional = true }
sphinx-rtd-dark-mode = {version = "^1.2.4", optional = true}
sphinx-rtd-theme = { version = "^1", optional = true }
sphinx-autodoc-typehints = { version = ">=1.15", optional = true }
sphinxcontrib-apidoc = { version = ">=0.3", optional = true }
sphinxcontrib-spelling = { version = ">=7.3", optional = true }
Expand Down
3 changes: 2 additions & 1 deletion src/formelsammlung/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
"""Formelsammlung package."""

from typing import List


try:
from importlib.metadata import metadata as get_md
except ModuleNotFoundError: # pragma: py-gte-38
from importlib_metadata import metadata as get_md # type: ignore[assignment]
from importlib_metadata import metadata as get_md


def _get_gh_repo_link(metadata_list: List[str]) -> str:
Expand Down
1 change: 1 addition & 0 deletions src/formelsammlung/env_exe_runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Call tools from tox environments."""

import subprocess # noqa: S404
import sys
from pathlib import Path
Expand Down
3 changes: 2 additions & 1 deletion src/formelsammlung/envvar.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Get environment variables and transform their type."""

import os
import re
from typing import Any, Iterable, NoReturn, Optional, Pattern, Set, Union
Expand All @@ -14,7 +15,7 @@
FLOAT_REGEX = r"^[\d]+(_\d+)*\.\d+$"


class EnvVarGetter: # pylint: disable=too-many-instance-attributes
class EnvVarGetter: # pylint: disable=too-many-instance-attributes,too-many-arguments
"""Class containing the config for :meth:`EnvVarGetter.getenv_typed`."""

def __init__(
Expand Down
1 change: 1 addition & 0 deletions src/formelsammlung/flask_sphinx_docs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Serve sphinx docs in your flask app."""

from pathlib import Path
from typing import Optional

Expand Down
5 changes: 3 additions & 2 deletions src/formelsammlung/strcalc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Calculate arithmetic expressions from strings."""

import ast
import operator
import sys
Expand Down Expand Up @@ -43,7 +44,7 @@ def visit_Constant( # noqa: N802
) -> NumberType: # pragma: py-lt-38
"""Handle `Constant` nodes."""
ret_val = node.value
if isinstance(ret_val, bool) or not isinstance(ret_val, NUMBERTYPES):
if not isinstance(ret_val, NUMBERTYPES) or isinstance(ret_val, bool):
raise ValueError(f"Extracted `Constant` is not of type {NumberType}.")
return ret_val

Expand All @@ -60,7 +61,7 @@ def visit_Expr(self, node: ast.Expr) -> NumberType: # noqa: N802
# safety hurdle from visist_Constant for backwards compatibility
if sys.version_info[0:2] < (3, 8): # pragma: py-gte-38
ret_val = self.visit(node.value)
if isinstance(ret_val, bool) or not isinstance(ret_val, NUMBERTYPES):
if not isinstance(ret_val, NUMBERTYPES) or isinstance(ret_val, bool):
raise ValueError(f"`Expr` did not return a {NumberType}.")
return ret_val

Expand Down
1 change: 1 addition & 0 deletions src/formelsammlung/venv_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utility function for working with virtual environments."""

import contextlib
import os
import shutil
Expand Down
1 change: 1 addition & 0 deletions tests/test_env_exe_runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for `tox_env_exe_runner` module."""

# pylint: disable=protected-access
import os
import subprocess # noqa: S404
Expand Down
1 change: 1 addition & 0 deletions tests/test_envvar.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for `envvar` module."""

# pylint: disable=protected-access
import re
from decimal import Decimal
Expand Down
1 change: 1 addition & 0 deletions tests/test_flask_sphinx_docs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for `flask_sphinx_docs` module."""

# pylint: disable=W0212
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions tests/test_strcalc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for `strcalc` module."""

import random
from typing import Union

Expand Down
1 change: 1 addition & 0 deletions tests/test_venv_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for `venv_utils` module."""

import os
import shutil
import sys
Expand Down

0 comments on commit 3d1028f

Please sign in to comment.