-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port to Python 3.10, bug fixes and code quality imporvements
- Loading branch information
1 parent
3f9beac
commit e46c846
Showing
26 changed files
with
948 additions
and
544 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,3 +132,6 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# Cache | ||
**_cache** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,66 @@ | ||
exclude: '.git|.tox' | ||
exclude: '^docs/|/migrations/' | ||
default_stages: [ commit ] | ||
fail_fast: true | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.4.0 | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-json | ||
- id: check-toml | ||
- id: check-merge-conflict | ||
- id: check-xml | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: check-builtin-literals | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: detect-private-key | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 20.8b1 | ||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v3.7.0 | ||
hooks: | ||
- id: black | ||
- id: pyupgrade | ||
args: [ --py311-plus ] | ||
|
||
- repo: https://github.com/timothycrosley/isort | ||
rev: 5.6.4 | ||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
|
||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: 3.8.4 | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
# Ruff: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.0.280 | ||
hooks: | ||
- id: ruff | ||
args: [ --fix, --exit-non-zero-on-fix ] | ||
types_or: [ python, pyi, jupyter ] | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/PyCQA/bandit | ||
rev: 1.7.5 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: [ flake8-isort ] | ||
- id: bandit | ||
args: [ "-c", "bandit.yaml" ] | ||
|
||
- repo: local | ||
- repo: https://github.com/sourcery-ai/sourcery | ||
# Source: https://docs.sourcery.ai/Guides/Getting-Started/Pre-Commit/ | ||
# https://sourcery.ai/blog/python-best-practices/ | ||
rev: v1.6.0 | ||
hooks: | ||
- id: pytest-check | ||
name: pytest-check | ||
entry: pytest | ||
language: system | ||
pass_filenames: false | ||
always_run: true | ||
- id: sourcery | ||
# only check the files which have changed: does not work on first commit | ||
args: [ --diff=git diff HEAD, --no-summary ] | ||
# args: [ --diff=git diff HEAD, --fix, --no-summary ] | ||
# args: [ --fix, --no-summary ] | ||
|
||
|
||
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date | ||
ci: | ||
autoupdate_schedule: weekly | ||
skip: [ ] | ||
submodules: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#https://docs.sourcery.ai/Reference/Configuration/sourcery-yaml/ | ||
|
||
ignore: | ||
- .git | ||
- venv | ||
- .venv | ||
- env | ||
- .env | ||
- .tox | ||
- node_modules | ||
- vendor | ||
- repository_directory | ||
|
||
rule_settings: | ||
enable: [default] | ||
disable: [] | ||
rule_types: | ||
- refactoring | ||
- suggestion | ||
- comment | ||
python_version: '3.11' | ||
|
||
rules: [] | ||
|
||
metrics: | ||
quality_threshold: 25.0 | ||
|
||
github: | ||
labels: [] | ||
ignore_labels: | ||
- sourcery-ignore | ||
request_review: author | ||
sourcery_branch: sourcery/{base_branch} | ||
|
||
clone_detection: | ||
min_lines: 3 | ||
min_duplicates: 2 | ||
identical_clones_only: false | ||
|
||
proxy: | ||
no_ssl_verify: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# also see pyproject.toml for [tool.bandit] | ||
# https://bandit.readthedocs.io/en/1.7.5/config.html | ||
# exclude = tests,path/to/file | ||
# tests = B201,B301 | ||
|
||
exclude_dirs: [ 'tests/', 'repository_directory/', "tox" ] | ||
tests: [ ] | ||
skips: [ | ||
'B113' # request.get without a timeout | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# YAML copied from: https://realpython.com/python-logging/#other-configuration-methods | ||
version: 1 | ||
formatters: | ||
extended: | ||
format: '%(asctime)-20s :: %(levelname)-8s :: [%(process)d]%(processName)s :: %(threadName)s[%(thread)d] :: %(pathname)s :: %(lineno)d :: %(message)s' | ||
simple: | ||
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' | ||
handlers: | ||
console: | ||
class: logging.StreamHandler | ||
level: DEBUG | ||
formatter: simple | ||
stream: ext://sys.stdout | ||
file_handler: | ||
class: logging.handlers.RotatingFileHandler | ||
level: DEBUG | ||
formatter: extended | ||
filename: info.log | ||
encoding: utf8 | ||
maxBytes: 10000 | ||
backupCount: 10 | ||
mode: a | ||
loggers: | ||
sampleLogger: | ||
level: DEBUG | ||
handlers: [console, file_handler] | ||
propagate: no | ||
root: | ||
level: DEBUG | ||
handlers: [console, file_handler] |
Oops, something went wrong.