GetoptError is always initialized with exactly two parameters, so simplify
the constructor.
This commit is contained in:
parent
b2a0a838e0
commit
e1fd5260ea
|
@ -20,13 +20,10 @@ option involved with the exception.
|
||||||
class GetoptError(Exception):
|
class GetoptError(Exception):
|
||||||
opt = ''
|
opt = ''
|
||||||
msg = ''
|
msg = ''
|
||||||
def __init__(self, *args):
|
def __init__(self, msg, opt):
|
||||||
self.args = args
|
self.msg = msg
|
||||||
if len(args) == 1:
|
self.opt = opt
|
||||||
self.msg = args[0]
|
Exception.__init__(self, msg, opt)
|
||||||
elif len(args) == 2:
|
|
||||||
self.msg = args[0]
|
|
||||||
self.opt = args[1]
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.msg
|
return self.msg
|
||||||
|
|
Loading…
Reference in New Issue