diff --git a/.flake8 b/.flake8 index e72eaa73333..bd33e493bfc 100644 --- a/.flake8 +++ b/.flake8 @@ -22,9 +22,7 @@ per-file-ignores = __init__.py: F401, F403 man/build_html.py: E501 imagery/i.atcorr/create_iwave.py: F632, F821, W293 - doc/python/raster_example_ctypes.py: F403, F405 - doc/python/vector_example_ctypes.py: F403, F405 - doc/python/m.distance.py: F403, F405, E501 + doc/python/m.distance.py: E501 doc/gui/wxpython/example/dialogs.py: F401 locale/grass_po_stats.py: E122, E128, E231, E401, E722 gui/scripts/d.wms.py: E501 diff --git a/doc/python/m.distance.py b/doc/python/m.distance.py index 5eddb1dcc56..576760c3b40 100755 --- a/doc/python/m.distance.py +++ b/doc/python/m.distance.py @@ -45,10 +45,21 @@ # %end import sys +from ctypes import byref, c_double import grass.script as gs - -from grass.lib.gis import * +from grass.lib.gis import ( + G_gisinit, + G_begin_distance_calculations, + G_scan_easting, + G_scan_northing, + G_distance, + G_begin_polygon_area_calculations, + G_area_of_polygon, + G_database_units_to_meters_factor, + G_database_unit_name, + PROJECTION_LL, +) def main(): diff --git a/doc/python/raster_example_ctypes.py b/doc/python/raster_example_ctypes.py index f62ce4a9492..67f7a2cf4cb 100644 --- a/doc/python/raster_example_ctypes.py +++ b/doc/python/raster_example_ctypes.py @@ -17,9 +17,23 @@ import os import sys - -from grass.lib.gis import * -from grass.lib.raster import * +import math + +from ctypes import POINTER, c_int, c_float, c_double, c_void_p, cast + +from grass.lib.gis import G_gisinit, G_find_raster2, G_free +from grass.lib.raster import ( + Rast_map_type, + CELL_TYPE, + FCELL_TYPE, + DCELL_TYPE, + Rast_open_old, + Rast_allocate_buf, + Rast_window_rows, + Rast_window_cols, + Rast_get_row, + Rast_close, +) # check if GRASS is running or not if "GISBASE" not in os.environ: diff --git a/doc/python/vector_example_ctypes.py b/doc/python/vector_example_ctypes.py index 9f8a90d6459..ae3877224d0 100644 --- a/doc/python/vector_example_ctypes.py +++ b/doc/python/vector_example_ctypes.py @@ -7,9 +7,28 @@ import os import sys +from ctypes import pointer, byref -from grass.lib.gis import * -from grass.lib.vector import * +# Import specific functions and classes instead of using wildcard imports +from grass.lib.gis import G_gisinit, G_find_vector2 +from grass.lib.vector import ( + Map_info, + Vect_set_open_level, + Vect_open_old, + Vect_get_full_name, + Vect_is_3d, + Vect_get_num_dblinks, + Vect_get_scale, + Vect_get_map_box, + Vect_point_in_box, + Vect_get_num_lines, + Vect_get_num_primitives, + Vect_get_num_areas, + Vect_close, + bound_box, + GV_POINT, + GV_LINE, +) if "GISBASE" not in os.environ: sys.exit("You must be in GRASS GIS to run this program.")