diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-09-06 19:30:47 -0700 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-09-06 19:30:47 -0700 |
commit | a318745bed432fcd0527e691406c238c0d4d07fc (patch) | |
tree | 8a96feffd8d421e079ccfb7e31e6dbb0534e0ba4 /cmd2 | |
parent | f5e94b366fcffd141890a4bd8c9d2259afd1f43c (diff) | |
download | cmd2-git-a318745bed432fcd0527e691406c238c0d4d07fc.tar.gz |
Simplified override of __new__
Eliminated redundant type information, since that is all being provided by attr.ib() calls
Diffstat (limited to 'cmd2')
-rw-r--r-- | cmd2/parsing.py | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/cmd2/parsing.py b/cmd2/parsing.py index a5dbb72c..7a9a9ff6 100644 --- a/cmd2/parsing.py +++ b/cmd2/parsing.py @@ -59,18 +59,7 @@ class Statement(str): # if output was redirected, the destination file output_to = attr.ib(default='', validator=attr.validators.instance_of(str), type=str) - def __new__(cls, - args: object, - raw: str = '', - command: str = '', - arg_list: List[str] = None, - multiline_command: str = '', - terminator: str = '', - suffix: str = '', - pipe_to: List[str] = None, - output: str = '', - output_to: str = '' - ): + def __new__(cls, value: object, *pos_args, **kw_args): """Create a new instance of Statement. We must override __new__ because we are subclassing `str` which is immutable and takes a different number of @@ -78,7 +67,7 @@ class Statement(str): NOTE: attrs takes care of initializing other members in the __init__ it generates. """ - stmt = super().__new__(cls, args) + stmt = super().__new__(cls, value) return stmt @property |