Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r.in.wms: Removed bare 'except' and repositioned imports #4622

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
arohanajit marked this conversation as resolved.
Show resolved Hide resolved


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
Loading