diff --git a/.flake8 b/.flake8 index 3adda73f28..1d6bda6b69 100644 --- a/.flake8 +++ b/.flake8 @@ -88,9 +88,6 @@ per-file-ignores = python/grass/*/*/__init__.py: F403 python/grass/*/*/*/__init__.py: F403 # E402 module level import not at top of file - scripts/r.in.wms/wms_gdal_drv.py: E722 - scripts/r.in.wms/wms_drv.py: E402, E722 - scripts/r.in.wms/srs.py: E722 scripts/r.semantic.label/r.semantic.label.py: E501 scripts/db.out.ogr/db.out.ogr.py: F841 scripts/g.extension/g.extension.py: E501 diff --git a/scripts/r.in.wms/srs.py b/scripts/r.in.wms/srs.py index 8d996fcde9..752f71d815 100644 --- a/scripts/r.in.wms/srs.py +++ b/scripts/r.in.wms/srs.py @@ -79,7 +79,7 @@ def __init__(self, srs): # code is always the last value try: self.code = int(values[-1]) - except: + except (IndexError, ValueError): self.code = values[-1] elif len(values) == 2: # it's an authority:code code diff --git a/scripts/r.in.wms/wms_drv.py b/scripts/r.in.wms/wms_drv.py index e825aabe43..f9dc42d238 100644 --- a/scripts/r.in.wms/wms_drv.py +++ b/scripts/r.in.wms/wms_drv.py @@ -18,13 +18,13 @@ """ import socket -import grass.script as gs - from time import sleep +import grass.script as gs + try: from osgeo import gdal -except: +except ImportError: gs.fatal( _( "Unable to load GDAL Python bindings (requires package 'python-gdal' " @@ -32,21 +32,18 @@ ) ) -import numpy as np - -np.arrayrange = np.arange - -from math import pi, floor - -from urllib.error import HTTPError from http.client import HTTPException - +from math import floor, pi +from urllib.error import HTTPError from xml.etree.ElementTree import ParseError -from wms_base import GetEpsg, GetSRSParamVal, WMSBase +import numpy as np -from wms_cap_parsers import WMTSCapabilitiesTree, OnEarthCapabilitiesTree from srs import Srs +from wms_base import GetEpsg, GetSRSParamVal, WMSBase +from wms_cap_parsers import OnEarthCapabilitiesTree, WMTSCapabilitiesTree + +np.arrayrange = np.arange class WMSDrv(WMSBase): diff --git a/scripts/r.in.wms/wms_gdal_drv.py b/scripts/r.in.wms/wms_gdal_drv.py index 830be2b593..869f71195a 100644 --- a/scripts/r.in.wms/wms_gdal_drv.py +++ b/scripts/r.in.wms/wms_gdal_drv.py @@ -17,7 +17,7 @@ try: from osgeo import gdal -except: +except ImportError: gs.fatal( _( "Unable to load GDAL Python bindings (requires package 'python-gdal' being "