Message ID | 145574404546.3171.3505501417912073835.stgit@localhost (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 02/17/2016 02:20 PM, Lluís Vilanova wrote: > Lets the user to manage event arguments as a list, and simplifies s/to // > argument concatenation. [meta-comment] The subject line was formatted as "[PATCHv71/4]", which looks like version 71 of 4? If you use 'git format-patch -v7', you'll get subject lines that read "[PATCH v7 1/4]", and are more legible as a result. The same trick works with 'git send-email -v7'. > > Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> > --- > scripts/tracetool/__init__.py | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > Reviewed-by: Eric Blake <eblake@redhat.com>
Eric Blake writes: > On 02/17/2016 02:20 PM, Lluís Vilanova wrote: >> Lets the user to manage event arguments as a list, and simplifies > s/to // Fixed. >> argument concatenation. > [meta-comment] The subject line was formatted as "[PATCHv71/4]", which > looks like version 71 of 4? If you use 'git format-patch -v7', you'll > get subject lines that read "[PATCH v7 1/4]", and are more legible as a > result. The same trick works with 'git send-email -v7'. Yes, I just discovered I had an overriden mail template that was causing the recurring formatting errors (I'm using stgit to manage my queue and send the emails, so the cmdline is slightly different). >> >> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> >> --- >> scripts/tracetool/__init__.py | 15 +++++++++++++-- >> 1 file changed, 13 insertions(+), 2 deletions(-) >> > Reviewed-by: Eric Blake <eblake@redhat.com> Thanks, Lluis
diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py index 181675f..0663e7f 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -50,9 +50,14 @@ class Arguments: Parameters ---------- args : - List of (type, name) tuples. + List of (type, name) tuples or Arguments objects. """ - self._args = args + self._args = [] + for arg in args: + if isinstance(arg, Arguments): + self._args.extend(arg._args) + else: + self._args.append(arg) def copy(self): """Create a new copy.""" @@ -83,6 +88,12 @@ class Arguments: res.append((arg_type, identifier)) return Arguments(res) + def __getitem__(self, index): + if isinstance(index, slice): + return Arguments(self._args[index]) + else: + return self._args[index] + def __iter__(self): """Iterate over the (type, name) pairs.""" return iter(self._args)
Lets the user to manage event arguments as a list, and simplifies argument concatenation. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> --- scripts/tracetool/__init__.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)