diff --git a/.github/workflows/python-code-quality.yml b/.github/workflows/python-code-quality.yml index 2fdf7766a73..777637e8322 100644 --- a/.github/workflows/python-code-quality.yml +++ b/.github/workflows/python-code-quality.yml @@ -29,7 +29,7 @@ jobs: - os: ubuntu-22.04 python-version: "3.10" min-python-version: "3.7" - black-version: "23.1.0" + black-version: "24.4.0" flake8-version: "3.9.2" pylint-version: "2.12.2" bandit-version: "1.7.8" @@ -60,7 +60,7 @@ jobs: run: python -m pip install --upgrade pip - name: Install Black only - run: pip install black==${{ matrix.black-version }} + run: pip install black[jupyter]==${{ matrix.black-version }} - name: Run Black run: black . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 61509b4280b..65cb46a2f53 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,10 +39,11 @@ repos: rev: v0.33.0 hooks: - id: markdownlint - - repo: https://github.com/psf/black - rev: 23.1.0 + # Using this mirror lets us use mypyc-compiled black, which is about 2x faster + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 24.4.0 hooks: - - id: black + - id: black-jupyter exclude: | (?x)^( python/libgrass_interface_generator/ diff --git a/doc/notebooks/hydrology.ipynb b/doc/notebooks/hydrology.ipynb index f19ce35c436..b9e23acf3c1 100644 --- a/doc/notebooks/hydrology.ipynb +++ b/doc/notebooks/hydrology.ipynb @@ -69,7 +69,9 @@ "\n", "# Add a raster, vector and legend to the map\n", "elev_map.d_rast(map=\"elevation\")\n", - "elev_map.d_legend(raster=\"elevation\", at=(65, 90, 85, 88), fontsize=12, flags=\"b\", title=\"DTM\")\n", + "elev_map.d_legend(\n", + " raster=\"elevation\", at=(65, 90, 85, 88), fontsize=12, flags=\"b\", title=\"DTM\"\n", + ")\n", "\n", "# Display map\n", "elev_map.show()" @@ -90,9 +92,27 @@ "metadata": {}, "outputs": [], "source": [ - "gs.run_command(\"r.fill.dir\", input=\"elevation\", output=\"elev_fill1\", direction=\"dir1\", areas=\"area1\")\n", - "gs.run_command(\"r.fill.dir\", input=\"elev_fill1\", output=\"elev_fill2\", direction=\"dir2\", areas=\"area2\")\n", - "gs.run_command(\"r.fill.dir\", input=\"elev_fill2\", output=\"elev_fill3\", direction=\"dir3\", areas=\"area3\")\n", + "gs.run_command(\n", + " \"r.fill.dir\",\n", + " input=\"elevation\",\n", + " output=\"elev_fill1\",\n", + " direction=\"dir1\",\n", + " areas=\"area1\",\n", + ")\n", + "gs.run_command(\n", + " \"r.fill.dir\",\n", + " input=\"elev_fill1\",\n", + " output=\"elev_fill2\",\n", + " direction=\"dir2\",\n", + " areas=\"area2\",\n", + ")\n", + "gs.run_command(\n", + " \"r.fill.dir\",\n", + " input=\"elev_fill2\",\n", + " output=\"elev_fill3\",\n", + " direction=\"dir3\",\n", + " areas=\"area3\",\n", + ")\n", "gs.mapcalc(\"depr_bin = if((elevation-elev_fill3) < 0., 1, null())\")\n", "gs.run_command(\"r.colors\", map=\"depr_bin\", color=\"blues\")" ] @@ -129,13 +149,15 @@ "metadata": {}, "outputs": [], "source": [ - "gs.run_command(\"r.watershed\", \n", - " elevation=\"elevation@PERMANENT\",\n", - " drainage=\"drainage\", # Drainage Direction\n", - " accumulation=\"flowacc\", # Flow Accumulation\n", - " basin=\"watersheds\",\n", - " stream=\"streams\",\n", - " threshold=80000)\n", + "gs.run_command(\n", + " \"r.watershed\",\n", + " elevation=\"elevation@PERMANENT\",\n", + " drainage=\"drainage\", # Drainage Direction\n", + " accumulation=\"flowacc\", # Flow Accumulation\n", + " basin=\"watersheds\",\n", + " stream=\"streams\",\n", + " threshold=80000,\n", + ")\n", "\n", "# Convert streams raster to vector\n", "gs.run_command(\"r.to.vect\", input=\"streams\", output=\"streams\", type=\"line\")" @@ -160,7 +182,7 @@ "\n", "# We can modify with color table for rasters with `r.colors`.\n", "# Note that if the raster is located in a different mapset (for example,\n", - "# elevation is in PERMANENT, not user1), the `r.colors` will not change \n", + "# elevation is in PERMANENT, not user1), the `r.colors` will not change\n", "# the color in InteractiveMap.\n", "gs.run_command(\"r.colors\", map=\"drainage\", color=\"aspect\")\n", "\n", @@ -193,13 +215,19 @@ "outputs": [], "source": [ "# Count cells in each watershed\n", - "gs.run_command(\"r.stats.zonal\", base=\"watersheds\", cover=\"elevation\", method=\"count\", output=\"watersheds_count\")\n", + "gs.run_command(\n", + " \"r.stats.zonal\",\n", + " base=\"watersheds\",\n", + " cover=\"elevation\",\n", + " method=\"count\",\n", + " output=\"watersheds_count\",\n", + ")\n", "\n", "# Get projection resolution\n", - "proj=gs.parse_command(\"g.region\", flags=\"m\")\n", + "proj = gs.parse_command(\"g.region\", flags=\"m\")\n", "\n", "# Multiply N-S resollution by E-W resolution to get cell area\n", - "cell_area = float(proj[\"nsres\"])*float(proj[\"ewres\"])\n", + "cell_area = float(proj[\"nsres\"]) * float(proj[\"ewres\"])\n", "\n", "# Calculate watersheds areas and convert from m2 to km2\n", "gs.mapcalc(\"'watershed_area' = float('watersheds_count'*{})/1000000\".format(cell_area))" @@ -220,18 +248,20 @@ "source": [ "# Display a map of watershed areas.\n", "gs.run_command(\"r.colors\", map=\"watershed_area\", color=\"plasma\")\n", - " \n", + "\n", "watershed_map = gj.Map()\n", "watershed_map.d_rast(map=\"watershed_area\")\n", - "watershed_map.d_legend(raster=\"watershed_area\",\n", - " bgcolor=\"none\",\n", - " color=\"black\",\n", - " border_color=\"none\",\n", - " at=(3, 40, 84, 88),\n", - " lines=2,\n", - " fontsize=15,\n", - " title=\"Area\",\n", - " units=\" km2\")\n", + "watershed_map.d_legend(\n", + " raster=\"watershed_area\",\n", + " bgcolor=\"none\",\n", + " color=\"black\",\n", + " border_color=\"none\",\n", + " at=(3, 40, 84, 88),\n", + " lines=2,\n", + " fontsize=15,\n", + " title=\"Area\",\n", + " units=\" km2\",\n", + ")\n", "watershed_map.show()" ] }, @@ -265,7 +295,14 @@ "# Display slope map\n", "slope_map = gj.Map()\n", "slope_map.d_rast(map=\"slope\")\n", - "slope_map.d_legend(raster=\"slope\", at=(65, 90, 85, 90), fontsize=15, flags=\"b\", title=\"Slope\", units=\"°\")\n", + "slope_map.d_legend(\n", + " raster=\"slope\",\n", + " at=(65, 90, 85, 90),\n", + " fontsize=15,\n", + " flags=\"b\",\n", + " title=\"Slope\",\n", + " units=\"°\",\n", + ")\n", "slope_map.show()" ] }, @@ -284,14 +321,16 @@ "source": [ "separator = \"|\"\n", "\n", - "columns = defaultdict(list) # each value in each column is appended to a list\n", + "columns = defaultdict(list) # each value in each column is appended to a list\n", "\n", - "text = gs.read_command(\"r.univar\", map=\"elevation\", zones=\"watersheds\", separator=separator, flags=\"t\")\n", + "text = gs.read_command(\n", + " \"r.univar\", map=\"elevation\", zones=\"watersheds\", separator=separator, flags=\"t\"\n", + ")\n", "reader = csv.DictReader(text.splitlines(), delimiter=separator)\n", - "for row in reader: # read a row as {column1: value1, column2: value2,...}\n", - " for (k,v) in row.items(): # go over each column name and value \n", - " columns[k].append(v) # append the value into the appropriate list\n", - " # based on column name k\n", + "for row in reader: # read a row as {column1: value1, column2: value2,...}\n", + " for k, v in row.items(): # go over each column name and value\n", + " columns[k].append(v) # append the value into the appropriate list\n", + " # based on column name k\n", "\n", "watersheds = columns[\"zone\"]\n", "means = np.array(columns[\"mean\"], dtype=np.float32)\n", @@ -333,7 +372,9 @@ "outputs": [], "source": [ "# Convert to vector\n", - "gs.run_command(\"r.to.vect\", flags=\"s\", input=\"watersheds\", output=\"watersheds_vector\", type=\"area\")" + "gs.run_command(\n", + " \"r.to.vect\", flags=\"s\", input=\"watersheds\", output=\"watersheds_vector\", type=\"area\"\n", + ")" ] }, { @@ -345,14 +386,16 @@ "# Display\n", "watershed_vect_map = gj.Map()\n", "watershed_vect_map.d_rast(map=\"elevation\")\n", - "watershed_vect_map.d_vect(map=\"watersheds_vector\",\n", - " fill_color=\"none\",\n", - " width=1.5,\n", - " color=\"black\",\n", - " attribute_column=\"value\",\n", - " label_bgcolor=\"black\",\n", - " label_color=\"white\",\n", - " label_size=10)\n", + "watershed_vect_map.d_vect(\n", + " map=\"watersheds_vector\",\n", + " fill_color=\"none\",\n", + " width=1.5,\n", + " color=\"black\",\n", + " attribute_column=\"value\",\n", + " label_bgcolor=\"black\",\n", + " label_color=\"white\",\n", + " label_size=10,\n", + ")\n", "watershed_vect_map.show()" ] } diff --git a/doc/notebooks/jupyter_example.ipynb b/doc/notebooks/jupyter_example.ipynb index a0f660b5cd3..48628e08263 100644 --- a/doc/notebooks/jupyter_example.ipynb +++ b/doc/notebooks/jupyter_example.ipynb @@ -64,7 +64,9 @@ "outputs": [], "source": [ "gs.parse_command(\"g.region\", raster=\"lakes\", flags=\"pg\")\n", - "gs.run_command(\"r.buffer\", input=\"lakes\", output=\"lakes_buff\", distances=[60, 120, 240, 500])\n", + "gs.run_command(\n", + " \"r.buffer\", input=\"lakes\", output=\"lakes_buff\", distances=[60, 120, 240, 500]\n", + ")\n", "\n", "# Start a Map\n", "r_buffer_map = gj.Map()\n", @@ -101,7 +103,9 @@ "v_buffer_map = gj.Map()\n", "\n", "# Add vector layers and legend\n", - "v_buffer_map.d_vect(map=\"boundary_state\", fill_color=\"#5A91ED\", legend_label=\"State boundary\")\n", + "v_buffer_map.d_vect(\n", + " map=\"boundary_state\", fill_color=\"#5A91ED\", legend_label=\"State boundary\"\n", + ")\n", "v_buffer_map.d_vect(map=\"buffer\", fill_color=\"#F8766D\", legend_label=\"Inner portion\")\n", "v_buffer_map.d_legend_vect(at=(10, 35))\n", "\n", diff --git a/doc/notebooks/jupyter_tutorial.ipynb b/doc/notebooks/jupyter_tutorial.ipynb index 8213ea970ca..73d656905f7 100644 --- a/doc/notebooks/jupyter_tutorial.ipynb +++ b/doc/notebooks/jupyter_tutorial.ipynb @@ -142,7 +142,7 @@ "source": [ "# Then, we return to the first instance and continue to modify and display it\n", "# Notice that layers a drawn in the order they are added\n", - "example_map.run(\"d.vect\", map = \"zipcodes\", color=\"red\", fill_color=\"none\")\n", + "example_map.run(\"d.vect\", map=\"zipcodes\", color=\"red\", fill_color=\"none\")\n", "example_map.show()" ] }, @@ -277,11 +277,11 @@ "metadata": {}, "outputs": [], "source": [ - "import folium \n", + "import folium\n", "\n", "\n", "# Create a map\n", - "m = folium.Map(location=[35.761168,-78.668271], zoom_start=13)\n", + "m = folium.Map(location=[35.761168, -78.668271], zoom_start=13)\n", "\n", "# Create and add elevation layer to map\n", "gj.Raster(\"elevation\", opacity=0.5).add_to(m)\n", @@ -291,7 +291,7 @@ "tooltip = \"Click me!\"\n", "# and add a marker\n", "folium.Marker(\n", - " [35.781608,-78.675800], popup=\"Point of Interest\", tooltip=tooltip\n", + " [35.781608, -78.675800], popup=\"Point of Interest\", tooltip=tooltip\n", ").add_to(m)\n", "\n", "# Display map\n", @@ -313,10 +313,10 @@ "metadata": {}, "outputs": [], "source": [ - "import ipyleaflet \n", + "import ipyleaflet\n", "\n", "# Create map\n", - "m = ipyleaflet.Map(center=[35.761168,-78.668271], zoom=13)\n", + "m = ipyleaflet.Map(center=[35.761168, -78.668271], zoom=13)\n", "\n", "# Create and add elevation layer to map\n", "gj.Raster(\"elevation\", opacity=0.5).add_to(m)\n", @@ -325,12 +325,12 @@ "# Like make a tooltip\n", "title = \"Click me!\"\n", "# and add a marker\n", - "marker = ipyleaflet.Marker(name='marker', location=(35.781608,-78.675800), title=title)\n", + "marker = ipyleaflet.Marker(name=\"marker\", location=(35.781608, -78.675800), title=title)\n", "\n", "# Add the marker to the map\n", "m.add(marker)\n", "\n", - "control = ipyleaflet.LayersControl(position='topright')\n", + "control = ipyleaflet.LayersControl(position=\"topright\")\n", "m.add(control)\n", "m" ] @@ -451,9 +451,9 @@ "metadata": {}, "outputs": [], "source": [ - "series = gj.SeriesMap(height = 500)\n", + "series = gj.SeriesMap(height=500)\n", "series.add_rasters([\"elevation\", \"elevation_shade\", \"slope\"])\n", - "#series.add_vectors([\"streams\", \"streets\", \"viewpoints\"])\n", + "# series.add_vectors([\"streams\", \"streets\", \"viewpoints\"])\n", "series.d_vect(map=\"streets\")\n", "series.d_barscale()\n", "series.show() # Create Slider" diff --git a/doc/notebooks/parallelization_tutorial.ipynb b/doc/notebooks/parallelization_tutorial.ipynb index 35a49fa2766..2c5d902e9a4 100644 --- a/doc/notebooks/parallelization_tutorial.ipynb +++ b/doc/notebooks/parallelization_tutorial.ipynb @@ -139,6 +139,7 @@ "import time\n", "from grass.pygrass.modules.grid import GridModule\n", "import time\n", + "\n", "start = time.time()\n", "grid = GridModule(\n", " \"v.surf.idw\",\n", diff --git a/doc/notebooks/scripting_example.ipynb b/doc/notebooks/scripting_example.ipynb index 612904da115..f71ebb8f284 100644 --- a/doc/notebooks/scripting_example.ipynb +++ b/doc/notebooks/scripting_example.ipynb @@ -74,7 +74,9 @@ "outputs": [], "source": [ "gs.parse_command(\"g.region\", raster=\"lakes\", flags=\"pg\")\n", - "gs.run_command(\"r.buffer\", input=\"lakes\", output=\"lakes_buff\", distances=[60, 120, 240, 500])\n", + "gs.run_command(\n", + " \"r.buffer\", input=\"lakes\", output=\"lakes_buff\", distances=[60, 120, 240, 500]\n", + ")\n", "gs.run_command(\"d.erase\")\n", "gs.run_command(\"d.rast\", map=\"lakes_buff\")\n", "gs.run_command(\"d.legend\", raster=\"lakes_buff\", range=(2, 5), at=(80, 100, 2, 10))\n", @@ -102,8 +104,12 @@ "gs.parse_command(\"g.region\", vector=\"boundary_state\", flags=\"pg\")\n", "gs.run_command(\"d.erase\") # erase the display before drawing again\n", "!rm -f $GRASS_LEGEND_FILE # and remove the legend file\n", - "gs.run_command(\"d.vect\", map=\"boundary_state\", fill_color=\"#5A91ED\", legend_label=\"State boundary\")\n", - "gs.run_command(\"d.vect\", map=\"buffer\", fill_color=\"#F8766D\", legend_label=\"Inner portion\")\n", + "gs.run_command(\n", + " \"d.vect\", map=\"boundary_state\", fill_color=\"#5A91ED\", legend_label=\"State boundary\"\n", + ")\n", + "gs.run_command(\n", + " \"d.vect\", map=\"buffer\", fill_color=\"#F8766D\", legend_label=\"Inner portion\"\n", + ")\n", "gs.run_command(\"d.legend.vect\", at=(10, 35))\n", "Image(filename=\"map.png\")" ] diff --git a/doc/notebooks/solar_potential.ipynb b/doc/notebooks/solar_potential.ipynb index cb3fd985910..98253ad6450 100644 --- a/doc/notebooks/solar_potential.ipynb +++ b/doc/notebooks/solar_potential.ipynb @@ -93,7 +93,18 @@ "metadata": {}, "outputs": [], "source": [ - "gs.run_command(\"r.sunmask\", elevation=\"elevation\", year=\"2001\", month=\"12\", day=\"22\", hour=\"16\", minute=\"15\", sec=\"0\", timezone=\"-5\", flags=\"s\")" + "gs.run_command(\n", + " \"r.sunmask\",\n", + " elevation=\"elevation\",\n", + " year=\"2001\",\n", + " month=\"12\",\n", + " day=\"22\",\n", + " hour=\"16\",\n", + " minute=\"15\",\n", + " sec=\"0\",\n", + " timezone=\"-5\",\n", + " flags=\"s\",\n", + ")" ] }, { @@ -111,7 +122,15 @@ "metadata": {}, "outputs": [], "source": [ - "gs.run_command(\"r.sun\", elevation=\"elevation\", aspect=\"aspect\", slope=\"slope\", incidout=\"incident\", day=\"356\", time=\"16.25\")\n", + "gs.run_command(\n", + " \"r.sun\",\n", + " elevation=\"elevation\",\n", + " aspect=\"aspect\",\n", + " slope=\"slope\",\n", + " incidout=\"incident\",\n", + " day=\"356\",\n", + " time=\"16.25\",\n", + ")\n", "gs.parse_command(\"r.info\", map=\"incident\", flags=\"g\")\n", "gs.run_command(\"r.colors\", map=\"incident\", co=\"bcyr\", flags=\"e\")" ] @@ -181,10 +200,26 @@ "metadata": {}, "outputs": [], "source": [ - "gs.run_command(\"r.sun\", elevation=\"elevation\", aspect=\"aspect\", slope=\"slope\", day=\"356\", glob_rad=\"winter\", insol_time=\"its356\")\n", + "gs.run_command(\n", + " \"r.sun\",\n", + " elevation=\"elevation\",\n", + " aspect=\"aspect\",\n", + " slope=\"slope\",\n", + " day=\"356\",\n", + " glob_rad=\"winter\",\n", + " insol_time=\"its356\",\n", + ")\n", "gs.run_command(\"r.colors\", map=\"winter\", co=\"gyr\", flags=\"e\")\n", "\n", - "gs.run_command(\"r.sun\", elevation=\"elevation\", aspect=\"aspect\", slope=\"slope\", day=\"172\", glob_rad=\"summer\", insol_time=\"its172\")\n", + "gs.run_command(\n", + " \"r.sun\",\n", + " elevation=\"elevation\",\n", + " aspect=\"aspect\",\n", + " slope=\"slope\",\n", + " day=\"172\",\n", + " glob_rad=\"summer\",\n", + " insol_time=\"its172\",\n", + ")\n", "gs.run_command(\"r.colors\", map=\"summer\", co=\"gyr\", flags=\"e\")" ] }, diff --git a/doc/notebooks/temporal.ipynb b/doc/notebooks/temporal.ipynb index 9a4433dc7fa..07e030a372c 100644 --- a/doc/notebooks/temporal.ipynb +++ b/doc/notebooks/temporal.ipynb @@ -32,7 +32,9 @@ "!curl http://fatra.cnr.ncsu.edu/temporal-grass-workshop/NC_spm_temporal_workshop.zip -o ../../data/NC_spm_temporal_workshop.zip\n", "\n", "# Unpack zip to grassdata\n", - "shutil.unpack_archive(\"../../data/NC_spm_temporal_workshop.zip\", \"../../data/grassdata\", \"zip\")" + "shutil.unpack_archive(\n", + " \"../../data/NC_spm_temporal_workshop.zip\", \"../../data/grassdata\", \"zip\"\n", + ")" ] }, { @@ -219,7 +221,7 @@ "source": [ "precip_map = gj.TimeSeriesMap(use_region=True)\n", "precip_map.add_raster_series(\"precip_sum_2010\")\n", - "precip_map.d_legend(color=\"black\", at=(10,40,2,6)) #Add legend\n", + "precip_map.d_legend(color=\"black\", at=(10, 40, 2, 6)) # Add legend\n", "precip_map.d_vect(map=\"boundary_county\", fill_color=\"none\")\n", "precip_map.d_barscale()\n", "precip_map.show()" @@ -240,7 +242,11 @@ "source": [ "from IPython.display import Image\n", "\n", - "Image(precip_map.save(\"image.gif\", duration=500, label=True, text_size=16, text_color=\"gray\"))" + "Image(\n", + " precip_map.save(\n", + " \"image.gif\", duration=500, label=True, text_size=16, text_color=\"gray\"\n", + " )\n", + ")" ] }, { diff --git a/doc/notebooks/viewshed_analysis.ipynb b/doc/notebooks/viewshed_analysis.ipynb index 263931ba25c..a4f0b61744a 100644 --- a/doc/notebooks/viewshed_analysis.ipynb +++ b/doc/notebooks/viewshed_analysis.ipynb @@ -65,8 +65,17 @@ "outputs": [], "source": [ "gs.parse_command(\"g.region\", raster=\"elevation\", flags=\"apg\")\n", - "gs.write_command(\"v.in.ascii\", input=\"-\", stdin=\"%s|%s\" % (642212, 224767), output=\"viewpoints\")\n", - "gs.run_command(\"r.viewshed\", input=\"elevation\", output=\"tower_los\", coordinates=\"642212,224767\", observer_elevation=\"165\", max_distance=\"10000\")" + "gs.write_command(\n", + " \"v.in.ascii\", input=\"-\", stdin=\"%s|%s\" % (642212, 224767), output=\"viewpoints\"\n", + ")\n", + "gs.run_command(\n", + " \"r.viewshed\",\n", + " input=\"elevation\",\n", + " output=\"tower_los\",\n", + " coordinates=\"642212,224767\",\n", + " observer_elevation=\"165\",\n", + " max_distance=\"10000\",\n", + ")" ] }, { diff --git a/general/g.mapsets/tests/conftest.py b/general/g.mapsets/tests/conftest.py index ca58228607c..ae4f1c106f9 100644 --- a/general/g.mapsets/tests/conftest.py +++ b/general/g.mapsets/tests/conftest.py @@ -5,7 +5,6 @@ Fixture for ReprojectionRenderer test with simple GRASS location, raster, vector. """ - from types import SimpleNamespace import grass.script as gs diff --git a/general/g.region/testsuite/test_g_region.py b/general/g.region/testsuite/test_g_region.py index b2f9d8aa83e..7362c062f1d 100644 --- a/general/g.region/testsuite/test_g_region.py +++ b/general/g.region/testsuite/test_g_region.py @@ -2,6 +2,7 @@ @author Anna Petrasova """ + from grass.gunittest.case import TestCase from grass.gunittest.gmodules import call_module import grass.script as gs diff --git a/gui/wxpython/animation/controller.py b/gui/wxpython/animation/controller.py index d6488d53263..ed03f7dadb5 100644 --- a/gui/wxpython/animation/controller.py +++ b/gui/wxpython/animation/controller.py @@ -13,6 +13,7 @@ @author Anna Petrasova """ + import os import wx diff --git a/gui/wxpython/animation/data.py b/gui/wxpython/animation/data.py index d19c2d21054..5c2cdf35ef1 100644 --- a/gui/wxpython/animation/data.py +++ b/gui/wxpython/animation/data.py @@ -15,6 +15,7 @@ @author Anna Petrasova """ + import os import copy diff --git a/gui/wxpython/animation/frame.py b/gui/wxpython/animation/frame.py index 38f07866264..e5bbd389d4c 100644 --- a/gui/wxpython/animation/frame.py +++ b/gui/wxpython/animation/frame.py @@ -17,6 +17,7 @@ @author Anna Petrasova """ + import os import wx import wx.aui diff --git a/gui/wxpython/animation/provider.py b/gui/wxpython/animation/provider.py index 10d83ec02f5..978c18e90cb 100644 --- a/gui/wxpython/animation/provider.py +++ b/gui/wxpython/animation/provider.py @@ -19,6 +19,7 @@ @author Anna Petrasova """ + import os import sys import wx @@ -427,9 +428,9 @@ def Render(self, cmdList, regions, regionFor3D, bgcolor, force, nprocs): for i in range(len(cmd_list)): proc_list[i].join() filename = queue_list[i].get() - self._mapFilesPool[ - HashCmd(cmd_list[i][0], cmd_list[i][1]) - ] = filename + self._mapFilesPool[HashCmd(cmd_list[i][0], cmd_list[i][1])] = ( + filename + ) self._mapFilesPool.SetSize( HashCmd(cmd_list[i][0], cmd_list[i][1]), (self.imageWidth, self.imageHeight), @@ -540,15 +541,17 @@ def Compose(self, cmdLists, regions, opacityList, bgcolor, force, nprocs): proc_list[i].join() filename = queue_list[i].get() if filename is None: - self._bitmapPool[ - HashCmds(cmd_lists[i][0], cmd_lists[i][1]) - ] = createNoDataBitmap( - self.imageWidth, self.imageHeight, text="Failed to render" + self._bitmapPool[HashCmds(cmd_lists[i][0], cmd_lists[i][1])] = ( + createNoDataBitmap( + self.imageWidth, + self.imageHeight, + text="Failed to render", + ) ) else: - self._bitmapPool[ - HashCmds(cmd_lists[i][0], cmd_lists[i][1]) - ] = BitmapFromImage(wx.Image(filename)) + self._bitmapPool[HashCmds(cmd_lists[i][0], cmd_lists[i][1])] = ( + BitmapFromImage(wx.Image(filename)) + ) os.remove(filename) proc_count = 0 proc_list = [] diff --git a/gui/wxpython/animation/temporal_manager.py b/gui/wxpython/animation/temporal_manager.py index 4fc31f75d26..a111edc81cb 100644 --- a/gui/wxpython/animation/temporal_manager.py +++ b/gui/wxpython/animation/temporal_manager.py @@ -221,9 +221,11 @@ def GetLabelsAndMaps(self): timestamps = [ ( datetime.datetime.strftime(st, formatString), - datetime.datetime.strftime(end, formatString) - if end is not None - else None, + ( + datetime.datetime.strftime(end, formatString) + if end is not None + else None + ), unit, ) for (st, end, unit) in timestamps diff --git a/gui/wxpython/animation/toolbars.py b/gui/wxpython/animation/toolbars.py index 0fc21c70366..1ac3c2efedb 100644 --- a/gui/wxpython/animation/toolbars.py +++ b/gui/wxpython/animation/toolbars.py @@ -17,6 +17,7 @@ @author Anna Petrasova """ + import wx from gui_core.toolbars import BaseToolbar, BaseIcons from icons.icon import MetaIcon diff --git a/gui/wxpython/animation/utils.py b/gui/wxpython/animation/utils.py index b6c0d27abac..9be0fe78c17 100644 --- a/gui/wxpython/animation/utils.py +++ b/gui/wxpython/animation/utils.py @@ -17,6 +17,7 @@ @author Anna Perasova """ + import os import wx import hashlib diff --git a/gui/wxpython/core/treemodel.py b/gui/wxpython/core/treemodel.py index 1c1fc2deee9..46f255021e9 100644 --- a/gui/wxpython/core/treemodel.py +++ b/gui/wxpython/core/treemodel.py @@ -15,6 +15,7 @@ @author Anna Petrasova """ + import copy from grass.script.utils import naturally_sort diff --git a/gui/wxpython/core/ws.py b/gui/wxpython/core/ws.py index 32dec87a05d..fc88772ff36 100644 --- a/gui/wxpython/core/ws.py +++ b/gui/wxpython/core/ws.py @@ -16,6 +16,7 @@ @author Stepan Turek (mentor: Martin Landa) """ + import sys import copy import time diff --git a/gui/wxpython/datacatalog/dialogs.py b/gui/wxpython/datacatalog/dialogs.py index 948238c7146..5e463e83543 100644 --- a/gui/wxpython/datacatalog/dialogs.py +++ b/gui/wxpython/datacatalog/dialogs.py @@ -14,7 +14,6 @@ @author Anna Petrasova """ - import wx from gui_core.widgets import FloatValidator, IntegerValidator from core.giface import Notification diff --git a/gui/wxpython/datacatalog/tree.py b/gui/wxpython/datacatalog/tree.py index 02d68f938a1..8821aeb61d4 100644 --- a/gui/wxpython/datacatalog/tree.py +++ b/gui/wxpython/datacatalog/tree.py @@ -18,6 +18,7 @@ @author Anna Petrasova (kratochanna gmail com) @author Linda Kladivova (l.kladivova@seznam.cz) """ + import os import re import copy diff --git a/gui/wxpython/gcp/statusbar.py b/gui/wxpython/gcp/statusbar.py index 1d10ad0b9b4..1424f7f4846 100644 --- a/gui/wxpython/gcp/statusbar.py +++ b/gui/wxpython/gcp/statusbar.py @@ -16,7 +16,6 @@ @author Anna Kratochvilova (statusbar refactoring) """ - import wx from core.gcmd import GMessage diff --git a/gui/wxpython/gui_core/menu.py b/gui/wxpython/gui_core/menu.py index 55ba0d40d48..3c1376cea0d 100644 --- a/gui/wxpython/gui_core/menu.py +++ b/gui/wxpython/gui_core/menu.py @@ -22,6 +22,7 @@ @author Vaclav Petras (menu customization) @author Tomas Zigo RecentFilesMenu """ + import re import os import wx diff --git a/gui/wxpython/gui_core/preferences.py b/gui/wxpython/gui_core/preferences.py index 257fafc4dca..85915c9567f 100644 --- a/gui/wxpython/gui_core/preferences.py +++ b/gui/wxpython/gui_core/preferences.py @@ -371,9 +371,9 @@ def _createGeneralPage(self, notebook): group="manager", key="copySelectedTextToClipboard", subkey="enabled" ) ) - self.winId[ - "manager:copySelectedTextToClipboard:enabled" - ] = copySelectedTextToClipboard.GetId() + self.winId["manager:copySelectedTextToClipboard:enabled"] = ( + copySelectedTextToClipboard.GetId() + ) gridSizer.Add(copySelectedTextToClipboard, pos=(row, 0), span=(1, 2)) @@ -1423,9 +1423,9 @@ def _createLayersPage(self, notebook): subkey=["transparent", "enabled"], ) ) - self.winId[ - "vectorLayer:featureColor:transparent:enabled" - ] = transpFeature.GetId() + self.winId["vectorLayer:featureColor:transparent:enabled"] = ( + transpFeature.GetId() + ) gridSizer.Add(transpFeature, pos=(row, col + 1), flag=wx.ALIGN_CENTER_VERTICAL) # area fill color diff --git a/gui/wxpython/gui_core/pystc.py b/gui/wxpython/gui_core/pystc.py index b11bf0f8418..bf268f88f33 100644 --- a/gui/wxpython/gui_core/pystc.py +++ b/gui/wxpython/gui_core/pystc.py @@ -15,7 +15,6 @@ @author Anna Petrasova (dark theme) """ - import keyword import wx diff --git a/gui/wxpython/gui_core/query.py b/gui/wxpython/gui_core/query.py index 638a64fa948..3a250af4d42 100644 --- a/gui/wxpython/gui_core/query.py +++ b/gui/wxpython/gui_core/query.py @@ -13,6 +13,7 @@ @author Anna Kratochvilova """ + import wx from gui_core.treeview import TreeListView diff --git a/gui/wxpython/iclass/dialogs.py b/gui/wxpython/iclass/dialogs.py index fb799e27057..868928efc89 100644 --- a/gui/wxpython/iclass/dialogs.py +++ b/gui/wxpython/iclass/dialogs.py @@ -19,6 +19,7 @@ @author Vaclav Petras @author Anna Kratochvilova """ + import os import wx diff --git a/gui/wxpython/icons/grass_icons.py b/gui/wxpython/icons/grass_icons.py index 2c13429d9ec..e4cd9b55ed7 100644 --- a/gui/wxpython/icons/grass_icons.py +++ b/gui/wxpython/icons/grass_icons.py @@ -3,6 +3,7 @@ http://robert.szczepanek.pl/icons.php https://svn.osgeo.org/osgeo/graphics/toolbar-icons/24x24/ """ + __author__ = "Robert Szczepanek" import os diff --git a/gui/wxpython/image2target/ii2t_statusbar.py b/gui/wxpython/image2target/ii2t_statusbar.py index 1d10ad0b9b4..1424f7f4846 100644 --- a/gui/wxpython/image2target/ii2t_statusbar.py +++ b/gui/wxpython/image2target/ii2t_statusbar.py @@ -16,7 +16,6 @@ @author Anna Kratochvilova (statusbar refactoring) """ - import wx from core.gcmd import GMessage diff --git a/gui/wxpython/iscatt/controllers.py b/gui/wxpython/iscatt/controllers.py index d3602d9124f..c526a4bf28d 100644 --- a/gui/wxpython/iscatt/controllers.py +++ b/gui/wxpython/iscatt/controllers.py @@ -19,6 +19,7 @@ @author Stepan Turek (mentor: Martin Landa) """ + from copy import deepcopy import wx diff --git a/gui/wxpython/iscatt/frame.py b/gui/wxpython/iscatt/frame.py index 242731ef182..9ff5a6ceac6 100644 --- a/gui/wxpython/iscatt/frame.py +++ b/gui/wxpython/iscatt/frame.py @@ -18,7 +18,6 @@ @author Stepan Turek (mentor: Martin Landa) """ - import os import wx diff --git a/gui/wxpython/iscatt/iscatt_core.py b/gui/wxpython/iscatt/iscatt_core.py index d97cdb84a56..1c5b2887edb 100644 --- a/gui/wxpython/iscatt/iscatt_core.py +++ b/gui/wxpython/iscatt/iscatt_core.py @@ -17,6 +17,7 @@ @author Stepan Turek (mentor: Martin Landa) """ + import os import numpy as np diff --git a/gui/wxpython/iscatt/plots.py b/gui/wxpython/iscatt/plots.py index be036ffd7b9..661da107754 100644 --- a/gui/wxpython/iscatt/plots.py +++ b/gui/wxpython/iscatt/plots.py @@ -15,6 +15,7 @@ @author Stepan Turek (mentor: Martin Landa) """ + import wx import numpy as np from math import ceil diff --git a/gui/wxpython/iscatt/toolbars.py b/gui/wxpython/iscatt/toolbars.py index 47d799e1961..6c5ab3947d6 100644 --- a/gui/wxpython/iscatt/toolbars.py +++ b/gui/wxpython/iscatt/toolbars.py @@ -13,6 +13,7 @@ @author Stepan Turek (mentor: Martin Landa) """ + import wx from icons.icon import MetaIcon diff --git a/gui/wxpython/location_wizard/dialogs.py b/gui/wxpython/location_wizard/dialogs.py index aaa0b4f1112..236913c211b 100644 --- a/gui/wxpython/location_wizard/dialogs.py +++ b/gui/wxpython/location_wizard/dialogs.py @@ -17,6 +17,7 @@ @author Jachym Cepicky @author Martin Landa """ + import os import wx diff --git a/gui/wxpython/location_wizard/wizard.py b/gui/wxpython/location_wizard/wizard.py index 4127d5047d4..4f3a2924847 100644 --- a/gui/wxpython/location_wizard/wizard.py +++ b/gui/wxpython/location_wizard/wizard.py @@ -33,6 +33,7 @@ @author Martin Landa @author Hamish Bowman (planetary ellipsoids) """ + import os import locale import functools diff --git a/gui/wxpython/mapwin/decorations.py b/gui/wxpython/mapwin/decorations.py index 5ead9c5f0e7..2eb5abe6075 100644 --- a/gui/wxpython/mapwin/decorations.py +++ b/gui/wxpython/mapwin/decorations.py @@ -32,7 +32,6 @@ class OverlayController: - """Base class for decorations (barscale, legend) controller.""" def __init__(self, renderer, giface): diff --git a/gui/wxpython/mapwin/graphics.py b/gui/wxpython/mapwin/graphics.py index 1522cf9f4dd..0bc94bae6d2 100644 --- a/gui/wxpython/mapwin/graphics.py +++ b/gui/wxpython/mapwin/graphics.py @@ -15,7 +15,6 @@ @author Stepan Turek (handlers support, GraphicsSet) """ - from copy import copy import wx diff --git a/gui/wxpython/nviz/mapwindow.py b/gui/wxpython/nviz/mapwindow.py index 1c291e1068b..fa9f51207da 100644 --- a/gui/wxpython/nviz/mapwindow.py +++ b/gui/wxpython/nviz/mapwindow.py @@ -2066,18 +2066,18 @@ def UpdateVolumeProperties(self, id, data, isosurfId=None): if ( data["draw"]["shading"]["isosurface"]["value"] < 0 ): # need to calculate - mode = data["draw"]["shading"]["isosurface"][ - "value" - ] = self.nvizDefault.GetDrawMode( - shade=data["draw"]["shading"]["isosurface"], string=False + mode = data["draw"]["shading"]["isosurface"]["value"] = ( + self.nvizDefault.GetDrawMode( + shade=data["draw"]["shading"]["isosurface"], string=False + ) ) self._display.SetIsosurfaceMode(id, mode) else: if data["draw"]["shading"]["slice"]["value"] < 0: # need to calculate - mode = data["draw"]["shading"]["slice"][ - "value" - ] = self.nvizDefault.GetDrawMode( - shade=data["draw"]["shading"]["slice"], string=False + mode = data["draw"]["shading"]["slice"]["value"] = ( + self.nvizDefault.GetDrawMode( + shade=data["draw"]["shading"]["slice"], string=False + ) ) self._display.SetSliceMode(id, mode) data["draw"]["shading"].pop("update") @@ -2504,17 +2504,7 @@ def NvizCmdCommand(self): # vlines # if vectors: - cmdLines = ( - cmdLWidth - ) = ( - cmdLHeight - ) = ( - cmdLColor - ) = ( - cmdLMode - ) = ( - cmdLPos - ) = ( + cmdLines = cmdLWidth = cmdLHeight = cmdLColor = cmdLMode = cmdLPos = ( cmdPoints ) = cmdPWidth = cmdPSize = cmdPColor = cmdPMarker = cmdPPos = cmdPLayer = "" markers = [ diff --git a/gui/wxpython/photo2image/ip2i_statusbar.py b/gui/wxpython/photo2image/ip2i_statusbar.py index c1fcf9a9907..3415906aeee 100644 --- a/gui/wxpython/photo2image/ip2i_statusbar.py +++ b/gui/wxpython/photo2image/ip2i_statusbar.py @@ -16,7 +16,6 @@ @author Anna Kratochvilova (statusbar refactoring) """ - import wx from core.gcmd import GMessage diff --git a/gui/wxpython/psmap/dialogs.py b/gui/wxpython/psmap/dialogs.py index 1e0a7851409..88c2f5abc98 100644 --- a/gui/wxpython/psmap/dialogs.py +++ b/gui/wxpython/psmap/dialogs.py @@ -3212,9 +3212,9 @@ def update(self): if self.colorColRadio.GetValue(): # this color is taken in case of no record in rgb column self.vPropertiesDict["fcolor"] = "none" - self.vPropertiesDict[ - "rgbcolumn" - ] = self.colorColChoice.GetStringSelection() + self.vPropertiesDict["rgbcolumn"] = ( + self.colorColChoice.GetStringSelection() + ) else: self.vPropertiesDict["fcolor"] = "none" @@ -3238,9 +3238,9 @@ def update(self): if self.colorColRadio.GetValue(): # this color is taken in case of no record in rgb column self.vPropertiesDict["color"] = "none" - self.vPropertiesDict[ - "rgbcolumn" - ] = self.colorColChoice.GetStringSelection() + self.vPropertiesDict["rgbcolumn"] = ( + self.colorColChoice.GetStringSelection() + ) # # size and style # @@ -3258,9 +3258,9 @@ def update(self): self.vPropertiesDict["sizecolumn"] = None self.vPropertiesDict["scale"] = None else: - self.vPropertiesDict[ - "sizecolumn" - ] = self.sizeColChoice.GetStringSelection() + self.vPropertiesDict["sizecolumn"] = ( + self.sizeColChoice.GetStringSelection() + ) self.vPropertiesDict["scale"] = self.scaleSpin.GetValue() self.vPropertiesDict["size"] = None @@ -3273,9 +3273,9 @@ def update(self): if self.rotateRadio.GetValue(): self.vPropertiesDict["rotate"] = self.rotateSpin.GetValue() else: - self.vPropertiesDict[ - "rotatecolumn" - ] = self.rotateColChoice.GetStringSelection() + self.vPropertiesDict["rotatecolumn"] = ( + self.rotateColChoice.GetStringSelection() + ) if self.type == "areas": # pattern diff --git a/gui/wxpython/psmap/frame.py b/gui/wxpython/psmap/frame.py index 85ccbae0067..88a4ad08dd5 100644 --- a/gui/wxpython/psmap/frame.py +++ b/gui/wxpython/psmap/frame.py @@ -2292,10 +2292,10 @@ def Zoom(self, zoomFactor, view): rot = float(self.instruction[id]["rotate"]) else: rot = 0 - self.instruction[id][ - "rect" - ] = bounds = self.parent.getModifiedTextBounds( - coords[0], coords[1], extent, rot + self.instruction[id]["rect"] = bounds = ( + self.parent.getModifiedTextBounds( + coords[0], coords[1], extent, rot + ) ) self.DrawRotText( pdc=self.pdcObj, diff --git a/gui/wxpython/psmap/utils.py b/gui/wxpython/psmap/utils.py index af68405446f..f7e4cea1ad3 100644 --- a/gui/wxpython/psmap/utils.py +++ b/gui/wxpython/psmap/utils.py @@ -15,6 +15,7 @@ @author Anna Kratochvilova """ + import wx from math import ceil, floor, sin, cos, pi diff --git a/gui/wxpython/rdigit/controller.py b/gui/wxpython/rdigit/controller.py index 26e9f455e68..2e98ca32ccc 100644 --- a/gui/wxpython/rdigit/controller.py +++ b/gui/wxpython/rdigit/controller.py @@ -13,6 +13,7 @@ @author Anna Petrasova """ + import os import tempfile import wx diff --git a/gui/wxpython/rlisetup/functions.py b/gui/wxpython/rlisetup/functions.py index d77962a97c1..2b9433ea4d6 100644 --- a/gui/wxpython/rlisetup/functions.py +++ b/gui/wxpython/rlisetup/functions.py @@ -3,6 +3,7 @@ @author: lucadelu """ + import wx import os import sys diff --git a/gui/wxpython/startup/guiutils.py b/gui/wxpython/startup/guiutils.py index ca04e52aefc..d94da9f9b16 100644 --- a/gui/wxpython/startup/guiutils.py +++ b/gui/wxpython/startup/guiutils.py @@ -14,7 +14,6 @@ This is for code which depend on something from GUI (wx or wxGUI). """ - import os import wx diff --git a/gui/wxpython/vdigit/toolbars.py b/gui/wxpython/vdigit/toolbars.py index 306732e79b4..fb461118d2a 100644 --- a/gui/wxpython/vdigit/toolbars.py +++ b/gui/wxpython/vdigit/toolbars.py @@ -14,6 +14,7 @@ @author Martin Landa @author Stepan Turek (handlers support) """ + import wx from grass import script as grass diff --git a/gui/wxpython/vdigit/wxdigit.py b/gui/wxpython/vdigit/wxdigit.py index 9cf6005a077..0c36100e561 100644 --- a/gui/wxpython/vdigit/wxdigit.py +++ b/gui/wxpython/vdigit/wxdigit.py @@ -26,7 +26,6 @@ @author Martin Landa """ - import grass.script.core as grass from grass.pydispatch.signal import Signal diff --git a/gui/wxpython/vdigit/wxdisplay.py b/gui/wxpython/vdigit/wxdisplay.py index 21f86f3718d..988afc481ac 100644 --- a/gui/wxpython/vdigit/wxdisplay.py +++ b/gui/wxpython/vdigit/wxdisplay.py @@ -17,7 +17,6 @@ @author Martin Landa """ - import locale import os diff --git a/gui/wxpython/vnet/toolbars.py b/gui/wxpython/vnet/toolbars.py index bb0a1aacdd5..5f80e50cd9d 100644 --- a/gui/wxpython/vnet/toolbars.py +++ b/gui/wxpython/vnet/toolbars.py @@ -85,7 +85,7 @@ def _toolbarData(self): icons["pointDelete"], self.OnDeletePoint, ), - (None,) # , + (None,), # , # ('isec_turn_edit', icons['isec_turn_edit'], # self.dialog.OnDefIsecTurnCosts, # wx.ITEM_CHECK), diff --git a/gui/wxpython/vnet/vnet_data.py b/gui/wxpython/vnet/vnet_data.py index 946e31975e8..528efa0a6c2 100644 --- a/gui/wxpython/vnet/vnet_data.py +++ b/gui/wxpython/vnet/vnet_data.py @@ -22,6 +22,7 @@ @author Lukas Bocan (turn costs support) @author Eliska Kyzlikova (turn costs support) """ + import os import math from copy import deepcopy diff --git a/gui/wxpython/wxplot/profile.py b/gui/wxpython/wxplot/profile.py index 591608767d7..1b55da68919 100644 --- a/gui/wxpython/wxplot/profile.py +++ b/gui/wxpython/wxplot/profile.py @@ -234,9 +234,11 @@ def SetupProfile(self): # transect self.seglist.append( ( - segment_geodesic_cum_dist - if self._is_lat_lon_proj and haveCtypes - else cumdist, + ( + segment_geodesic_cum_dist + if self._is_lat_lon_proj and haveCtypes + else cumdist + ), val, ) ) diff --git a/imagery/i.pca/testsuite/test_pca.py b/imagery/i.pca/testsuite/test_pca.py index 9da7991f876..8e9df84f2eb 100644 --- a/imagery/i.pca/testsuite/test_pca.py +++ b/imagery/i.pca/testsuite/test_pca.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase diff --git a/imagery/i.segment/testsuite/test_isegment.py b/imagery/i.segment/testsuite/test_isegment.py index 09046f980af..66d24d41661 100644 --- a/imagery/i.segment/testsuite/test_isegment.py +++ b/imagery/i.segment/testsuite/test_isegment.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase diff --git a/imagery/i.signatures/testsuite/test_i_signatures.py b/imagery/i.signatures/testsuite/test_i_signatures.py index 34f38774bc0..651d510ed03 100644 --- a/imagery/i.signatures/testsuite/test_i_signatures.py +++ b/imagery/i.signatures/testsuite/test_i_signatures.py @@ -8,6 +8,7 @@ Read the file COPYING that comes with GRASS for details """ + import os import shutil import json diff --git a/imagery/i.svm.predict/testsuite/test_i_svm_predict.py b/imagery/i.svm.predict/testsuite/test_i_svm_predict.py index 706af4f4fa2..3662124f45d 100644 --- a/imagery/i.svm.predict/testsuite/test_i_svm_predict.py +++ b/imagery/i.svm.predict/testsuite/test_i_svm_predict.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + import unittest import shutil diff --git a/imagery/i.svm.train/testsuite/test_i_svm_train.py b/imagery/i.svm.train/testsuite/test_i_svm_train.py index d895ffcd22f..f097405d98f 100644 --- a/imagery/i.svm.train/testsuite/test_i_svm_train.py +++ b/imagery/i.svm.train/testsuite/test_i_svm_train.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + import os import unittest import ctypes diff --git a/imagery/i.vi/testsuite/test_vi.py b/imagery/i.vi/testsuite/test_vi.py index a0da8245a5e..0c383417257 100644 --- a/imagery/i.vi/testsuite/test_vi.py +++ b/imagery/i.vi/testsuite/test_vi.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase diff --git a/lib/gis/testsuite/gis_lib_env_test.py b/lib/gis/testsuite/gis_lib_env_test.py index 91382f552c0..fafc00a37ed 100644 --- a/lib/gis/testsuite/gis_lib_env_test.py +++ b/lib/gis/testsuite/gis_lib_env_test.py @@ -2,6 +2,7 @@ @author Soeren Gebbert """ + from grass.gunittest.case import TestCase import grass.lib.gis as libgis diff --git a/lib/imagery/testsuite/test_imagery_find.py b/lib/imagery/testsuite/test_imagery_find.py index a943e2d3520..72e99bc2776 100644 --- a/lib/imagery/testsuite/test_imagery_find.py +++ b/lib/imagery/testsuite/test_imagery_find.py @@ -8,6 +8,7 @@ Read the file COPYING that comes with GRASS for details """ + import os import shutil diff --git a/lib/imagery/testsuite/test_imagery_sigfile.py b/lib/imagery/testsuite/test_imagery_sigfile.py index c8bc90a4f95..104cd5a59b4 100644 --- a/lib/imagery/testsuite/test_imagery_sigfile.py +++ b/lib/imagery/testsuite/test_imagery_sigfile.py @@ -8,6 +8,7 @@ Read the file COPYING that comes with GRASS for details """ + import os import stat import ctypes @@ -383,9 +384,9 @@ def test_symmetric_complete_difference(self): self.assertEqual(ref_err, "The_Doors") # Clean up memory to help track memory leaks when run by valgrind - S.semantic_labels[ - 0 - ] = None # C should not call free() on memory allocated by python + S.semantic_labels[0] = ( + None # C should not call free() on memory allocated by python + ) I_free_signatures(ctypes.byref(S)) I_free_group_ref(ctypes.byref(R)) if ret: diff --git a/lib/imagery/testsuite/test_imagery_signature_management.py b/lib/imagery/testsuite/test_imagery_signature_management.py index b2ec954a74e..21f052372e2 100644 --- a/lib/imagery/testsuite/test_imagery_signature_management.py +++ b/lib/imagery/testsuite/test_imagery_signature_management.py @@ -8,6 +8,7 @@ Read the file COPYING that comes with GRASS for details """ + import os import shutil import ctypes diff --git a/lib/imagery/testsuite/test_imagery_sigsetfile.py b/lib/imagery/testsuite/test_imagery_sigsetfile.py index 6e5a119c236..b8bcb566520 100644 --- a/lib/imagery/testsuite/test_imagery_sigsetfile.py +++ b/lib/imagery/testsuite/test_imagery_sigsetfile.py @@ -8,6 +8,7 @@ Read the file COPYING that comes with GRASS for details """ + import os import stat import ctypes diff --git a/lib/raster/testsuite/test_raster_metadata.py b/lib/raster/testsuite/test_raster_metadata.py index 7da2c0fe4cf..43bbfaeea99 100644 --- a/lib/raster/testsuite/test_raster_metadata.py +++ b/lib/raster/testsuite/test_raster_metadata.py @@ -8,6 +8,7 @@ Read the file COPYING that comes with GRASS for details """ + import random import string diff --git a/lib/raster3d/testsuite/raster3d_lib_test.py b/lib/raster3d/testsuite/raster3d_lib_test.py index 5ec919c94ba..a0020ab9ef1 100644 --- a/lib/raster3d/testsuite/raster3d_lib_test.py +++ b/lib/raster3d/testsuite/raster3d_lib_test.py @@ -2,6 +2,7 @@ @author Soeren Gebbert """ + from grass.gunittest.case import TestCase diff --git a/man/parser_standard_options.py b/man/parser_standard_options.py index 3454084f330..6a6d769ab5e 100644 --- a/man/parser_standard_options.py +++ b/man/parser_standard_options.py @@ -3,6 +3,7 @@ @author: pietro """ + import argparse import os import sys diff --git a/pyproject.toml b/pyproject.toml index e06ff451bd0..c99b85ab4dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,24 +1,11 @@ [tool.black] +required-version = '24' line-length = 88 -target-version = ['py37', 'py38', 'py39', 'py310'] -include = '\.pyi?$' -exclude = ''' +target-version = ['py38', 'py39', 'py310', 'py311', 'py312'] +# 'extend-exclude' excludes files or directories in addition to the defaults +extend-exclude = ''' ( - # exclude directories in the root of the project - /( - \.eggs - | \.git - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | bin\..* - | dist\..* - )/ - | python/libgrass_interface_generator/ + python/libgrass_interface_generator/ ) ''' diff --git a/python/grass/grassdb/create.py b/python/grass/grassdb/create.py index f7e7b509405..041b5ed28f8 100644 --- a/python/grass/grassdb/create.py +++ b/python/grass/grassdb/create.py @@ -9,7 +9,6 @@ .. sectionauthor:: Vaclav Petras """ - import os import shutil import getpass diff --git a/python/grass/grassdb/manage.py b/python/grass/grassdb/manage.py index c79df87ce07..0446263615e 100644 --- a/python/grass/grassdb/manage.py +++ b/python/grass/grassdb/manage.py @@ -9,7 +9,6 @@ .. sectionauthor:: Vaclav Petras """ - import os import shutil import sys diff --git a/python/grass/gunittest/multireport.py b/python/grass/gunittest/multireport.py index 54c1c915909..014d8296e4b 100644 --- a/python/grass/gunittest/multireport.py +++ b/python/grass/gunittest/multireport.py @@ -9,7 +9,6 @@ :authors: Vaclav Petras """ - import sys import os import argparse diff --git a/python/grass/gunittest/runner.py b/python/grass/gunittest/runner.py index 8879527a24c..891e1b65a5a 100644 --- a/python/grass/gunittest/runner.py +++ b/python/grass/gunittest/runner.py @@ -12,7 +12,6 @@ a template. It is not expected that something will left. """ - import sys import time diff --git a/python/grass/gunittest/testsuite/test_assertions.py b/python/grass/gunittest/testsuite/test_assertions.py index fb14e50bbd8..bf0f946d37d 100644 --- a/python/grass/gunittest/testsuite/test_assertions.py +++ b/python/grass/gunittest/testsuite/test_assertions.py @@ -2,7 +2,6 @@ Tests assertion methods. """ - import os import grass.script.core as gcore diff --git a/python/grass/gunittest/testsuite/test_checkers.py b/python/grass/gunittest/testsuite/test_checkers.py index 8d6571a8aa4..d35ffcb19d8 100644 --- a/python/grass/gunittest/testsuite/test_checkers.py +++ b/python/grass/gunittest/testsuite/test_checkers.py @@ -11,7 +11,6 @@ @author Vaclav Petras """ - from grass.script.utils import parse_key_val, try_remove from grass.gunittest.case import TestCase diff --git a/python/grass/imaging/operations.py b/python/grass/imaging/operations.py index d1837a485b0..8c60c4c599e 100644 --- a/python/grass/imaging/operations.py +++ b/python/grass/imaging/operations.py @@ -53,7 +53,6 @@ .. sectionauthor:: Vaclav Petras """ - # import similar to what is in visvis try: import PIL diff --git a/python/grass/jupyter/tests/seriesmap_test.py b/python/grass/jupyter/tests/seriesmap_test.py index 79f3b20dbda..e19faf5f663 100644 --- a/python/grass/jupyter/tests/seriesmap_test.py +++ b/python/grass/jupyter/tests/seriesmap_test.py @@ -1,6 +1,5 @@ """Test SeriesMap functions""" - from pathlib import Path import pytest diff --git a/python/grass/jupyter/tests/timeseriesmap_test.py b/python/grass/jupyter/tests/timeseriesmap_test.py index ed7e5c6e156..d75ec8372e4 100644 --- a/python/grass/jupyter/tests/timeseriesmap_test.py +++ b/python/grass/jupyter/tests/timeseriesmap_test.py @@ -1,6 +1,5 @@ """Test TimeSeriesMap functions""" - from pathlib import Path import pytest diff --git a/python/grass/pydispatch/dispatcher.py b/python/grass/pydispatch/dispatcher.py index a34706f8cf7..0915629fdd9 100644 --- a/python/grass/pydispatch/dispatcher.py +++ b/python/grass/pydispatch/dispatcher.py @@ -25,6 +25,7 @@ deletion, (considerably speeds up the cleanup process vs. the original code.) """ + import weakref from grass.pydispatch import saferef, robustapply, errors diff --git a/python/grass/pydispatch/robust.py b/python/grass/pydispatch/robust.py index f65471037d7..9923d3afc90 100644 --- a/python/grass/pydispatch/robust.py +++ b/python/grass/pydispatch/robust.py @@ -1,4 +1,5 @@ """Module implementing error-catching version of send (sendRobust)""" + from grass.pydispatch.dispatcher import Any, Anonymous, liveReceivers, getAllReceivers from grass.pydispatch.robustapply import robustApply diff --git a/python/grass/pydispatch/robustapply.py b/python/grass/pydispatch/robustapply.py index ac4211bbddf..1c10bc917c6 100644 --- a/python/grass/pydispatch/robustapply.py +++ b/python/grass/pydispatch/robustapply.py @@ -5,6 +5,7 @@ and subset the given arguments to match only those which are acceptable. """ + import sys if sys.hexversion >= 0x3000000: diff --git a/python/grass/pydispatch/signal.py b/python/grass/pydispatch/signal.py index edb962853da..1e968e99dca 100644 --- a/python/grass/pydispatch/signal.py +++ b/python/grass/pydispatch/signal.py @@ -4,7 +4,6 @@ @author Vaclav Petras """ - from grass.pydispatch import dispatcher diff --git a/python/grass/pygrass/gis/region.py b/python/grass/pygrass/gis/region.py index 02a273a6ac6..453c2c84f5f 100644 --- a/python/grass/pygrass/gis/region.py +++ b/python/grass/pygrass/gis/region.py @@ -3,6 +3,7 @@ @author: Pietro Zambelli """ + import ctypes import grass.lib.gis as libgis import grass.lib.raster as libraster diff --git a/python/grass/pygrass/messages/__init__.py b/python/grass/pygrass/messages/__init__.py index 60e8e43e31c..36356433381 100644 --- a/python/grass/pygrass/messages/__init__.py +++ b/python/grass/pygrass/messages/__init__.py @@ -13,6 +13,7 @@ @author Soeren Gebbert """ + import sys from multiprocessing import Process, Lock, Pipe diff --git a/python/grass/pygrass/modules/grid/patch.py b/python/grass/pygrass/modules/grid/patch.py index 3d7c5432e43..be555583591 100644 --- a/python/grass/pygrass/modules/grid/patch.py +++ b/python/grass/pygrass/modules/grid/patch.py @@ -3,6 +3,7 @@ @author: pietro """ + from grass.pygrass.gis.region import Region from grass.pygrass.raster import RasterRow from grass.pygrass.utils import coor2pixel diff --git a/python/grass/pygrass/modules/grid/split.py b/python/grass/pygrass/modules/grid/split.py index a32665f5fcc..5ff56a3e737 100644 --- a/python/grass/pygrass/modules/grid/split.py +++ b/python/grass/pygrass/modules/grid/split.py @@ -3,6 +3,7 @@ @author: pietro """ + from grass.pygrass.gis.region import Region from grass.pygrass.vector.basic import Bbox diff --git a/python/grass/pygrass/modules/interface/__init__.py b/python/grass/pygrass/modules/interface/__init__.py index 37546d463dd..a05211e21c3 100644 --- a/python/grass/pygrass/modules/interface/__init__.py +++ b/python/grass/pygrass/modules/interface/__init__.py @@ -3,6 +3,7 @@ @author: pietro """ + from grass.pygrass.modules.interface import flag from grass.pygrass.modules.interface import parameter from grass.pygrass.modules.interface import module diff --git a/python/grass/pygrass/modules/interface/env.py b/python/grass/pygrass/modules/interface/env.py index 98e5208ef5b..4fbef04dae3 100644 --- a/python/grass/pygrass/modules/interface/env.py +++ b/python/grass/pygrass/modules/interface/env.py @@ -3,6 +3,7 @@ @author: pietro """ + import os import sys diff --git a/python/grass/pygrass/modules/interface/parameter.py b/python/grass/pygrass/modules/interface/parameter.py index 7ab67c186ad..161640e638e 100644 --- a/python/grass/pygrass/modules/interface/parameter.py +++ b/python/grass/pygrass/modules/interface/parameter.py @@ -3,6 +3,7 @@ @author: pietro """ + import re from grass.pygrass.modules.interface.docstring import docstring_property @@ -249,9 +250,11 @@ def get_bash(self): if isinstance(self.rawvalue, (list, tuple)): value = sep.join( [ - sep.join([str(v) for v in val]) - if isinstance(val, tuple) - else str(val) + ( + sep.join([str(v) for v in val]) + if isinstance(val, tuple) + else str(val) + ) for val in self.rawvalue ] ) diff --git a/python/grass/pygrass/modules/interface/testsuite/test_flag.py b/python/grass/pygrass/modules/interface/testsuite/test_flag.py index 26b9ba531ff..909c6d00d55 100644 --- a/python/grass/pygrass/modules/interface/testsuite/test_flag.py +++ b/python/grass/pygrass/modules/interface/testsuite/test_flag.py @@ -3,6 +3,7 @@ @author: pietro """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test diff --git a/python/grass/pygrass/modules/interface/testsuite/test_modules.py b/python/grass/pygrass/modules/interface/testsuite/test_modules.py index 10b4c3f2529..d95bf6177af 100644 --- a/python/grass/pygrass/modules/interface/testsuite/test_modules.py +++ b/python/grass/pygrass/modules/interface/testsuite/test_modules.py @@ -3,6 +3,7 @@ @author: pietro """ + from fnmatch import fnmatch from io import BytesIO diff --git a/python/grass/pygrass/modules/interface/testsuite/test_parameter.py b/python/grass/pygrass/modules/interface/testsuite/test_parameter.py index e3bf9921bfd..57f17cb3027 100644 --- a/python/grass/pygrass/modules/interface/testsuite/test_parameter.py +++ b/python/grass/pygrass/modules/interface/testsuite/test_parameter.py @@ -3,6 +3,7 @@ @author: pietro """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test diff --git a/python/grass/pygrass/modules/interface/typedict.py b/python/grass/pygrass/modules/interface/typedict.py index f2ece769d6c..c8fdeb48a76 100644 --- a/python/grass/pygrass/modules/interface/typedict.py +++ b/python/grass/pygrass/modules/interface/typedict.py @@ -3,6 +3,7 @@ @author: pietro """ + from collections import OrderedDict from copy import deepcopy diff --git a/python/grass/pygrass/modules/testsuite/test_import_isolation.py b/python/grass/pygrass/modules/testsuite/test_import_isolation.py index d91ae1a830b..d1321a554d0 100644 --- a/python/grass/pygrass/modules/testsuite/test_import_isolation.py +++ b/python/grass/pygrass/modules/testsuite/test_import_isolation.py @@ -9,6 +9,7 @@ Created on Wed Jul 15 11:34:32 2015 """ + import sys import fnmatch diff --git a/python/grass/pygrass/raster/abstract.py b/python/grass/pygrass/raster/abstract.py index 76d638db7db..6969154b7fb 100644 --- a/python/grass/pygrass/raster/abstract.py +++ b/python/grass/pygrass/raster/abstract.py @@ -3,6 +3,7 @@ @author: pietro """ + import ctypes # diff --git a/python/grass/pygrass/raster/category.py b/python/grass/pygrass/raster/category.py index b7a1294d96c..b43a10ae48d 100644 --- a/python/grass/pygrass/raster/category.py +++ b/python/grass/pygrass/raster/category.py @@ -3,6 +3,7 @@ @author: pietro """ + import ctypes from operator import itemgetter diff --git a/python/grass/pygrass/raster/history.py b/python/grass/pygrass/raster/history.py index 6140a6197b2..5041c9e55d8 100644 --- a/python/grass/pygrass/raster/history.py +++ b/python/grass/pygrass/raster/history.py @@ -3,6 +3,7 @@ @author: pietro """ + import ctypes import grass.lib.raster as libraster import datetime diff --git a/python/grass/pygrass/raster/raster_type.py b/python/grass/pygrass/raster/raster_type.py index 0b8244fe551..aa54a6d6df6 100644 --- a/python/grass/pygrass/raster/raster_type.py +++ b/python/grass/pygrass/raster/raster_type.py @@ -3,6 +3,7 @@ @author: pietro """ + import grass.lib.raster as libraster import ctypes import numpy as np diff --git a/python/grass/pygrass/raster/rowio.py b/python/grass/pygrass/raster/rowio.py index 650419122c3..62c5683ef68 100644 --- a/python/grass/pygrass/raster/rowio.py +++ b/python/grass/pygrass/raster/rowio.py @@ -3,6 +3,7 @@ @author: pietro """ + import ctypes import grass.lib.rowio as librowio diff --git a/python/grass/pygrass/raster/segment.py b/python/grass/pygrass/raster/segment.py index 6e9c4c4c781..60966d0f846 100644 --- a/python/grass/pygrass/raster/segment.py +++ b/python/grass/pygrass/raster/segment.py @@ -3,6 +3,7 @@ @author: pietro """ + import ctypes import grass.lib.gis as libgis import grass.lib.raster as libraster diff --git a/python/grass/pygrass/raster/testsuite/test_numpy.py b/python/grass/pygrass/raster/testsuite/test_numpy.py index c773e628f96..a2a6e1cdd26 100644 --- a/python/grass/pygrass/raster/testsuite/test_numpy.py +++ b/python/grass/pygrass/raster/testsuite/test_numpy.py @@ -3,6 +3,7 @@ @author: lucadelu """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test from numpy.random import random diff --git a/python/grass/pygrass/shell/conversion.py b/python/grass/pygrass/shell/conversion.py index 344dfd2811b..76802c08ce1 100644 --- a/python/grass/pygrass/shell/conversion.py +++ b/python/grass/pygrass/shell/conversion.py @@ -4,7 +4,6 @@ @author: pietro """ - dcont = """ {key} {value} diff --git a/python/grass/pygrass/vector/abstract.py b/python/grass/pygrass/vector/abstract.py index e1dda3a8d7d..bafbb006d6c 100644 --- a/python/grass/pygrass/vector/abstract.py +++ b/python/grass/pygrass/vector/abstract.py @@ -3,6 +3,7 @@ @author: pietro """ + import ctypes import datetime import grass.lib.vector as libvect diff --git a/python/grass/pygrass/vector/basic.py b/python/grass/pygrass/vector/basic.py index 8917629ca43..2b8c013b433 100644 --- a/python/grass/pygrass/vector/basic.py +++ b/python/grass/pygrass/vector/basic.py @@ -3,6 +3,7 @@ @author: pietro """ + import ctypes import grass.lib.vector as libvect from collections.abc import Iterable diff --git a/python/grass/pygrass/vector/find.py b/python/grass/pygrass/vector/find.py index ac56265447c..50599af5ab5 100644 --- a/python/grass/pygrass/vector/find.py +++ b/python/grass/pygrass/vector/find.py @@ -3,6 +3,7 @@ @author: pietro """ + import grass.lib.vector as libvect from grass.pygrass.errors import must_be_open diff --git a/python/grass/pygrass/vector/geometry.py b/python/grass/pygrass/vector/geometry.py index 81d9f3a8d78..855f374b47e 100644 --- a/python/grass/pygrass/vector/geometry.py +++ b/python/grass/pygrass/vector/geometry.py @@ -3,6 +3,7 @@ @author: pietro """ + import ctypes import re from collections import namedtuple diff --git a/python/grass/pygrass/vector/testsuite/test_filters.py b/python/grass/pygrass/vector/testsuite/test_filters.py index 6d3d7247f66..9252b134c02 100644 --- a/python/grass/pygrass/vector/testsuite/test_filters.py +++ b/python/grass/pygrass/vector/testsuite/test_filters.py @@ -3,6 +3,7 @@ @author: pietro """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test diff --git a/python/grass/pygrass/vector/testsuite/test_geometry.py b/python/grass/pygrass/vector/testsuite/test_geometry.py index a81c7d4a96f..d4ad7431278 100644 --- a/python/grass/pygrass/vector/testsuite/test_geometry.py +++ b/python/grass/pygrass/vector/testsuite/test_geometry.py @@ -3,6 +3,7 @@ @author: pietro """ + import sys import unittest import numpy as np diff --git a/python/grass/pygrass/vector/testsuite/test_geometry_attrs.py b/python/grass/pygrass/vector/testsuite/test_geometry_attrs.py index a1b75e0e9a6..4c17ef03d4c 100644 --- a/python/grass/pygrass/vector/testsuite/test_geometry_attrs.py +++ b/python/grass/pygrass/vector/testsuite/test_geometry_attrs.py @@ -3,6 +3,7 @@ @author: pietro """ + import sys import unittest import numpy as np diff --git a/python/grass/pygrass/vector/testsuite/test_table.py b/python/grass/pygrass/vector/testsuite/test_table.py index d80be7beb04..d603817de98 100644 --- a/python/grass/pygrass/vector/testsuite/test_table.py +++ b/python/grass/pygrass/vector/testsuite/test_table.py @@ -3,6 +3,7 @@ @author: pietro """ + import os import sqlite3 import tempfile as tmp diff --git a/python/grass/pygrass/vector/testsuite/test_vector.py b/python/grass/pygrass/vector/testsuite/test_vector.py index 12a553e02e2..a57856eca45 100644 --- a/python/grass/pygrass/vector/testsuite/test_vector.py +++ b/python/grass/pygrass/vector/testsuite/test_vector.py @@ -3,6 +3,7 @@ @author: pietro """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test diff --git a/python/grass/pygrass/vector/testsuite/test_vector3d.py b/python/grass/pygrass/vector/testsuite/test_vector3d.py index 25fe46c8914..16ee0fd969e 100644 --- a/python/grass/pygrass/vector/testsuite/test_vector3d.py +++ b/python/grass/pygrass/vector/testsuite/test_vector3d.py @@ -3,6 +3,7 @@ @author: pietro """ + import numpy as np from grass.gunittest.case import TestCase diff --git a/python/grass/script/task.py b/python/grass/script/task.py index 1c4e29f69a6..325b5640edc 100644 --- a/python/grass/script/task.py +++ b/python/grass/script/task.py @@ -17,6 +17,7 @@ .. sectionauthor:: Martin Landa """ + import os import re import sys diff --git a/python/grass/script/vector.py b/python/grass/script/vector.py index 6b0c9efe2b2..4297fa0171f 100644 --- a/python/grass/script/vector.py +++ b/python/grass/script/vector.py @@ -16,6 +16,7 @@ .. sectionauthor:: Glynn Clements .. sectionauthor:: Martin Landa """ + import os from .utils import parse_key_val diff --git a/python/grass/temporal/abstract_dataset.py b/python/grass/temporal/abstract_dataset.py index 4d6d4d81b51..720b2210ad8 100644 --- a/python/grass/temporal/abstract_dataset.py +++ b/python/grass/temporal/abstract_dataset.py @@ -9,6 +9,7 @@ :authors: Soeren Gebbert """ + from abc import ABCMeta, abstractmethod from .core import ( get_tgis_message_interface, diff --git a/python/grass/temporal/abstract_map_dataset.py b/python/grass/temporal/abstract_map_dataset.py index 035e64c7622..7306133251b 100644 --- a/python/grass/temporal/abstract_map_dataset.py +++ b/python/grass/temporal/abstract_map_dataset.py @@ -9,6 +9,7 @@ :authors: Soeren Gebbert """ + import grass.script as gs from grass.exceptions import ImplementationError from datetime import datetime diff --git a/python/grass/temporal/abstract_space_time_dataset.py b/python/grass/temporal/abstract_space_time_dataset.py index d7e28427190..b4812361174 100644 --- a/python/grass/temporal/abstract_space_time_dataset.py +++ b/python/grass/temporal/abstract_space_time_dataset.py @@ -9,6 +9,7 @@ class that is the base class for all space time datasets. :authors: Soeren Gebbert """ + import sys import uuid import os diff --git a/python/grass/temporal/base.py b/python/grass/temporal/base.py index 1f2b6290aa6..84d247449ff 100644 --- a/python/grass/temporal/base.py +++ b/python/grass/temporal/base.py @@ -24,6 +24,7 @@ :author: Soeren Gebbert """ + from datetime import datetime from .core import ( get_tgis_message_interface, diff --git a/python/grass/temporal/core.py b/python/grass/temporal/core.py index 4b7fe953b51..56d3b4cb77e 100644 --- a/python/grass/temporal/core.py +++ b/python/grass/temporal/core.py @@ -28,6 +28,7 @@ :author: Soeren Gebbert """ + # import traceback import os import grass.script as gscript diff --git a/python/grass/temporal/datetime_math.py b/python/grass/temporal/datetime_math.py index 66bee770ead..3cd30120788 100644 --- a/python/grass/temporal/datetime_math.py +++ b/python/grass/temporal/datetime_math.py @@ -8,6 +8,7 @@ :authors: Soeren Gebbert """ + from datetime import datetime, timedelta from .core import get_tgis_message_interface import copy diff --git a/python/grass/temporal/extract.py b/python/grass/temporal/extract.py index 9cb91ac2230..3f8c9cb0738 100644 --- a/python/grass/temporal/extract.py +++ b/python/grass/temporal/extract.py @@ -8,6 +8,7 @@ :authors: Soeren Gebbert """ + from .core import ( get_tgis_message_interface, get_current_mapset, diff --git a/python/grass/temporal/factory.py b/python/grass/temporal/factory.py index cc3652ff4ca..b7ef8ab5218 100644 --- a/python/grass/temporal/factory.py +++ b/python/grass/temporal/factory.py @@ -17,6 +17,7 @@ :authors: Soeren Gebbert """ + from .core import get_tgis_message_interface from .space_time_datasets import ( SpaceTimeRaster3DDataset, diff --git a/python/grass/temporal/gui_support.py b/python/grass/temporal/gui_support.py index 44e32b6e2e8..09b858657bc 100644 --- a/python/grass/temporal/gui_support.py +++ b/python/grass/temporal/gui_support.py @@ -9,6 +9,7 @@ :authors: Soeren Gebbert """ + from .core import get_available_temporal_mapsets, init_dbif from .factory import dataset_factory import grass.script as gscript diff --git a/python/grass/temporal/list_stds.py b/python/grass/temporal/list_stds.py index 785bb9217f6..0a216bedcd2 100644 --- a/python/grass/temporal/list_stds.py +++ b/python/grass/temporal/list_stds.py @@ -443,11 +443,13 @@ def check_columns(column_names, output_format, element_type): ).format( name=dataset.get_id(), element_type=element_type, - detail=_( - "Dataset is empty or where clause is too constrained or incorrect" - ) - if where - else _("Dataset is empty"), + detail=( + _( + "Dataset is empty or where clause is too constrained or incorrect" + ) + if where + else _("Dataset is empty") + ), ) ) if connection_state_changed: diff --git a/python/grass/temporal/mapcalc.py b/python/grass/temporal/mapcalc.py index e23d8cac165..54edeab885d 100644 --- a/python/grass/temporal/mapcalc.py +++ b/python/grass/temporal/mapcalc.py @@ -8,6 +8,7 @@ :authors: Soeren Gebbert """ + import copy from datetime import datetime from multiprocessing import Process diff --git a/python/grass/temporal/metadata.py b/python/grass/temporal/metadata.py index b9bd7adcc41..a77c16b9850 100644 --- a/python/grass/temporal/metadata.py +++ b/python/grass/temporal/metadata.py @@ -21,6 +21,7 @@ :authors: Soeren Gebbert """ + from .base import SQLDatabaseInterface from .core import SQLDatabaseInterfaceConnection, get_tgis_db_version_from_metadata diff --git a/python/grass/temporal/open_stds.py b/python/grass/temporal/open_stds.py index 837f1a860a7..83aacc1c819 100644 --- a/python/grass/temporal/open_stds.py +++ b/python/grass/temporal/open_stds.py @@ -17,6 +17,7 @@ :authors: Soeren Gebbert """ + from .core import init_dbif, get_current_mapset, get_tgis_message_interface from .factory import dataset_factory from .abstract_map_dataset import AbstractMapDataset diff --git a/python/grass/temporal/register.py b/python/grass/temporal/register.py index 7514cb33d03..323a798d876 100644 --- a/python/grass/temporal/register.py +++ b/python/grass/temporal/register.py @@ -16,6 +16,7 @@ :authors: Soeren Gebbert """ + from datetime import datetime import grass.script as gscript from .core import get_tgis_message_interface, init_dbif, get_current_mapset diff --git a/python/grass/temporal/sampling.py b/python/grass/temporal/sampling.py index 38fdd1aed53..afe84ce57b3 100644 --- a/python/grass/temporal/sampling.py +++ b/python/grass/temporal/sampling.py @@ -16,6 +16,7 @@ :authors: Soeren Gebbert """ + from .core import ( get_current_mapset, get_tgis_message_interface, diff --git a/python/grass/temporal/space_time_datasets.py b/python/grass/temporal/space_time_datasets.py index df1da106e0c..372f32900a1 100644 --- a/python/grass/temporal/space_time_datasets.py +++ b/python/grass/temporal/space_time_datasets.py @@ -8,6 +8,7 @@ :authors: Soeren Gebbert """ + import getpass from .abstract_map_dataset import AbstractMapDataset from .abstract_space_time_dataset import AbstractSpaceTimeDataset diff --git a/python/grass/temporal/spatial_extent.py b/python/grass/temporal/spatial_extent.py index 4288b7eadc6..ced1f88a9a1 100644 --- a/python/grass/temporal/spatial_extent.py +++ b/python/grass/temporal/spatial_extent.py @@ -33,6 +33,7 @@ :authors: Soeren Gebbert """ + from .base import SQLDatabaseInterface diff --git a/python/grass/temporal/spatial_topology_dataset_connector.py b/python/grass/temporal/spatial_topology_dataset_connector.py index 104a1491e39..0f303e5e663 100644 --- a/python/grass/temporal/spatial_topology_dataset_connector.py +++ b/python/grass/temporal/spatial_topology_dataset_connector.py @@ -13,6 +13,7 @@ :authors: Soeren Gebbert """ + import copy diff --git a/python/grass/temporal/spatio_temporal_relationships.py b/python/grass/temporal/spatio_temporal_relationships.py index cfc56644262..14b81ed40d4 100644 --- a/python/grass/temporal/spatio_temporal_relationships.py +++ b/python/grass/temporal/spatio_temporal_relationships.py @@ -17,6 +17,7 @@ :authors: Soeren Gebbert """ + from datetime import datetime from .core import init_dbif from .abstract_dataset import AbstractDatasetComparisonKeyStartTime diff --git a/python/grass/temporal/temporal_algebra.py b/python/grass/temporal/temporal_algebra.py index bd74d6799ff..b8f71ff0655 100644 --- a/python/grass/temporal/temporal_algebra.py +++ b/python/grass/temporal/temporal_algebra.py @@ -796,12 +796,12 @@ def __init__( self.process_chain_dict = ( {} ) # This dictionary stores all processes, as well as the maps to register and remove - self.process_chain_dict[ - "processes" - ] = [] # The mapcalc and v.patch module calls - self.process_chain_dict[ - "register" - ] = [] # Maps that must be registered/updated or inserted in a new STDS + self.process_chain_dict["processes"] = ( + [] + ) # The mapcalc and v.patch module calls + self.process_chain_dict["register"] = ( + [] + ) # Maps that must be registered/updated or inserted in a new STDS self.process_chain_dict["remove"] = [] # The g.remove module calls self.process_chain_dict["STDS"] = {} # The STDS that must be created diff --git a/python/grass/temporal/temporal_extent.py b/python/grass/temporal/temporal_extent.py index 4d033c89102..066f1697462 100644 --- a/python/grass/temporal/temporal_extent.py +++ b/python/grass/temporal/temporal_extent.py @@ -19,6 +19,7 @@ :authors: Soeren Gebbert """ + from .base import SQLDatabaseInterface ############################################################################### diff --git a/python/grass/temporal/temporal_granularity.py b/python/grass/temporal/temporal_granularity.py index df7eb949b0f..a7c47c045d2 100644 --- a/python/grass/temporal/temporal_granularity.py +++ b/python/grass/temporal/temporal_granularity.py @@ -17,6 +17,7 @@ :authors: Soeren Gebbert """ + from .datetime_math import compute_datetime_delta from .abstract_map_dataset import AbstractMapDataset from functools import reduce diff --git a/python/grass/temporal/temporal_operator.py b/python/grass/temporal/temporal_operator.py index f2a5a57bb1c..d86aab8adbd 100644 --- a/python/grass/temporal/temporal_operator.py +++ b/python/grass/temporal/temporal_operator.py @@ -139,6 +139,7 @@ SyntaxError: Unknown optype rter, must be one of ['select', 'boolean', 'raster', 'hash', 'relation', 'overlay'] """ + try: import ply.lex as lex import ply.yacc as yacc diff --git a/python/grass/temporal/temporal_raster3d_algebra.py b/python/grass/temporal/temporal_raster3d_algebra.py index 536f035130c..88d44768b6a 100644 --- a/python/grass/temporal/temporal_raster3d_algebra.py +++ b/python/grass/temporal/temporal_raster3d_algebra.py @@ -10,6 +10,7 @@ :authors: Thomas Leppelt and Soeren Gebbert """ + try: import ply.yacc as yacc except ImportError: diff --git a/python/grass/temporal/temporal_raster_base_algebra.py b/python/grass/temporal/temporal_raster_base_algebra.py index 12daadf2f3b..3fb3d31ad2a 100644 --- a/python/grass/temporal/temporal_raster_base_algebra.py +++ b/python/grass/temporal/temporal_raster_base_algebra.py @@ -40,6 +40,7 @@ LexToken(NAME,'B',1,23) """ + import copy import grass.pygrass.modules as pymod diff --git a/python/grass/temporal/temporal_topology_dataset_connector.py b/python/grass/temporal/temporal_topology_dataset_connector.py index 4a105bee033..a75a13ef54f 100644 --- a/python/grass/temporal/temporal_topology_dataset_connector.py +++ b/python/grass/temporal/temporal_topology_dataset_connector.py @@ -15,6 +15,7 @@ :authors: Soeren Gebbert """ + import copy diff --git a/python/grass/temporal/temporal_vector_algebra.py b/python/grass/temporal/temporal_vector_algebra.py index 5e545e08574..87341fb2c58 100644 --- a/python/grass/temporal/temporal_vector_algebra.py +++ b/python/grass/temporal/temporal_vector_algebra.py @@ -41,6 +41,7 @@ LexToken(RPAREN,')',1,16) """ + try: import ply.yacc as yacc except ImportError: diff --git a/python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py b/python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py index fd011a55d53..1ed80cd1316 100644 --- a/python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py +++ b/python/grass/temporal/testsuite/unittests_temporal_raster3d_algebra.py @@ -7,7 +7,6 @@ :authors: Soeren Gebbert and Thomas Leppelt """ - import grass.script import grass.temporal as tgis from grass.gunittest.case import TestCase diff --git a/python/grass/temporal/unit_tests.py b/python/grass/temporal/unit_tests.py index fd412ee6cf2..8083680ef3f 100644 --- a/python/grass/temporal/unit_tests.py +++ b/python/grass/temporal/unit_tests.py @@ -8,6 +8,7 @@ :authors: Soeren Gebbert """ + import copy from datetime import datetime import grass.script.core as core diff --git a/python/grass/temporal/univar_statistics.py b/python/grass/temporal/univar_statistics.py index 80cca737199..bb5475aec1e 100755 --- a/python/grass/temporal/univar_statistics.py +++ b/python/grass/temporal/univar_statistics.py @@ -18,6 +18,7 @@ :authors: Soeren Gebbert """ + from multiprocessing import Pool from subprocess import PIPE diff --git a/raster/r.basins.fill/testsuite/testrbf.py b/raster/r.basins.fill/testsuite/testrbf.py index fdbcd4b548f..b9937b05689 100644 --- a/raster/r.basins.fill/testsuite/testrbf.py +++ b/raster/r.basins.fill/testsuite/testrbf.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + import unittest from grass.gunittest.case import TestCase diff --git a/raster/r.external/testsuite/test_r_external.py b/raster/r.external/testsuite/test_r_external.py index 839a724a5b7..a22498eb773 100644 --- a/raster/r.external/testsuite/test_r_external.py +++ b/raster/r.external/testsuite/test_r_external.py @@ -2,6 +2,7 @@ @author Markus Neteler """ + from grass.gunittest.case import TestCase diff --git a/raster/r.gwflow/testsuite/validation_7x7_grid.py b/raster/r.gwflow/testsuite/validation_7x7_grid.py index f4595eaf421..6d632092300 100644 --- a/raster/r.gwflow/testsuite/validation_7x7_grid.py +++ b/raster/r.gwflow/testsuite/validation_7x7_grid.py @@ -7,6 +7,7 @@ @author Soeren Gebbert """ + from grass.gunittest.case import TestCase diff --git a/raster/r.horizon/testsuite/test_r_horizon.py b/raster/r.horizon/testsuite/test_r_horizon.py index 4118c1cb203..846988401dc 100644 --- a/raster/r.horizon/testsuite/test_r_horizon.py +++ b/raster/r.horizon/testsuite/test_r_horizon.py @@ -11,6 +11,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + import json from grass.gunittest.case import TestCase diff --git a/raster/r.in.ascii/testsuite/test_r_in_ascii.py b/raster/r.in.ascii/testsuite/test_r_in_ascii.py index 151b6ff7978..20e0c2a8f9e 100644 --- a/raster/r.in.ascii/testsuite/test_r_in_ascii.py +++ b/raster/r.in.ascii/testsuite/test_r_in_ascii.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test from grass.script.core import read_command diff --git a/raster/r.in.gdal/testsuite/test_r_in_gdal.py b/raster/r.in.gdal/testsuite/test_r_in_gdal.py index 3e3f6bcd554..2b8bee0982a 100644 --- a/raster/r.in.gdal/testsuite/test_r_in_gdal.py +++ b/raster/r.in.gdal/testsuite/test_r_in_gdal.py @@ -2,6 +2,7 @@ @author Soeren Gebbert """ + from grass.gunittest.case import TestCase diff --git a/raster/r.info/testsuite/test_r_info.py b/raster/r.info/testsuite/test_r_info.py index 05953ae56b4..a4d554232dd 100644 --- a/raster/r.info/testsuite/test_r_info.py +++ b/raster/r.info/testsuite/test_r_info.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule diff --git a/raster/r.random.cells/testsuite/test_random_cells.py b/raster/r.random.cells/testsuite/test_random_cells.py index 9faeb3b0135..0d4ca4379e5 100644 --- a/raster/r.random.cells/testsuite/test_random_cells.py +++ b/raster/r.random.cells/testsuite/test_random_cells.py @@ -12,7 +12,6 @@ for details. """ - from grass.gunittest.case import TestCase from grass.gunittest.main import test diff --git a/raster/r.random/testsuite/testrandom.py b/raster/r.random/testsuite/testrandom.py index 791aebfa669..e2bc2e413a3 100644 --- a/raster/r.random/testsuite/testrandom.py +++ b/raster/r.random/testsuite/testrandom.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test from grass.gunittest.gmodules import SimpleModule diff --git a/raster/r.reclass/testsuite/test_r_reclass.py b/raster/r.reclass/testsuite/test_r_reclass.py index 71d63d1c4bb..3f4ecfdf6a3 100644 --- a/raster/r.reclass/testsuite/test_r_reclass.py +++ b/raster/r.reclass/testsuite/test_r_reclass.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test from grass.gunittest.gmodules import SimpleModule diff --git a/raster/r.series.interp/testsuite/interp_test.py b/raster/r.series.interp/testsuite/interp_test.py index 017912172be..e4cadd251cd 100644 --- a/raster/r.series.interp/testsuite/interp_test.py +++ b/raster/r.series.interp/testsuite/interp_test.py @@ -1,6 +1,7 @@ """Test of r.series.interp @author Soeren Gebbert """ + from grass.gunittest.case import TestCase diff --git a/raster/r.support/testsuite/test_r_support.py b/raster/r.support/testsuite/test_r_support.py index f7b7dd9e917..9a024c4a723 100644 --- a/raster/r.support/testsuite/test_r_support.py +++ b/raster/r.support/testsuite/test_r_support.py @@ -8,6 +8,7 @@ Read the file COPYING that comes with GRASS for details """ + import random import string diff --git a/raster/r.texture/testsuite/test_texture.py b/raster/r.texture/testsuite/test_texture.py index af24229e9ba..378eaaeabb5 100644 --- a/raster/r.texture/testsuite/test_texture.py +++ b/raster/r.texture/testsuite/test_texture.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase diff --git a/raster/r.tile/testsuite/testrt.py b/raster/r.tile/testsuite/testrt.py index c1da1d10cdf..6cb5a91c296 100644 --- a/raster/r.tile/testsuite/testrt.py +++ b/raster/r.tile/testsuite/testrt.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test diff --git a/raster/r.to.vect/testsuite/test_r_to_vect.py b/raster/r.to.vect/testsuite/test_r_to_vect.py index 57de45e4b77..7ba284d0261 100644 --- a/raster/r.to.vect/testsuite/test_r_to_vect.py +++ b/raster/r.to.vect/testsuite/test_r_to_vect.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test diff --git a/raster/r.univar/testsuite/test_r_univar.py b/raster/r.univar/testsuite/test_r_univar.py index 368ff3faae0..c03aea5dcfa 100644 --- a/raster/r.univar/testsuite/test_r_univar.py +++ b/raster/r.univar/testsuite/test_r_univar.py @@ -2,6 +2,7 @@ @author Soeren Gebbert """ + from grass.gunittest.case import TestCase diff --git a/raster/r.what/testsuite/testrw.py b/raster/r.what/testsuite/testrw.py index f63ae5dfe30..8184f534720 100644 --- a/raster/r.what/testsuite/testrw.py +++ b/raster/r.what/testsuite/testrw.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test from grass.gunittest.gmodules import SimpleModule diff --git a/raster3d/r3.flow/testsuite/r3flow_test.py b/raster3d/r3.flow/testsuite/r3flow_test.py index 8385f10559e..f7d013f38bd 100644 --- a/raster3d/r3.flow/testsuite/r3flow_test.py +++ b/raster3d/r3.flow/testsuite/r3flow_test.py @@ -3,6 +3,7 @@ @author Anna Petrasova """ + import os from grass.gunittest.case import TestCase from grass.gunittest.main import test diff --git a/raster3d/r3.gradient/testsuite/r3gradient_test.py b/raster3d/r3.gradient/testsuite/r3gradient_test.py index 9d0814dac78..d41e0a74baa 100644 --- a/raster3d/r3.gradient/testsuite/r3gradient_test.py +++ b/raster3d/r3.gradient/testsuite/r3gradient_test.py @@ -3,6 +3,7 @@ @author Anna Petrasova """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test diff --git a/scripts/r.fillnulls/testsuite/test_r_fillnulls.py b/scripts/r.fillnulls/testsuite/test_r_fillnulls.py index 8cfed138f4e..975fd5330f2 100644 --- a/scripts/r.fillnulls/testsuite/test_r_fillnulls.py +++ b/scripts/r.fillnulls/testsuite/test_r_fillnulls.py @@ -3,6 +3,7 @@ @author: Sanjeet Bhatti """ + import os from grass.gunittest.case import TestCase diff --git a/scripts/r.in.wms/srs.py b/scripts/r.in.wms/srs.py index 43ee8747eb2..6840e72dca5 100644 --- a/scripts/r.in.wms/srs.py +++ b/scripts/r.in.wms/srs.py @@ -11,6 +11,7 @@ @author Stepan Turek (Based on code from OWSLib - Copyright below) """ + # -*- coding: ISO-8859-15 -*- # ============================================================================= # Copyright (c) 2011 Tom Kralidis diff --git a/scripts/r.in.wms/wms_cap_parsers.py b/scripts/r.in.wms/wms_cap_parsers.py index 6846124efa3..8418bbdbbe6 100644 --- a/scripts/r.in.wms/wms_cap_parsers.py +++ b/scripts/r.in.wms/wms_cap_parsers.py @@ -16,6 +16,7 @@ @author Stepan Turek (Mentor: Martin Landa) """ + import pathlib from xml.etree.ElementTree import ParseError diff --git a/scripts/r.mapcalc.simple/testsuite/test_rmapcalcsimple.py b/scripts/r.mapcalc.simple/testsuite/test_rmapcalcsimple.py index 70da5f40b11..d400ccc7980 100644 --- a/scripts/r.mapcalc.simple/testsuite/test_rmapcalcsimple.py +++ b/scripts/r.mapcalc.simple/testsuite/test_rmapcalcsimple.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase diff --git a/scripts/r.reclass.area/testsuite/testrra.py b/scripts/r.reclass.area/testsuite/testrra.py index 6c7822c0f6c..e6e2300875b 100644 --- a/scripts/r.reclass.area/testsuite/testrra.py +++ b/scripts/r.reclass.area/testsuite/testrra.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test diff --git a/scripts/v.rast.stats/testsuite/test_v_rast_stats.py b/scripts/v.rast.stats/testsuite/test_v_rast_stats.py index 4b411bf6666..ca3111d14d8 100644 --- a/scripts/v.rast.stats/testsuite/test_v_rast_stats.py +++ b/scripts/v.rast.stats/testsuite/test_v_rast_stats.py @@ -2,6 +2,7 @@ @author Soeren Gebbert """ + from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule from grass.pygrass.vector import VectorTopo diff --git a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute.py b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute.py index 2056a654f7c..c5eb4618d92 100644 --- a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute.py +++ b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute.py @@ -7,6 +7,7 @@ :authors: Soeren Gebbert """ + import os import grass.pygrass.modules as pymod import grass.temporal as tgis diff --git a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py index f70c150c7c0..ac6471398ad 100644 --- a/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py +++ b/temporal/t.rast.aggregate/testsuite/test_aggregation_absolute_parallel.py @@ -7,6 +7,7 @@ :authors: Soeren Gebbert """ + import os import grass.pygrass.modules as pymod import grass.temporal as tgis diff --git a/temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py b/temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py index 265d4f82465..fe53844feea 100644 --- a/temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py +++ b/temporal/t.rast.aggregate/testsuite/test_aggregation_relative.py @@ -7,6 +7,7 @@ :authors: Soeren Gebbert """ + import os import grass.pygrass.modules as pymod import grass.temporal as tgis diff --git a/temporal/t.rast.series/testsuite/test_series.py b/temporal/t.rast.series/testsuite/test_series.py index 4eb41f80f1a..7b9df7921b7 100644 --- a/temporal/t.rast.series/testsuite/test_series.py +++ b/temporal/t.rast.series/testsuite/test_series.py @@ -7,6 +7,7 @@ :authors: Soeren Gebbert """ + import os import grass.pygrass.modules as pymod import grass.temporal as tgis diff --git a/temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py b/temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py index 59d47a1dacd..980ec553119 100644 --- a/temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py +++ b/temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py @@ -7,7 +7,6 @@ :authors: Soeren Gebbert and Thomas Leppelt """ - import grass.script import grass.temporal as tgis from grass.gunittest.case import TestCase diff --git a/temporal/t.shift/testsuite/test_shift.py b/temporal/t.shift/testsuite/test_shift.py index 1c1f29f03d9..eff9a5f5702 100644 --- a/temporal/t.shift/testsuite/test_shift.py +++ b/temporal/t.shift/testsuite/test_shift.py @@ -7,6 +7,7 @@ :authors: Soeren Gebbert """ + import os import grass.pygrass.modules as pymod import grass.temporal as tgis diff --git a/temporal/t.snap/testsuite/test_snap.py b/temporal/t.snap/testsuite/test_snap.py index e16acc52a57..5d8c0bbe166 100644 --- a/temporal/t.snap/testsuite/test_snap.py +++ b/temporal/t.snap/testsuite/test_snap.py @@ -7,6 +7,7 @@ :authors: Soeren Gebbert """ + import os import grass.pygrass.modules as pymod import grass.temporal as tgis diff --git a/temporal/t.support/testsuite/test_support_str3ds.py b/temporal/t.support/testsuite/test_support_str3ds.py index 4e2a1d30123..613b5e9bbc3 100644 --- a/temporal/t.support/testsuite/test_support_str3ds.py +++ b/temporal/t.support/testsuite/test_support_str3ds.py @@ -7,6 +7,7 @@ :authors: Soeren Gebbert """ + import os import grass.pygrass.modules as pymod import grass.temporal as tgis diff --git a/temporal/t.support/testsuite/test_support_strds.py b/temporal/t.support/testsuite/test_support_strds.py index a618f94bc5b..40692693c34 100644 --- a/temporal/t.support/testsuite/test_support_strds.py +++ b/temporal/t.support/testsuite/test_support_strds.py @@ -7,6 +7,7 @@ :authors: Soeren Gebbert """ + import os import grass.pygrass.modules as pymod import grass.temporal as tgis diff --git a/temporal/t.support/testsuite/test_support_stvds.py b/temporal/t.support/testsuite/test_support_stvds.py index 256e3a9b98f..2cd973c2119 100644 --- a/temporal/t.support/testsuite/test_support_stvds.py +++ b/temporal/t.support/testsuite/test_support_stvds.py @@ -7,6 +7,7 @@ :authors: Soeren Gebbert """ + import os import grass.pygrass.modules as pymod import grass.temporal as tgis diff --git a/temporal/t.unregister/testsuite/test_unregister.py b/temporal/t.unregister/testsuite/test_unregister.py index 6cf54e482e2..fa011b9edaa 100644 --- a/temporal/t.unregister/testsuite/test_unregister.py +++ b/temporal/t.unregister/testsuite/test_unregister.py @@ -7,6 +7,7 @@ :authors: Soeren Gebbert """ + import os import grass.pygrass.modules as pymod import grass.temporal as tgis diff --git a/vector/v.extract/testsuite/test_v_extract.py b/vector/v.extract/testsuite/test_v_extract.py index ff0c8b590a3..d266e8ad649 100644 --- a/vector/v.extract/testsuite/test_v_extract.py +++ b/vector/v.extract/testsuite/test_v_extract.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + import os from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule diff --git a/vector/v.fill.holes/examples.ipynb b/vector/v.fill.holes/examples.ipynb index 28d86332b0a..fcc006501e4 100644 --- a/vector/v.fill.holes/examples.ipynb +++ b/vector/v.fill.holes/examples.ipynb @@ -82,7 +82,7 @@ "outputs": [], "source": [ "!g.region vector=data grow=3 res=1\n", - "text_position = (75,5)" + "text_position = (75, 5)" ] }, { @@ -144,7 +144,7 @@ "source": [ "!g.region vector=dissolve_data grow=2 res=1\n", "\n", - "text_position = (75,5)\n", + "text_position = (75, 5)\n", "\n", "plot = gj.Map(use_region=True, width=700)\n", "plot.d_background(color=\"white\")\n", @@ -209,7 +209,7 @@ "plot = gj.Map(use_region=True, width=700)\n", "plot.d_background(color=\"white\")\n", "plot.d_vect(map=\"lakes_only\", legend_label=\"Original\")\n", - "plot.d_legend_vect(flags=\"b\", at=(60,10))\n", + "plot.d_legend_vect(flags=\"b\", at=(60, 10))\n", "plot.show()" ] }, @@ -231,7 +231,7 @@ "plot = gj.Map(use_region=True, width=700)\n", "plot.d_background(color=\"white\")\n", "plot.d_vect(map=\"lakes_filled\", legend_label=\"Filled\")\n", - "plot.d_legend_vect(flags=\"b\", at=(60,10))\n", + "plot.d_legend_vect(flags=\"b\", at=(60, 10))\n", "plot.show()" ] }, @@ -253,7 +253,7 @@ "plot = gj.Map(use_region=True, width=700)\n", "plot.d_background(color=\"white\")\n", "plot.d_vect(map=\"lakes_dissolved\", legend_label=\"Dissolved\")\n", - "plot.d_legend_vect(flags=\"b\", at=(60,10))\n", + "plot.d_legend_vect(flags=\"b\", at=(60, 10))\n", "plot.show()" ] }, @@ -265,9 +265,17 @@ "source": [ "plot = gj.Map(use_region=True, width=1024)\n", "plot.d_background(color=\"#E28A2B\")\n", - "plot.d_vect(map=\"lakes_filled\", color=\"none\", fill_color=\"#384C6B\", legend_label=\"Filled\")\n", - "plot.d_vect(map=\"lakes_only\", color=\"#859BBA\", fill_color=\"none\", width=2, legend_label=\"Original\")\n", - "plot.d_legend_vect(flags=\"b\", at=(80,85), fontsize=22, symbol_size=35)\n", + "plot.d_vect(\n", + " map=\"lakes_filled\", color=\"none\", fill_color=\"#384C6B\", legend_label=\"Filled\"\n", + ")\n", + "plot.d_vect(\n", + " map=\"lakes_only\",\n", + " color=\"#859BBA\",\n", + " fill_color=\"none\",\n", + " width=2,\n", + " legend_label=\"Original\",\n", + ")\n", + "plot.d_legend_vect(flags=\"b\", at=(80, 85), fontsize=22, symbol_size=35)\n", "filename = \"v_fill_holes.png\"\n", "plot.save(filename)\n", "!mogrify -trim {filename}\n", diff --git a/vector/v.in.ogr/testsuite/test_v_in_ogr.py b/vector/v.in.ogr/testsuite/test_v_in_ogr.py index 7257c44b0ee..167cd8747e8 100644 --- a/vector/v.in.ogr/testsuite/test_v_in_ogr.py +++ b/vector/v.in.ogr/testsuite/test_v_in_ogr.py @@ -2,6 +2,7 @@ @author Markus Neteler """ + from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule diff --git a/vector/v.to.rast/testsuite/test_v_to_rast.py b/vector/v.to.rast/testsuite/test_v_to_rast.py index 273c77983d8..352b8c578f3 100644 --- a/vector/v.to.rast/testsuite/test_v_to_rast.py +++ b/vector/v.to.rast/testsuite/test_v_to_rast.py @@ -11,6 +11,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test diff --git a/vector/v.univar/testsuite/v_univar_test.py b/vector/v.univar/testsuite/v_univar_test.py index 3b9c75b7d70..33fd0425c1d 100644 --- a/vector/v.univar/testsuite/v_univar_test.py +++ b/vector/v.univar/testsuite/v_univar_test.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test from grass.gunittest.gmodules import SimpleModule diff --git a/vector/v.vect.stats/testsuite/test_vect_stats.py b/vector/v.vect.stats/testsuite/test_vect_stats.py index 8d7cf0e6c18..fe982ceff33 100644 --- a/vector/v.vect.stats/testsuite/test_vect_stats.py +++ b/vector/v.vect.stats/testsuite/test_vect_stats.py @@ -8,6 +8,7 @@ License (>=v2). Read the file COPYING that comes with GRASS for details. """ + from grass.gunittest.case import TestCase from grass.gunittest.main import test from grass.gunittest.gmodules import SimpleModule