Skip to content

Commit

Permalink
Merge branch 'main' into gettext_po_deduplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
neteler authored Nov 20, 2024
2 parents 7e596dc + 36359e2 commit 7b1428f
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 33 deletions.
9 changes: 1 addition & 8 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ per-file-ignores =
gui/wxpython/iclass/frame.py: F405, F403
gui/wxpython/iclass/g.gui.iclass.py: E501
gui/wxpython/iclass/statistics.py: F841, F405, F403
gui/wxpython/wxplot/histogram.py: E722
gui/wxpython/wxplot/profile.py: F841, E722
gui/wxpython/wxplot/base.py: F841, E722
gui/wxpython/location_wizard/dialogs.py: F841
gui/wxpython/location_wizard/wizard.py: E722
gui/wxpython/mapdisp/main.py: E722
Expand All @@ -45,9 +42,6 @@ per-file-ignores =
gui/wxpython/mapwin/graphics.py: E722
gui/wxpython/startup/locdownload.py: E722, E402
gui/wxpython/timeline/g.gui.timeline.py: E501
gui/wxpython/tools/build_modules_xml.py: E722
gui/wxpython/web_services/cap_interface.py: E501
gui/wxpython/web_services/widgets.py: F841, E402
# Generated file
gui/wxpython/menustrings.py: E501
# F821 undefined name 'cmp'
Expand All @@ -69,11 +63,10 @@ per-file-ignores =
python/grass/temporal/temporal_granularity.py: E722
# Current benchmarks/tests are changing sys.path before import.
# Possibly, a different approach should be taken there anyway.
python/grass/pygrass/tests/benchmark.py: E402, F821
python/grass/pygrass/tests/benchmark.py: F821
# Configuration file for Sphinx:
# Ignoring import/code mix and line length.
# Files not managed by Black
python/grass/imaging/images2gif.py: E226
# Unused imports in init files
# F403 star import used; unable to detect undefined names
python/grass/temporal/__init__.py: F401, F403
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
coverage html
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2
uses: codecov/codecov-action@985343d70564a82044c1b7fcb84c2fa05405c1a2 # v5.0.4
with:
verbose: true
flags: pytest-python-${{ matrix.python-version }}
Expand Down
8 changes: 3 additions & 5 deletions gui/wxpython/web_services/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,14 @@
)

import grass.script as gs
from grass.pydispatch.signal import Signal

rinwms_path = os.path.join(os.getenv("GISBASE"), "etc", "r.in.wms")
if rinwms_path not in sys.path:
sys.path.append(rinwms_path)

from wms_base import WMSDriversInfo
from srs import Srs

from grass.pydispatch.signal import Signal
from wms_base import WMSDriversInfo # noqa:E402
from srs import Srs # noqa:E402


class WSPanel(wx.Panel):
Expand Down Expand Up @@ -750,7 +749,6 @@ def OnListSelChanged(self, event):
self.projs_list = []
projs_list = []

intersect_proj = []
first = True
for curr in curr_sel_ls:
layer_projs = curr["cap_intf_l"].GetLayerData("srs")
Expand Down
7 changes: 3 additions & 4 deletions gui/wxpython/wxplot/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from gui_core.wrap import Menu

import grass.script as gs
from grass.exceptions import CalledModuleError

PlotIcons = {
"draw": MetaIcon(img="show", label=_("Draw/re-draw plot")),
Expand Down Expand Up @@ -204,7 +205,7 @@ def InitRasterOpts(self, rasterList, plottype):

try:
ret = gs.raster_info(r)
except:
except CalledModuleError:
continue
# if r.info cannot parse map, skip it

Expand Down Expand Up @@ -270,7 +271,7 @@ def InitRasterPairs(self, rasterList, plottype):
ret0 = gs.raster_info(rpair[0])
ret1 = gs.raster_info(rpair[1])

except:
except (IndexError, CalledModuleError):
continue
# if r.info cannot parse map, skip it

Expand Down Expand Up @@ -510,7 +511,6 @@ def OnMotion(self, event):

def PlotOptionsMenu(self, event):
"""Popup menu for plot and text options"""
point = wx.GetMousePosition()
popt = Menu()
# Add items to the menu
settext = wx.MenuItem(popt, wx.ID_ANY, _("Text settings"))
Expand Down Expand Up @@ -608,7 +608,6 @@ def PlotOptions(self, event):

def PrintMenu(self, event):
"""Print options and output menu"""
point = wx.GetMousePosition()
printmenu = Menu()
for title, handler in (
(_("Page setup"), self.OnPageSetup),
Expand Down
5 changes: 1 addition & 4 deletions gui/wxpython/wxplot/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ def OnCreateHist(self, event):
create a list of cell value and count/percent/area pairs. This is passed to
plot to create a line graph of the histogram.
"""
try:
self.SetCursor(StockCursor(wx.CURSOR_ARROW))
except:
pass
self.SetCursor(StockCursor(wx.CURSOR_ARROW))

self.SetGraphStyle()
wx.BeginBusyCursor()
Expand Down
5 changes: 2 additions & 3 deletions gui/wxpython/wxplot/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def SetupProfile(self):
# delete extra first segment point
try:
self.seglist.pop(0)
except:
except IndexError:
pass

#
Expand Down Expand Up @@ -291,7 +291,6 @@ def CreateDatalist(self, raster, coords):
# freezing with large, high resolution maps
region = gs.region()
curr_res = min(float(region["nsres"]), float(region["ewres"]))
transect_rec = 0
if self.transect_length / curr_res > 500:
transect_res = self.transect_length / 500
else:
Expand Down Expand Up @@ -486,7 +485,7 @@ def OnStats(self, event):
statstr += "median: %f\n" % np.median(a)
statstr += "distance along transect: %f\n\n" % self.transect_length
message.append(statstr)
except:
except (ValueError, TypeError, KeyError, IndexError):
pass

stats = PlotStatsFrame(self, id=wx.ID_ANY, message=message, title=title)
Expand Down
5 changes: 5 additions & 0 deletions python/grass/pygrass/tests/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@
from jinja2 import Template
from pathlib import Path


sys.path.append(str(Path.cwd()))
sys.path.append("%s/.." % (str(Path.cwd())))


# flake8: noqa: E402
import grass.lib.gis as libgis
import grass.lib.raster as libraster
import grass.script as gs
import ctypes

# flake8: qa


def test__RasterSegment_value_access__if():
test_a = pygrass.RasterSegment(name="test_a")
Expand Down
11 changes: 3 additions & 8 deletions vector/v.mkgrid/v.mkgrid.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ <h3>Creating a positioned grid in a latitude-longitude</h3>
at 167deg 52min east, 47deg 6min south. For use with e.g. QGIS you can then
pull this grid into a project with projected coordinate reference system (CRS)
using <em>v.proj</em> before
exporting as a Shapefile with <em>v.out.ogr</em> (within GRASS GIS you could
just use <em>d.grid -w</em> from the projec with projected CRS for the same effect):
exporting as a vector file with <em>v.out.ogr</em> (within GRASS GIS you could
just use <em>d.grid -w</em> from the project with projected CRS for the same effect):

<div class="code"><pre>
v.mkgrid map=p2min_grid grid=10,12 position=coor coordinates=167:52E,47:06S box=0:02,0:02
Expand Down Expand Up @@ -153,7 +153,7 @@ <h3>Using hexagons for point density</h3>
v.vect.stats points=points_of_interest areas=hexagons count_column=count
</pre></div>

User should note that some of the points may be outside the grid
Users should note that some of the points may be outside the grid
since the hexagons cannot cover all the area around the edges
(the computational region extent needs to be enlarged if all points
should be considered).
Expand All @@ -164,11 +164,6 @@ <h3>Using hexagons for point density</h3>
v.colors map=hexagons use=attr column=count color=viridis
</pre></div>

<!--
d.erase 77:77:77
mogrify -trim .png
-->

<center>
<img src="v_mkgrid.png"><br>
Point density in a hexagonal grid
Expand Down

0 comments on commit 7b1428f

Please sign in to comment.