Skip to content

Commit

Permalink
wxGUI: Fix F405 error by explicitly importing required modules in isc…
Browse files Browse the repository at this point in the history
…att/ (#4426)

* update 405 in core_c

* updated flake8

* support explicit imports

* ran isort to make sort imports
  • Loading branch information
arohanajit authored Oct 2, 2024
1 parent fa30424 commit 1b639db
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ per-file-ignores =
gui/scripts/d.wms.py: E501
gui/wxpython/image2target/*: F841, E722
gui/wxpython/image2target/g.gui.image2target.py: E501, F841
gui/wxpython/iscatt/*: F841, 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
27 changes: 23 additions & 4 deletions gui/wxpython/iscatt/core_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,34 @@
@author Stepan Turek <stepan.turek seznam.cz> (mentor: Martin Landa)
"""

import ctypes
import sys
import numpy as np
from ctypes import POINTER, c_char_p, c_double, c_int, c_uint8, pointer
from multiprocessing import Process, Queue

from ctypes import *
import numpy as np

try:
from grass.lib.imagery import *
from grass.lib.gis import G_get_window
from grass.lib.imagery import (
SC_SCATT_CONDITIONS,
SC_SCATT_DATA,
I_apply_colormap,
I_compute_scatts,
I_create_cat_rast,
I_insert_patch_to_cat_rast,
I_merge_arrays,
I_rasterize,
I_sc_add_cat,
I_sc_free_cats,
I_sc_init_cats,
I_sc_insert_scatt_data,
I_scd_init_scatt_data,
scdScattData,
struct_Cell_head,
struct_Range,
struct_scCats,
)
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

0 comments on commit 1b639db

Please sign in to comment.