python-modernize -f libmodernize.fixes.fix_imports_six

This commit is contained in:
Tomas Kopecek 2018-06-28 16:58:29 +02:00 committed by Mike McLean
parent f03646bab5
commit be535c2854
21 changed files with 81 additions and 81 deletions

View file

@ -15,7 +15,7 @@ except ImportError: # pragma: no cover
import koji
from koji.util import LazyDict, LazyValue
import koji.policy
import ConfigParser
import six.moves.configparser
from email.MIMEText import MIMEText
import fnmatch
import optparse
@ -25,7 +25,7 @@ import smtplib
import socket # for socket.error
import sys
import time
import xmlrpclib # for ProtocolError and Fault
import six.moves.xmlrpc_client # for ProtocolError and Fault
OptionParser = optparse.OptionParser
@ -116,7 +116,7 @@ def get_options():
defaults = parser.get_default_values()
config = ConfigParser.ConfigParser()
config = six.moves.configparser.ConfigParser()
cf = getattr(options, 'config_file', None)
if cf:
if not os.access(cf, os.F_OK):
@ -341,7 +341,7 @@ def warn(msg):
def ensure_connection(session):
try:
ret = session.getAPIVersion()
except xmlrpclib.ProtocolError:
except six.moves.xmlrpc_client.ProtocolError:
error(_("Error: Unable to connect to server"))
if ret != koji.API_VERSION:
warn(_("WARNING: The server is at API version %d and the client is at %d" % (ret, koji.API_VERSION)))
@ -456,7 +456,7 @@ def handle_trash():
continue
try:
refs = session.buildReferences(binfo['id'], limit=10)
except xmlrpclib.Fault:
except six.moves.xmlrpc_client.Fault:
print("[%i/%i] Error checking references for %s. Skipping" % (i, N, nvr))
continue
#XXX - this is more data than we need
@ -658,7 +658,7 @@ def handle_delete(just_salvage=False):
session.untagBuildBypass(trashcan_tag, binfo['id'])
try:
session.deleteBuild(binfo['id'])
except (xmlrpclib.Fault, koji.GenericError), e:
except (six.moves.xmlrpc_client.Fault, koji.GenericError), e:
print("Warning: deletion failed: %s" % e)
#server issue
pass
@ -877,7 +877,7 @@ def handle_prune():
try:
session.untagBuildBypass(taginfo['id'], entry['build_id'], force=bypass)
untagged.setdefault(nvr, {})[tagname] = 1
except (xmlrpclib.Fault, koji.GenericError), e:
except (six.moves.xmlrpc_client.Fault, koji.GenericError), e:
print("Warning: untag operation failed: %s" % e)
pass
# if action == 'keep' do nothing
@ -911,7 +911,7 @@ def handle_prune():
print("Deleting untagged build: %s" % nvr)
try:
session.deleteBuild(build_id, strict=False)
except (xmlrpclib.Fault, koji.GenericError), e:
except (six.moves.xmlrpc_client.Fault, koji.GenericError), e:
print("Warning: deletion failed: %s" % e)
#server issue
pass

View file

@ -30,7 +30,7 @@ try:
except ImportError: # pragma: no cover
krbV = None
import koji
import ConfigParser
import six.moves.configparser
import fnmatch
import optparse
import os
@ -41,7 +41,7 @@ import string
import sys
import time
import urllib2
import xmlrpclib # for ProtocolError and Fault
import six.moves.xmlrpc_client # for ProtocolError and Fault
import rpm
# koji.fp.o keeps stalling, probably network errors...
@ -163,7 +163,7 @@ def get_options():
(options, args) = parser.parse_args()
defaults = parser.get_default_values()
config = ConfigParser.ConfigParser()
config = six.moves.configparser.ConfigParser()
cf = getattr(options, 'config_file', None)
if cf:
if not os.access(cf, os.F_OK):
@ -299,7 +299,7 @@ def warn(msg):
def ensure_connection(session):
try:
ret = session.getAPIVersion()
except xmlrpclib.ProtocolError:
except six.moves.xmlrpc_client.ProtocolError:
error(_("Error: Unable to connect to server"))
if ret != koji.API_VERSION:
warn(_("WARNING: The server is at API version %d and the client is at "

View file

@ -26,7 +26,7 @@ import os
import koji
from koji.util import rmtree, parseStatus
from optparse import OptionParser
from ConfigParser import ConfigParser
from six.moves.configparser import ConfigParser
import errno
import logging
import logging.handlers