diff options
author | Michael Lando <ml636r@att.com> | 2017-03-29 10:54:26 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-03-29 10:54:26 +0000 |
commit | 249698f5ece210994f8a3a7529653c67fc577ff4 (patch) | |
tree | 63052e82b5dc63e0a88988191ad7ecc9fbd79de2 /jython-tosca-parser/src/main/resources/Lib/site-packages/babel-2.3.4-py2.7.egg/babel/_compat.py | |
parent | b4c0ae1af144b665c5cde3a3f44cee953e66683a (diff) | |
parent | e2cc2530fc6d54ebc975c01a4ff887ce12f0a736 (diff) |
Merge "[SDC-6] sdc-distribution-client 1707 rebasing"
Diffstat (limited to 'jython-tosca-parser/src/main/resources/Lib/site-packages/babel-2.3.4-py2.7.egg/babel/_compat.py')
-rw-r--r-- | jython-tosca-parser/src/main/resources/Lib/site-packages/babel-2.3.4-py2.7.egg/babel/_compat.py | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/jython-tosca-parser/src/main/resources/Lib/site-packages/babel-2.3.4-py2.7.egg/babel/_compat.py b/jython-tosca-parser/src/main/resources/Lib/site-packages/babel-2.3.4-py2.7.egg/babel/_compat.py new file mode 100644 index 0000000..75abf9e --- /dev/null +++ b/jython-tosca-parser/src/main/resources/Lib/site-packages/babel-2.3.4-py2.7.egg/babel/_compat.py @@ -0,0 +1,76 @@ +import sys +import array + +PY2 = sys.version_info[0] == 2 + +_identity = lambda x: x + + +if not PY2: + text_type = str + string_types = (str,) + integer_types = (int, ) + unichr = chr + + text_to_native = lambda s, enc: s + + iterkeys = lambda d: iter(d.keys()) + itervalues = lambda d: iter(d.values()) + iteritems = lambda d: iter(d.items()) + + from io import StringIO, BytesIO + import pickle + + izip = zip + imap = map + range_type = range + + cmp = lambda a, b: (a > b) - (a < b) + + array_tobytes = array.array.tobytes + +else: + text_type = unicode + string_types = (str, unicode) + integer_types = (int, long) + + text_to_native = lambda s, enc: s.encode(enc) + unichr = unichr + + iterkeys = lambda d: d.iterkeys() + itervalues = lambda d: d.itervalues() + iteritems = lambda d: d.iteritems() + + from cStringIO import StringIO as BytesIO + from StringIO import StringIO + import cPickle as pickle + + from itertools import imap + from itertools import izip + range_type = xrange + + cmp = cmp + + array_tobytes = array.array.tostring + + +number_types = integer_types + (float,) + + +# +# Use cdecimal when available +# +from decimal import (Decimal as _dec, + InvalidOperation as _invop, + ROUND_HALF_EVEN as _RHE) +try: + from cdecimal import (Decimal as _cdec, + InvalidOperation as _cinvop, + ROUND_HALF_EVEN as _CRHE) + Decimal = _cdec + InvalidOperation = (_invop, _cinvop) + ROUND_HALF_EVEN = _CRHE +except ImportError: + Decimal = _dec + InvalidOperation = _invop + ROUND_HALF_EVEN = _RHE |