File tree 1 file changed +7
-10
lines changed 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -655,20 +655,17 @@ def _set_opt_strings(self, opts):
655
655
self ._long_opts .append (opt )
656
656
657
657
def __repr__ (self ):
658
- retval = 'Argument('
658
+ args = []
659
659
if self ._short_opts :
660
- retval += '_short_opts: ' + repr (self ._short_opts ) + ', '
660
+ args += [ '_short_opts: ' + repr (self ._short_opts ) + ', ' ]
661
661
if self ._long_opts :
662
- retval += '_long_opts: ' + repr (self ._long_opts ) + ', '
663
- retval += 'dest: ' + repr (self .dest ) + ', '
662
+ args += [ '_long_opts: ' + repr (self ._long_opts ) + ', ' ]
663
+ args += [ 'dest: ' + repr (self .dest ) + ', ' ]
664
664
if hasattr (self , 'type' ):
665
- retval += 'type: ' + repr (self .type ) + ', '
665
+ args += [ 'type: ' + repr (self .type ) + ', ' ]
666
666
if hasattr (self , 'default' ):
667
- retval += 'default: ' + repr (self .default ) + ', '
668
- if retval [- 2 :] == ', ' : # always long enough to test ("Argument(" )
669
- retval = retval [:- 2 ]
670
- retval += ')'
671
- return retval
667
+ args += ['default: ' + repr (self .default ) + ', ' ]
668
+ return 'Argument({0})' .format (', ' .join (args ))
672
669
673
670
674
671
class OptionGroup :
You can’t perform that action at this time.
0 commit comments