aboutsummaryrefslogtreecommitdiff
path: root/src/ppm
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2020-03-31 15:13:24 +0200
committerGuido Günther <agx@sigxcpu.org>2020-03-31 15:15:31 +0200
commita163721e4850a47f26bab088ac3c41e8167f718b (patch)
treeadcb337110f80fdd0d9325d872e18fbdf5f618a4 /src/ppm
parent805d20d132098b9123f5527ffd0a4e1b807fd5a9 (diff)
Switch to python3
Diffstat (limited to 'src/ppm')
-rw-r--r--src/ppm/accountdb.py1
-rw-r--r--src/ppm/modemproxy.py8
-rw-r--r--src/ppm/provider.py5
-rw-r--r--src/ppm/providerdb.py5
4 files changed, 11 insertions, 8 deletions
diff --git a/src/ppm/accountdb.py b/src/ppm/accountdb.py
index e0a22a3..4b70a2a 100644
--- a/src/ppm/accountdb.py
+++ b/src/ppm/accountdb.py
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
+from builtins import object
from gi.repository import Gio
from gi.repository import GObject
import logging
diff --git a/src/ppm/modemproxy.py b/src/ppm/modemproxy.py
index 6284af1..15f77fd 100644
--- a/src/ppm/modemproxy.py
+++ b/src/ppm/modemproxy.py
@@ -92,10 +92,10 @@ class ModemManagerProxy(GObject.GObject):
def mm_request(func):
def wrapped_f( self, *args, **kw):
- self.request = "%s" % func.func_name
- if kw.has_key('reply_func'):
+ self.request = "%s" % func.__name__
+ if 'reply_func' in kw:
self.reply_func = kw['reply_func']
- if kw.has_key('error_func'):
+ if 'error_func' in kw:
self.error_func = kw['error_func']
self.emit('request-started', self)
func(self, *args, **kw)
@@ -135,7 +135,7 @@ class ModemManagerProxy(GObject.GObject):
def get_modems(self):
modems = []
self.get_objects()
- for path, obj in self.objects().iteritems():
+ for path, obj in self.objects().items():
if self.MM_DBUS_INTERFACE_MODEM in obj:
modems.append(path)
return modems
diff --git a/src/ppm/provider.py b/src/ppm/provider.py
index ccdf810..fbcbcbd 100644
--- a/src/ppm/provider.py
+++ b/src/ppm/provider.py
@@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
+from builtins import object
import logging
class ProviderError(Exception):
@@ -48,14 +49,14 @@ class Provider(object):
def has_fetch_balance_cmd(self):
# Only USSD for now
- if self.fetch_balance_cmds.has_key('ussd'):
+ if 'ussd' in self.fetch_balance_cmds:
return True
else:
return False
def has_top_up_cmd(self):
# Only USSD for now
- if self.top_up_cmds.has_key('ussd'):
+ if 'ussd' in self.top_up_cmds:
return True
else:
return False
diff --git a/src/ppm/providerdb.py b/src/ppm/providerdb.py
index 0e35b59..bc90139 100644
--- a/src/ppm/providerdb.py
+++ b/src/ppm/providerdb.py
@@ -14,11 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
+from builtins import object
import os
import logging
from lxml import etree
-from provider import Provider
+from . provider import Provider
class ProviderDB(object):
"""Proxy to mobile broadband provider database"""
@@ -50,7 +51,7 @@ class ProviderDB(object):
def _load_countries(self):
try:
- for line in file(self.country_codes, 'r'):
+ for line in open(self.country_codes, 'r'):
if line[0] != '#':
(code, country) = line.split('\t',2)
self.__countries[code.lower()] = country.strip()