diff --git a/examples/dictionary/define.py b/examples/dictionary/define.py index 921da601..c14d39e8 100644 --- a/examples/dictionary/define.py +++ b/examples/dictionary/define.py @@ -1,6 +1,6 @@ from __future__ import print_function import dict -from pyxb.utils.six.moves.urllib.request import urlopen +from pyxb.utils.sal import urlopen import sys from pyxb.utils import domutils diff --git a/examples/dictionary/showdict.py b/examples/dictionary/showdict.py index 08b3b893..d216ebca 100644 --- a/examples/dictionary/showdict.py +++ b/examples/dictionary/showdict.py @@ -3,7 +3,7 @@ from __future__ import print_function import sys import dict -from pyxb.utils.six.moves.urllib.request import urlopen +from pyxb.utils.sal import urlopen import pyxb.utils.domutils as domutils from xml.dom import minidom diff --git a/examples/geocoder/client.py b/examples/geocoder/client.py index 23ea20f1..c9a33663 100644 --- a/examples/geocoder/client.py +++ b/examples/geocoder/client.py @@ -1,6 +1,6 @@ from __future__ import print_function import sys -from pyxb.utils.six.moves.urllib import request as urllib_request +from pyxb.utils.sal import urllib_request import GeoCoder from pyxb import BIND from pyxb.utils import domutils diff --git a/examples/ndfd/forecast.py b/examples/ndfd/forecast.py index 1df1f222..2856c1a0 100644 --- a/examples/ndfd/forecast.py +++ b/examples/ndfd/forecast.py @@ -3,7 +3,7 @@ import DWML import datetime import pyxb.binding.datatypes as xsd -from pyxb.utils.six.moves.urllib.request import urlopen +from pyxb.utils.sal import urlopen import time import collections import sys diff --git a/examples/ndfd/latlon.py b/examples/ndfd/latlon.py index 781638aa..cf6f8a71 100644 --- a/examples/ndfd/latlon.py +++ b/examples/ndfd/latlon.py @@ -4,8 +4,8 @@ import DWML import datetime import pyxb -from pyxb.utils import domutils, six -from pyxb.utils.six.moves.urllib import request as urllib_request +from pyxb.utils import domutils, sal as six +from pyxb.utils.sal import urllib_request import pyxb.binding.datatypes as xsd import pyxb.bundles.wssplat.soap11 as soapenv diff --git a/examples/ndfd/showreq.py b/examples/ndfd/showreq.py index 6cc2b6d7..8fc98840 100644 --- a/examples/ndfd/showreq.py +++ b/examples/ndfd/showreq.py @@ -2,7 +2,7 @@ import xml.dom import xml.dom.minidom import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import pyxb.namespace # Structure diff --git a/examples/ucum/showunits.py b/examples/ucum/showunits.py index 0f462618..ead75030 100644 --- a/examples/ucum/showunits.py +++ b/examples/ucum/showunits.py @@ -4,7 +4,7 @@ import ucum import pyxb import sys -from pyxb.utils import six +from pyxb.utils import sal as six def ucumHTML (u): """Convert mixed content to UCUM's version of HTML""" diff --git a/examples/weather/client.py b/examples/weather/client.py index 816e4b44..7acf72c2 100644 --- a/examples/weather/client.py +++ b/examples/weather/client.py @@ -1,7 +1,7 @@ from __future__ import print_function import sys import time -from pyxb.utils.six.moves.urllib import request as urllib_request +from pyxb.utils.sal import urllib_request import pyxb.bundles.wssplat.soap11 as soapenv import weather diff --git a/examples/weather/client_get.py b/examples/weather/client_get.py index f9b37a43..6b6687ee 100644 --- a/examples/weather/client_get.py +++ b/examples/weather/client_get.py @@ -1,6 +1,6 @@ from __future__ import print_function import time -from pyxb.utils.six.moves.urllib import request as urllib_request +from pyxb.utils.sal import urllib_request import weather # Bindings generated by PyXB import pyxb.utils.domutils as domutils diff --git a/examples/xsdprimer/ipo.py b/examples/xsdprimer/ipo.py index 0b5fe5ea..d4440e8d 100644 --- a/examples/xsdprimer/ipo.py +++ b/examples/xsdprimer/ipo.py @@ -1,6 +1,6 @@ # Bring everything in from raw.ipo import * -from pyxb.utils import six +from pyxb.utils import sal as six # Provide a way to reference the raw bindings that we're going to override import raw.ipo as raw_ipo diff --git a/maintainer/buildUnicode.py b/maintainer/buildUnicode.py index 75798458..76c4f177 100644 --- a/maintainer/buildUnicode.py +++ b/maintainer/buildUnicode.py @@ -29,8 +29,8 @@ from __future__ import print_function import textwrap import re -from pyxb.utils import six -from pyxb.utils.six.moves import xrange +from pyxb.utils import sal as six +from pyxb.utils.sal import xrange def countCodepoints (codepoints): count = 0 diff --git a/pyxb/__init__.py b/pyxb/__init__.py index 1773f16d..76a2698b 100644 --- a/pyxb/__init__.py +++ b/pyxb/__init__.py @@ -26,7 +26,7 @@ """ import logging -from pyxb.utils import six +from pyxb.utils import sal as six _log = logging.getLogger(__name__) diff --git a/pyxb/__init__.py.in b/pyxb/__init__.py.in index 09ba6642..c32564d5 100644 --- a/pyxb/__init__.py.in +++ b/pyxb/__init__.py.in @@ -26,7 +26,7 @@ submodules: """ import logging -from pyxb.utils import six +from pyxb.utils import sal as six _log = logging.getLogger(__name__) diff --git a/pyxb/binding/basis.py b/pyxb/binding/basis.py index a24c32e9..bdaa9a7d 100644 --- a/pyxb/binding/basis.py +++ b/pyxb/binding/basis.py @@ -20,7 +20,7 @@ import collections.abc import xml.dom import pyxb -from pyxb.utils import domutils, utility, six +from pyxb.utils import domutils, utility, sal as six import pyxb.namespace from pyxb.namespace.builtin import XMLSchema_instance as XSI import decimal diff --git a/pyxb/binding/content.py b/pyxb/binding/content.py index 5c45dfb7..b29dd43a 100644 --- a/pyxb/binding/content.py +++ b/pyxb/binding/content.py @@ -33,7 +33,7 @@ import pyxb.utils.fac from pyxb.binding import basis import pyxb.utils.utility -from pyxb.utils import six +from pyxb.utils import sal as six _log = logging.getLogger(__name__) diff --git a/pyxb/binding/datatypes.py b/pyxb/binding/datatypes.py index 66940572..535fa6ae 100644 --- a/pyxb/binding/datatypes.py +++ b/pyxb/binding/datatypes.py @@ -52,7 +52,7 @@ from pyxb.exceptions_ import * import pyxb.namespace import pyxb.utils.unicode -from pyxb.utils import six +from pyxb.utils import sal as six from . import basis _log = logging.getLogger(__name__) diff --git a/pyxb/binding/facets.py b/pyxb/binding/facets.py index d2c29079..01da938b 100644 --- a/pyxb/binding/facets.py +++ b/pyxb/binding/facets.py @@ -29,7 +29,7 @@ import pyxb from . import datatypes from . import basis -from pyxb.utils import utility, six +from pyxb.utils import utility, sal as six _log = logging.getLogger(__name__) diff --git a/pyxb/binding/generate.py b/pyxb/binding/generate.py index 87f6d5f2..f3d59dd7 100644 --- a/pyxb/binding/generate.py +++ b/pyxb/binding/generate.py @@ -27,7 +27,8 @@ import pyxb import pyxb.xmlschema as xs -from pyxb.utils import utility, templates, six +from pyxb.utils import utility, templates +from pyxb.utils import sal as six from pyxb.utils.utility import repr2to3 from pyxb.binding import basis, datatypes, facets @@ -1671,7 +1672,7 @@ def _finalizeModuleContents_vx (self, template_map): import pyxb.utils.utility import pyxb.utils.domutils import sys -import pyxb.utils.six as _six +import pyxb.utils.sal as _six ''') self.bindingIO().appendPrologBoilerplate(template_map) self.bindingIO().prolog().append(self.bindingIO().expand(''' @@ -1794,7 +1795,7 @@ def _finalizeModuleContents_vx (self, template_map): import pyxb import pyxb.binding import pyxb.utils.utility -import pyxb.utils.six as _six +import pyxb.utils.sal as _six ''') self.bindingIO().appendPrologBoilerplate(template_map) diff --git a/pyxb/binding/xml_.py b/pyxb/binding/xml_.py index e14883c6..4bb1c19b 100644 --- a/pyxb/binding/xml_.py +++ b/pyxb/binding/xml_.py @@ -29,7 +29,7 @@ import pyxb.binding import pyxb.utils.utility import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six # Unique identifier for bindings created at the same time _GenerationUID = pyxb.namespace.builtin.BuiltInObjectUID diff --git a/pyxb/bundles/wssplat/wsdl11.py b/pyxb/bundles/wssplat/wsdl11.py index 3ce31450..2ce46fa1 100644 --- a/pyxb/bundles/wssplat/wsdl11.py +++ b/pyxb/bundles/wssplat/wsdl11.py @@ -17,7 +17,7 @@ import pyxb.bundles.wssplat.raw.wsdl11 as raw_wsdl11 import pyxb.namespace -from pyxb.utils import domutils, six +from pyxb.utils import domutils, sal as six import xml.dom def ImportRelatedNamespaces (): diff --git a/pyxb/exceptions_.py b/pyxb/exceptions_.py index f90cb9f7..34b099ce 100644 --- a/pyxb/exceptions_.py +++ b/pyxb/exceptions_.py @@ -21,7 +21,7 @@ """ import pyxb -from pyxb.utils import six +from pyxb.utils import sal as six class PyXBException (Exception): """Base class for exceptions that indicate a problem that the user should fix.""" diff --git a/pyxb/namespace/__init__.py b/pyxb/namespace/__init__.py index 8b3e09e8..1a6e965c 100644 --- a/pyxb/namespace/__init__.py +++ b/pyxb/namespace/__init__.py @@ -22,7 +22,7 @@ import pyxb import pyxb.utils.utility -from pyxb.utils import six +from pyxb.utils import sal as six import xml.dom import logging diff --git a/pyxb/namespace/archive.py b/pyxb/namespace/archive.py index b6809eb0..cfab388d 100644 --- a/pyxb/namespace/archive.py +++ b/pyxb/namespace/archive.py @@ -21,7 +21,7 @@ import os.path import pyxb import pyxb.utils.utility -from pyxb.utils import six +from pyxb.utils import sal as six _log = logging.getLogger(__name__) @@ -45,7 +45,7 @@ def GetArchivePath (): return os.environ.get(PathEnvironmentVariable) # Stuff required for pickling -from pyxb.utils.six.moves import cPickle as pickle +from pyxb.utils.sal import cPickle as pickle import re class NamespaceArchive (object): diff --git a/pyxb/namespace/builtin.py b/pyxb/namespace/builtin.py index 92b3c58a..753154d7 100644 --- a/pyxb/namespace/builtin.py +++ b/pyxb/namespace/builtin.py @@ -17,7 +17,7 @@ import logging import pyxb -from pyxb.utils import six +from pyxb.utils import sal as six _log = logging.getLogger(__name__) diff --git a/pyxb/namespace/resolution.py b/pyxb/namespace/resolution.py index bf695ecb..f37199b3 100644 --- a/pyxb/namespace/resolution.py +++ b/pyxb/namespace/resolution.py @@ -20,7 +20,7 @@ import pyxb import pyxb.utils.utility from pyxb.namespace import archive, utility -from pyxb.utils import six +from pyxb.utils import sal as six _log = logging.getLogger(__name__) diff --git a/pyxb/namespace/utility.py b/pyxb/namespace/utility.py index 964e8235..a3d445ce 100644 --- a/pyxb/namespace/utility.py +++ b/pyxb/namespace/utility.py @@ -18,7 +18,7 @@ import logging import pyxb import pyxb.namespace -from pyxb.utils import six +from pyxb.utils import sal as six _log = logging.getLogger(__name__) diff --git a/pyxb/utils/domutils.py b/pyxb/utils/domutils.py index e050c43f..f72757bf 100644 --- a/pyxb/utils/domutils.py +++ b/pyxb/utils/domutils.py @@ -23,8 +23,8 @@ import pyxb.namespace.resolution import pyxb.utils.saxutils import pyxb.utils.saxdom -from pyxb.utils import six -from pyxb.utils.six.moves import xrange +from pyxb.utils import sal as six +from pyxb.utils.sal import xrange _log = logging.getLogger(__name__) diff --git a/pyxb/utils/fac.py b/pyxb/utils/fac.py index f350ebaa..3fa37f52 100644 --- a/pyxb/utils/fac.py +++ b/pyxb/utils/fac.py @@ -60,8 +60,8 @@ import operator import functools import logging -from pyxb.utils import six -from pyxb.utils.six.moves import xrange +from pyxb.utils import sal as six +from pyxb.utils.sal import xrange log_ = logging.getLogger(__name__) diff --git a/pyxb/utils/sal.py b/pyxb/utils/sal.py new file mode 100644 index 00000000..b0d2c952 --- /dev/null +++ b/pyxb/utils/sal.py @@ -0,0 +1,122 @@ +"""Utilities for writing code that runs on Python 2 and 3 + +Change from 'six' to 'sal' because six quit working in at Python 3.12.4 or sooner +and Python 2.x has passed its end of life. The concept here is to support only +the know trouble items as python evolves rather a "compete" unit for all changes +from 2.x to 3.x. Instead of uisng PEP compliant code to squeeze the transistions +into the python space, just use a Software Abstraction Layer (sal) to handle just +the evolving code that pyxb needs. +""" + +# Copyright (c) 2010-2015 Benjamin Peterson +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from __future__ import absolute_import + +import functools +import itertools +import operator +import sys +import types +# Useful for very coarse version differentiation. +PY2 = sys.version_info[0] == 2 +PY3 = sys.version_info[0] == 3 +PY34 = sys.version_info[0:2] >= (3, 4) + +if PY3: + string_types = str, + integer_types = int, + class_types = type, + text_type = str + binary_type = bytes + + none_type = type(None) + boolean_type = bool + float_type = float + int_type = int + long_type = int + list_type = list + tuple_type = tuple + dictionary_type = dict + + MAXSIZE = sys.maxsize + + import io + import pickle as cPickle + from builtins import exec as exec_ + from builtins import range as xrange + from sys import intern + from types import ModuleType as imp_new_module + from urllib import parse as urlparse + from urllib import request as urllib_request + from urllib.request import urlopen + + def iterkeys(d, **kw): + return iter(d.keys(**kw)) + def itervalues(d, **kw): + return iter(d.values(**kw)) + def iteritems(d, **kw): + return iter(d.items(**kw)) + def iterlists(d, **kw): + return iter(d.lists(**kw)) + viewkeys = operator.methodcaller("keys") + viewvalues = operator.methodcaller("values") + viewitems = operator.methodcaller("items") + def b(s): return s.encode("latin-1") + def u(s): return s + unichr = chr + import struct + int2byte = struct.Struct(">B").pack + del struct + byte2int = operator.itemgetter(0) + indexbytes = operator.getitem + iterbytes = iter + import io + StringIO = io.StringIO + BytesIO = io.BytesIO + file = io.IOBase + _assertCountEqual = "assertCountEqual" + if sys.version_info[1] <= 1: + _assertRaisesRegex = "assertRaisesRegexp" + _assertRegex = "assertRegexpMatches" + else: + _assertRaisesRegex = "assertRaisesRegex" + _assertRegex = "assertRegex" + Iterator = object +else: + raise TypeError("Python 2 no longer supported") + +def python_2_unicode_compatible(klass): + """ + A decorator that defines __unicode__ and __str__ methods under Python 2. + Under Python 3 it does nothing. + + To support Python 2 and 3 with a single code base, define a __str__ method + returning text and apply this decorator to the class. + """ + if PY2: + if '__str__' not in klass.__dict__: + raise ValueError("@python_2_unicode_compatible cannot be applied " + "to %s because it doesn't define __str__()." % + klass.__name__) + klass.__unicode__ = klass.__str__ + import pyxb + klass.__str__ = lambda self: self.__unicode__().encode(pyxb._OutputEncoding) + return klass diff --git a/pyxb/utils/saxdom.py b/pyxb/utils/saxdom.py index c40dd20c..007e7d3b 100644 --- a/pyxb/utils/saxdom.py +++ b/pyxb/utils/saxdom.py @@ -31,7 +31,7 @@ import io import xml.dom import pyxb.utils.saxutils -from pyxb.utils import six +from pyxb.utils import sal as six import pyxb.namespace _log = logging.getLogger(__name__) diff --git a/pyxb/utils/saxutils.py b/pyxb/utils/saxutils.py index 14520c74..a21f5f97 100644 --- a/pyxb/utils/saxutils.py +++ b/pyxb/utils/saxutils.py @@ -28,7 +28,7 @@ import io import logging import pyxb.namespace -from pyxb.utils import six +from pyxb.utils import sal as six _log = logging.getLogger(__name__) diff --git a/pyxb/utils/six.py b/pyxb/utils/six.py deleted file mode 100644 index 34567fc3..00000000 --- a/pyxb/utils/six.py +++ /dev/null @@ -1,890 +0,0 @@ -"""Utilities for writing code that runs on Python 2 and 3""" - -# Copyright (c) 2010-2015 Benjamin Peterson -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -from __future__ import absolute_import - -import functools -import itertools -import operator -import sys -import types - -__author__ = "Benjamin Peterson " -__version__ = "1.9.0" - - -# Useful for very coarse version differentiation. -PY2 = sys.version_info[0] == 2 -PY3 = sys.version_info[0] == 3 -PY34 = sys.version_info[0:2] >= (3, 4) - -if PY3: - string_types = str, - integer_types = int, - class_types = type, - text_type = str - binary_type = bytes - - none_type = type(None) - boolean_type = bool - float_type = float - int_type = int - long_type = int - list_type = list - tuple_type = tuple - dictionary_type = dict - - MAXSIZE = sys.maxsize -else: - string_types = basestring, - integer_types = (int, long) - class_types = (type, types.ClassType) - text_type = unicode - binary_type = str - - import types - none_type = types.NoneType - boolean_type = types.BooleanType - int_type = types.IntType - long_type = types.LongType - float_type = types.FloatType - list_type = types.ListType - tuple_type = types.TupleType - dictionary_type = types.DictionaryType - - if sys.platform.startswith("java"): - # Jython always uses 32 bits. - MAXSIZE = int((1 << 31) - 1) - else: - # It's possible to have sizeof(long) != sizeof(Py_ssize_t). - class X(object): - - def __len__(self): - return 1 << 31 - try: - len(X()) - except OverflowError: - # 32-bit - MAXSIZE = int((1 << 31) - 1) - else: - # 64-bit - MAXSIZE = int((1 << 63) - 1) - del X - - -def _add_doc(func, doc): - """Add documentation to a function.""" - func.__doc__ = doc - - -def _import_module(name): - """Import module, returning the module after the last dot.""" - __import__(name) - return sys.modules[name] - - -class _LazyDescr(object): - - def __init__(self, name): - self.name = name - - def __get__(self, obj, tp): - result = self._resolve() - setattr(obj, self.name, result) # Invokes __set__. - try: - # This is a bit ugly, but it avoids running this again by - # removing this descriptor. - delattr(obj.__class__, self.name) - except AttributeError: - pass - return result - - -class MovedModule(_LazyDescr): - - def __init__(self, name, old, new=None): - super(MovedModule, self).__init__(name) - if PY3: - if new is None: - new = name - self.mod = new - else: - self.mod = old - - def _resolve(self): - return _import_module(self.mod) - - def __getattr__(self, attr): - _module = self._resolve() - value = getattr(_module, attr) - setattr(self, attr, value) - return value - - -class _LazyModule(types.ModuleType): - - def __init__(self, name): - super(_LazyModule, self).__init__(name) - self.__doc__ = self.__class__.__doc__ - - def __dir__(self): - attrs = ["__doc__", "__name__"] - attrs += [attr.name for attr in self._moved_attributes] - return attrs - - # Subclasses should override this - _moved_attributes = [] - - -class MovedAttribute(_LazyDescr): - - def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None): - super(MovedAttribute, self).__init__(name) - if PY3: - if new_mod is None: - new_mod = name - self.mod = new_mod - if new_attr is None: - if old_attr is None: - new_attr = name - else: - new_attr = old_attr - self.attr = new_attr - else: - self.mod = old_mod - if old_attr is None: - old_attr = name - self.attr = old_attr - - def _resolve(self): - module = _import_module(self.mod) - return getattr(module, self.attr) - - -class _SixMetaPathImporter(object): - - """ - A meta path importer to import six.moves and its submodules. - - This class implements a PEP302 finder and loader. It should be compatible - with Python 2.5 and all existing versions of Python3 - """ - - def __init__(self, six_module_name): - self.name = six_module_name - self.known_modules = {} - - def _add_module(self, mod, *fullnames): - for fullname in fullnames: - self.known_modules[self.name + "." + fullname] = mod - - def _get_module(self, fullname): - return self.known_modules[self.name + "." + fullname] - - def find_module(self, fullname, path=None): - if fullname in self.known_modules: - return self - return None - - def __get_module(self, fullname): - try: - return self.known_modules[fullname] - except KeyError: - raise ImportError("This loader does not know module " + fullname) - - def load_module(self, fullname): - try: - # in case of a reload - return sys.modules[fullname] - except KeyError: - pass - mod = self.__get_module(fullname) - if isinstance(mod, MovedModule): - mod = mod._resolve() - else: - mod.__loader__ = self - sys.modules[fullname] = mod - return mod - - def is_package(self, fullname): - """ - Return true, if the named module is a package. - - We need this method to get correct spec objects with - Python 3.4 (see PEP451) - """ - return hasattr(self.__get_module(fullname), "__path__") - - def get_code(self, fullname): - """Return None - - Required, if is_package is implemented""" - self.__get_module(fullname) # eventually raises ImportError - return None - get_source = get_code # same as get_code - -_importer = _SixMetaPathImporter(__name__) - - -class _MovedItems(_LazyModule): - - """Lazy loading of moved objects""" - __path__ = [] # mark as package - - -_moved_attributes = [ - MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"), - MovedAttribute("file", "__builtin__", "io", "IOBase"), - MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"), - MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"), - MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), - MovedAttribute("intern", "__builtin__", "sys"), - MovedAttribute("map", "itertools", "builtins", "imap", "map"), - MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"), - MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"), - MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"), - MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"), - MovedAttribute("reduce", "__builtin__", "functools"), - MovedAttribute("shlex_quote", "pipes", "shlex", "quote"), - MovedAttribute("StringIO", "StringIO", "io"), - MovedAttribute("UserDict", "UserDict", "collections"), - MovedAttribute("UserList", "UserList", "collections"), - MovedAttribute("UserString", "UserString", "collections"), - MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"), - MovedAttribute("zip", "itertools", "builtins", "izip", "zip"), - MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"), - MovedModule("builtins", "__builtin__"), - MovedModule("configparser", "ConfigParser"), - MovedModule("copyreg", "copy_reg"), - MovedModule("dbm_gnu", "gdbm", "dbm.gnu"), - MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread"), - MovedModule("http_cookiejar", "cookielib", "http.cookiejar"), - MovedModule("http_cookies", "Cookie", "http.cookies"), - MovedModule("html_entities", "htmlentitydefs", "html.entities"), - MovedModule("html_parser", "HTMLParser", "html.parser"), - MovedModule("http_client", "httplib", "http.client"), - MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"), - MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"), - MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"), - MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"), - MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"), - MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"), - MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"), - MovedModule("cPickle", "cPickle", "pickle"), - MovedModule("queue", "Queue"), - MovedModule("reprlib", "repr"), - MovedModule("socketserver", "SocketServer"), - MovedModule("_thread", "thread", "_thread"), - MovedModule("tkinter", "Tkinter"), - MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"), - MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"), - MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"), - MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"), - MovedModule("tkinter_tix", "Tix", "tkinter.tix"), - MovedModule("tkinter_ttk", "ttk", "tkinter.ttk"), - MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"), - MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"), - MovedModule("tkinter_colorchooser", "tkColorChooser", - "tkinter.colorchooser"), - MovedModule("tkinter_commondialog", "tkCommonDialog", - "tkinter.commondialog"), - MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"), - MovedModule("tkinter_font", "tkFont", "tkinter.font"), - MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"), - MovedModule("tkinter_tksimpledialog", "tkSimpleDialog", - "tkinter.simpledialog"), - MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"), - MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"), - MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"), - MovedModule("urllib_robotparser", "robotparser", "urllib.robotparser"), - MovedModule("xmlrpc_client", "xmlrpclib", "xmlrpc.client"), - MovedModule("xmlrpc_server", "SimpleXMLRPCServer", "xmlrpc.server"), -] -# Add windows specific modules. -if sys.platform == "win32": - _moved_attributes += [ - MovedModule("winreg", "_winreg"), - ] - -for attr in _moved_attributes: - setattr(_MovedItems, attr.name, attr) - if isinstance(attr, MovedModule): - _importer._add_module(attr, "moves." + attr.name) -del attr - -_MovedItems._moved_attributes = _moved_attributes - -moves = _MovedItems(__name__ + ".moves") -_importer._add_module(moves, "moves") - - -class Module_six_moves_urllib_parse(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_parse""" - - -_urllib_parse_moved_attributes = [ - MovedAttribute("ParseResult", "urlparse", "urllib.parse"), - MovedAttribute("SplitResult", "urlparse", "urllib.parse"), - MovedAttribute("parse_qs", "urlparse", "urllib.parse"), - MovedAttribute("parse_qsl", "urlparse", "urllib.parse"), - MovedAttribute("urldefrag", "urlparse", "urllib.parse"), - MovedAttribute("urljoin", "urlparse", "urllib.parse"), - MovedAttribute("urlparse", "urlparse", "urllib.parse"), - MovedAttribute("urlsplit", "urlparse", "urllib.parse"), - MovedAttribute("urlunparse", "urlparse", "urllib.parse"), - MovedAttribute("urlunsplit", "urlparse", "urllib.parse"), - MovedAttribute("quote", "urllib", "urllib.parse"), - MovedAttribute("quote_plus", "urllib", "urllib.parse"), - MovedAttribute("unquote", "urllib", "urllib.parse"), - MovedAttribute("unquote_plus", "urllib", "urllib.parse"), - MovedAttribute("urlencode", "urllib", "urllib.parse"), - MovedAttribute("splitquery", "urllib", "urllib.parse"), - MovedAttribute("splittag", "urllib", "urllib.parse"), - MovedAttribute("splituser", "urllib", "urllib.parse"), - MovedAttribute("uses_fragment", "urlparse", "urllib.parse"), - MovedAttribute("uses_netloc", "urlparse", "urllib.parse"), - MovedAttribute("uses_params", "urlparse", "urllib.parse"), - MovedAttribute("uses_query", "urlparse", "urllib.parse"), - MovedAttribute("uses_relative", "urlparse", "urllib.parse"), -] -for attr in _urllib_parse_moved_attributes: - setattr(Module_six_moves_urllib_parse, attr.name, attr) -del attr - -Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes - -_importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"), - "moves.urllib_parse", "moves.urllib.parse") - - -class Module_six_moves_urllib_error(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_error""" - - -_urllib_error_moved_attributes = [ - MovedAttribute("URLError", "urllib2", "urllib.error"), - MovedAttribute("HTTPError", "urllib2", "urllib.error"), - MovedAttribute("ContentTooShortError", "urllib", "urllib.error"), -] -for attr in _urllib_error_moved_attributes: - setattr(Module_six_moves_urllib_error, attr.name, attr) -del attr - -Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes - -_importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"), - "moves.urllib_error", "moves.urllib.error") - - -class Module_six_moves_urllib_request(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_request""" - - -_urllib_request_moved_attributes = [ - MovedAttribute("urlopen", "urllib2", "urllib.request"), - MovedAttribute("install_opener", "urllib2", "urllib.request"), - MovedAttribute("build_opener", "urllib2", "urllib.request"), - MovedAttribute("pathname2url", "urllib", "urllib.request"), - MovedAttribute("url2pathname", "urllib", "urllib.request"), - MovedAttribute("getproxies", "urllib", "urllib.request"), - MovedAttribute("Request", "urllib2", "urllib.request"), - MovedAttribute("OpenerDirector", "urllib2", "urllib.request"), - MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"), - MovedAttribute("ProxyHandler", "urllib2", "urllib.request"), - MovedAttribute("BaseHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"), - MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"), - MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"), - MovedAttribute("FileHandler", "urllib2", "urllib.request"), - MovedAttribute("FTPHandler", "urllib2", "urllib.request"), - MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"), - MovedAttribute("UnknownHandler", "urllib2", "urllib.request"), - MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"), - MovedAttribute("urlretrieve", "urllib", "urllib.request"), - MovedAttribute("urlcleanup", "urllib", "urllib.request"), - MovedAttribute("URLopener", "urllib", "urllib.request"), - MovedAttribute("FancyURLopener", "urllib", "urllib.request"), - MovedAttribute("proxy_bypass", "urllib", "urllib.request"), -] -for attr in _urllib_request_moved_attributes: - setattr(Module_six_moves_urllib_request, attr.name, attr) -del attr - -Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes - -_importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"), - "moves.urllib_request", "moves.urllib.request") - - -class Module_six_moves_urllib_response(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_response""" - - -_urllib_response_moved_attributes = [ - MovedAttribute("addbase", "urllib", "urllib.response"), - MovedAttribute("addclosehook", "urllib", "urllib.response"), - MovedAttribute("addinfo", "urllib", "urllib.response"), - MovedAttribute("addinfourl", "urllib", "urllib.response"), -] -for attr in _urllib_response_moved_attributes: - setattr(Module_six_moves_urllib_response, attr.name, attr) -del attr - -Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes - -_importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"), - "moves.urllib_response", "moves.urllib.response") - - -class Module_six_moves_urllib_robotparser(_LazyModule): - - """Lazy loading of moved objects in six.moves.urllib_robotparser""" - - -_urllib_robotparser_moved_attributes = [ - MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"), -] -for attr in _urllib_robotparser_moved_attributes: - setattr(Module_six_moves_urllib_robotparser, attr.name, attr) -del attr - -Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes - -_importer._add_module(Module_six_moves_urllib_robotparser(__name__ + ".moves.urllib.robotparser"), - "moves.urllib_robotparser", "moves.urllib.robotparser") - - -class Module_six_moves_urllib(types.ModuleType): - - """Create a six.moves.urllib namespace that resembles the Python 3 namespace""" - __path__ = [] # mark as package - parse = _importer._get_module("moves.urllib_parse") - error = _importer._get_module("moves.urllib_error") - request = _importer._get_module("moves.urllib_request") - response = _importer._get_module("moves.urllib_response") - robotparser = _importer._get_module("moves.urllib_robotparser") - - def __dir__(self): - return ['parse', 'error', 'request', 'response', 'robotparser'] - -_importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"), - "moves.urllib") - - -def add_move(move): - """Add an item to six.moves.""" - setattr(_MovedItems, move.name, move) - - -def remove_move(name): - """Remove item from six.moves.""" - try: - delattr(_MovedItems, name) - except AttributeError: - try: - del moves.__dict__[name] - except KeyError: - raise AttributeError("no such move, %r" % (name,)) - - -if PY3: - _meth_func = "__func__" - _meth_self = "__self__" - - _func_closure = "__closure__" - _func_code = "__code__" - _func_defaults = "__defaults__" - _func_globals = "__globals__" -else: - _meth_func = "im_func" - _meth_self = "im_self" - - _func_closure = "func_closure" - _func_code = "func_code" - _func_defaults = "func_defaults" - _func_globals = "func_globals" - - -try: - advance_iterator = next -except NameError: - def advance_iterator(it): - return it.next() -next = advance_iterator - - -try: - callable = callable -except NameError: - def callable(obj): - return any("__call__" in klass.__dict__ for klass in type(obj).__mro__) - - -if PY3: - def get_unbound_function(unbound): - return unbound - - create_bound_method = types.MethodType - - def create_unbound_method(func, cls): - return func - - Iterator = object -else: - def get_unbound_function(unbound): - return unbound.im_func - - def create_bound_method(func, obj): - return types.MethodType(func, obj, obj.__class__) - - def create_unbound_method(func, cls): - return types.MethodType(func, None, cls) - - class Iterator(object): - - def next(self): - return type(self).__next__(self) - - callable = callable -_add_doc(get_unbound_function, - """Get the function out of a possibly unbound function""") - - -get_method_function = operator.attrgetter(_meth_func) -get_method_self = operator.attrgetter(_meth_self) -get_function_closure = operator.attrgetter(_func_closure) -get_function_code = operator.attrgetter(_func_code) -get_function_defaults = operator.attrgetter(_func_defaults) -get_function_globals = operator.attrgetter(_func_globals) - - -if PY3: - def iterkeys(d, **kw): - return iter(d.keys(**kw)) - - def itervalues(d, **kw): - return iter(d.values(**kw)) - - def iteritems(d, **kw): - return iter(d.items(**kw)) - - def iterlists(d, **kw): - return iter(d.lists(**kw)) - - viewkeys = operator.methodcaller("keys") - - viewvalues = operator.methodcaller("values") - - viewitems = operator.methodcaller("items") -else: - def iterkeys(d, **kw): - return d.iterkeys(**kw) - - def itervalues(d, **kw): - return d.itervalues(**kw) - - def iteritems(d, **kw): - return d.iteritems(**kw) - - def iterlists(d, **kw): - return d.iterlists(**kw) - - viewkeys = operator.methodcaller("viewkeys") - - viewvalues = operator.methodcaller("viewvalues") - - viewitems = operator.methodcaller("viewitems") - -_add_doc(iterkeys, "Return an iterator over the keys of a dictionary.") -_add_doc(itervalues, "Return an iterator over the values of a dictionary.") -_add_doc(iteritems, - "Return an iterator over the (key, value) pairs of a dictionary.") -_add_doc(iterlists, - "Return an iterator over the (key, [values]) pairs of a dictionary.") - - -if PY3: - def b(s): - return s.encode("latin-1") - - def u(s): - return s - unichr = chr - import struct - int2byte = struct.Struct(">B").pack - del struct - byte2int = operator.itemgetter(0) - indexbytes = operator.getitem - iterbytes = iter - import io - StringIO = io.StringIO - BytesIO = io.BytesIO - file = io.IOBase - _assertCountEqual = "assertCountEqual" - if sys.version_info[1] <= 1: - _assertRaisesRegex = "assertRaisesRegexp" - _assertRegex = "assertRegexpMatches" - else: - _assertRaisesRegex = "assertRaisesRegex" - _assertRegex = "assertRegex" -else: - def b(s): - return s - # Workaround for standalone backslash - - def u(s): - return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape") - unichr = unichr - int2byte = chr - - def byte2int(bs): - return ord(bs[0]) - - def indexbytes(buf, i): - return ord(buf[i]) - iterbytes = functools.partial(itertools.imap, ord) - import StringIO - StringIO = BytesIO = StringIO.StringIO - _assertCountEqual = "assertItemsEqual" - _assertRaisesRegex = "assertRaisesRegexp" - _assertRegex = "assertRegexpMatches" -_add_doc(b, """Byte literal""") -_add_doc(u, """Text literal""") - - -def assertCountEqual(self, *args, **kwargs): - return getattr(self, _assertCountEqual)(*args, **kwargs) - - -def assertRaisesRegex(self, *args, **kwargs): - return getattr(self, _assertRaisesRegex)(*args, **kwargs) - - -def assertRegex(self, *args, **kwargs): - return getattr(self, _assertRegex)(*args, **kwargs) - - -if PY3: - exec_ = getattr(moves.builtins, "exec") - - def reraise(tp, value, tb=None): - if value is None: - value = tp() - if value.__traceback__ is not tb: - raise value.with_traceback(tb) - raise value - -else: - def exec_(_code_, _globs_=None, _locs_=None): - """Execute code in a namespace.""" - if _globs_ is None: - frame = sys._getframe(1) - _globs_ = frame.f_globals - if _locs_ is None: - _locs_ = frame.f_locals - del frame - elif _locs_ is None: - _locs_ = _globs_ - exec("""exec _code_ in _globs_, _locs_""") - - exec_("""def reraise(tp, value, tb=None): - raise tp, value, tb -""") - - -if sys.version_info[:2] == (3, 2): - exec_("""def raise_from(value, from_value): - if from_value is None: - raise value - raise value from from_value -""") -elif sys.version_info[:2] > (3, 2): - exec_("""def raise_from(value, from_value): - raise value from from_value -""") -else: - def raise_from(value, from_value): - raise value - - -print_ = getattr(moves.builtins, "print", None) -if print_ is None: - def print_(*args, **kwargs): - """The new-style print function for Python 2.4 and 2.5.""" - fp = kwargs.pop("file", sys.stdout) - if fp is None: - return - - def write(data): - if not isinstance(data, basestring): - data = str(data) - # If the file has an encoding, encode unicode with it. - if (isinstance(fp, file) and - isinstance(data, unicode) and - fp.encoding is not None): - errors = getattr(fp, "errors", None) - if errors is None: - errors = "strict" - data = data.encode(fp.encoding, errors) - fp.write(data) - want_unicode = False - sep = kwargs.pop("sep", None) - if sep is not None: - if isinstance(sep, unicode): - want_unicode = True - elif not isinstance(sep, str): - raise TypeError("sep must be None or a string") - end = kwargs.pop("end", None) - if end is not None: - if isinstance(end, unicode): - want_unicode = True - elif not isinstance(end, str): - raise TypeError("end must be None or a string") - if kwargs: - raise TypeError("invalid keyword arguments to print()") - if not want_unicode: - for arg in args: - if isinstance(arg, unicode): - want_unicode = True - break - if want_unicode: - newline = unicode("\n") - space = unicode(" ") - else: - newline = "\n" - space = " " - if sep is None: - sep = space - if end is None: - end = newline - for i, arg in enumerate(args): - if i: - write(sep) - write(arg) - write(end) -if sys.version_info[:2] < (3, 3): - _print = print_ - - def print_(*args, **kwargs): - fp = kwargs.get("file", sys.stdout) - flush = kwargs.pop("flush", False) - _print(*args, **kwargs) - if flush and fp is not None: - fp.flush() - -_add_doc(reraise, """Reraise an exception.""") - -if sys.version_info[0:2] < (3, 4): - def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS, - updated=functools.WRAPPER_UPDATES): - def wrapper(f): - f = functools.wraps(wrapped, assigned, updated)(f) - f.__wrapped__ = wrapped - return f - return wrapper -else: - wraps = functools.wraps - - -def with_metaclass(meta, *bases): - """Create a base class with a metaclass.""" - # This requires a bit of explanation: the basic idea is to make a dummy - # metaclass for one level of class instantiation that replaces itself with - # the actual metaclass. - class metaclass(meta): - - def __new__(cls, name, this_bases, d): - return meta(name, bases, d) - return type.__new__(metaclass, 'temporary_class', (), {}) - - -def add_metaclass(metaclass): - """Class decorator for creating a class with a metaclass.""" - def wrapper(cls): - orig_vars = cls.__dict__.copy() - slots = orig_vars.get('__slots__') - if slots is not None: - if isinstance(slots, str): - slots = [slots] - for slots_var in slots: - orig_vars.pop(slots_var) - orig_vars.pop('__dict__', None) - orig_vars.pop('__weakref__', None) - return metaclass(cls.__name__, cls.__bases__, orig_vars) - return wrapper - - -def python_2_unicode_compatible(klass): - """ - A decorator that defines __unicode__ and __str__ methods under Python 2. - Under Python 3 it does nothing. - - To support Python 2 and 3 with a single code base, define a __str__ method - returning text and apply this decorator to the class. - """ - if PY2: - if '__str__' not in klass.__dict__: - raise ValueError("@python_2_unicode_compatible cannot be applied " - "to %s because it doesn't define __str__()." % - klass.__name__) - klass.__unicode__ = klass.__str__ - import pyxb - klass.__str__ = lambda self: self.__unicode__().encode(pyxb._OutputEncoding) - return klass - - -# Complete the moves implementation. -# This code is at the end of this module to speed up module loading. -# Turn this module into a package. -__path__ = [] # required for PEP 302 and PEP 451 -__package__ = __name__ # see PEP 366 @ReservedAssignment -if globals().get("__spec__") is not None: - __spec__.submodule_search_locations = [] # PEP 451 @UndefinedVariable -# Remove other six meta path importers, since they cause problems. This can -# happen if six is removed from sys.modules and then reloaded. (Setuptools does -# this for some reason.) -if sys.meta_path: - for i, importer in enumerate(sys.meta_path): - # Here's some real nastiness: Another "instance" of the six module might - # be floating around. Therefore, we can't use isinstance() to check for - # the six meta path importer, since the other six instance will have - # inserted an importer with different class. - if (type(importer).__name__ == "_SixMetaPathImporter" and - importer.name == __name__): - del sys.meta_path[i] - break - del i, importer -# Finally, add the importer to the meta path import hook. -sys.meta_path.append(_importer) diff --git a/pyxb/utils/unicode.py b/pyxb/utils/unicode.py index e330c982..8a1738e9 100644 --- a/pyxb/utils/unicode.py +++ b/pyxb/utils/unicode.py @@ -35,8 +35,8 @@ import re import logging import pyxb.utils.utility -from pyxb.utils import six -from pyxb.utils.six.moves import xrange +from pyxb.utils import sal as six +from pyxb.utils.sal import xrange _log = logging.getLogger(__name__) diff --git a/pyxb/utils/utility.py b/pyxb/utils/utility.py index 549f8970..8a4552de 100644 --- a/pyxb/utils/utility.py +++ b/pyxb/utils/utility.py @@ -19,11 +19,11 @@ import os import errno import pyxb -from pyxb.utils.six.moves.urllib import parse as urlparse +from pyxb.utils.sal import urlparse import time import datetime import logging -from pyxb.utils import six +from pyxb.utils import sal as six _log = logging.getLogger(__name__) @@ -735,7 +735,7 @@ def DataFromURI (uri, archive_directory=None): If the uri does not include a scheme (e.g., C{http:}), it is assumed to be a file path on the local system.""" - from pyxb.utils.six.moves.urllib.request import urlopen + from pyxb.utils.sal import urlopen stream = None exc = None # Only something that has a colon is a non-file URI. Some things @@ -768,7 +768,7 @@ def DataFromURI (uri, archive_directory=None): try: # Protect this in case whatever stream is doesn't have an fp # attribute. - if isinstance(stream, six.moves.file) or isinstance(stream.fp, six.moves.file): + if isinstance(stream, six.file) or isinstance(stream.fp, six.file): archive_directory = None except: pass @@ -974,7 +974,7 @@ class UTCOffsetTimeZone (datetime.tzinfo): """ # Regular expression that matches valid ISO8601 time zone suffixes - __Lexical_re = re.compile('^([-+])(\d\d):(\d\d)$') + __Lexical_re = re.compile(r'^([-+])(\d\d):(\d\d)$') # The offset in minutes east of UTC. __utcOffset_min = 0 @@ -1154,7 +1154,7 @@ def GetMatchingFiles (path, pattern=None, default_path_wildcard=None, default_pa within the archive path specified by the user. One could use:: files = GetMatchingFiles('&bundles//:+', - pattern=re.compile('.*\.wxs$'), + pattern=re.compile('.*wxs$'), default_path_wildcard='+', default_path='/usr/local/pyxb/nsarchives', prefix_pattern='&', @@ -1227,7 +1227,7 @@ class Location (object): def __init__ (self, location_base=None, line_number=None, column_number=None): if isinstance(location_base, str): - location_base = six.moves.intern(location_base) + location_base = six.intern(location_base) self.__locationBase = location_base self.__lineNumber = line_number self.__columnNumber = column_number diff --git a/pyxb/utils/xmlre.py b/pyxb/utils/xmlre.py index 6e9e50e0..396acef4 100644 --- a/pyxb/utils/xmlre.py +++ b/pyxb/utils/xmlre.py @@ -37,7 +37,7 @@ import re import logging import pyxb.utils.unicode -from pyxb.utils import six +from pyxb.utils import sal as six _log = logging.getLogger(__name__) diff --git a/pyxb/xmlschema/structures.py b/pyxb/xmlschema/structures.py index 4aa26171..beef8179 100644 --- a/pyxb/xmlschema/structures.py +++ b/pyxb/xmlschema/structures.py @@ -36,7 +36,7 @@ import logging from xml.dom import Node import copy -from pyxb.utils.six.moves.urllib import parse as urlparse +from pyxb.utils.sal import urlparse import os.path import pyxb @@ -45,7 +45,8 @@ import pyxb.namespace.resolution from pyxb.binding import basis, datatypes, facets -from pyxb.utils import domutils, six +from pyxb.utils import domutils +from pyxb.utils import sal as six import pyxb.utils.utility _log = logging.getLogger(__name__) diff --git a/setup.py b/setup.py index 89576b2d..94f53142 100755 --- a/setup.py +++ b/setup.py @@ -83,7 +83,7 @@ def finalize_options (self): pass # Regular expression that matches unittest sources - __TestFile_re = re.compile('^test.*\.py$') + __TestFile_re = re.compile(r'^test.*\.py$') def run (self): # Make sure log messages are supported @@ -183,8 +183,8 @@ def run (self): ] package_data = {} - init_re = re.compile('^__init__\.py$') - wxs_re = re.compile('^.*\.wxs$') + init_re = re.compile(r'^__init__\.py$') + wxs_re = re.compile(r'^.*\.wxs$') setup_path = os.path.dirname(__file__) bundle_base = os.path.join(setup_path, 'pyxb', 'bundles') diff --git a/tests/bindings/test-constraints.py b/tests/bindings/test-constraints.py index 3c0312df..afc62122 100644 --- a/tests/bindings/test-constraints.py +++ b/tests/bindings/test-constraints.py @@ -10,7 +10,7 @@ import pyxb.binding import pyxb.binding.facets as facets import pyxb.binding.datatypes as datatypes -from pyxb.utils import six +from pyxb.utils import sal as six import sys # 4.3.1 length diff --git a/tests/bugs/test-200907231705.py b/tests/bugs/test-200907231705.py index 425d8f56..91f1cf4f 100644 --- a/tests/bugs/test-200907231705.py +++ b/tests/bugs/test-200907231705.py @@ -7,7 +7,7 @@ import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import os.path xsd=''' diff --git a/tests/bugs/test-200908111918.py b/tests/bugs/test-200908111918.py index d11723ef..bb0df1da 100644 --- a/tests/bugs/test-200908111918.py +++ b/tests/bugs/test-200908111918.py @@ -8,7 +8,7 @@ import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import os.path xsd=''' diff --git a/tests/complex/nsaugment/tst-app.py b/tests/complex/nsaugment/tst-app.py index 813f90d7..fffd7513 100644 --- a/tests/complex/nsaugment/tst-app.py +++ b/tests/complex/nsaugment/tst-app.py @@ -8,7 +8,7 @@ import common import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six pyxb.utils.domutils.BindingDOMSupport.DeclareNamespace(app.Namespace, 'app') pyxb.utils.domutils.BindingDOMSupport.DeclareNamespace(common.Namespace, 'common') diff --git a/tests/complex/nsdep/tst-a.py b/tests/complex/nsdep/tst-a.py index 2acd5fa3..0411a3b3 100644 --- a/tests/complex/nsdep/tst-a.py +++ b/tests/complex/nsdep/tst-a.py @@ -4,7 +4,7 @@ logging.basicConfig() _log = logging.getLogger(__name__) from pyxb.utils.domutils import BindingDOMSupport -from pyxb.utils import six +from pyxb.utils import sal as six import unittest import bindings._A as A diff --git a/tests/complex/nsdep/tst-b.py b/tests/complex/nsdep/tst-b.py index 8836b782..40232806 100644 --- a/tests/complex/nsdep/tst-b.py +++ b/tests/complex/nsdep/tst-b.py @@ -4,7 +4,7 @@ logging.basicConfig() _log = logging.getLogger(__name__) from pyxb.utils.domutils import BindingDOMSupport -from pyxb.utils import six +from pyxb.utils import sal as six import unittest import bindings._A as A diff --git a/tests/complex/nsext/tst-app.py b/tests/complex/nsext/tst-app.py index 0900f040..94c47b9e 100644 --- a/tests/complex/nsext/tst-app.py +++ b/tests/complex/nsext/tst-app.py @@ -8,7 +8,7 @@ import common4app import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six pyxb.utils.domutils.BindingDOMSupport.DeclareNamespace(app.Namespace, 'app') pyxb.utils.domutils.BindingDOMSupport.DeclareNamespace(common4app.Namespace, 'common') diff --git a/tests/datatypes/test-base64Binary.py b/tests/datatypes/test-base64Binary.py index 9eaf1c81..2415b516 100644 --- a/tests/datatypes/test-base64Binary.py +++ b/tests/datatypes/test-base64Binary.py @@ -7,7 +7,7 @@ import binascii import pyxb import pyxb.binding.datatypes as xsd -from pyxb.utils import six +from pyxb.utils import sal as six class Test_base64Binary (unittest.TestCase): RFC4648_S9 = ( (six.u('14fb9c03d97e'), six.u('FPucA9l+')), diff --git a/tests/datatypes/test-hexBinary.py b/tests/datatypes/test-hexBinary.py index 97c65dbb..7f683eec 100644 --- a/tests/datatypes/test-hexBinary.py +++ b/tests/datatypes/test-hexBinary.py @@ -6,7 +6,7 @@ from pyxb.exceptions_ import * import unittest import pyxb.binding.datatypes as xsd -from pyxb.utils import six +from pyxb.utils import sal as six import binascii class Test_hexBinary (unittest.TestCase): diff --git a/tests/drivers/test-ctd-attr.py b/tests/drivers/test-ctd-attr.py index 02f40279..ae3e8f2f 100644 --- a/tests/drivers/test-ctd-attr.py +++ b/tests/drivers/test-ctd-attr.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/drivers/test-empty-cstd.py b/tests/drivers/test-empty-cstd.py index 0a067077..a66e239c 100644 --- a/tests/drivers/test-empty-cstd.py +++ b/tests/drivers/test-empty-cstd.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/drivers/test-external.py b/tests/drivers/test-external.py index f54be62a..f5529696 100644 --- a/tests/drivers/test-external.py +++ b/tests/drivers/test-external.py @@ -5,11 +5,11 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import pyxb.namespace import sys -import imp +from pyxb.utils.sal import imp_new_module import os.path @@ -20,7 +20,7 @@ # Create a module into which we'll stick the shared types bindings. # Put it into the sys modules so the import directive in subsequent # code is resolved. -st = imp.new_module('st') +st = imp_new_module('st') sys.modules['st'] = st # Now get the code for the shared types bindings, and evaluate it diff --git a/tests/drivers/test-mg-choice.py b/tests/drivers/test-mg-choice.py index 2ecfeecd..3d7b8444 100644 --- a/tests/drivers/test-mg-choice.py +++ b/tests/drivers/test-mg-choice.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/drivers/test-mg-sequence.py b/tests/drivers/test-mg-sequence.py index b1081ef2..15f8cee7 100644 --- a/tests/drivers/test-mg-sequence.py +++ b/tests/drivers/test-mg-sequence.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/drivers/test-particle.py b/tests/drivers/test-particle.py index 5ce2103a..ae0ef641 100644 --- a/tests/drivers/test-particle.py +++ b/tests/drivers/test-particle.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/drivers/test-po1.py b/tests/drivers/test-po1.py index 16ddfd6c..ee03d195 100644 --- a/tests/drivers/test-po1.py +++ b/tests/drivers/test-po1.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/drivers/test-properties.py b/tests/drivers/test-properties.py index d5f47c80..e3f12af2 100644 --- a/tests/drivers/test-properties.py +++ b/tests/drivers/test-properties.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import pyxb.binding.basis diff --git a/tests/drivers/test-properties2.py b/tests/drivers/test-properties2.py index 7d8be7ad..e0d675eb 100644 --- a/tests/drivers/test-properties2.py +++ b/tests/drivers/test-properties2.py @@ -6,7 +6,7 @@ import pyxb import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import pyxb.binding.basis diff --git a/tests/drivers/test-substgroup.py b/tests/drivers/test-substgroup.py index 5461968b..8f027c94 100644 --- a/tests/drivers/test-substgroup.py +++ b/tests/drivers/test-substgroup.py @@ -6,7 +6,7 @@ import pyxb import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import pyxb.binding.saxer import io diff --git a/tests/drivers/test-xsi-nil.py b/tests/drivers/test-xsi-nil.py index f77e58b9..a1b7b0c4 100644 --- a/tests/drivers/test-xsi-nil.py +++ b/tests/drivers/test-xsi-nil.py @@ -6,7 +6,7 @@ import pyxb import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import pyxb.binding.saxer import io diff --git a/tests/drivers/test-xsi-type.py b/tests/drivers/test-xsi-type.py index d438f136..dd7a0d7b 100644 --- a/tests/drivers/test-xsi-type.py +++ b/tests/drivers/test-xsi-type.py @@ -6,7 +6,7 @@ import pyxb import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node diff --git a/tests/pyxb/test-cdata.py b/tests/pyxb/test-cdata.py index 994f2f7e..55c6d584 100644 --- a/tests/pyxb/test-cdata.py +++ b/tests/pyxb/test-cdata.py @@ -7,7 +7,7 @@ import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import os.path xsd=''' diff --git a/tests/pyxb/test-reserved.py b/tests/pyxb/test-reserved.py index cc121871..99e5f7a3 100644 --- a/tests/pyxb/test-reserved.py +++ b/tests/pyxb/test-reserved.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import unittest import pyxb.binding.basis -from pyxb.utils import six +from pyxb.utils import sal as six class TestReserved (unittest.TestCase): def testSTD (self): diff --git a/tests/trac/test-issue-0013.py b/tests/trac/test-issue-0013.py index a294c506..37d9c5de 100644 --- a/tests/trac/test-issue-0013.py +++ b/tests/trac/test-issue-0013.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import pyxb.namespace diff --git a/tests/trac/test-issue-0014.py b/tests/trac/test-issue-0014.py index ca5723db..e72387e6 100644 --- a/tests/trac/test-issue-0014.py +++ b/tests/trac/test-issue-0014.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import pyxb.namespace import xml.dom.minidom as minidom diff --git a/tests/trac/test-issue-0015.py b/tests/trac/test-issue-0015.py index 272332fc..322ad5f3 100644 --- a/tests/trac/test-issue-0015.py +++ b/tests/trac/test-issue-0015.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import pyxb.namespace diff --git a/tests/trac/test-issue-0019.py b/tests/trac/test-issue-0019.py index a53d0859..ebed1872 100644 --- a/tests/trac/test-issue-0019.py +++ b/tests/trac/test-issue-0019.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import pyxb.namespace import xml.dom.minidom as minidom diff --git a/tests/trac/test-issue-0022.py b/tests/trac/test-issue-0022.py index 35732f83..584e327f 100644 --- a/tests/trac/test-issue-0022.py +++ b/tests/trac/test-issue-0022.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import pyxb.namespace import xml.dom.minidom as minidom diff --git a/tests/trac/test-trac-0021.py b/tests/trac/test-trac-0021.py index 0c787a26..b327cf4d 100644 --- a/tests/trac/test-trac-0021.py +++ b/tests/trac/test-trac-0021.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0039.py b/tests/trac/test-trac-0039.py index 81e64022..406062a0 100644 --- a/tests/trac/test-trac-0039.py +++ b/tests/trac/test-trac-0039.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import pyxb.binding.datatypes as xs diff --git a/tests/trac/test-trac-0058.py b/tests/trac/test-trac-0058.py index 16644b7e..8df454cb 100644 --- a/tests/trac/test-trac-0058.py +++ b/tests/trac/test-trac-0058.py @@ -7,7 +7,7 @@ import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import os.path xsd=''' diff --git a/tests/trac/test-trac-0060.py b/tests/trac/test-trac-0060.py index 9005bd7e..fb237be6 100644 --- a/tests/trac/test-trac-0060.py +++ b/tests/trac/test-trac-0060.py @@ -7,7 +7,7 @@ import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from pyxb.namespace.builtin import XMLSchema_instance as XSI import os.path diff --git a/tests/trac/test-trac-0069.py b/tests/trac/test-trac-0069.py index 6834f2cc..67288000 100644 --- a/tests/trac/test-trac-0069.py +++ b/tests/trac/test-trac-0069.py @@ -7,7 +7,7 @@ import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import os.path xsd=''' diff --git a/tests/trac/test-trac-0071.py b/tests/trac/test-trac-0071.py index 2af357d9..b0f41f7f 100644 --- a/tests/trac/test-trac-0071.py +++ b/tests/trac/test-trac-0071.py @@ -7,7 +7,7 @@ import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import os.path xsd=''' diff --git a/tests/trac/test-trac-0074.py b/tests/trac/test-trac-0074.py index 89bbeda5..e2fd3f92 100644 --- a/tests/trac/test-trac-0074.py +++ b/tests/trac/test-trac-0074.py @@ -7,7 +7,7 @@ import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import xml.dom.minidom import io diff --git a/tests/trac/test-trac-0079.py b/tests/trac/test-trac-0079.py index d2ef3b92..d8870d92 100644 --- a/tests/trac/test-trac-0079.py +++ b/tests/trac/test-trac-0079.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0094.py b/tests/trac/test-trac-0094.py index 94d88c94..d92e1a1c 100644 --- a/tests/trac/test-trac-0094.py +++ b/tests/trac/test-trac-0094.py @@ -7,7 +7,7 @@ import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import os.path xsd=six.u(''' diff --git a/tests/trac/test-trac-0100.py b/tests/trac/test-trac-0100.py index ee6d834f..f04d5c62 100644 --- a/tests/trac/test-trac-0100.py +++ b/tests/trac/test-trac-0100.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0111.py b/tests/trac/test-trac-0111.py index 048b7c88..c1d53cd7 100644 --- a/tests/trac/test-trac-0111.py +++ b/tests/trac/test-trac-0111.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0112.py b/tests/trac/test-trac-0112.py index ecd19d35..82d1022f 100644 --- a/tests/trac/test-trac-0112.py +++ b/tests/trac/test-trac-0112.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0126.py b/tests/trac/test-trac-0126.py index 916a6620..870f379d 100644 --- a/tests/trac/test-trac-0126.py +++ b/tests/trac/test-trac-0126.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0139.py b/tests/trac/test-trac-0139.py index eb12ecab..77dd1d0d 100644 --- a/tests/trac/test-trac-0139.py +++ b/tests/trac/test-trac-0139.py @@ -11,7 +11,7 @@ import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.saxutils -from pyxb.utils import six +from pyxb.utils import sal as six import tempfile import xml.sax diff --git a/tests/trac/test-trac-0141.py b/tests/trac/test-trac-0141.py index 5f2d28b6..65bc05be 100644 --- a/tests/trac/test-trac-0141.py +++ b/tests/trac/test-trac-0141.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import pyxb.utils.utility from pyxb.utils.utility import MakeIdentifier diff --git a/tests/trac/test-trac-0153.py b/tests/trac/test-trac-0153.py index 4904708f..f6f749c4 100644 --- a/tests/trac/test-trac-0153.py +++ b/tests/trac/test-trac-0153.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0175.py b/tests/trac/test-trac-0175.py index 2f312613..fc3df588 100644 --- a/tests/trac/test-trac-0175.py +++ b/tests/trac/test-trac-0175.py @@ -8,7 +8,7 @@ import operator import functools from xml.dom import Node -from pyxb.utils.six.moves import xrange +from pyxb.utils.sal import xrange import os.path xsd=''' diff --git a/tests/trac/test-trac-0184.py b/tests/trac/test-trac-0184.py index 8c4de478..3c987dbd 100644 --- a/tests/trac/test-trac-0184.py +++ b/tests/trac/test-trac-0184.py @@ -7,7 +7,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import os.path xsd=''' diff --git a/tests/trac/test-trac-0203.py b/tests/trac/test-trac-0203.py index 8eb2022a..a55fc669 100644 --- a/tests/trac/test-trac-0203.py +++ b/tests/trac/test-trac-0203.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0207.py b/tests/trac/test-trac-0207.py index a7dbcb29..b6299f5d 100644 --- a/tests/trac/test-trac-0207.py +++ b/tests/trac/test-trac-0207.py @@ -6,7 +6,7 @@ import pyxb import pyxb.utils.utility import pyxb.binding.datatypes as xsd -from pyxb.utils.six.moves import cPickle as pickle +from pyxb.utils.sal import cPickle as pickle import unittest diff --git a/tests/trac/test-trac-0211.py b/tests/trac/test-trac-0211.py index 71ee247f..ef606a5f 100644 --- a/tests/trac/test-trac-0211.py +++ b/tests/trac/test-trac-0211.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0212.py b/tests/trac/test-trac-0212.py index a3b053de..40b56e99 100644 --- a/tests/trac/test-trac-0212.py +++ b/tests/trac/test-trac-0212.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0213.py b/tests/trac/test-trac-0213.py index 16a927e5..a3da5613 100644 --- a/tests/trac/test-trac-0213.py +++ b/tests/trac/test-trac-0213.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0216.py b/tests/trac/test-trac-0216.py index 47098b82..f14a2e7e 100644 --- a/tests/trac/test-trac-0216.py +++ b/tests/trac/test-trac-0216.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0219.py b/tests/trac/test-trac-0219.py index 7bdc26e5..be6cd90f 100644 --- a/tests/trac/test-trac-0219.py +++ b/tests/trac/test-trac-0219.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/test-trac-0221.py b/tests/trac/test-trac-0221.py index 927f5c26..ca2f6783 100644 --- a/tests/trac/test-trac-0221.py +++ b/tests/trac/test-trac-0221.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import pyxb.binding.datatypes as xs diff --git a/tests/trac/test-trac-0231.py b/tests/trac/test-trac-0231.py index f95ebe9e..1ae36200 100644 --- a/tests/trac/test-trac-0231.py +++ b/tests/trac/test-trac-0231.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import pyxb.binding.datatypes as xs diff --git a/tests/trac/test-trac-0232.py b/tests/trac/test-trac-0232.py index 50fe30b1..9be49131 100644 --- a/tests/trac/test-trac-0232.py +++ b/tests/trac/test-trac-0232.py @@ -5,7 +5,7 @@ _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six from xml.dom import Node import os.path diff --git a/tests/trac/trac-0026/check-validation.py b/tests/trac/trac-0026/check-validation.py index a4743af2..fad11d9d 100644 --- a/tests/trac/trac-0026/check-validation.py +++ b/tests/trac/trac-0026/check-validation.py @@ -37,7 +37,7 @@ import pyxb import pyxb.binding.datatypes as xs -from pyxb.utils import six +from pyxb.utils import sal as six import trac26 import unittest import sys diff --git a/tests/trac/trac-0033/tread.py b/tests/trac/trac-0033/tread.py index 781ce697..bb7769a0 100644 --- a/tests/trac/trac-0033/tread.py +++ b/tests/trac/trac-0033/tread.py @@ -7,7 +7,7 @@ import time import pyxb.binding.generate import pyxb.utils.domutils -from pyxb.utils.six.moves import xrange +from pyxb.utils.sal import xrange max_reps = 20 diff --git a/tests/trac/trac-0114/check.py b/tests/trac/trac-0114/check.py index d9347d0a..d641b243 100644 --- a/tests/trac/trac-0114/check.py +++ b/tests/trac/trac-0114/check.py @@ -4,7 +4,7 @@ if __name__ == '__main__': logging.basicConfig() _log = logging.getLogger(__name__) -from pyxb.utils import six +from pyxb.utils import sal as six import noi import unittest import pyxb diff --git a/tests/trac/trac-0184/check.py b/tests/trac/trac-0184/check.py index bd00626e..75e32d3f 100644 --- a/tests/trac/trac-0184/check.py +++ b/tests/trac/trac-0184/check.py @@ -4,7 +4,7 @@ logging.basicConfig() _log = logging.getLogger(__name__) import pyxb.utils.domutils -from pyxb.utils import six +from pyxb.utils import sal as six import bindings.s0 as s0 import bindings.s1 as s1 diff --git a/tests/trac/trac-0196/check.py b/tests/trac/trac-0196/check.py index 126e933e..040eaf42 100644 --- a/tests/trac/trac-0196/check.py +++ b/tests/trac/trac-0196/check.py @@ -12,7 +12,7 @@ import uu0196 as uu import mix from pyxb.utils.domutils import BindingDOMSupport -from pyxb.utils import six +from pyxb.utils import sal as six BindingDOMSupport.DeclareNamespace(qq.Namespace, 'qq') BindingDOMSupport.DeclareNamespace(qu.Namespace, 'qu') diff --git a/tests/trac/trac-0198/check.py b/tests/trac/trac-0198/check.py index 035ee806..7535d056 100644 --- a/tests/trac/trac-0198/check.py +++ b/tests/trac/trac-0198/check.py @@ -9,7 +9,7 @@ import wsu from pyxb.utils.domutils import BindingDOMSupport -from pyxb.utils import six +from pyxb.utils import sal as six BindingDOMSupport.DeclareNamespace(wsu.Namespace, 'wsu') BindingDOMSupport.DeclareNamespace(wsse.Namespace, 'wsse') diff --git a/tests/utils/test-fac.py b/tests/utils/test-fac.py index a908ca3c..53022f8b 100644 --- a/tests/utils/test-fac.py +++ b/tests/utils/test-fac.py @@ -1,8 +1,8 @@ import unittest import sys from pyxb.utils.fac import * -from pyxb.utils import six -from pyxb.utils.six.moves import xrange +from pyxb.utils import sal as six +from pyxb.utils.sal import xrange class TestFAC (unittest.TestCase): a = Symbol('a') diff --git a/tests/utils/test-utility.py b/tests/utils/test-utility.py index 607b4241..910ca85a 100644 --- a/tests/utils/test-utility.py +++ b/tests/utils/test-utility.py @@ -6,7 +6,7 @@ import unittest from pyxb.utils.utility import * from pyxb.utils.utility import _DeconflictSymbols_mixin -from pyxb.utils import six +from pyxb.utils import sal as six import sys class DST_base (_DeconflictSymbols_mixin):