Skip to content

Commit 06d19cb

Browse files
committed
Convert to Python 3 via 2to3-3.8
1 parent 4066119 commit 06d19cb

6 files changed

Lines changed: 24 additions & 24 deletions

File tree

‎OMMClient/OMDevice.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from OMMClient import *
1+
from .OMMClient import *
22
from threading import Lock
33

44

@@ -71,5 +71,5 @@ def __setattr__(self, key, value):
7171
self.__dict__[key] = value
7272

7373
def _init_from_attributes(self, attributes):
74-
for key, val in attributes.items():
74+
for key, val in list(attributes.items()):
7575
self.__dict__[key] = val

‎OMMClient/OMMClient.py‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from threading import Thread, Event, Lock
2-
from OMUser import OMMUser
3-
from OMDevice import OMMDevice
2+
from .OMUser import OMMUser
3+
from .OMDevice import OMMDevice
44
from time import sleep
55
from events import Events
6-
from utils import *
7-
from messagehelper import *
6+
from .utils import *
7+
from .messagehelper import *
88
import socket
99
import ssl
10-
import Queue
10+
import queue
1111

1212

1313
# noinspection PyMissingConstructor
@@ -46,8 +46,8 @@ def __init__(self, host, port=12622):
4646
self._tcp_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
4747
self._tcp_socket.settimeout(10)
4848
self._ssl_socket = ssl.wrap_socket(self._tcp_socket)
49-
self._send_q = Queue.Queue()
50-
self._recv_q = Queue.Queue()
49+
self._send_q = queue.Queue()
50+
self._recv_q = queue.Queue()
5151
self._worker = Thread(target=self._work)
5252
self._worker.daemon = True
5353
self._dispatcher = Thread(target=self._dispatch)
@@ -531,7 +531,7 @@ def _work(self):
531531
data = None
532532
try:
533533
data = self._ssl_socket.recv(65536)
534-
except Exception, e:
534+
except Exception as e:
535535
if e.message == "The read operation timed out":
536536
continue
537537
if data:

‎OMMClient/OMUser.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from OMMClient import *
1+
from .OMMClient import *
22
from threading import Lock
33

44

@@ -106,12 +106,12 @@ def __setattr__(self, key, value):
106106
self.__dict__[key] = value
107107

108108
def _init_from_attributes(self, attributes):
109-
for key, val in attributes.items():
109+
for key, val in list(attributes.items()):
110110
self.__dict__[key] = val
111111

112112
def get_attributes(self):
113113
attributes = {}
114-
for key, val in self.__dict__.items():
114+
for key, val in list(self.__dict__.items()):
115115
if "_" in key:
116116
attributes[key] = val
117117
return attributes
@@ -121,4 +121,4 @@ def commit(self):
121121
return True
122122
with self._changelock:
123123
for change in self._changes:
124-
print change
124+
print(change)

‎OMMClient/messagehelper.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ def construct_message(name, attributes=None, children=None):
3030
impl = getDOMImplementation()
3131
message = impl.createDocument(None, name, None)
3232
root_element = message.documentElement
33-
for key, val in attributes.items():
33+
for key, val in list(attributes.items()):
3434
root_element.setAttribute(str(key), str(val))
3535
if children is not None:
36-
for key, val in children.items():
36+
for key, val in list(children.items()):
3737
new_child = message.createElement(key)
3838
if val is not None:
39-
for attr_key, attr_val in val.items():
39+
for attr_key, attr_val in list(val.items()):
4040
new_child.setAttribute(str(attr_key), str(attr_val))
4141
root_element.appendChild(new_child)
42-
print root_element.toxml()
42+
print(root_element.toxml())
4343
return root_element.toxml()

‎docs/conf.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
master_doc = 'index'
2424

2525
# General information about the project.
26-
project = u'python-mitel'
27-
copyright = u'2017, thomasDOTwtf'
28-
author = u'thomasDOTwtf'
26+
project = 'python-mitel'
27+
copyright = '2017, thomasDOTwtf'
28+
author = 'thomasDOTwtf'
2929

3030
# The short X.Y version.
31-
version = u'0.1'
31+
version = '0.1'
3232
# The full version, including alpha/beta/rc tags.
33-
release = u'0.1'
33+
release = '0.1'
3434

3535
language = None
3636
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

‎test.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def HandsetHandler(message, attributes, children):
1515

1616
test = OMMClient.OMMClient(host, port)
1717
test.login(user, password, ommsync=True)
18-
print test.get_device(35)
18+
print(test.get_device(35))
1919
#print test.create_user("test1","3332",login="3332",pin="1234")
2020
#test.attach_user_device(1, 36)
2121
#test.detach_user_device(5, 35)

0 commit comments

Comments
 (0)