Skip to content

Commit cec1eb2

Browse files
committed
Flake8 whitespace fixes, remove obsolete version check.
Removed obsolete 2.4 version check. 2.7 or newer is required.
1 parent 7823d0a commit cec1eb2

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

roundup/scripts/roundup_mailgw.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@
4242
from roundup import mailgw
4343
from roundup.i18n import _
4444

45+
4546
def usage(args, message=None):
4647
if message is not None:
4748
print(message)
4849
print(_(
49-
"""Usage: %(program)s [-v] [-c class] [[-C class] -S field=value]* [instance home] [mail source [specification]]
50+
"""Usage: %(program)s [-v] [-c class] [[-C class] -S field=value]* [instance home] [mail source [specification]]
5051
5152
Options:
5253
-v: print version and exit
@@ -124,25 +125,26 @@ def usage(args, message=None):
124125
This supports the same notation as IMAP.
125126
imaps_cram username:password@server [mailbox]
126127
127-
""")%{'program': args[0]})
128+
""") % {'program': args[0]})
128129
return 1
129130

131+
130132
def main(argv):
131133
'''Handle the arguments to the program and initialise environment.
132134
'''
133135
# take the argv array and parse it leaving the non-option
134136
# arguments in the args array.
135137
try:
136138
optionsList, args = getopt.getopt(argv[1:], 'vc:C:S:', ['set=',
137-
'class='])
139+
'class='])
138140
except getopt.GetoptError:
139141
# print help information and exit:
140142
usage(argv)
141143
sys.exit(2)
142144

143-
for (opt, arg) in optionsList:
145+
for (opt, _arg) in optionsList:
144146
if opt == '-v':
145-
print('%s (python %s)'%(roundup_version, sys.version.split()[0]))
147+
print('%s (python %s)' % (roundup_version, sys.version.split()[0]))
146148
return
147149

148150
# figure the instance home
@@ -168,7 +170,8 @@ def main(argv):
168170

169171
# otherwise, figure what sort of mail source to handle
170172
if len(args) < 3:
171-
return usage(argv, _('Error: not enough source specification information'))
173+
return usage(argv, _(
174+
'Error: not enough source specification information'))
172175
source, specification = args[1:3]
173176

174177
# time out net connections after a minute if we can
@@ -202,8 +205,6 @@ def main(argv):
202205
# now invoke the mailgw handler depending on the server handler requested
203206
if source.startswith('pop'):
204207
ssl = source.endswith('s')
205-
if ssl and sys.version_info<(2,4):
206-
return usage(argv, _('Error: a later version of python is required'))
207208
return handler.do_pop(server, username, password, ssl)
208209
elif source == 'apop':
209210
return handler.do_apop(server, username, password)
@@ -217,14 +218,17 @@ def main(argv):
217218
if len(args) > 3:
218219
mailbox = args[3]
219220
return handler.do_imap(server, username, password, mailbox, ssl,
220-
cram)
221+
cram)
221222

222223
return usage(argv, _('Error: The source must be either "mailbox",'
223-
' "pop", "pops", "apop", "imap", "imaps" or "imaps_cram'))
224+
' "pop", "pops", "apop", "imap", "imaps" or'
225+
' "imaps_cram'))
226+
224227

225228
def run():
226229
sys.exit(main(sys.argv))
227230

231+
228232
# call main
229233
if __name__ == '__main__':
230234
run()

0 commit comments

Comments
 (0)