[owslib] 02/04: Imported Upstream version 0.8.13
Johan Van de Wauw
johanvdw-guest at moszumanska.debian.org
Fri Feb 13 21:43:02 UTC 2015
This is an automated email from the git hooks/post-receive script.
johanvdw-guest pushed a commit to branch master
in repository owslib.
commit c5de3b6d1efcace195bde05445dcf4f800dd7287
Author: Johan Van de Wauw <johan.vandewauw at gmail.com>
Date: Fri Feb 13 22:04:16 2015 +0100
Imported Upstream version 0.8.13
---
OWSLib.egg-info/PKG-INFO | 2 +-
PKG-INFO | 2 +-
VERSION.txt | 2 +-
owslib/__init__.py | 4 +++-
owslib/coverage/__init__.py | 2 ++
owslib/coverage/wcs100.py | 6 ++++--
owslib/coverage/wcs110.py | 8 +++++---
owslib/coverage/wcsBase.py | 2 ++
owslib/coverage/wcsdecoder.py | 6 ++++--
owslib/crs.py | 2 ++
owslib/csw.py | 10 ++++++----
owslib/dif.py | 2 ++
owslib/etree.py | 2 ++
owslib/feature/__init__.py | 2 ++
owslib/feature/wfs100.py | 8 +++++---
owslib/feature/wfs110.py | 8 +++++---
owslib/feature/wfs200.py | 8 +++++---
owslib/fes.py | 2 ++
owslib/fgdc.py | 2 ++
owslib/interfaces.py | 2 ++
owslib/iso.py | 4 +++-
owslib/namespaces.py | 3 +++
owslib/ows.py | 2 ++
owslib/sos.py | 5 ++++-
owslib/swe/__init__.py | 2 ++
owslib/swe/common.py | 6 ++++--
owslib/swe/observation/__init__.py | 2 ++
owslib/swe/observation/sos100.py | 11 +++++++----
owslib/swe/observation/sos200.py | 8 +++++---
owslib/swe/sensor/__init__.py | 2 ++
owslib/swe/sensor/sml.py | 2 ++
owslib/tms.py | 5 ++++-
owslib/util.py | 19 ++++++++++---------
owslib/waterml/__init__.py | 2 ++
owslib/waterml/wml.py | 2 ++
owslib/waterml/wml10.py | 4 +++-
owslib/waterml/wml11.py | 2 ++
owslib/wcs.py | 6 ++++--
owslib/wfs.py | 6 +++++-
owslib/wmc.py | 5 ++++-
owslib/wms.py | 19 +++++++++++--------
owslib/wmts.py | 10 ++++++----
owslib/wps.py | 22 ++++++++++++----------
43 files changed, 159 insertions(+), 72 deletions(-)
diff --git a/OWSLib.egg-info/PKG-INFO b/OWSLib.egg-info/PKG-INFO
index c16916a..5fac362 100644
--- a/OWSLib.egg-info/PKG-INFO
+++ b/OWSLib.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: OWSLib
-Version: 0.8.12
+Version: 0.8.13
Summary: OGC Web Service utility library
Home-page: http://geopython.github.io/OWSLib
Author: Tom Kralidis
diff --git a/PKG-INFO b/PKG-INFO
index c16916a..5fac362 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: OWSLib
-Version: 0.8.12
+Version: 0.8.13
Summary: OGC Web Service utility library
Home-page: http://geopython.github.io/OWSLib
Author: Tom Kralidis
diff --git a/VERSION.txt b/VERSION.txt
index 7eff8ab..c2f73c6 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-0.8.12
+0.8.13
diff --git a/owslib/__init__.py b/owslib/__init__.py
index 0a5ca3c..442ef8c 100644
--- a/owslib/__init__.py
+++ b/owslib/__init__.py
@@ -1 +1,3 @@
-__version__ = '0.8.12'
+from __future__ import (absolute_import, division, print_function)
+
+__version__ = '0.8.13'
diff --git a/owslib/coverage/__init__.py b/owslib/coverage/__init__.py
index e69de29..6eef950 100644
--- a/owslib/coverage/__init__.py
+++ b/owslib/coverage/__init__.py
@@ -0,0 +1,2 @@
+
+from __future__ import (absolute_import, division, print_function)
diff --git a/owslib/coverage/wcs100.py b/owslib/coverage/wcs100.py
index d54da21..110b118 100644
--- a/owslib/coverage/wcs100.py
+++ b/owslib/coverage/wcs100.py
@@ -9,6 +9,8 @@
# Contact email: d.lowe at rl.ac.uk
# =============================================================================
+from __future__ import (absolute_import, division, print_function)
+
from owslib.coverage.wcsBase import WCSBase, WCSCapabilitiesReader, ServiceException
from urllib import urlencode
from owslib.util import openURL, testXMLValue
@@ -32,7 +34,7 @@ class WebCoverageService_1_0_0(WCSBase):
if name in self.__getattribute__('contents').keys():
return self.__getattribute__('contents')[name]
else:
- raise KeyError, "No content named %s" % name
+ raise KeyError("No content named %s" % name)
def __init__(self,url,xml, cookies):
self.version='1.0.0'
@@ -166,7 +168,7 @@ class WebCoverageService_1_0_0(WCSBase):
for item in self.operations:
if item.name == name:
return item
- raise KeyError, "No operation named %s" % name
+ raise KeyError("No operation named %s" % name)
class OperationMetadata(object):
diff --git a/owslib/coverage/wcs110.py b/owslib/coverage/wcs110.py
index 39022f0..01a212b 100644
--- a/owslib/coverage/wcs110.py
+++ b/owslib/coverage/wcs110.py
@@ -11,7 +11,9 @@
##########NOTE: Does not conform to new interfaces yet #################
-from wcsBase import WCSBase, WCSCapabilitiesReader, ServiceException
+from __future__ import (absolute_import, division, print_function)
+
+from .wcsBase import WCSBase, WCSCapabilitiesReader, ServiceException
from owslib.util import openURL, testXMLValue
from urllib import urlencode
from urllib2 import urlopen
@@ -36,7 +38,7 @@ class WebCoverageService_1_1_0(WCSBase):
if name in self.__getattribute__('contents').keys():
return self.__getattribute__('contents')[name]
else:
- raise KeyError, "No content named %s" % name
+ raise KeyError("No content named %s" % name)
def __init__(self,url,xml, cookies):
self.version='1.1.0'
@@ -191,7 +193,7 @@ class WebCoverageService_1_1_0(WCSBase):
for item in self.operations:
if item.name == name:
return item
- raise KeyError, "No operation named %s" % name
+ raise KeyError("No operation named %s" % name)
class Operation(object):
"""Abstraction for operation metadata
diff --git a/owslib/coverage/wcsBase.py b/owslib/coverage/wcsBase.py
index 8debc46..f49c640 100644
--- a/owslib/coverage/wcsBase.py
+++ b/owslib/coverage/wcsBase.py
@@ -9,6 +9,8 @@
# Contact email: d.lowe at rl.ac.uk
# =============================================================================
+from __future__ import (absolute_import, division, print_function)
+
from urllib import urlencode
from urllib2 import urlopen, Request
from owslib.etree import etree
diff --git a/owslib/coverage/wcsdecoder.py b/owslib/coverage/wcsdecoder.py
index e220e8d..8b7a883 100644
--- a/owslib/coverage/wcsdecoder.py
+++ b/owslib/coverage/wcsdecoder.py
@@ -13,6 +13,8 @@
#decoder=wcsdecoder.WCSDecoder(u)
#decoder.getCoverages()
+from __future__ import (absolute_import, division, print_function)
+
import os
from owslib.etree import etree
import email
@@ -66,9 +68,9 @@ class MpartMime(object):
#create the directory if it doesn't exist:
try:
os.mkdir(unpackdir)
- except OSError, e:
+ except OSError as e:
# Ignore directory exists error
- if e.errno <> errno.EEXIST:
+ if e.errno != errno.EEXIST:
raise
#now walk through the multipart mime and write out files
diff --git a/owslib/crs.py b/owslib/crs.py
index bda0de3..cd55358 100644
--- a/owslib/crs.py
+++ b/owslib/crs.py
@@ -9,6 +9,8 @@
""" API for OGC CRS constructs. """
+from __future__ import (absolute_import, division, print_function)
+
# list of URN codes for EPSG in which axis order
# of coordinates are y,x (e.g. lat, long)
axisorder_yx = frozenset([
diff --git a/owslib/csw.py b/owslib/csw.py
index d24a399..0d800c8 100644
--- a/owslib/csw.py
+++ b/owslib/csw.py
@@ -9,6 +9,8 @@
""" CSW request and response processor """
+from __future__ import (absolute_import, division, print_function)
+
import base64
import inspect
import warnings
@@ -402,7 +404,7 @@ class CatalogueServiceWeb:
validtransactions = ['insert', 'update', 'delete']
if ttype not in validtransactions: # invalid transaction
- raise RuntimeError, 'Invalid transaction \'%s\'.' % ttype
+ raise RuntimeError('Invalid transaction \'%s\'.' % ttype)
node1 = etree.SubElement(node0, util.nspath_eval('csw:%s' % ttype.capitalize(), namespaces))
@@ -411,7 +413,7 @@ class CatalogueServiceWeb:
if ttype == 'insert':
if record is None:
- raise RuntimeError, 'Nothing to insert.'
+ raise RuntimeError('Nothing to insert.')
node1.append(etree.fromstring(record))
if ttype == 'update':
@@ -487,7 +489,7 @@ class CatalogueServiceWeb:
for item in self.operations:
if item.name.lower() == name.lower():
return item
- raise KeyError, "No operation named %s" % name
+ raise KeyError("No operation named %s" % name)
def getService_urls(self, service_string=None):
"""
@@ -650,7 +652,7 @@ class CatalogueServiceWeb:
]
if self._exml.getroot().tag not in valid_xpaths:
- raise RuntimeError, 'Document is XML, but not CSW-ish'
+ raise RuntimeError('Document is XML, but not CSW-ish')
# check if it's an OGC Exception
val = self._exml.find(util.nspath_eval('ows:Exception', namespaces))
diff --git a/owslib/dif.py b/owslib/dif.py
index 443e6ba..2c53089 100644
--- a/owslib/dif.py
+++ b/owslib/dif.py
@@ -9,6 +9,8 @@
""" DIF metadata parser """
+from __future__ import (absolute_import, division, print_function)
+
from owslib.etree import etree
from owslib import util
from owslib.namespaces import Namespaces
diff --git a/owslib/etree.py b/owslib/etree.py
index d0417f5..70d766d 100644
--- a/owslib/etree.py
+++ b/owslib/etree.py
@@ -4,6 +4,8 @@
# Contact email: sgillies at frii.com
# =============================================================================
+from __future__ import (absolute_import, division, print_function)
+
def patch_well_known_namespaces(etree_module):
diff --git a/owslib/feature/__init__.py b/owslib/feature/__init__.py
index 91030d1..b43a11a 100644
--- a/owslib/feature/__init__.py
+++ b/owslib/feature/__init__.py
@@ -5,6 +5,8 @@
#
# =============================================================================
+from __future__ import (absolute_import, division, print_function)
+
from owslib.crs import Crs
from urllib import urlencode
diff --git a/owslib/feature/wfs100.py b/owslib/feature/wfs100.py
index 13975f7..619834d 100644
--- a/owslib/feature/wfs100.py
+++ b/owslib/feature/wfs100.py
@@ -6,6 +6,8 @@
# $Id: wfs.py 503 2006-02-01 17:09:12Z dokai $
# =============================================================================
+from __future__ import (absolute_import, division, print_function)
+
import cgi
from cStringIO import StringIO
from urllib import urlencode
@@ -70,7 +72,7 @@ class WebFeatureService_1_0_0(object):
if name in self.__getattribute__('contents').keys():
return self.__getattribute__('contents')[name]
else:
- raise KeyError, "No content named %s" % name
+ raise KeyError("No content named %s" % name)
def __init__(self, url, version, xml=None, parse_remote_metadata=False, timeout=30):
@@ -238,7 +240,7 @@ class WebFeatureService_1_0_0(object):
for item in self.operations:
if item.name == name:
return item
- raise KeyError, "No operation named %s" % name
+ raise KeyError("No operation named %s" % name)
class ServiceIdentification(object):
''' Implements IServiceIdentificationMetadata '''
@@ -321,7 +323,7 @@ class ContentMetadata:
metadataUrl['metadata'] = Metadata(doc)
if metadataUrl['type'] == 'TC211':
metadataUrl['metadata'] = MD_Metadata(doc)
- except Exception, err:
+ except Exception:
metadataUrl['metadata'] = None
self.metadataUrls.append(metadataUrl)
diff --git a/owslib/feature/wfs110.py b/owslib/feature/wfs110.py
index 8f30c03..b5f693a 100644
--- a/owslib/feature/wfs110.py
+++ b/owslib/feature/wfs110.py
@@ -7,6 +7,8 @@
# Contact email: tomkralidis at gmail.com
# =============================================================================
+from __future__ import (absolute_import, division, print_function)
+
import cgi
from cStringIO import StringIO
from urllib import urlencode
@@ -53,7 +55,7 @@ class WebFeatureService_1_1_0(WebFeatureService_):
if name in self.__getattribute__('contents').keys():
return self.__getattribute__('contents')[name]
else:
- raise KeyError, "No content named %s" % name
+ raise KeyError("No content named %s" % name)
def __init__(self, url, version, xml=None, parse_remote_metadata=False, timeout=30):
@@ -244,7 +246,7 @@ class WebFeatureService_1_1_0(WebFeatureService_):
for item in self.operations:
if item.name == name:
return item
- raise KeyError, "No operation named %s" % name
+ raise KeyError("No operation named %s" % name)
@@ -299,7 +301,7 @@ class ContentMetadata:
metadataUrl['metadata'] = Metadata(doc)
if metadataUrl['type'] in ['TC211', '19115', '19139']:
metadataUrl['metadata'] = MD_Metadata(doc)
- except Exception, err:
+ except Exception:
metadataUrl['metadata'] = None
self.metadataUrls.append(metadataUrl)
diff --git a/owslib/feature/wfs200.py b/owslib/feature/wfs200.py
index b4175ae..b6d9c1e 100644
--- a/owslib/feature/wfs200.py
+++ b/owslib/feature/wfs200.py
@@ -6,6 +6,8 @@
# $Id: wfs.py 503 2006-02-01 17:09:12Z dokai $
# =============================================================================
+from __future__ import (absolute_import, division, print_function)
+
#owslib imports:
from owslib.ows import ServiceIdentification, ServiceProvider, OperationsMetadata
from owslib.etree import etree
@@ -61,7 +63,7 @@ class WebFeatureService_2_0_0(WebFeatureService_):
if name in self.__getattribute__('contents').keys():
return self.__getattribute__('contents')[name]
else:
- raise KeyError, "No content named %s" % name
+ raise KeyError("No content named %s" % name)
def __init__(self, url, version, xml=None, parse_remote_metadata=False, timeout=30):
@@ -303,7 +305,7 @@ class WebFeatureService_2_0_0(WebFeatureService_):
for item in self.operations:
if item.name == name:
return item
- raise KeyError, "No operation named %s" % name
+ raise KeyError("No operation named %s" % name)
class StoredQuery(object):
'''' Class to describe a storedquery '''
@@ -390,7 +392,7 @@ class ContentMetadata:
metadataUrl['metadata'] = Metadata(doc)
except: # ISO
metadataUrl['metadata'] = MD_Metadata(doc)
- except Exception, err:
+ except Exception:
metadataUrl['metadata'] = None
self.metadataUrls.append(metadataUrl)
diff --git a/owslib/fes.py b/owslib/fes.py
index d69b095..9caed02 100644
--- a/owslib/fes.py
+++ b/owslib/fes.py
@@ -15,6 +15,8 @@ Filter Encoding: http://www.opengeospatial.org/standards/filter
Currently supports version 1.1.0 (04-095).
"""
+from __future__ import (absolute_import, division, print_function)
+
from owslib.etree import etree
from owslib import util
from owslib.namespaces import Namespaces
diff --git a/owslib/fgdc.py b/owslib/fgdc.py
index 13483a3..10c7539 100644
--- a/owslib/fgdc.py
+++ b/owslib/fgdc.py
@@ -9,6 +9,8 @@
""" FGDC metadata parser """
+from __future__ import (absolute_import, division, print_function)
+
from owslib.etree import etree
from owslib import util
diff --git a/owslib/interfaces.py b/owslib/interfaces.py
index 1bfa530..a877824 100644
--- a/owslib/interfaces.py
+++ b/owslib/interfaces.py
@@ -1,3 +1,5 @@
+from __future__ import (absolute_import, division, print_function)
+
# Follows the 4 aspects of service metadata
diff --git a/owslib/iso.py b/owslib/iso.py
index 364f158..6c294d0 100644
--- a/owslib/iso.py
+++ b/owslib/iso.py
@@ -10,6 +10,8 @@
""" ISO metadata parser """
+from __future__ import (absolute_import, division, print_function)
+
from owslib.etree import etree
from owslib import util
from owslib.namespaces import Namespaces
@@ -762,7 +764,7 @@ class CodelistCatalogue(object):
return self.dictionaries.keys()
def getcodedefinitionidentifiers(self, cdl):
- if self.dictionaries.has_key(cdl):
+ if cdl in self.dictionaries:
ids = []
for i in self.dictionaries[cdl]['entries']:
ids.append(self.dictionaries[cdl]['entries'][i]['identifier'])
diff --git a/owslib/namespaces.py b/owslib/namespaces.py
index 0380844..5ee49b1 100644
--- a/owslib/namespaces.py
+++ b/owslib/namespaces.py
@@ -1,3 +1,6 @@
+from __future__ import (absolute_import, division, print_function)
+
+
class Namespaces(object):
"""
Class for holding and maniputlating a dictionary containing the various namespaces for
diff --git a/owslib/ows.py b/owslib/ows.py
index 24bf51c..f92ffcb 100644
--- a/owslib/ows.py
+++ b/owslib/ows.py
@@ -15,6 +15,8 @@ OWS Common: http://www.opengeospatial.org/standards/common
Currently supports version 1.1.0 (06-121r3).
"""
+from __future__ import (absolute_import, division, print_function)
+
from owslib.etree import etree
from owslib import crs, util
from owslib.namespaces import Namespaces
diff --git a/owslib/sos.py b/owslib/sos.py
index 4404413..c3e15d1 100644
--- a/owslib/sos.py
+++ b/owslib/sos.py
@@ -11,7 +11,10 @@
Sensor Observation Service (SOS) methods and metadata. Factory function.
"""
-from swe.observation import sos100, sos200
+from __future__ import (absolute_import, division, print_function)
+
+from .swe.observation import sos100, sos200
+
def SensorObservationService(url, version='1.0.0', xml=None):
"""sos factory function, returns a version specific SensorObservationService object"""
diff --git a/owslib/swe/__init__.py b/owslib/swe/__init__.py
index e69de29..6eef950 100644
--- a/owslib/swe/__init__.py
+++ b/owslib/swe/__init__.py
@@ -0,0 +1,2 @@
+
+from __future__ import (absolute_import, division, print_function)
diff --git a/owslib/swe/common.py b/owslib/swe/common.py
index 6f7df8d..bee32ac 100644
--- a/owslib/swe/common.py
+++ b/owslib/swe/common.py
@@ -1,3 +1,5 @@
+from __future__ import (absolute_import, division, print_function)
+
from owslib.util import nspath_eval
from owslib.namespaces import Namespaces
from owslib.util import testXMLAttribute, testXMLValue, InfiniteDateTime, NegativeInfiniteDateTime
@@ -24,7 +26,7 @@ def make_pair(string, cast=None):
try:
string = map(lambda x: cast(x), string)
except:
- print "Could not cast pair to correct type. Setting to an empty tuple!"
+ print("Could not cast pair to correct type. Setting to an empty tuple!")
string = ""
return tuple(string)
@@ -407,4 +409,4 @@ class XMLEncoding(AbstractEncoding):
class BinaryEncoding(AbstractEncoding):
def __init__(self, element):
- raise NotImplementedError
\ No newline at end of file
+ raise NotImplementedError
diff --git a/owslib/swe/observation/__init__.py b/owslib/swe/observation/__init__.py
index e69de29..6eef950 100644
--- a/owslib/swe/observation/__init__.py
+++ b/owslib/swe/observation/__init__.py
@@ -0,0 +1,2 @@
+
+from __future__ import (absolute_import, division, print_function)
diff --git a/owslib/swe/observation/sos100.py b/owslib/swe/observation/sos100.py
index 698c53a..06e5b1d 100644
--- a/owslib/swe/observation/sos100.py
+++ b/owslib/swe/observation/sos100.py
@@ -1,3 +1,5 @@
+from __future__ import (absolute_import, division, print_function)
+
import cgi
from owslib.etree import etree
from datetime import datetime
@@ -33,7 +35,7 @@ class SensorObservationService_1_0_0(object):
if id in self.__getattribute__('contents').keys():
return self.__getattribute__('contents')[id]
else:
- raise KeyError, "No Observational Offering with id: %s" % id
+ raise KeyError("No Observational Offering with id: %s" % id)
def __init__(self, url, version='1.0.0', xml=None, username=None, password=None):
"""Initialize."""
@@ -187,7 +189,8 @@ class SensorObservationService_1_0_0(object):
data = urlencode(request)
- response = openURL(base_url, data, method, username=self.username, password=self.password, **kwargs).read()
+ response = openURL(base_url, data, method, username=self.username,
+ password=self.password, **url_kwargs).read()
try:
tr = etree.fromstring(response)
if tr.tag == nspath_eval("ows:ExceptionReport", namespaces):
@@ -206,7 +209,7 @@ class SensorObservationService_1_0_0(object):
for item in self.operations:
if item.name.lower() == name.lower():
return item
- raise KeyError, "No Operation named %s" % name
+ raise KeyError("No Operation named %s" % name)
class SosObservationOffering(object):
def __init__(self, element):
@@ -228,7 +231,7 @@ class SosObservationOffering(object):
# (left, bottom, right, top) in self.bbox_srs units
self.bbox = (float(lower_left_corner[1]), float(lower_left_corner[0]), float(upper_right_corner[1]), float(upper_right_corner[0]))
self.bbox_srs = Crs(testXMLValue(envelope.attrib.get('srsName'), True))
- except Exception, err:
+ except Exception:
self.bbox = None
self.bbox_srs = None
diff --git a/owslib/swe/observation/sos200.py b/owslib/swe/observation/sos200.py
index a306dcc..5a0d45f 100644
--- a/owslib/swe/observation/sos200.py
+++ b/owslib/swe/observation/sos200.py
@@ -1,3 +1,5 @@
+from __future__ import (absolute_import, division, print_function)
+
import cgi
from owslib.etree import etree
from datetime import datetime
@@ -35,7 +37,7 @@ class SensorObservationService_2_0_0(object):
if id in self.__getattribute__('contents').keys():
return self.__getattribute__('contents')[id]
else:
- raise KeyError, "No Observational Offering with id: %s" % id
+ raise KeyError("No Observational Offering with id: %s" % id)
def __init__(self, url, version='2.0.0', xml=None, username=None, password=None):
"""Initialize."""
@@ -202,7 +204,7 @@ class SensorObservationService_2_0_0(object):
for item in self.operations:
if item.name.lower() == name.lower():
return item
- raise KeyError, "No Operation named %s" % name
+ raise KeyError("No Operation named %s" % name)
class SosObservationOffering(object):
def __init__(self, element):
@@ -222,7 +224,7 @@ class SosObservationOffering(object):
# (left, bottom, right, top) in self.bbox_srs units
self.bbox = (float(lower_left_corner[1]), float(lower_left_corner[0]), float(upper_right_corner[1]), float(upper_right_corner[0]))
self.bbox_srs = Crs(testXMLValue(envelope.attrib.get('srsName'), True))
- except Exception, err:
+ except Exception:
self.bbox = None
self.bbox_srs = None
diff --git a/owslib/swe/sensor/__init__.py b/owslib/swe/sensor/__init__.py
index e69de29..6eef950 100644
--- a/owslib/swe/sensor/__init__.py
+++ b/owslib/swe/sensor/__init__.py
@@ -0,0 +1,2 @@
+
+from __future__ import (absolute_import, division, print_function)
diff --git a/owslib/swe/sensor/sml.py b/owslib/swe/sensor/sml.py
index f220ace..28e199e 100644
--- a/owslib/swe/sensor/sml.py
+++ b/owslib/swe/sensor/sml.py
@@ -1,5 +1,7 @@
# encoding: utf-8
+from __future__ import (absolute_import, division, print_function)
+
from owslib.etree import etree
from owslib import crs, util
from owslib.util import testXMLValue, testXMLAttribute, nspath_eval, xmltag_split, dict_union, extract_xml_list
diff --git a/owslib/tms.py b/owslib/tms.py
index 09403d6..c5eff4b 100644
--- a/owslib/tms.py
+++ b/owslib/tms.py
@@ -15,9 +15,12 @@
# TMS as defined in:
# http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification
-from etree import etree
+from __future__ import (absolute_import, division, print_function)
+
+from .etree import etree
from .util import openURL, testXMLValue
+
FORCE900913 = False
def force900913(epsg):
diff --git a/owslib/util.py b/owslib/util.py
index 1b36730..cc586c0 100644
--- a/owslib/util.py
+++ b/owslib/util.py
@@ -7,6 +7,8 @@
# Contact email: tomkralidis at gmail.com
# =============================================================================
+from __future__ import (absolute_import, division, print_function)
+
import base64
import sys
from dateutil import parser
@@ -177,13 +179,13 @@ def openURL(url_base, data, method='Get', cookies=None, username=None, password=
if cookies is not None:
req.add_header('Cookie', cookies)
u = openit(req, timeout=timeout)
- except HTTPError, e: #Some servers may set the http header to 400 if returning an OGC service exception or 401 if unauthorised.
+ except HTTPError as e: #Some servers may set the http header to 400 if returning an OGC service exception or 401 if unauthorised.
if e.code in [400, 401]:
- raise ServiceException, e.read()
+ raise ServiceException(e.read())
else:
raise e
# check for service exceptions without the http header set
- if ((u.info().has_key('Content-Type')) and (u.info()['Content-Type'] in ['text/xml', 'application/xml'])):
+ if 'Content-Type' in u.info() and u.info()['Content-Type'] in ['text/xml', 'application/xml']:
#just in case 400 headers were not set, going to have to read the xml to see if it's an exception report.
#wrap the url stram in a extended StringIO object so it's re-readable
u=RereadableURL(u)
@@ -193,8 +195,7 @@ def openURL(url_base, data, method='Get', cookies=None, username=None, password=
if serviceException is None:
serviceException=se_tree.find('ServiceException')
if serviceException is not None:
- raise ServiceException, \
- str(serviceException.text).strip()
+ raise ServiceException(str(serviceException.text).strip())
u.seek(0) #return cursor to start of u
return u
@@ -380,7 +381,7 @@ def http_post(url=None, request=None, lang='en-US', timeout=10, username=None, p
up.close()
# check if response is gzip compressed
- if ui.has_key('Content-Encoding'):
+ if 'Content-Encoding' in ui:
if ui['Content-Encoding'] == 'gzip': # uncompress response
import gzip
cds = StringIO(response)
@@ -492,9 +493,9 @@ def build_get_url(base_url, params):
def dump(obj, prefix=''):
'''Utility function to print to standard output a generic object with all its attributes.'''
-
- print "%s %s : %s" % (prefix, obj.__class__, obj.__dict__)
-
+
+ print("%s %s : %s" % (prefix, obj.__class__, obj.__dict__))
+
def getTypedValue(type, value):
''' Utility function to cast a string value to the appropriate XSD type. '''
diff --git a/owslib/waterml/__init__.py b/owslib/waterml/__init__.py
index e69de29..6eef950 100644
--- a/owslib/waterml/__init__.py
+++ b/owslib/waterml/__init__.py
@@ -0,0 +1,2 @@
+
+from __future__ import (absolute_import, division, print_function)
diff --git a/owslib/waterml/wml.py b/owslib/waterml/wml.py
index 1d17f0c..043e557 100644
--- a/owslib/waterml/wml.py
+++ b/owslib/waterml/wml.py
@@ -1,3 +1,5 @@
+from __future__ import (absolute_import, division, print_function)
+
from owslib.etree import etree
from owslib.util import nspath, testXMLValue, openURL
from owslib.util import xml_to_dict as _xml_to_dict
diff --git a/owslib/waterml/wml10.py b/owslib/waterml/wml10.py
index ac540bc..f90dfe4 100644
--- a/owslib/waterml/wml10.py
+++ b/owslib/waterml/wml10.py
@@ -1,3 +1,5 @@
+from __future__ import (absolute_import, division, print_function)
+
from owslib.waterml.wml import SitesResponse, TimeSeriesResponse, VariablesResponse, namespaces
from owslib.etree import etree
@@ -29,4 +31,4 @@ class WaterML_1_0(object):
except:
raise
- raise ValueError('Unable to determine response type from xml')
\ No newline at end of file
+ raise ValueError('Unable to determine response type from xml')
diff --git a/owslib/waterml/wml11.py b/owslib/waterml/wml11.py
index db8c230..f95a27b 100644
--- a/owslib/waterml/wml11.py
+++ b/owslib/waterml/wml11.py
@@ -1,3 +1,5 @@
+from __future__ import (absolute_import, division, print_function)
+
from owslib.waterml.wml import SitesResponse, TimeSeriesResponse, VariablesResponse, namespaces
from owslib.etree import etree
diff --git a/owslib/wcs.py b/owslib/wcs.py
index 634c056..572c87a 100644
--- a/owslib/wcs.py
+++ b/owslib/wcs.py
@@ -13,10 +13,12 @@
Web Coverage Server (WCS) methods and metadata. Factory function.
"""
+from __future__ import (absolute_import, division, print_function)
import urllib2
-import etree
-from coverage import wcs100, wcs110, wcsBase
+from . import etree
+from .coverage import wcs100, wcs110, wcsBase
+
def WebCoverageService(url, version=None, xml=None, cookies=None, timeout=30):
''' wcs factory function, returns a version specific WebCoverageService object '''
diff --git a/owslib/wfs.py b/owslib/wfs.py
index 3f2b6cd..cee4352 100644
--- a/owslib/wfs.py
+++ b/owslib/wfs.py
@@ -13,7 +13,11 @@
Web Feature Server (WFS) methods and metadata. Factory function.
"""
-from feature import wfs100, wfs110, wfs200
+from __future__ import (absolute_import, division, print_function)
+
+from .feature import wfs100, wfs110, wfs200
+
+
def WebFeatureService(url, version='1.0.0', xml=None, parse_remote_metadata=False,
timeout=30):
''' wfs factory function, returns a version specific WebFeatureService object
diff --git a/owslib/wmc.py b/owslib/wmc.py
index d215cb4..2ff3133 100644
--- a/owslib/wmc.py
+++ b/owslib/wmc.py
@@ -16,7 +16,10 @@ https://portal.opengeospatial.org/files/?artifact_id=8618
"""
-from etree import etree
+from __future__ import (absolute_import, division, print_function)
+
+from .etree import etree
+
context_ns_uri = 'http://www.opengis.net/context'
context_schemas_uri = 'http://schemas.opengis.net/context/1.0.0/context.xsd'
diff --git a/owslib/wms.py b/owslib/wms.py
index e726b5c..bfe7597 100644
--- a/owslib/wms.py
+++ b/owslib/wms.py
@@ -15,14 +15,17 @@ API for Web Map Service (WMS) methods and metadata.
Currently supports only version 1.1.1 of the WMS protocol.
"""
+from __future__ import (absolute_import, division, print_function)
+
import cgi
import urllib2
from urllib import urlencode
import warnings
-from etree import etree
+from .etree import etree
from .util import openURL, testXMLValue, extract_xml_list, xmltag_split
-from fgdc import Metadata
-from iso import MD_Metadata
+from .fgdc import Metadata
+from .iso import MD_Metadata
+
class ServiceException(Exception):
"""WMS ServiceException
@@ -55,7 +58,7 @@ class WebMapService(object):
if name in self.__getattribute__('contents').keys():
return self.__getattribute__('contents')[name]
else:
- raise KeyError, "No content named %s" % name
+ raise KeyError("No content named %s" % name)
def __init__(self, url, version='1.1.1', xml=None,
@@ -261,7 +264,7 @@ class WebMapService(object):
for item in self.operations:
if item.name == name:
return item
- raise KeyError, "No operation named %s" % name
+ raise KeyError("No operation named %s" % name)
class ServiceIdentification(object):
''' Implements IServiceIdentificationMetadata '''
@@ -300,14 +303,14 @@ class ServiceProvider(object):
for item in self.contents:
if item.name == name:
return item
- raise KeyError, "No content named %s" % name
+ raise KeyError("No content named %s" % name)
def getOperationByName(self, name):
"""Return a named content item."""
for item in self.operations:
if item.name == name:
return item
- raise KeyError, "No operation named %s" % name
+ raise KeyError("No operation named %s" % name)
class ContentMetadata:
"""
@@ -485,7 +488,7 @@ class ContentMetadata:
metadataUrl['metadata'] = Metadata(doc)
if metadataUrl['type'] == 'TC211':
metadataUrl['metadata'] = MD_Metadata(doc)
- except Exception, err:
+ except Exception:
metadataUrl['metadata'] = None
self.metadataUrls.append(metadataUrl)
diff --git a/owslib/wmts.py b/owslib/wmts.py
index eff4e04..9b4d78d 100644
--- a/owslib/wmts.py
+++ b/owslib/wmts.py
@@ -29,15 +29,17 @@ would be appreciated.
"""
+from __future__ import (absolute_import, division, print_function)
+
import warnings
import urlparse
import urllib2
from urllib import urlencode
-from etree import etree
+from .etree import etree
from .util import openURL, testXMLValue, getXMLInteger
-from fgdc import Metadata
-from iso import MD_Metadata
-from ows import ServiceProvider, ServiceIdentification, OperationsMetadata
+from .fgdc import Metadata
+from .iso import MD_Metadata
+from .ows import ServiceProvider, ServiceIdentification, OperationsMetadata
_OWS_NS = '{http://www.opengis.net/ows/1.1}'
diff --git a/owslib/wps.py b/owslib/wps.py
index 0929c31..0463407 100644
--- a/owslib/wps.py
+++ b/owslib/wps.py
@@ -84,6 +84,8 @@ Also, the directory tests/ contains several examples of well-formed "Execute" re
"""
+from __future__ import (absolute_import, division, print_function)
+
from owslib.etree import etree
from owslib.ows import DEFAULT_OWS_NAMESPACE, ServiceIdentification, ServiceProvider, OperationsMetadata
from time import sleep
@@ -1362,21 +1364,21 @@ def printInputOutput(value, indent=''):
'''
# InputOutput fields
- print '%s identifier=%s, title=%s, abstract=%s, data type=%s' % (indent, value.identifier, value.title, value.abstract, value.dataType)
+ print('%s identifier=%s, title=%s, abstract=%s, data type=%s' % (indent, value.identifier, value.title, value.abstract, value.dataType))
for val in value.allowedValues:
- print '%s Allowed Value: %s' % (indent, printValue(val))
+ print('%s Allowed Value: %s' % (indent, printValue(val)))
if value.anyValue:
- print ' Any value allowed'
+ print(' Any value allowed')
for val in value.supportedValues:
- print '%s Supported Value: %s' % (indent, printValue(val))
- print '%s Default Value: %s ' % (indent, printValue(value.defaultValue))
-
+ print('%s Supported Value: %s' % (indent, printValue(val)))
+ print('%s Default Value: %s ' % (indent, printValue(value.defaultValue)))
+
# Input fields
if isinstance(value, Input):
- print '%s minOccurs=%d, maxOccurs=%d' % (indent, value.minOccurs, value.maxOccurs)
-
+ print('%s minOccurs=%d, maxOccurs=%d' % (indent, value.minOccurs, value.maxOccurs))
+
# Output fields
if isinstance(value, Output):
- print '%s reference=%s, mimeType=%s' % (indent, value.reference, value.mimeType)
+ print('%s reference=%s, mimeType=%s' % (indent, value.reference, value.mimeType))
for datum in value.data:
- print '%s Data Value: %s' % (indent, printValue(datum))
+ print('%s Data Value: %s' % (indent, printValue(datum)))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/owslib.git
More information about the Pkg-grass-devel
mailing list