test: Convert to Python 3

Change raw_input() to input() and unicode to str. This is *not*
compatible with Python 2. Update the hashbangs to run with Python 3.
This commit is contained in:
Martin Pitt 2014-03-11 17:39:22 +01:00 committed by Denis Kenzior
parent ad4f90684f
commit c027ab9fbc
94 changed files with 124 additions and 124 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import os
import re

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus, sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@ -45,7 +45,7 @@ if state == "idle":
print("State: %s" % (state))
while state == "user-response":
response = raw_input("Enter response: ")
response = input("Enter response: ")
result = ussd.Respond(response, timeout=100)

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib
@ -6,7 +6,7 @@ import dbus
import dbus.mainloop.glib
_dbus2py = {
dbus.String : unicode,
dbus.String : str,
dbus.UInt32 : int,
dbus.Int32 : int,
dbus.Int16 : int,

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib
@ -6,7 +6,7 @@ import dbus
import dbus.mainloop.glib
_dbus2py = {
dbus.String : unicode,
dbus.String : str,
dbus.UInt32 : int,
dbus.Int32 : int,
dbus.Int16 : int,

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus, sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus, sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import os
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus
@ -46,7 +46,7 @@ if state == "idle":
print("State: %s" % (state))
while state == "user-response":
response = raw_input("Enter response: ")
response = input("Enter response: ")
print(ussd.Respond(response, timeout=100))

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import dbus.mainloop.glib
@ -78,7 +78,7 @@ def set_topics(cbs):
invalidData = False;
index = 0
topics = raw_input('Enter the topic ID(s) you want to register to: ')
topics = input('Enter the topic ID(s) you want to register to: ')
while index < len(topics):
if topics[index] == ',' or topics[index] == '-':

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib
import sys
@ -40,7 +40,7 @@ def print_menu():
def stdin_handler(channel, condition, gnss, path):
in_key = os.read(channel.unix_get_fd(), 160).rstrip().decode('UTF-8')
if in_key == '0':
xml = raw_input('type the element and press enter: ')
xml = input('type the element and press enter: ')
try:
gnss.SendPositioningElement(dbus.String(xml))
print("ok")

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib
import sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus, sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from gi.repository import GLib
@ -132,7 +132,7 @@ def stdin_handler(channel, condition, sms, value, number):
lock = "on"
if in_key == '0':
print_send_sms_menu()
sms_type = raw_input('Select SMS type: ')
sms_type = input('Select SMS type: ')
if sms_type == '1':
message_send(sms, number, value)
@ -150,49 +150,49 @@ def stdin_handler(channel, condition, sms, value, number):
elif in_key == '1':
message_delivery_report(sms, 1)
send_msg = raw_input('Send test message[y/n]?: ')
send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y':
message_send(sms, number, ("(1)" + value +
": UseDeliveryReports[TRUE]"))
elif in_key == '2':
message_delivery_report(sms, 0)
send_msg = raw_input('Send test message[y/n]?: ')
send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y':
message_send(sms, number, ("(2) " + value +
": UseDeliveryReports[FALSE]"))
elif in_key == '3':
message_service_center_address(sms, SCA)
send_msg = raw_input('Send test message[y/n]?: ')
send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y':
message_send(sms, number, ("(3) " + value +
": ServiceCenterAddress"))
elif in_key == '4':
message_bearer(sms, "ps-only")
send_msg = raw_input('Send test message[y/n]?: ')
send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y':
message_send(sms, number, ("(4) " + value +
": Bearer[ps-only]"))
elif in_key == '5':
message_bearer(sms, "cs-only")
send_msg = raw_input('Send test message[y/n]?: ')
send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y':
message_send(sms, number, ("(5) " + value +
": Bearer[cs-only]"))
elif in_key == '6':
message_bearer(sms, "ps-preferred")
send_msg = raw_input('Send test message[y/n]?: ')
send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y':
message_send(sms, number, ("(6) " + value +
": Bearer[ps-preferred]"))
elif in_key == '7':
message_bearer(sms, "cs-preferred")
send_msg = raw_input('Send test message[y/n]?: ')
send_msg = input('Send test message[y/n]?: ')
if send_msg == 'y':
message_send(sms,number, ("(7) " + value +
": Bearer[cs-preferred]"))

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import sys
import dbus

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
from gi.repository import GLib
@ -57,7 +57,7 @@ class StkAgent(dbus.service.Object):
index += 1
print("\nDefault: %d" % (default))
select = raw_input("Enter Selection (t, b):")
select = input("Enter Selection (t, b):")
if select == 'b':
raise GoBack("User wishes to go back")
@ -74,7 +74,7 @@ class StkAgent(dbus.service.Object):
print("DisplayText (%s)" % (title))
print("Icon: (%d)" % (icon))
print("Urgent: (%d)" % (urgent))
key = raw_input("Press return to clear ('t' terminates, "
key = input("Press return to clear ('t' terminates, "
"'b' goes back, 'n' busy, "
"'w' return and wait):")
@ -107,7 +107,7 @@ class StkAgent(dbus.service.Object):
print("Hide typing: (%s)" % (hide_typing))
print("Enter characters, min: %d, max: %d:" % (min_chars,
max_chars))
userin = raw_input("")
userin = input("")
return userin
@ -121,7 +121,7 @@ class StkAgent(dbus.service.Object):
print("Hide typing: (%s)" % (hide_typing))
print("Enter digits, min: %d, max: %d:" % (min_chars,
max_chars))
userin = raw_input("'t' terminates, 'b' goes back:")
userin = input("'t' terminates, 'b' goes back:")
if userin == 'b':
raise GoBack("User wishes to go back")
@ -135,7 +135,7 @@ class StkAgent(dbus.service.Object):
def RequestKey(self, title, icon):
print("Title: (%s)" % (title))
print("Icon: (%d)" % (icon))
key = raw_input("Enter Key (t, b):")
key = input("Enter Key (t, b):")
if key == 'b':
raise GoBack("User wishes to go back")
@ -149,7 +149,7 @@ class StkAgent(dbus.service.Object):
def RequestDigit(self, title, icon):
print("Title: (%s)" % (title))
print("Icon: (%d)" % (icon))
key = raw_input("Enter Digit (t, b):")
key = input("Enter Digit (t, b):")
if key == 'b':
raise GoBack("User wishes to go back")
@ -163,7 +163,7 @@ class StkAgent(dbus.service.Object):
def RequestQuickDigit(self, title, icon):
print("Title: (%s)" % (title))
print("Icon: (%d)" % (icon))
key = raw_input("Quick digit (0-9, *, #, t, b):")
key = input("Quick digit (0-9, *, #, t, b):")
if key == 'b':
raise GoBack("User wishes to go back")
@ -177,7 +177,7 @@ class StkAgent(dbus.service.Object):
def RequestConfirmation(self, title, icon):
print("Title: (%s)" % (title))
print("Icon: (%d)" % (icon))
key = raw_input("Enter Confirmation (t, b, y, n):")
key = input("Enter Confirmation (t, b, y, n):")
if key == 'b':
raise GoBack("User wishes to go back")
@ -193,7 +193,7 @@ class StkAgent(dbus.service.Object):
def ConfirmCallSetup(self, info, icon):
print("Information: (%s)" % (info))
print("Icon: (%d)" % (icon))
key = raw_input("Enter Confirmation (t, y, n):")
key = input("Enter Confirmation (t, y, n):")
if key == 't':
raise EndSession("User wishes to terminate session")
@ -208,7 +208,7 @@ class StkAgent(dbus.service.Object):
print("Information: (%s)" % (info))
print("Icon: (%d)" % (icon))
print("URL (%s)" % (url))
key = raw_input("Enter Confirmation (y, n):")
key = input("Enter Confirmation (y, n):")
if key == 'y':
return True
@ -231,7 +231,7 @@ class StkAgent(dbus.service.Object):
signal.alarm(5)
try:
key = raw_input("Press return to end before end of"
key = input("Press return to end before end of"
" single tone (t):")
signal.alarm(0)
@ -249,7 +249,7 @@ class StkAgent(dbus.service.Object):
print("LoopTone: %s" % (tone))
print("Text: %s" % (text))
print("Icon: %d" % (icon))
key = raw_input("Press return to end before timeout "
key = input("Press return to end before timeout "
"('t' terminates, 'w' return and wait):")
if key == 'w':
@ -278,7 +278,7 @@ class StkAgent(dbus.service.Object):
def DisplayAction(self, text, icon):
print("Text: (%s)" % (text))
print("Icon: (%d)" % (icon))
key = raw_input("Press 't' to terminate the session ")
key = input("Press 't' to terminate the session ")
if key == 't':
raise EndSession("User wishes to terminate session")
@ -288,7 +288,7 @@ class StkAgent(dbus.service.Object):
def ConfirmOpenChannel(self, info, icon):
print("Open channel confirmation: (%s)" % (info))
print("Icon: (%d)" % (icon))
key = raw_input("Enter Confirmation (t, y, n):")
key = input("Enter Confirmation (t, y, n):")
if key == 't':
raise EndSession("User wishes to terminate session")
@ -298,7 +298,7 @@ class StkAgent(dbus.service.Object):
return False
_dbus2py = {
dbus.String : unicode,
dbus.String : str,
dbus.UInt32 : int,
dbus.Int32 : int,
dbus.Int16 : int,
@ -395,7 +395,7 @@ if __name__ == '__main__':
except:
pass
select = int(raw_input("Enter Selection: "))
select = int(input("Enter Selection: "))
stk.SelectItem(select, path)
elif mode == 'agent':
path = "/test/agent"

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
import dbus
import sys