Skip to content

Commit

Permalink
r.in.wms: Removed bare 'except' and repositioned imports (#4622)
Browse files Browse the repository at this point in the history
  • Loading branch information
arohanajit authored Nov 1, 2024
1 parent 3f0b69f commit 7d9bbac
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
3 changes: 0 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/r.in.wms/srs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 10 additions & 13 deletions scripts/r.in.wms/wms_drv.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,32 @@
"""

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' "
"being installed)"
)
)

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):
Expand Down
2 changes: 1 addition & 1 deletion scripts/r.in.wms/wms_gdal_drv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down

0 comments on commit 7d9bbac

Please sign in to comment.