99#: Running under Python 3
1010PY3K = sys .version_info [0 ] == 3 and True or False
1111
12+ #: Running under Python 2.7, or newer
13+ PY27 = sys .version_info [:2 ] == 3 and True or False
14+
1215GITHUB_DATE_FORMAT = "%Y/%m/%d %H:%M:%S %z"
1316# We need to manually mangle the timezone for commit date formatting because it
1417# uses -xx:xx format
@@ -158,9 +161,9 @@ def get_value(self, *args, **kwargs):
158161 datatype = kwargs .pop ("datatype" , None )
159162 value = self .make_request (* args , ** kwargs )
160163 if datatype :
161- if not PY3K :
162- # unicode keys are not accepted as kwargs by python, see :
163- #http://mail-archives.apache .org/mod_mbox/qpid-dev/200609.mbox/%3C1159389941.4505.10.camel@localhost.localdomain%3E
164+ if not PY27 :
165+ # unicode keys are not accepted as kwargs by python, until 2.7 :
166+ # http://bugs.python .org/issue2646
164167 # So we make a local dict with the same keys but as strings:
165168 return datatype (** dict ((str (k ), v ) for (k , v ) in value .items ()))
166169 else :
@@ -171,7 +174,7 @@ def get_values(self, *args, **kwargs):
171174 datatype = kwargs .pop ("datatype" , None )
172175 values = self .make_request (* args , ** kwargs )
173176 if datatype :
174- if not PY3K :
177+ if not PY27 :
175178 # Same as above, unicode keys will blow up in **args, so we need to
176179 # create a new 'values' dict with string keys
177180 return [datatype (** dict ((str (k ), v ) for (k , v ) in value .items ()))
0 commit comments