Skip to content

Commit

Permalink
fix(typehint): use redundant alias imports for mypy
Browse files Browse the repository at this point in the history
This commit also better aligns the repo with `pyvista/CONTRIBUTING.md`.

Fixes Issue #163
  • Loading branch information
adamgranthendry committed Jun 26, 2022
1 parent 9334f9d commit faeeaa8
Show file tree
Hide file tree
Showing 23 changed files with 915 additions and 675 deletions.
4 changes: 4 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[codespell]
skip = *.pyc,*.txt,*.gif,*.png,*.jpg,*.ply,*.vtk,*.vti,*.vtu,*.js,*.html,*.doctree,*.ttf,*.woff,*.woff2,*.eot,*.mp4,*.inv,*.pickle,*.ipynb,flycheck*,./.git/*,./.hypothesis/*,*.yml,doc/_build/*,./doc/images/*,./dist/*,*~,.hypothesis*,./doc/examples/*,*.mypy_cache/*,*cover,./tests/tinypages/_build/*,*/_autosummary/*
ignore-words-list = lod,byteorder,flem,parm,doubleclick,revered
quiet-level = 3
21 changes: 21 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[flake8]
exclude = .git,__pycache__,build,dist,doc/examples,doc/_build,pyvista/**/__init__.py,pyvista/__init__.py,.venv,.venv/**/*.py, .venv/**/*.pyi
ignore =
# whitespace before ':'
E203,
# line break before binary operator
W503,
# line length too long
E501,
# do not assign a lambda expression, use a def
E731,
# too many leading '#' for block comment
E266,
# ambiguous variable name
E741,
# module level import not at top of file
E402,
# Quotes (temporary)
Q0,
# bare excepts (temporary)
B001, E722
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,11 @@ docs/external_examples.rst

# vim
*.swp

<<<<<<< Updated upstream
# venv
.venv
=======
# virtual environments
.venv/
>>>>>>> Stashed changes
6 changes: 0 additions & 6 deletions .isort.cfg

This file was deleted.

51 changes: 51 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort

- repo: https://gitlab.com/PyCQA/flake8
rev: 3.9.2
hooks:
- id: flake8
additional_dependencies: [
"flake8-black==0.3.2",
"flake8-isort==4.1.1",
"flake8-quotes==3.3.1",
]

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
args: [
"doc examples examples_flask pyvista tests",
"*.py *.rst *.md",
]

- repo: https://github.com/pycqa/pydocstyle
rev: 6.1.1
hooks:
- id: pydocstyle
additional_dependencies: [toml==0.10.2]
files: ^(pyvista/|other/)
exclude: ^pyvista/ext/

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-merge-conflict
- id: debug-statements
- id: no-commit-to-branch
args: [--branch, main]

# this validates our github workflow files
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.15.1
hooks:
- id: check-github-workflows
82 changes: 2 additions & 80 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,86 +60,15 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use "--disable=all --enable=classes
# --disable=W".
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
# Many previous options removed in pylint PR4942
disable=raw-checker-failed,
bad-inline-option,
locally-disabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
deprecated-operator-function,
deprecated-urllib-function,
xreadlines-attribute,
deprecated-sys-function,
exception-escape,
comprehension-escape,
bad-continuation,
arguments-differ,
no-name-in-module,
no-member
Expand Down Expand Up @@ -442,13 +371,6 @@ max-line-length=100
# Maximum number of lines in a module.
max-module-lines=1000

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
Expand Down
141 changes: 141 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"[markdown]": {
"editor.codeActionsOnSave": {
"source.fixAll.markdownlint": true
},
"editor.defaultFormatter": null,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.wordWrap": "bounded",
"editor.wordWrapColumn": 90
},
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"editor.defaultFormatter": "ms-python.python",
"editor.formatOnSave": true,
"files.trimTrailingWhitespace": true
},
"cSpell.allowCompoundWords": true,
"cSpell.dictionaries": [
"python"
],
"cSpell.ignorePaths": [
"*.dll",
"*.html",
"*.css",
"*.json",
"*.git/**",
"**/build/**",
".venv/",
"*.bat"
],
"cSpell.words": [
"autocrlf",
"bdist",
"CICD",
"cobertura",
"deps",
"DICOM",
"docparams",
"docstrings",
"docutils",
"fspath",
"genindex",
"gitlabci",
"GLFM",
"guiqtbot",
"Hendry",
"ipynb",
"iscc",
"isort",
"Kaszynski",
"Kubernetes",
"modindex",
"mypy",
"NSIS",
"nsist",
"numfig",
"pwsh",
"pyinstaller",
"pylint",
"pylintrc",
"pynsist",
"pyproject",
"pyqt",
"pyside",
"pytest",
"pytestqt",
"PYTHONIOENCODING",
"pyvista",
"pyvistaqt",
"pyvistaqtdoc",
"qapp",
"qtbot",
"QTBUG",
"qtpy",
"rcfile",
"recommonmark",
"rgba",
"rsrc",
"sphinxcontrib",
"tada",
"tldr",
"toctree",
"todos",
"venv",
"virtualenv",
"vmtk"
],
"editor.acceptSuggestionOnEnter": "off",
"editor.formatOnSave": false,
"editor.rulers": [
90
],
"editor.tabCompletion": "on",
"esbonio.sphinx.buildDir": "${workspaceFolder}/docs/_build",
"esbonio.sphinx.confDir": "${workspaceFolder}/docs",
"esbonio.sphinx.forceFullBuild": false,
"explorer.compactFolders": false,
"files.exclude": {
"**/.git": false
},
"git-graph.referenceLabels.alignment": "Branches (aligned to the graph) & Tags (on the right)",
"grammarly.files.include": [
"**/README.rst",
"**/CODE_OF_CONDUCT.md",
"**/CONTRIBUTING.md"
],
"markdownlint.config": {
"MD026": false, // Trailing punctuation okay in headers (e.g. emojis)
"MD033": false, // Some HTML is fine
"MD041": false, // Allow non-headings for first line in file
"MD046": false // Allow indented code blocks (M029 errors otherwise)
},
"mypy.dmypyExecutable": "${workspaceFolder}/.venv/Scripts/dmypy.exe",
"powershell.integratedConsole.showOnStartup": false,
"powershell.powerShellDefaultVersion": "PowerShell Core 7 (x64)",
"python.formatting.provider": "black",
"python.linting.flake8Enabled": true,
"python.linting.flake8Path": "${workspaceFolder}/.venv/Scripts/flake8.exe",
"python.linting.mypyArgs": [
"--config-file",
"mypy.ini"
],
"python.linting.mypyEnabled": false,
"python.linting.mypyPath": "${workspaceFolder}/.venv/Scripts/mypy.exe",
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "${workspaceFolder}/.venv/Scripts/pylint.exe",
"python.terminal.activateEnvInCurrentTerminal": true,
"python.terminal.activateEnvironment": true,
"python.testing.pytestArgs": [
"${workspaceFolder}/tests"
],
"python.testing.pytestEnabled": true,
"python.testing.pytestPath": "${workspaceFolder}/.venv/Scripts/pytest.exe",
"restructuredtext.linter.rstcheck.executablePath": "${workspaceFolder}/.venv/Scripts/rstcheck.exe",
"trailing-spaces.syntaxIgnore": [
"markdown"
]
}
Loading

0 comments on commit faeeaa8

Please sign in to comment.