Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Fix Flake8 issues in example files #4353

Merged
merged 8 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ 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/gui/wxpython/example/dialogs.py: F401
locale/grass_po_stats.py: E122, E128, E231, E401, E722
gui/scripts/d.wms.py: E501
Expand Down
11 changes: 8 additions & 3 deletions doc/python/m.distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

# %module
# % label: Finds the distance between two or more points.
# % description: If the projection is latitude-longitude, this distance is measured along the geodesic.
# % description: If the projection is lat-long, distance measured along the geodesic.
arohanajit marked this conversation as resolved.
Show resolved Hide resolved
# % keyword: miscellaneous
# % keyword: distance
# % keyword: measure
Expand All @@ -45,10 +45,15 @@
# %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
arohanajit marked this conversation as resolved.
Show resolved Hide resolved
)


def main():
Expand Down
11 changes: 9 additions & 2 deletions doc/python/raster_example_ctypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@

import os
import sys
import math

from grass.lib.gis import *
from grass.lib.raster import *
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
arohanajit marked this conversation as resolved.
Show resolved Hide resolved
)

# check if GRASS is running or not
if "GISBASE" not in os.environ:
Expand Down
11 changes: 9 additions & 2 deletions doc/python/vector_example_ctypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@

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
arohanajit marked this conversation as resolved.
Show resolved Hide resolved
)

if "GISBASE" not in os.environ:
sys.exit("You must be in GRASS GIS to run this program.")
Expand Down
Loading