forked from Infinidat/munch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix python 3 compatibility to work with IronPython (fix Infinidat#13)
- Loading branch information
Showing
2 changed files
with
4 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1 @@ | ||
import sys | ||
|
||
_PY2 = (sys.version_info < (3, 0)) | ||
|
||
|
||
def identity(x): | ||
return x | ||
|
||
# u('string') replaces the forwards-incompatible u'string' | ||
if _PY2: | ||
import codecs | ||
|
||
def u(string): | ||
return codecs.unicode_escape_decode(string)[0] | ||
else: | ||
u = identity | ||
|
||
# dict.iteritems(), dict.iterkeys() is also incompatible | ||
if _PY2: | ||
iteritems = dict.iteritems # pylint: disable=no-member | ||
iterkeys = dict.iterkeys # pylint: disable=no-member | ||
else: | ||
iteritems = dict.items | ||
iterkeys = dict.keys | ||
from six import u, iteritems, iterkeys # pylint: disable=unused-import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,9 @@ | |
url="http://github.com/Infinidat/munch", | ||
author="Rotem Yaari", | ||
author_email="[email protected]", | ||
install_requires=[ | ||
'six', | ||
], | ||
packages=find_packages(exclude=["tests"]), | ||
keywords=['munch', 'dict', 'mapping', 'container', 'collection'], | ||
classifiers=[ | ||
|