From 5b83fd89bda76e21f8fdf1caf2671f0617d5bd23 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Sun, 8 Dec 2024 17:48:48 -0500 Subject: [PATCH] grass.pygrass: Fixed E402 in pygrass/utils (#4759) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update * update --------- Co-authored-by: Arohan Ajit Co-authored-by: Edouard Choinière <27212526+echoix@users.noreply.github.com> --- .flake8 | 1 - python/grass/pygrass/utils.py | 13 ++++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.flake8 b/.flake8 index c9da26c037e..2fa95e7ec67 100644 --- a/.flake8 +++ b/.flake8 @@ -49,7 +49,6 @@ per-file-ignores = python/grass/pygrass/vector/__init__.py: E402 python/grass/pygrass/raster/__init__.py: E402 python/grass/pygrass/vector/__init__.py: E402 - python/grass/pygrass/utils.py: E402 python/grass/temporal/abstract_space_time_dataset.py: E722 python/grass/temporal/c_libraries_interface.py: E722 python/grass/temporal/core.py: E722 diff --git a/python/grass/pygrass/utils.py b/python/grass/pygrass/utils.py index d8804665b1e..2d6a2498848 100644 --- a/python/grass/pygrass/utils.py +++ b/python/grass/pygrass/utils.py @@ -1,19 +1,21 @@ -import itertools import fnmatch +import itertools import os from sqlite3 import OperationalError import grass.lib.gis as libgis +from grass.script import core as grasscore +from grass.script import utils as grassutils +# flake8: noqa: E402 libgis.G_gisinit("") import grass.lib.raster as libraster from grass.lib.ctypes_preamble import String -from grass.script import core as grasscore -from grass.script import utils as grassutils - from grass.pygrass.errors import GrassError +# flake8: qa + test_vector_name = "Utils_test_vector" test_raster_name = "Utils_test_raster" @@ -461,7 +463,7 @@ def create_test_vector_map(map_name="test_vector"): """ from grass.pygrass.vector import VectorTopo - from grass.pygrass.vector.geometry import Point, Line, Centroid, Boundary + from grass.pygrass.vector.geometry import Boundary, Centroid, Line, Point cols = [ ("cat", "INTEGER PRIMARY KEY"), @@ -589,6 +591,7 @@ def create_test_stream_network_map(map_name="streams"): if __name__ == "__main__": import doctest + from grass.script.core import run_command create_test_vector_map(test_vector_name)