Runnable with both Python3 and Python2, with both PyQt5 and PyQt4 by using Qt.py #2250

Open
kashikoibumi wants to merge 127 commits from kashikoibumi/py3qt into v0.6
3 changed files with 6 additions and 5 deletions
Showing only changes of commit e0c2976a17 - Show all commits

View File

@ -49,7 +49,8 @@ License: MIT
# pylint: disable=too-many-lines,too-many-branches,too-many-statements,global-statement,too-many-return-statements # pylint: disable=too-many-lines,too-many-branches,too-many-statements,global-statement,too-many-return-statements
# pylint: disable=unused-argument # pylint: disable=unused-argument
from six.moves import collections_abc as collections from collections import OrderedDict
from six.moves.collections_abc import Hashable
from six.moves import range as xrange from six.moves import range as xrange
import struct import struct
import sys import sys
@ -752,7 +753,7 @@ def _unpack_map(code, fp, options):
raise Exception("logic error, not map: 0x%02x" % six.byte2int(code)) raise Exception("logic error, not map: 0x%02x" % six.byte2int(code))
d = {} if not options.get('use_ordered_dict') \ d = {} if not options.get('use_ordered_dict') \
else collections.OrderedDict() else OrderedDict()
for _ in xrange(length): for _ in xrange(length):
# Unpack key # Unpack key
k = _unpack(fp, options) k = _unpack(fp, options)
@ -760,7 +761,7 @@ def _unpack_map(code, fp, options):
if isinstance(k, list): if isinstance(k, list):
# Attempt to convert list into a hashable tuple # Attempt to convert list into a hashable tuple
k = _deep_list_to_tuple(k) k = _deep_list_to_tuple(k)
elif not isinstance(k, collections.Hashable): elif not isinstance(k, Hashable):
raise UnhashableKeyException( raise UnhashableKeyException(
"encountered unhashable key: %s, %s" % (str(k), str(type(k)))) "encountered unhashable key: %s, %s" % (str(k), str(type(k))))
elif k in d: elif k in d:

View File

@ -3,7 +3,7 @@ A queue with multiple internal subqueues.
Elements are added into a random subqueue, and retrieval rotates Elements are added into a random subqueue, and retrieval rotates
""" """
from six.moves.collections_abc import deque from collections import deque
from six.moves import queue from six.moves import queue

View File

@ -1,7 +1,7 @@
""" """
Named tuples representing the network peers Named tuples representing the network peers
""" """
from six.moves import collections_abc as collections import collections
Peer = collections.namedtuple('Peer', ['host', 'port']) Peer = collections.namedtuple('Peer', ['host', 'port'])
Node = collections.namedtuple('Node', ['services', 'host', 'port']) Node = collections.namedtuple('Node', ['services', 'host', 'port'])