[GRASS-git] [OSGeo/grass] 1aab3b: Apply Black to grass package, use Python 3 style e...

Vaclav Petras noreply at github.com
Sat Feb 20 16:31:25 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/OSGeo/grass
  Commit: 1aab3bbcff76c12d422e7dffd9aba8277f91cd86
      https://github.com/OSGeo/grass/commit/1aab3bbcff76c12d422e7dffd9aba8277f91cd86
  Author: Vaclav Petras <wenzeslaus at gmail.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M .github/workflows/black.yml
    M man/sphinx/conf.py
    A pyproject.toml
    M python/grass/.flake8
    M python/grass/__init__.py
    M python/grass/bandref/reader.py
    M python/grass/docs/conf.py
    M python/grass/exceptions/__init__.py
    M python/grass/exceptions/testsuite/test_ScriptError.py
    M python/grass/grassdb/checks.py
    M python/grass/gunittest/case.py
    M python/grass/gunittest/checkers.py
    M python/grass/gunittest/gmodules.py
    M python/grass/gunittest/gutils.py
    M python/grass/gunittest/invoker.py
    M python/grass/gunittest/loader.py
    M python/grass/gunittest/main.py
    M python/grass/gunittest/multireport.py
    M python/grass/gunittest/multirunner.py
    M python/grass/gunittest/reporters.py
    M python/grass/gunittest/runner.py
    M python/grass/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_errors/testsuite/test_error.py
    M python/grass/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_errors/testsuite/test_import_error.py
    M python/grass/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_gfatalerror.py
    M python/grass/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_osexit_one.py
    M python/grass/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_osexit_zero.py
    M python/grass/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_segfaut.py
    M python/grass/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_sysexit_one.py
    M python/grass/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_sysexit_zero.py
    M python/grass/gunittest/testsuite/data/samplecode/submodule_test_fail/testsuite/test_fail.py
    M python/grass/gunittest/testsuite/data/samplecode/testsuite/test_good_and_bad.py
    M python/grass/gunittest/testsuite/data/samplecode/testsuite/test_python_unittest.py
    M python/grass/gunittest/testsuite/data/samplecode/testsuite/test_success.py
    M python/grass/gunittest/testsuite/test_assertions.py
    M python/grass/gunittest/testsuite/test_assertions_rast3d.py
    M python/grass/gunittest/testsuite/test_assertions_vect.py
    M python/grass/gunittest/testsuite/test_checkers.py
    M python/grass/gunittest/testsuite/test_gmodules.py
    M python/grass/gunittest/testsuite/test_gunitest_doctests.py
    M python/grass/gunittest/testsuite/test_module_assertions.py
    M python/grass/gunittest/utils.py
    M python/grass/imaging/images2avi.py
    M python/grass/imaging/images2gif.py
    M python/grass/imaging/images2ims.py
    M python/grass/imaging/images2swf.py
    M python/grass/imaging/operations.py
    M python/grass/pydispatch/dispatcher.py
    M python/grass/pydispatch/robust.py
    M python/grass/pydispatch/robustapply.py
    M python/grass/pydispatch/saferef.py
    M python/grass/pydispatch/signal.py
    M python/grass/pygrass/errors.py
    M python/grass/pygrass/gis/__init__.py
    M python/grass/pygrass/gis/region.py
    M python/grass/pygrass/gis/testsuite/test_gis.py
    M python/grass/pygrass/gis/testsuite/test_pygrass_gis_doctests.py
    M python/grass/pygrass/messages/__init__.py
    M python/grass/pygrass/messages/testsuite/test_pygrass_messages_doctests.py
    M python/grass/pygrass/modules/grid/grid.py
    M python/grass/pygrass/modules/grid/patch.py
    M python/grass/pygrass/modules/grid/split.py
    M python/grass/pygrass/modules/grid/testsuite/test_pygrass_modules_grid_doctests.py
    M python/grass/pygrass/modules/interface/__init__.py
    M python/grass/pygrass/modules/interface/docstring.py
    M python/grass/pygrass/modules/interface/env.py
    M python/grass/pygrass/modules/interface/flag.py
    M python/grass/pygrass/modules/interface/module.py
    M python/grass/pygrass/modules/interface/parameter.py
    M python/grass/pygrass/modules/interface/read.py
    M python/grass/pygrass/modules/interface/testsuite/test_flag.py
    M python/grass/pygrass/modules/interface/testsuite/test_modules.py
    M python/grass/pygrass/modules/interface/testsuite/test_parameter.py
    M python/grass/pygrass/modules/interface/testsuite/test_pygrass_modules_interface_doctests.py
    M python/grass/pygrass/modules/interface/typedict.py
    M python/grass/pygrass/modules/shortcuts.py
    M python/grass/pygrass/modules/testsuite/test_import_isolation.py
    M python/grass/pygrass/modules/testsuite/test_pygrass_modules_doctests.py
    M python/grass/pygrass/orderdict.py
    M python/grass/pygrass/raster/__init__.py
    M python/grass/pygrass/raster/abstract.py
    M python/grass/pygrass/raster/buffer.py
    M python/grass/pygrass/raster/history.py
    M python/grass/pygrass/raster/raster_type.py
    M python/grass/pygrass/raster/rowio.py
    M python/grass/pygrass/raster/segment.py
    M python/grass/pygrass/raster/testsuite/test_category.py
    M python/grass/pygrass/raster/testsuite/test_history.py
    M python/grass/pygrass/raster/testsuite/test_numpy.py
    M python/grass/pygrass/raster/testsuite/test_pygrass_raster.py
    M python/grass/pygrass/raster/testsuite/test_pygrass_raster_doctests.py
    M python/grass/pygrass/raster/testsuite/test_raster_img.py
    M python/grass/pygrass/raster/testsuite/test_raster_region.py
    M python/grass/pygrass/rpc/__init__.py
    M python/grass/pygrass/rpc/base.py
    M python/grass/pygrass/rpc/testsuite/test_pygrass_rpc_doctests.py
    M python/grass/pygrass/shell/conversion.py
    M python/grass/pygrass/shell/show.py
    M python/grass/pygrass/shell/testsuite/test_pygrass_shell_doctests.py
    M python/grass/pygrass/tests/benchmark.py
    M python/grass/pygrass/tests/set_mapset.py
    M python/grass/pygrass/testsuite/test_pygrass_doctests.py
    M python/grass/pygrass/utils.py
    M python/grass/pygrass/vector/__init__.py
    M python/grass/pygrass/vector/abstract.py
    M python/grass/pygrass/vector/basic.py
    M python/grass/pygrass/vector/find.py
    M python/grass/pygrass/vector/geometry.py
    M python/grass/pygrass/vector/sql.py
    M python/grass/pygrass/vector/table.py
    M python/grass/pygrass/vector/testsuite/test_filters.py
    M python/grass/pygrass/vector/testsuite/test_geometry.py
    M python/grass/pygrass/vector/testsuite/test_geometry_attrs.py
    M python/grass/pygrass/vector/testsuite/test_pygrass_vector_doctests.py
    M python/grass/pygrass/vector/testsuite/test_table.py
    M python/grass/pygrass/vector/testsuite/test_vector.py
    M python/grass/pygrass/vector/testsuite/test_vector3d.py
    M python/grass/pygrass/vector/vector_type.py
    M python/grass/script/__init__.py
    M python/grass/script/array.py
    M python/grass/script/core.py
    M python/grass/script/db.py
    M python/grass/script/raster.py
    M python/grass/script/raster3d.py
    M python/grass/script/setup.py
    M python/grass/script/task.py
    M python/grass/script/testsuite/data/script_using_temporary_region.py
    M python/grass/script/testsuite/test_core_make_val.py
    M python/grass/script/testsuite/test_script_doctests.py
    M python/grass/script/testsuite/test_script_raster.py
    M python/grass/script/testsuite/test_start_command_functions.py
    M python/grass/script/testsuite/test_start_command_functions_nc.py
    M python/grass/script/testsuite/test_utils.py
    M python/grass/script/utils.py
    M python/grass/script/vector.py
    M python/grass/temporal/__init__.py
    M python/grass/temporal/abstract_dataset.py
    M python/grass/temporal/abstract_map_dataset.py
    M python/grass/temporal/abstract_space_time_dataset.py
    M python/grass/temporal/aggregation.py
    M python/grass/temporal/base.py
    M python/grass/temporal/c_libraries_interface.py
    M python/grass/temporal/core.py
    M python/grass/temporal/datetime_math.py
    M python/grass/temporal/extract.py
    M python/grass/temporal/factory.py
    M python/grass/temporal/gui_support.py
    M python/grass/temporal/list_stds.py
    M python/grass/temporal/mapcalc.py
    M python/grass/temporal/metadata.py
    M python/grass/temporal/open_stds.py
    M python/grass/temporal/register.py
    M python/grass/temporal/sampling.py
    M python/grass/temporal/space_time_datasets.py
    M python/grass/temporal/spatial_extent.py
    M python/grass/temporal/spatial_topology_dataset_connector.py
    M python/grass/temporal/spatio_temporal_relationships.py
    M python/grass/temporal/stds_export.py
    M python/grass/temporal/stds_import.py
    M python/grass/temporal/temporal_algebra.py
    M python/grass/temporal/temporal_extent.py
    M python/grass/temporal/temporal_granularity.py
    M python/grass/temporal/temporal_operator.py
    M python/grass/temporal/temporal_raster3d_algebra.py
    M python/grass/temporal/temporal_raster_algebra.py
    M python/grass/temporal/temporal_raster_base_algebra.py
    M python/grass/temporal/temporal_topology_dataset_connector.py
    M python/grass/temporal/temporal_vector_algebra.py
    M python/grass/temporal/testsuite/test_register_function.py
    M python/grass/temporal/testsuite/test_temporal_doctests.py
    M python/grass/temporal/testsuite/unittests_temporal_algebra.py
    M python/grass/temporal/testsuite/unittests_temporal_algebra_grs.py
    M python/grass/temporal/testsuite/unittests_temporal_algebra_mixed_stds.py
    M python/grass/temporal/testsuite/unittests_temporal_conditionals.py
    M python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py
    M python/grass/temporal/testsuite/unittests_temporal_raster_algebra.py
    M python/grass/temporal/testsuite/unittests_temporal_raster_algebra_equal_ts.py
    M python/grass/temporal/testsuite/unittests_temporal_raster_algebra_grs.py
    M python/grass/temporal/testsuite/unittests_temporal_raster_algebra_spatial_topology.py
    M python/grass/temporal/testsuite/unittests_temporal_raster_conditionals.py
    M python/grass/temporal/testsuite/unittests_temporal_raster_conditionals_complement_else.py
    M python/grass/temporal/testsuite/unittests_temporal_vector_algebra.py
    M python/grass/temporal/unit_tests.py
    M python/grass/temporal/univar_statistics.py
    M scripts/g.extension/testsuite/test_addons_toolboxes.py
    M scripts/i.tasscap/i.tasscap.py
    M scripts/r.shade/r.shade.py
    M scripts/r3.in.xyz/r3.in.xyz.py
    M scripts/v.import/v.import.py
    M scripts/v.rast.stats/testsuite/test_v_rast_stats.py
    M scripts/v.rast.stats/v.rast.stats.py
    M utils/mkhtml.py

  Log Message:
  -----------
  Apply Black to grass package, use Python 3 style everywhere (#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.




More information about the grass-commit mailing list