Skip to content

Commit

Permalink
Fixed syntax errors for Python 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
walac committed Feb 20, 2012
1 parent 14c95bc commit c9c23d6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
11 changes: 9 additions & 2 deletions usb/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,15 @@ def __init__(self, dev, backend):
)
)

self.bus = int(desc.bus) if desc.bus is not None else None
self.address = int(desc.address) if desc.address is not None else None
if desc.bus is not None:
self.bus = int(desc.bus)
else:
self.bus = None

if desc.address is not None:
self.address = int(desc.address)
else:
self.address = None

def set_configuration(self, configuration = None):
r"""Set the active configuration.
Expand Down
6 changes: 4 additions & 2 deletions usb/legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@ def claimInterface(self, interface):
Arguments:
interface: interface number or an Interface object.
"""
if_num = interface.interfaceNumber \
if isinstance(interface, Interface) else interface
if isinstance(interface, Interface):
if_num = interface.interfaceNumber
else:
if_num = interface

util.claim_interface(self.dev, if_num)
self.__claimed_interface = if_num
Expand Down

0 comments on commit c9c23d6

Please sign in to comment.