Skip to content

Commit

Permalink
Rename 'iso_3' to 'iso3' etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
vjf committed Mar 22, 2024
1 parent 6b29258 commit 4cb7cb5
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 39 deletions.
12 changes: 6 additions & 6 deletions owslib/catalogue/csw2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from owslib import util
from owslib import ows
from owslib.iso import MD_Metadata, FC_FeatureCatalogue
from owslib.iso_3 import MD_Metadata as MD_Metadata_3 # ISO 19115 Part 3 XML
from owslib.iso_3 import FC_FeatureCatalogue as FC_FeatureCatalogue_3 # ISO 19115 Part 3 XML
from owslib.iso3 import MD_Metadata as MD_Metadata3 # ISO 19115 Part 3 XML
from owslib.iso3 import FC_FeatureCatalogue as FC_FeatureCatalogue3 # ISO 19115 Part 3 XML
from owslib.fgdc import Metadata
from owslib.dif import DIF
from owslib.gm03 import GM03
Expand Down Expand Up @@ -580,12 +580,12 @@ def _parserecords(self, outputschema, esn):
val = i.find(util.nspath_eval('gm03:fileIdentifier', namespaces))
identifier = self._setidentifierkey(util.testXMLValue(val))
self.records[identifier] = GM03(i)
elif MD_Metadata_3.handles(outputschema): # ISO 19115 Part 3 XML
for elem, id in MD_Metadata_3.find_ids(self._exml):
self.records[self._setidentifierkey(id)] = MD_Metadata_3(elem)
elif MD_Metadata3.handles(outputschema): # ISO 19115 Part 3 XML
for elem, id in MD_Metadata3.find_ids(self._exml):
self.records[self._setidentifierkey(id)] = MD_Metadata3(elem)
for i in self._exml.findall('.//' + util.nspath_eval('gfc:FC_FeatureCatalogue', namespaces)):
identifier = self._setidentifierkey(util.testXMLValue(i.attrib['uuid'], attrib=True))
self.records[identifier] = FC_FeatureCatalogue_3(i)
self.records[identifier] = FC_FeatureCatalogue3(i)
else: # process default
for i in self._exml.findall('.//' + util.nspath_eval('csw:%s' % self._setesnel(esn), namespaces)):
val = i.find(util.nspath_eval('dc:identifier', namespaces))
Expand Down
12 changes: 6 additions & 6 deletions owslib/catalogue/csw3.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from owslib import util
from owslib import ows
from owslib.iso import MD_Metadata, FC_FeatureCatalogue
from owslib.iso_3 import MD_Metadata as MD_Metadata_3 # ISO 19115 Part 3 XML
from owslib.iso_3 import FC_FeatureCatalogue as FC_FeatureCatalogue_3 # ISO 19115 Part 3 XML
from owslib.iso3 import MD_Metadata as MD_Metadata3 # ISO 19115 Part 3 XML
from owslib.iso3 import FC_FeatureCatalogue as FC_FeatureCatalogue3 # ISO 19115 Part 3 XML
from owslib.fgdc import Metadata
from owslib.dif import DIF
from owslib.gm03 import GM03
Expand Down Expand Up @@ -479,12 +479,12 @@ def _parserecords(self, outputschema, esn):
val = i.find(util.nspath_eval('gm03:fileIdentifier', namespaces))
identifier = self._setidentifierkey(util.testXMLValue(val))
self.records[identifier] = GM03(i)
elif MD_Metadata_3.handles(outputschema): # ISO 19115 Part 3 XML
for elem, id in MD_Metadata_3.find_ids(self._exml):
self.records[self._setidentifierkey(id)] = MD_Metadata_3(elem)
elif MD_Metadata3.handles(outputschema): # ISO 19115 Part 3 XML
for elem, id in MD_Metadata3.find_ids(self._exml):
self.records[self._setidentifierkey(id)] = MD_Metadata3(elem)
for i in self._exml.findall('.//' + util.nspath_eval('gfc:FC_FeatureCatalogue', namespaces)):
identifier = self._setidentifierkey(util.testXMLValue(i.attrib['uuid'], attrib=True))
self.records[identifier] = FC_FeatureCatalogue_3(i)
self.records[identifier] = FC_FeatureCatalogue3(i)
else: # process default
for i in self._exml.findall('.//' + util.nspath_eval('csw30:%s' % self._setesnel(esn), namespaces)):
val = i.find(util.nspath_eval('dc:identifier', namespaces))
Expand Down
6 changes: 3 additions & 3 deletions owslib/feature/wfs100.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from owslib.etree import etree
from owslib.fgdc import Metadata
from owslib.iso import MD_Metadata
from owslib.iso_3 import MD_Metadata as MD_Metadata_3 # ISO 19115 Part 3 XML
from owslib.iso3 import MD_Metadata as MD_Metadata3 # ISO 19115 Part 3 XML
from owslib.crs import Crs
from owslib.namespaces import Namespaces
from owslib.feature.schema import get_schema
Expand Down Expand Up @@ -471,9 +471,9 @@ def parse_remote_metadata(self, timeout=30):
if mdelem is not None:
metadataUrl["metadata"] = MD_Metadata(mdelem)
else:
mdelem = MD_Metadata_3.find_start(doc)
mdelem = MD_Metadata3.find_start(doc)
if mdelem is not None:
metadataUrl["metadata"] = MD_Metadata_3(mdelem)
metadataUrl["metadata"] = MD_Metadata3(mdelem)
else:
metadataUrl["metadata"] = None
except Exception:
Expand Down
6 changes: 3 additions & 3 deletions owslib/feature/wfs110.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from owslib.etree import etree
from owslib.fgdc import Metadata
from owslib.iso import MD_Metadata
from owslib.iso_3 import MD_Metadata as MD_Metadata_3 # ISO 19115 Part 3 XML
from owslib.iso3 import MD_Metadata as MD_Metadata3 # ISO 19115 Part 3 XML
from owslib.ows import (
OwsCommon,
ServiceIdentification,
Expand Down Expand Up @@ -488,9 +488,9 @@ def parse_remote_metadata(self, timeout=30):
if mdelem is not None:
metadataUrl["metadata"] = MD_Metadata(mdelem)
else:
mdelem = MD_Metadata_3.find_start(doc)
mdelem = MD_Metadata3.find_start(doc)
if mdelem is not None:
metadataUrl["metadata"] = MD_Metadata_3(mdelem)
metadataUrl["metadata"] = MD_Metadata3(mdelem)
else:
metadataUrl["metadata"] = None
except Exception:
Expand Down
6 changes: 3 additions & 3 deletions owslib/feature/wfs200.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from owslib import util
from owslib.fgdc import Metadata
from owslib.iso import MD_Metadata
from owslib.iso_3 import MD_Metadata as MD_Metadata_3 # ISO 19115 Part 3 XML
from owslib.iso3 import MD_Metadata as MD_Metadata3 # ISO 19115 Part 3 XML
from owslib.ows import Constraint, ServiceIdentification, ServiceProvider, OperationsMetadata
from owslib.etree import etree
from owslib.util import nspath, testXMLValue, openURL, Authentication
Expand Down Expand Up @@ -613,9 +613,9 @@ def parse_remote_metadata(self, timeout=30):
metadataUrl["metadata"] = MD_Metadata(mdelem)
continue
else: # ISO 19115 Part 3 XML
mdelem = MD_Metadata_3.find_start(doc)
mdelem = MD_Metadata3.find_start(doc)
if mdelem is not None:
metadataUrl["metadata"] = MD_Metadata_3(mdelem)
metadataUrl["metadata"] = MD_Metadata3(mdelem)
else:
metadataUrl["metadata"] = None
continue
Expand Down
2 changes: 1 addition & 1 deletion owslib/iso_3.py → owslib/iso3.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Parsing is initiated by passing in etree root Element to the 'MD_Metadata' constructor:
from owslib.etree import etree
from owslib.iso_3 import MD_Metadata
from owslib.iso3 import MD_Metadata
exml = etree.fromstring(xml_bytes)
mdb = MD_Metadata(exml)
Expand Down
6 changes: 3 additions & 3 deletions owslib/map/wms111.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
bind_url, nspath_eval, Authentication)
from owslib.fgdc import Metadata
from owslib.iso import MD_Metadata
from owslib.iso_3 import MD_Metadata as MD_Metadata_3 # ISO 19115 Part 3 XML
from owslib.iso3 import MD_Metadata as MD_Metadata3 # ISO 19115 Part 3 XML
from owslib.map.common import WMSCapabilitiesReader, AbstractContentMetadata
from owslib.namespaces import Namespaces

Expand Down Expand Up @@ -619,9 +619,9 @@ def parse_remote_metadata(self, timeout=30):
metadataUrl['metadata'] = MD_Metadata(mdelem)
continue
else: # ISO 19115 Part 3 XML
mdelem = MD_Metadata_3.find_start(doc)
mdelem = MD_Metadata3.find_start(doc)
if mdelem is not None:
metadataUrl["metadata"] = MD_Metadata_3(mdelem)
metadataUrl["metadata"] = MD_Metadata3(mdelem)
else:
metadataUrl["metadata"] = None
continue
Expand Down
6 changes: 3 additions & 3 deletions owslib/map/wms130.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
nspath_eval, bind_url, Authentication)
from owslib.fgdc import Metadata
from owslib.iso import MD_Metadata
from owslib.iso_3 import MD_Metadata as MD_Metadata_3 # ISO 19115 Part 3 XML
from owslib.iso3 import MD_Metadata as MD_Metadata3 # ISO 19115 Part 3 XML
from owslib.crs import Crs
from owslib.namespaces import Namespaces
from owslib.map.common import WMSCapabilitiesReader, AbstractContentMetadata
Expand Down Expand Up @@ -711,9 +711,9 @@ def parse_remote_metadata(self, timeout=30):
metadataUrl['metadata'] = MD_Metadata(mdelem)
continue
else:
mdelem = MD_Metadata_3.find_start(doc)
mdelem = MD_Metadata3.find_start(doc)
if mdelem is not None:
metadataUrl["metadata"] = MD_Metadata_3(mdelem)
metadataUrl["metadata"] = MD_Metadata3(mdelem)
else:
metadataUrl["metadata"] = None
except Exception:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_csw_geonetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_csw_geonetwork():
@pytest.mark.skipif(not service_ok(SERVICE_URL3),
reason='service is unreachable')
@pytest.mark.parametrize("esn_in", ['full', 'summary'])
def test_csw_geonetwork_iso_3(esn_in):
def test_csw_geonetwork_iso3(esn_in):
""" Test retrieving records from Belgian geonetwork,
specifically requesting ISO 19115 Part 3 XML records.
"""
Expand All @@ -37,4 +37,4 @@ def test_csw_geonetwork_iso_3(esn_in):
assert c.results.get('nextrecord') > 0
assert c.results.get('matches') > 0
for id in c.records.keys():
assert c.records[id].identifier == id
assert c.records[id].identifier == id
2 changes: 1 addition & 1 deletion tests/test_iso3_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

from owslib.etree import etree

from owslib.iso_3 import (MD_Metadata, SV_ServiceIdentification, PT_Locale,
from owslib.iso3 import (MD_Metadata, SV_ServiceIdentification, PT_Locale,
CI_Date, CI_Responsibility, Keyword, MD_Keywords,
MD_DataIdentification, MD_Distributor, MD_Distribution,
DQ_DataQuality, SV_ServiceIdentification,
Expand Down
16 changes: 8 additions & 8 deletions tests/test_remote_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def openURL(*args, **kwargs):
return open('tests/resources/csw_dov_getrecordbyid.xml', 'rb')


def openURL_3(*args, **kwargs):
def openURL3(*args, **kwargs):
""" Used to patch the 'openURL' call, returning ISO 19115 Part 3 XML
"""
return open('tests/resources/iso3_examples/auscope-3d-model.xml', 'rb')
Expand Down Expand Up @@ -314,7 +314,7 @@ def test_wfs_110_noremotemd_parse_all(self, mp_wfs_110_nometadata):

@pytest.mark.parametrize("openURL_in, lib_in", [
(openURL, owslib.iso.MD_Metadata),
(openURL_3, owslib.iso_3.MD_Metadata),
(openURL3, owslib.iso3.MD_Metadata),
])
def test_wfs_110_noremotemd_parse_single(self, mp_wfs_110_nometadata, monkeypatch, openURL_in, lib_in):
"""Test the remote metadata parsing for WFS 1.1.0.
Expand Down Expand Up @@ -373,7 +373,7 @@ def test_wfs_110_noremotemd_parse_none(self, mp_wfs_110_nometadata):

@pytest.mark.parametrize("openURL_in, lib_in", [
(openURL, owslib.iso.MD_Metadata),
(openURL_3, owslib.iso_3.MD_Metadata),
(openURL3, owslib.iso3.MD_Metadata),
])
def test_wfs_110_remotemd_parse_all(self, mp_wfs_110, monkeypatch, openURL_in, lib_in):
"""Test the remote metadata parsing for WFS 1.1.0.
Expand Down Expand Up @@ -409,7 +409,7 @@ def test_wfs_110_remotemd_parse_all(self, mp_wfs_110, monkeypatch, openURL_in, l

@pytest.mark.parametrize("openURL_in, lib_in", [
(openURL, owslib.iso.MD_Metadata),
(openURL_3, owslib.iso_3.MD_Metadata),
(openURL3, owslib.iso3.MD_Metadata),
])
def test_wfs_110_remotemd_parse_single(self, mp_wfs_110, monkeypatch, openURL_in, lib_in):
"""Test the remote metadata parsing for WFS 1.1.0.
Expand Down Expand Up @@ -542,7 +542,7 @@ def test_wfs_200_noremotemd_parse_none(self, mp_wfs_200_nometadata):

@pytest.mark.parametrize("openURL_in, lib_in", [
(openURL, owslib.iso.MD_Metadata),
(openURL_3, owslib.iso_3.MD_Metadata),
(openURL3, owslib.iso3.MD_Metadata),
])
def test_wfs_200_remotemd_parse_all(self, mp_wfs_200, monkeypatch, openURL_in, lib_in):
"""Test the remote metadata parsing for WFS 2.0.0.
Expand Down Expand Up @@ -579,7 +579,7 @@ def test_wfs_200_remotemd_parse_all(self, mp_wfs_200, monkeypatch, openURL_in, l

@pytest.mark.parametrize("openURL_in, lib_in", [
(openURL, owslib.iso.MD_Metadata),
(openURL_3, owslib.iso_3.MD_Metadata),
(openURL3, owslib.iso3.MD_Metadata),
])
def test_wfs_200_remotemd_parse_single(self, mp_wfs_200, monkeypatch, openURL_in, lib_in):
"""Test the remote metadata parsing for WFS 2.0.0.
Expand Down Expand Up @@ -711,7 +711,7 @@ def test_wms_111_noremotemd_parse_none(self, mp_wms_111_nometadata):

@pytest.mark.parametrize("openURL_in, lib_in", [
(openURL, owslib.iso.MD_Metadata),
(openURL_3, owslib.iso_3.MD_Metadata),
(openURL3, owslib.iso3.MD_Metadata),
])
def test_wms_130_remotemd_parse_all(self, mp_wms_130, monkeypatch, openURL_in, lib_in):
"""Test the remote metadata parsing for WMS 1.3.0.
Expand Down Expand Up @@ -747,7 +747,7 @@ def test_wms_130_remotemd_parse_all(self, mp_wms_130, monkeypatch, openURL_in, l

@pytest.mark.parametrize("openURL_in, lib_in", [
(openURL, owslib.iso.MD_Metadata),
(openURL_3, owslib.iso_3.MD_Metadata),
(openURL3, owslib.iso3.MD_Metadata),
])
def test_wms_130_remotemd_parse_single(self, mp_wms_130, monkeypatch, openURL_in, lib_in):
"""Test the remote metadata parsing for WMS 1.3.0.
Expand Down

0 comments on commit 4cb7cb5

Please sign in to comment.