python 3 fixes

This commit is contained in:
Daniel Pavel 2012-11-11 22:37:42 +02:00
parent 2c312c1a5b
commit 6db4deafee
5 changed files with 7 additions and 8 deletions

View File

@ -66,7 +66,7 @@ class _FeaturesArray(object):
raise IndexError raise IndexError
if self.features[index] is None: if self.features[index] is None:
# print "features getitem at %d" % index # print ("features getitem at %d" % index)
fs_index = self.features.index(_api.FEATURE.FEATURE_SET) fs_index = self.features.index(_api.FEATURE.FEATURE_SET)
# technically fs_function is 0x10 for this call, but we add the index to differentiate possibly conflicting requests # technically fs_function is 0x10 for this call, but we add the index to differentiate possibly conflicting requests
fs_function = 0x10 | (index & 0x0F) fs_function = 0x10 | (index & 0x0F)
@ -81,7 +81,7 @@ class _FeaturesArray(object):
if value in self.features: if value in self.features:
return True return True
# print "features contains %s" % repr(value) # print ("features contains %s" % repr(value))
for index in range(0, len(self.features)): for index in range(0, len(self.features)):
f = self.features[index] or self.__getitem__(index) f = self.features[index] or self.__getitem__(index)
assert f is not None assert f is not None

View File

@ -62,12 +62,12 @@ def _check_requirements():
if __name__ == '__main__': if __name__ == '__main__':
args = _parse_arguments()
req_fail = _check_requirements() req_fail = _check_requirements()
if req_fail: if req_fail:
raise ImportError('missing required package: %s' % req_fail) raise ImportError('missing required package: %s' % req_fail)
args = _parse_arguments()
import ui import ui
# check if the notifications are available and enabled # check if the notifications are available and enabled

View File

@ -257,7 +257,7 @@ def _update_receiver_box(frame, receiver):
def _update_device_box(frame, dev): def _update_device_box(frame, dev):
frame._device = dev frame._device = dev
# print dev.name, dev.kind # print (dev.name, dev.kind)
icon, label, info_label = ui.find_children(frame, 'icon', 'label', 'info-label') icon, label, info_label = ui.find_children(frame, 'icon', 'label', 'info-label')

View File

@ -245,7 +245,7 @@ class Receiver(object):
return 0 if count is None else ord(count[1:2]) return 0 if count is None else ord(count[1:2])
def __contains__(self, dev): def __contains__(self, dev):
# print self, "contains", dev # print (self, "contains", dev)
if self.handle == 0: if self.handle == 0:
return False return False
if type(dev) == int: if type(dev) == int:

View File

@ -7,7 +7,6 @@ import threading as _threading
from . import base as _base from . import base as _base
from .exceptions import NoReceiver as _NoReceiver from .exceptions import NoReceiver as _NoReceiver
from .common import Packet as _Packet from .common import Packet as _Packet
from .constants import MAX_ATTACHED_DEVICES as _MAX_ATTACHED_DEVICES
# for both Python 2 and 3 # for both Python 2 and 3
try: try:
@ -27,7 +26,7 @@ class EventsListener(_threading.Thread):
Incoming packets will be passed to the callback function in sequence. Incoming packets will be passed to the callback function in sequence.
""" """
def __init__(self, receiver_handle, events_callback): def __init__(self, receiver_handle, events_callback):
super(EventsListener, self).__init__(group='Unifying Receiver', name=self.__class__.__name__) super(EventsListener, self).__init__(name=self.__class__.__name__)
self.daemon = True self.daemon = True
self._active = False self._active = False