diff --git a/owslib/catalogue/csw2.py b/owslib/catalogue/csw2.py index e09555b7..193d831e 100644 --- a/owslib/catalogue/csw2.py +++ b/owslib/catalogue/csw2.py @@ -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 @@ -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)) diff --git a/owslib/catalogue/csw3.py b/owslib/catalogue/csw3.py index 77dbc36e..64e9ea58 100644 --- a/owslib/catalogue/csw3.py +++ b/owslib/catalogue/csw3.py @@ -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 @@ -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)) diff --git a/owslib/feature/wfs100.py b/owslib/feature/wfs100.py index 11d181c1..0484affd 100644 --- a/owslib/feature/wfs100.py +++ b/owslib/feature/wfs100.py @@ -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 @@ -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: diff --git a/owslib/feature/wfs110.py b/owslib/feature/wfs110.py index 0977cf75..ab28e922 100644 --- a/owslib/feature/wfs110.py +++ b/owslib/feature/wfs110.py @@ -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, @@ -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: diff --git a/owslib/feature/wfs200.py b/owslib/feature/wfs200.py index 4e731fa2..296548b0 100644 --- a/owslib/feature/wfs200.py +++ b/owslib/feature/wfs200.py @@ -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 @@ -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 diff --git a/owslib/iso_3.py b/owslib/iso3.py old mode 100755 new mode 100644 similarity index 99% rename from owslib/iso_3.py rename to owslib/iso3.py index 43770d46..4e3689d8 --- a/owslib/iso_3.py +++ b/owslib/iso3.py @@ -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) diff --git a/owslib/map/wms111.py b/owslib/map/wms111.py index 99cf11f8..ab4b795d 100644 --- a/owslib/map/wms111.py +++ b/owslib/map/wms111.py @@ -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 @@ -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 diff --git a/owslib/map/wms130.py b/owslib/map/wms130.py index d2faaf43..ba811366 100644 --- a/owslib/map/wms130.py +++ b/owslib/map/wms130.py @@ -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 @@ -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: diff --git a/tests/test_csw_geonetwork.py b/tests/test_csw_geonetwork.py index c5f66617..f2e9b464 100644 --- a/tests/test_csw_geonetwork.py +++ b/tests/test_csw_geonetwork.py @@ -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. """ @@ -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 \ No newline at end of file + assert c.records[id].identifier == id diff --git a/tests/test_iso3_parsing.py b/tests/test_iso3_parsing.py index 9c4a8a21..eba56cdf 100644 --- a/tests/test_iso3_parsing.py +++ b/tests/test_iso3_parsing.py @@ -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, diff --git a/tests/test_remote_metadata.py b/tests/test_remote_metadata.py index 98099426..85c36b05 100644 --- a/tests/test_remote_metadata.py +++ b/tests/test_remote_metadata.py @@ -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') @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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.