diff --git a/spacecmd/src/spacecmd/activationkey.py b/spacecmd/src/spacecmd/activationkey.py index 0171bcaa2997..ad29671914d7 100644 --- a/spacecmd/src/spacecmd/activationkey.py +++ b/spacecmd/src/spacecmd/activationkey.py @@ -33,10 +33,9 @@ import re import shlex import gettext -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib + +from xmlrpc import client as xmlrpclib + from spacecmd.i18n import _N from spacecmd.utils import * diff --git a/spacecmd/src/spacecmd/api.py b/spacecmd/src/spacecmd/api.py index 3e2a19e6d2a6..390fe2dd47ab 100644 --- a/spacecmd/src/spacecmd/api.py +++ b/spacecmd/src/spacecmd/api.py @@ -27,10 +27,9 @@ import logging import sys import gettext -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib + +from xmlrpc import client as xmlrpclib + from spacecmd.i18n import _N from spacecmd.utils import * diff --git a/spacecmd/src/spacecmd/configchannel.py b/spacecmd/src/spacecmd/configchannel.py index 92a7b5e97080..bac78715219a 100644 --- a/spacecmd/src/spacecmd/configchannel.py +++ b/spacecmd/src/spacecmd/configchannel.py @@ -34,10 +34,9 @@ import base64 import codecs import gettext -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib + +from xmlrpc import client as xmlrpclib + from spacecmd.i18n import _N from spacecmd.utils import * diff --git a/spacecmd/src/spacecmd/cryptokey.py b/spacecmd/src/spacecmd/cryptokey.py index 61c28530eadf..cef257685945 100644 --- a/spacecmd/src/spacecmd/cryptokey.py +++ b/spacecmd/src/spacecmd/cryptokey.py @@ -27,10 +27,9 @@ # pylint: disable=W0613 import gettext -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib + +from xmlrpc import client as xmlrpclib + from spacecmd.i18n import _N from spacecmd.utils import * diff --git a/spacecmd/src/spacecmd/errata.py b/spacecmd/src/spacecmd/errata.py index 2344d668253b..1f0bbcecc3fc 100644 --- a/spacecmd/src/spacecmd/errata.py +++ b/spacecmd/src/spacecmd/errata.py @@ -31,10 +31,9 @@ # pylint: disable=C0103 import gettext -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib + +from xmlrpc import client as xmlrpclib + from spacecmd.i18n import _N from spacecmd.utils import * diff --git a/spacecmd/src/spacecmd/group.py b/spacecmd/src/spacecmd/group.py index 70d893e87826..f9c27e6201bf 100644 --- a/spacecmd/src/spacecmd/group.py +++ b/spacecmd/src/spacecmd/group.py @@ -33,10 +33,9 @@ import os import re import shlex -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib + +from xmlrpc import client as xmlrpclib + from spacecmd.i18n import _N from spacecmd.utils import * diff --git a/spacecmd/src/spacecmd/kickstart.py b/spacecmd/src/spacecmd/kickstart.py index d4b35c9dc827..ce84cd929b9b 100644 --- a/spacecmd/src/spacecmd/kickstart.py +++ b/spacecmd/src/spacecmd/kickstart.py @@ -34,16 +34,12 @@ import os from getpass import getpass from operator import itemgetter -try: - from urllib2 import urlopen, HTTPError -except ImportError: - from urllib.request import urlopen - from urllib.error import HTTPError + +from urllib.request import urlopen +from urllib.error import HTTPError import re -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib + +from xmlrpc import client as xmlrpclib from spacecmd.i18n import _N from spacecmd.utils import * diff --git a/spacecmd/src/spacecmd/package.py b/spacecmd/src/spacecmd/package.py index 280390724c9e..bf18668dcaa9 100644 --- a/spacecmd/src/spacecmd/package.py +++ b/spacecmd/src/spacecmd/package.py @@ -30,10 +30,9 @@ # pylint: disable=C0103 import gettext -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib + +from xmlrpc import client as xmlrpclib + from spacecmd.i18n import _N from spacecmd.utils import * diff --git a/spacecmd/src/spacecmd/repo.py b/spacecmd/src/spacecmd/repo.py index cd4a4b5e7c9a..e070beb1ffbb 100644 --- a/spacecmd/src/spacecmd/repo.py +++ b/spacecmd/src/spacecmd/repo.py @@ -31,10 +31,9 @@ import gettext import shlex -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib + +from xmlrpc import client as xmlrpclib + from spacecmd.i18n import _N from spacecmd.utils import * diff --git a/spacecmd/src/spacecmd/schedule.py b/spacecmd/src/spacecmd/schedule.py index a34b8787f95f..2899c02c7146 100644 --- a/spacecmd/src/spacecmd/schedule.py +++ b/spacecmd/src/spacecmd/schedule.py @@ -32,10 +32,9 @@ import base64 import gettext from operator import itemgetter -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib + +from xmlrpc import client as xmlrpclib + from spacecmd.i18n import _N from spacecmd.utils import * diff --git a/spacecmd/src/spacecmd/shell.py b/spacecmd/src/spacecmd/shell.py index 2ce13c1cc221..f5230e1eb763 100644 --- a/spacecmd/src/spacecmd/shell.py +++ b/spacecmd/src/spacecmd/shell.py @@ -52,7 +52,7 @@ class UnknownCallException(Exception): def __init__(self): - Exception.__init__(self) + super().__init__(self) class SpacewalkShell(Cmd): diff --git a/spacecmd/src/spacecmd/softwarechannel.py b/spacecmd/src/spacecmd/softwarechannel.py index 432934acc363..376e48018d9d 100644 --- a/spacecmd/src/spacecmd/softwarechannel.py +++ b/spacecmd/src/spacecmd/softwarechannel.py @@ -31,18 +31,12 @@ # pylint: disable=C0103 import gettext -try: - from urllib import ContentTooShortError -except ImportError: - from urllib.error import ContentTooShortError -try: - from urllib import urlretrieve -except ImportError: - from urllib.request import urlretrieve -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib + +from urllib.error import ContentTooShortError +from urllib.request import urlretrieve + +from xmlrpc import client as xmlrpclib + from spacecmd.i18n import _N from spacecmd.utils import * diff --git a/spacecmd/src/spacecmd/system.py b/spacecmd/src/spacecmd/system.py index 5ef4bf1b5540..3f405ac603a8 100644 --- a/spacecmd/src/spacecmd/system.py +++ b/spacecmd/src/spacecmd/system.py @@ -33,10 +33,8 @@ import gettext import shlex from datetime import datetime -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib +from xmlrpc import client as xmlrpclib + from getpass import getpass from operator import itemgetter from xml.parsers.expat import ExpatError diff --git a/spacecmd/src/spacecmd/user.py b/spacecmd/src/spacecmd/user.py index 85eff59c43e0..66b0f6e68d1c 100644 --- a/spacecmd/src/spacecmd/user.py +++ b/spacecmd/src/spacecmd/user.py @@ -33,10 +33,9 @@ import gettext import shlex from getpass import getpass -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib + +from xmlrpc import client as xmlrpclib + from spacecmd.i18n import _N from spacecmd.utils import * diff --git a/spacecmd/src/spacecmd/utils.py b/spacecmd/src/spacecmd/utils.py index 329924be2501..f1c351700c10 100644 --- a/spacecmd/src/spacecmd/utils.py +++ b/spacecmd/src/spacecmd/utils.py @@ -40,11 +40,8 @@ import sys import time import argparse +from xmlrpc import client as xmlrpclib -try: - from xmlrpc import client as xmlrpclib -except ImportError: - import xmlrpclib from collections import deque from datetime import datetime, timedelta from difflib import unified_diff @@ -53,10 +50,7 @@ from subprocess import Popen, PIPE from dateutil.parser import isoparse -try: - import json -except ImportError: - import simplejson as json # python < 2.6 +import json import rpm