summaryrefslogtreecommitdiffstats
path: root/pykolab/cli
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-09 10:37:49 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-09 10:37:49 +0000
commit61714a5e0d99ba1bc08eeac7f0ead106d72abae3 (patch)
treebebe896d1e8bbf8a1e9590bcc20e8580461fb408 /pykolab/cli
parent0ae2417b2c4a614fd70c512b1283be37dd0c31dd (diff)
downloadpykolab-61714a5e0d99ba1bc08eeac7f0ead106d72abae3.tar.gz
Correct some pylint conventions
Diffstat (limited to 'pykolab/cli')
-rw-r--r--pykolab/cli/cmd_export_mailbox.py12
-rw-r--r--pykolab/cli/cmd_list_domains.py4
-rw-r--r--pykolab/cli/cmd_list_mailboxes.py2
-rw-r--r--pykolab/cli/cmd_sync.py6
-rw-r--r--pykolab/cli/cmd_transfer_mailbox.py2
-rw-r--r--pykolab/cli/commands.py36
-rw-r--r--pykolab/cli/telemetry/cmd_examine_command_issue.py6
-rw-r--r--pykolab/cli/telemetry/cmd_examine_session.py6
-rw-r--r--pykolab/cli/telemetry/cmd_list_sessions.py2
9 files changed, 38 insertions, 38 deletions
diff --git a/pykolab/cli/cmd_export_mailbox.py b/pykolab/cli/cmd_export_mailbox.py
index eab89d0..2e0875c 100644
--- a/pykolab/cli/cmd_export_mailbox.py
+++ b/pykolab/cli/cmd_export_mailbox.py
@@ -68,7 +68,7 @@ def execute(*args, **kw):
)
mboxlist_proc = subprocess.Popen(
- ['grep', '-E', '\s*%s\s*.*i.*p.*' %(user)],
+ ['grep', '-E', '\s*%s\s*.*i.*p.*' % (user)],
stdin=ctl_mboxlist.stdout,
stdout=subprocess.PIPE
)
@@ -78,7 +78,7 @@ def execute(*args, **kw):
# TODO: Handle errors from ctl_mboxlist process (stderr)
mboxlist_output = mboxlist_proc.communicate()[0]
- zipper_args = [ 'zip', '-r', '%s.zip' %(user) ]
+ zipper_args = [ 'zip', '-r', '%s.zip' % (user) ]
directories = []
for mbox_internal in mboxlist_output.split('\n'):
@@ -95,7 +95,7 @@ def execute(*args, **kw):
)
for partition in partitions:
- mbox_dir = '%s/domain/%s/%s/%s/user/%s/' %(
+ mbox_dir = '%s/domain/%s/%s/%s/user/%s/' % (
partition,
domain[0],
domain,
@@ -108,7 +108,7 @@ def execute(*args, **kw):
else:
log.debug(
- _('%s is not a directory') %(mbox_dir),
+ _('%s is not a directory') % (mbox_dir),
level=5
)
@@ -118,8 +118,8 @@ def execute(*args, **kw):
stdout=subprocess.PIPE
).communicate()[0]
- print >> sys.stderr, _("ZIP file at %s.zip") %(user)
+ print >> sys.stderr, _("ZIP file at %s.zip") % (user)
else:
- print >> sys.stderr, _("No directories found for user %s") %(user)
+ print >> sys.stderr, _("No directories found for user %s") % (user)
sys.exit(1)
diff --git a/pykolab/cli/cmd_list_domains.py b/pykolab/cli/cmd_list_domains.py
index 0bc2d27..cf12ee4 100644
--- a/pykolab/cli/cmd_list_domains.py
+++ b/pykolab/cli/cmd_list_domains.py
@@ -38,7 +38,7 @@ def execute(*args, **kw):
#print "domains:", domains['list']
- print "%-39s %-40s" %("Primary Domain Name Space","Secondary Domain Name Space(s)")
+ print "%-39s %-40s" % ("Primary Domain Name Space","Secondary Domain Name Space(s)")
# TODO: Take a hint in --quiet, and otherwise print out a nice table
# with headers and such.
@@ -46,6 +46,6 @@ def execute(*args, **kw):
if isinstance(domains['list'][domain_dn]['associateddomain'], list):
print domains['list'][domain_dn]['associateddomain'][0]
for domain_alias in domains['list'][domain_dn]['associateddomain'][1:]:
- print "%-39s %-40s" %('', domain_alias)
+ print "%-39s %-40s" % ('', domain_alias)
else:
print domains['list'][domain_dn]['associateddomain']
diff --git a/pykolab/cli/cmd_list_mailboxes.py b/pykolab/cli/cmd_list_mailboxes.py
index ae0444e..547eb74 100644
--- a/pykolab/cli/cmd_list_mailboxes.py
+++ b/pykolab/cli/cmd_list_mailboxes.py
@@ -31,7 +31,7 @@ imap = pykolab.imap
def __init__():
commands.register('list_mailboxes', execute, description="List mailboxes.\n" + \
- "%-28s" %('') + \
+ "%-28s" % ('') + \
"Use wildcards '*' and '%' for more control.\n")
def cli_options():
diff --git a/pykolab/cli/cmd_sync.py b/pykolab/cli/cmd_sync.py
index 14dd87d..348c010 100644
--- a/pykolab/cli/cmd_sync.py
+++ b/pykolab/cli/cmd_sync.py
@@ -38,7 +38,7 @@ def execute(*args, **kw):
domains = auth.list_domains()
end_time = time.time()
log.debug(
- _("Found %d domains in %d seconds") %(
+ _("Found %d domains in %d seconds") % (
len(domains),
(end_time-start_time)
),
@@ -48,13 +48,13 @@ def execute(*args, **kw):
all_folders = []
for primary_domain,secondary_domains in domains:
- log.debug(_("Running for domain %s") %(primary_domain), level=8)
+ log.debug(_("Running for domain %s") % (primary_domain), level=8)
auth.connect(primary_domain)
start_time = time.time()
auth.synchronize(primary_domain, secondary_domains)
end_time = time.time()
log.info(_("Synchronizing users for %s took %d seconds")
- %(primary_domain, (end_time-start_time))
+ % (primary_domain, (end_time-start_time))
)
diff --git a/pykolab/cli/cmd_transfer_mailbox.py b/pykolab/cli/cmd_transfer_mailbox.py
index 4f0de09..e7a7acc 100644
--- a/pykolab/cli/cmd_transfer_mailbox.py
+++ b/pykolab/cli/cmd_transfer_mailbox.py
@@ -51,7 +51,7 @@ def execute(*args, **kw):
if mbox_parts['domain'] == None:
user_identifier = mbox_parts['path_parts'][1]
else:
- user_identifier = "%s@%s" %(mbox_parts['path_parts'][1], mbox_parts['domain'])
+ user_identifier = "%s@%s" % (mbox_parts['path_parts'][1], mbox_parts['domain'])
print "User Identifier:", user_identifier
diff --git a/pykolab/cli/commands.py b/pykolab/cli/commands.py
index ea083ed..7236b0b 100644
--- a/pykolab/cli/commands.py
+++ b/pykolab/cli/commands.py
@@ -42,9 +42,9 @@ def __init__():
if filename.startswith('cmd_') and filename.endswith('.py'):
module_name = filename.replace('.py','')
cmd_name = module_name.replace('cmd_', '')
- #print "exec(\"from %s import __init__ as %s_register\"" %(module_name,cmd_name)
- exec("from %s import __init__ as %s_register" %(module_name,cmd_name))
- exec("%s_register()" %(cmd_name))
+ #print "exec(\"from %s import __init__ as %s_register\"" % (module_name,cmd_name)
+ exec("from %s import __init__ as %s_register" % (module_name,cmd_name))
+ exec("%s_register()" % (cmd_name))
for dirname in dirnames:
register_group(commands_path, dirname)
@@ -85,21 +85,21 @@ def list_commands(*args, **kw):
if __commands[_command].has_key('function'):
# This is a top-level command
if not __commands[_command]['description'] == None:
- print "%-25s - %s" %(_command.replace('_','-'),__commands[_command]['description'])
+ print "%-25s - %s" % (_command.replace('_','-'),__commands[_command]['description'])
else:
- print "%-25s" %(_command.replace('_','-'))
+ print "%-25s" % (_command.replace('_','-'))
for _command in _commands:
if not __commands[_command].has_key('function'):
# This is a nested command
- print "\n" + _("Command Group: %s") %(_command) + "\n"
+ print "\n" + _("Command Group: %s") % (_command) + "\n"
___commands = __commands[_command].keys()
___commands.sort()
for __command in ___commands:
if not __commands[_command][__command]['description'] == None:
- print "%-4s%-21s - %s" %('',__command.replace('_','-'),__commands[_command][__command]['description'])
+ print "%-4s%-21s - %s" % ('',__command.replace('_','-'),__commands[_command][__command]['description'])
else:
- print "%-4s%-21s" %('',__command.replace('_','-'))
+ print "%-4s%-21s" % ('',__command.replace('_','-'))
def execute(cmd_name, *args, **kw):
if not commands.has_key(cmd_name):
@@ -115,15 +115,15 @@ def execute(cmd_name, *args, **kw):
group = commands[cmd_name]['group']
command_name = commands[cmd_name]['cmd_name']
try:
- exec("from %s.cmd_%s import cli_options as %s_%s_cli_options" %(group,command_name,group,command_name))
- exec("%s_%s_cli_options()" %(group,command_name))
+ exec("from %s.cmd_%s import cli_options as %s_%s_cli_options" % (group,command_name,group,command_name))
+ exec("%s_%s_cli_options()" % (group,command_name))
except ImportError, e:
pass
else:
try:
- exec("from cmd_%s import cli_options as %s_cli_options" %(cmd_name,cmd_name))
- exec("%s_cli_options()" %(cmd_name))
+ exec("from cmd_%s import cli_options as %s_cli_options" % (cmd_name,cmd_name))
+ exec("%s_cli_options()" % (cmd_name))
except ImportError, e:
pass
@@ -144,13 +144,13 @@ def register_group(dirname, module):
if filename.startswith('cmd_') and filename.endswith('.py'):
module_name = filename.replace('.py','')
cmd_name = module_name.replace('cmd_', '')
- #print "exec(\"from %s.%s import __init__ as %s_%s_register\"" %(module,module_name,module,cmd_name)
- exec("from %s.%s import __init__ as %s_%s_register" %(module,module_name,module,cmd_name))
- exec("%s_%s_register()" %(module,cmd_name))
+ #print "exec(\"from %s.%s import __init__ as %s_%s_register\"" % (module,module_name,module,cmd_name)
+ exec("from %s.%s import __init__ as %s_%s_register" % (module,module_name,module,cmd_name))
+ exec("%s_%s_register()" % (module,cmd_name))
def register(cmd_name, func, group=None, description=None, aliases=[]):
if not group == None:
- command = "%s_%s" %(group,cmd_name)
+ command = "%s_%s" % (group,cmd_name)
else:
command = cmd_name
@@ -158,7 +158,7 @@ def register(cmd_name, func, group=None, description=None, aliases=[]):
aliases = [aliases]
if commands.has_key(command):
- log.fatal(_("Command '%s' already registered") %(command))
+ log.fatal(_("Command '%s' already registered") % (command))
sys.exit(1)
if callable(func):
@@ -180,7 +180,7 @@ def register(cmd_name, func, group=None, description=None, aliases=[]):
for alias in aliases:
commands[alias] = {
'function': func,
- 'description': _("Alias for %s") %(cmd_name)
+ 'description': _("Alias for %s") % (cmd_name)
}
##
diff --git a/pykolab/cli/telemetry/cmd_examine_command_issue.py b/pykolab/cli/telemetry/cmd_examine_command_issue.py
index f4248a0..fc8d3f7 100644
--- a/pykolab/cli/telemetry/cmd_examine_command_issue.py
+++ b/pykolab/cli/telemetry/cmd_examine_command_issue.py
@@ -75,7 +75,7 @@ def execute(*args, **kw):
id=session.server_id
).first()
- print _("Session by %s on server %s") %(user.sasl_username,server.fqdn)
+ print _("Session by %s on server %s") % (user.sasl_username,server.fqdn)
command_issues = db.query(
telemetry.TelemetryCommandIssue
@@ -99,7 +99,7 @@ def execute(*args, **kw):
if command_issue.id == _command_issue.id:
print "========="
- print "Client(%d): %s %s %s" %(
+ print "Client(%d): %s %s %s" % (
_command_issue.id,
_command_issue.command_tag,
command.command,
@@ -116,7 +116,7 @@ def execute(*args, **kw):
server_response_lines = server_response.response.split('\n');
for server_response_line in server_response_lines:
- print "Server(%d): %s" %(
+ print "Server(%d): %s" % (
server_response.id,
server_response_line
)
diff --git a/pykolab/cli/telemetry/cmd_examine_session.py b/pykolab/cli/telemetry/cmd_examine_session.py
index a1273fd..38dac94 100644
--- a/pykolab/cli/telemetry/cmd_examine_session.py
+++ b/pykolab/cli/telemetry/cmd_examine_session.py
@@ -100,7 +100,7 @@ def execute(*args, **kw):
return
- print _("Session by %s on server %s") %(user.sasl_username,server.fqdn)
+ print _("Session by %s on server %s") % (user.sasl_username,server.fqdn)
command_issues = db.query(
telemetry.TelemetryCommandIssue
@@ -121,7 +121,7 @@ def execute(*args, **kw):
id=command_issue.command_arg_id
).first()
- print "Client(%d): %s %s %s" %(
+ print "Client(%d): %s %s %s" % (
command_issue.id,
command_issue.command_tag,
command.command,
@@ -137,7 +137,7 @@ def execute(*args, **kw):
for server_response in server_responses:
server_response_lines = server_response.response.split('\n');
for server_response_line in server_response_lines:
- print "Server(%d): %s" %(
+ print "Server(%d): %s" % (
server_response.id,
server_response_line
)
diff --git a/pykolab/cli/telemetry/cmd_list_sessions.py b/pykolab/cli/telemetry/cmd_list_sessions.py
index 1f6503e..c90ef9d 100644
--- a/pykolab/cli/telemetry/cmd_list_sessions.py
+++ b/pykolab/cli/telemetry/cmd_list_sessions.py
@@ -58,7 +58,7 @@ def execute(*args, **kw):
id=session.user_id
).first()
- print _("Session for user %s started at %s with ID %s") %(
+ print _("Session for user %s started at %s with ID %s") % (
user.sasl_username,
session.start,
session.id