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

wxGUI: Fix F405 error by explicitly importing required modules in iscatt/ #4426

Merged
merged 6 commits into from
Oct 2, 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
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ per-file-ignores =
gui/wxpython/gui_core/widgets.py: E722
gui/wxpython/image2target/*: F841, E722
gui/wxpython/image2target/g.gui.image2target.py: E501, F841
gui/wxpython/iscatt/*: F841, E722, F405, F403
gui/wxpython/iscatt/*: F841, E722
gui/wxpython/lmgr/frame.py: F841, E722
# layertree still includes some formatting issues (it is ignored by Black)
gui/wxpython/lmgr/layertree.py: E722, E266, W504, E225
Expand Down
25 changes: 22 additions & 3 deletions gui/wxpython/iscatt/core_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,29 @@
import numpy as np
from multiprocessing import Process, Queue

from ctypes import *
import ctypes
from ctypes import POINTER, c_uint8, c_double, c_int, c_char_p, pointer

try:
from grass.lib.imagery import *
from grass.lib.imagery import (
I_apply_colormap,
I_merge_arrays,
I_create_cat_rast,
SC_SCATT_DATA,
SC_SCATT_CONDITIONS,
I_compute_scatts,
I_sc_free_cats,
struct_Range,
struct_Cell_head,
struct_scCats,
I_sc_init_cats,
I_sc_add_cat,
scdScattData,
I_scd_init_scatt_data,
I_sc_insert_scatt_data,
I_insert_patch_to_cat_rast,
I_rasterize,
)
from grass.lib.gis import G_get_window
except ImportError as e:
sys.stderr.write(_("Loading ctypes libs failed"))
Expand Down Expand Up @@ -238,7 +257,7 @@ def _getComputationStruct(cats, cats_rasts, cats_type, n_bands):

scatt_vals = scdScattData()

c_void_p = ctypes.POINTER(ctypes.c_void_p)
c_void_p = POINTER(ctypes.c_void_p)

if cats_type == SC_SCATT_DATA:
vals[:] = 0
Expand Down
Loading