From 5fe3363b9bdd7210ccb94bcfc9e748bd6ca01074 Mon Sep 17 00:00:00 2001 From: Remco Date: Mon, 9 Sep 2024 22:15:20 +0200 Subject: [PATCH 1/3] First commit --- main.py | 6 ++++ pre-commit-config.yaml | 66 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 pre-commit-config.yaml diff --git a/main.py b/main.py index e69de29..5c4ab2a 100644 --- a/main.py +++ b/main.py @@ -0,0 +1,6 @@ +import numpy as np + +if __name__ == '__main__': + numbers = [n for n in range(1, 11)] + numbers_array = np.array(numbers) + diff --git a/pre-commit-config.yaml b/pre-commit-config.yaml new file mode 100644 index 0000000..1092bd1 --- /dev/null +++ b/pre-commit-config.yaml @@ -0,0 +1,66 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace # Trailing whitespace checker + - id: end-of-file-fixer # End-of-file newline checker + - id: check-yaml # YAML syntax checker + - id: check-added-large-files # Prevents you from committing large files + - id: check-ast # Python AST checker + - id: check-json # JSON syntax checker + - id: check-xml # XML syntax checker + + - repo: https://github.com/psf/black + rev: 23.12.1 + hooks: + - id: black + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + args: ["--profile", "black"] + - repo: https://github.com/pycqa/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + additional_dependencies: + # source: https://github.com/DmytroLitvinov/awesome-flake8-extensions + # all-in-one plugins + - flake8-bugbear # tries to find bugs in your code + - flake8-simplify # encourages simplification of complex expressions + + # clean code + - flake8-comprehensions # helps you write better list/set/dict comprehensions + - flake8-picky-parentheses # checks for redundant parentheses and alignment of parentheses and brackets + - flake8-return # plugin that checks return values + + # naming + - flake8-builtins # checks for python builtins being used as variables or parameters + - flake8-variables-names # checks for good variable names + - pep8-naming # enforces PEP 8 naming conventions + + # complexity + - flake8-cognitive-complexity # plugin that checks for high cognitive complexity + - flake8-annotations-complexity # enforces complexity limits for function annotations + + # docstrings + - flake8-spellcheck # checks spelling + - flake8-docstrings # docstring conventions + + # imports + - flake8-import-order # enforces a lexicographic ordering of import statements + + # Comments + - flake8-eradicate # enforces the removal of commented out code + + # Annotations + - flake8-black # enforces black formatting + args: + [ + "--max-line-length", + "88", + "--extend-ignore", + "D100, SC200", + "--max-cognitive-complexity", + "3", + ] From 65bcc944476662f343d387536cb8c7d8295f957b Mon Sep 17 00:00:00 2001 From: Remco Date: Tue, 10 Sep 2024 11:43:38 +0200 Subject: [PATCH 2/3] Added the print functionality --- main.py | 6 ++-- pre-commit-config.yaml | 66 ------------------------------------------ 2 files changed, 3 insertions(+), 69 deletions(-) delete mode 100644 pre-commit-config.yaml diff --git a/main.py b/main.py index 5c4ab2a..c7d1488 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,6 @@ import numpy as np -if __name__ == '__main__': - numbers = [n for n in range(1, 11)] +if __name__ == "__main__": + numbers = list(range(1, 11)) numbers_array = np.array(numbers) - + print(numbers_array) diff --git a/pre-commit-config.yaml b/pre-commit-config.yaml deleted file mode 100644 index 1092bd1..0000000 --- a/pre-commit-config.yaml +++ /dev/null @@ -1,66 +0,0 @@ -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 - hooks: - - id: trailing-whitespace # Trailing whitespace checker - - id: end-of-file-fixer # End-of-file newline checker - - id: check-yaml # YAML syntax checker - - id: check-added-large-files # Prevents you from committing large files - - id: check-ast # Python AST checker - - id: check-json # JSON syntax checker - - id: check-xml # XML syntax checker - - - repo: https://github.com/psf/black - rev: 23.12.1 - hooks: - - id: black - - repo: https://github.com/pycqa/isort - rev: 5.13.2 - hooks: - - id: isort - args: ["--profile", "black"] - - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 - hooks: - - id: flake8 - additional_dependencies: - # source: https://github.com/DmytroLitvinov/awesome-flake8-extensions - # all-in-one plugins - - flake8-bugbear # tries to find bugs in your code - - flake8-simplify # encourages simplification of complex expressions - - # clean code - - flake8-comprehensions # helps you write better list/set/dict comprehensions - - flake8-picky-parentheses # checks for redundant parentheses and alignment of parentheses and brackets - - flake8-return # plugin that checks return values - - # naming - - flake8-builtins # checks for python builtins being used as variables or parameters - - flake8-variables-names # checks for good variable names - - pep8-naming # enforces PEP 8 naming conventions - - # complexity - - flake8-cognitive-complexity # plugin that checks for high cognitive complexity - - flake8-annotations-complexity # enforces complexity limits for function annotations - - # docstrings - - flake8-spellcheck # checks spelling - - flake8-docstrings # docstring conventions - - # imports - - flake8-import-order # enforces a lexicographic ordering of import statements - - # Comments - - flake8-eradicate # enforces the removal of commented out code - - # Annotations - - flake8-black # enforces black formatting - args: - [ - "--max-line-length", - "88", - "--extend-ignore", - "D100, SC200", - "--max-cognitive-complexity", - "3", - ] From cbeca5e29c3ee5295505d804b101eab83be3a21d Mon Sep 17 00:00:00 2001 From: Remco Date: Tue, 10 Sep 2024 11:55:27 +0200 Subject: [PATCH 3/3] Added the requirements file --- .pre-commit-config.yaml | 66 +++++++++++++++++++++++++++++++++++++++++ requirements.txt | 1 + 2 files changed, 67 insertions(+) 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..1092bd1 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,66 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace # Trailing whitespace checker + - id: end-of-file-fixer # End-of-file newline checker + - id: check-yaml # YAML syntax checker + - id: check-added-large-files # Prevents you from committing large files + - id: check-ast # Python AST checker + - id: check-json # JSON syntax checker + - id: check-xml # XML syntax checker + + - repo: https://github.com/psf/black + rev: 23.12.1 + hooks: + - id: black + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + args: ["--profile", "black"] + - repo: https://github.com/pycqa/flake8 + rev: 6.1.0 + hooks: + - id: flake8 + additional_dependencies: + # source: https://github.com/DmytroLitvinov/awesome-flake8-extensions + # all-in-one plugins + - flake8-bugbear # tries to find bugs in your code + - flake8-simplify # encourages simplification of complex expressions + + # clean code + - flake8-comprehensions # helps you write better list/set/dict comprehensions + - flake8-picky-parentheses # checks for redundant parentheses and alignment of parentheses and brackets + - flake8-return # plugin that checks return values + + # naming + - flake8-builtins # checks for python builtins being used as variables or parameters + - flake8-variables-names # checks for good variable names + - pep8-naming # enforces PEP 8 naming conventions + + # complexity + - flake8-cognitive-complexity # plugin that checks for high cognitive complexity + - flake8-annotations-complexity # enforces complexity limits for function annotations + + # docstrings + - flake8-spellcheck # checks spelling + - flake8-docstrings # docstring conventions + + # imports + - flake8-import-order # enforces a lexicographic ordering of import statements + + # Comments + - flake8-eradicate # enforces the removal of commented out code + + # Annotations + - flake8-black # enforces black formatting + args: + [ + "--max-line-length", + "88", + "--extend-ignore", + "D100, SC200", + "--max-cognitive-complexity", + "3", + ] diff --git a/requirements.txt b/requirements.txt index e69de29..723ca13 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1 @@ +numpy == 1.26.1