forked from OSGeo/grass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply Black to grass package, use Python 3 style everywhere (OSGeo#1382)
This applies Black 20.8b1 formatting to grass Python package and all related tests. ctypes is not formatted by Black and two additional files are ignored because of bug in Black which breaks strings with escape sequence for tab. This adds pyproject.toml file with Black configuration for the project. In the CI, instead of mutliple Black runs, just run once for the whole tree and ignore directories which are not formatted yet. Black is very fast (so no need for multiple job) and only one configuration is needed (unlike Flake8) Newly, only Python 3 versions are specified as targets for Black, so also string literals starting with u (Python 2) are replaced by simple strings. This also applies Python 3 targeted Black to already formatted code. This replaces unicode literals (Python 2) by plain Python 3 strings and adds commas to kwargs in function calls. Update Flake8 config for use with Black. Enable Flake8 whitespace checks and fix remaining issues not touched by Black. Ignore many E226 in images2gif.py which is now ignored by Black. Enable long line warning in Flake8. Fix or ignore lines not fixed by Black.
- Loading branch information
1 parent
981a6db
commit 1aab3bb
Showing
191 changed files
with
23,287 additions
and
17,267 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
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,39 @@ | ||
[tool.black] | ||
line-length = 88 | ||
target-version = ['py36', 'py37', 'py38'] | ||
include = '\.pyi?$' | ||
exclude = ''' | ||
( | ||
# exclude directories in the root of the project | ||
/( | ||
\.eggs | ||
| \.git | ||
| \.hg | ||
| \.mypy_cache | ||
| \.tox | ||
| \.venv | ||
| _build | ||
| buck-out | ||
| build | ||
| bin\. | ||
| dist\. | ||
)/ | ||
| python/grass/ctypes | ||
# Bug in Black related to tab escape prevents these from being formatted correctly. | ||
# https://github.com/psf/black/issues/1970 | ||
| python/grass/imaging/images2gif.py | ||
| python/grass/pygrass/raster/category.py | ||
# Directories and files not yet under Black | ||
| db | ||
| doc | ||
| general | ||
| gui | ||
| imagery | ||
| lib/gis | ||
| temporal | ||
| raster | ||
| vector | ||
| docker/testdata/test_grass_session.py | ||
| display/d.mon/render_cmd.py | ||
) | ||
''' |
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
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
Oops, something went wrong.