[Piglit] [PATCH 08/13] results.py: Modernize some things

Ilia Mirkin imirkin at alum.mit.edu
Sat Jun 21 06:53:11 PDT 2014


On Sat, Jun 21, 2014 at 8:06 AM, Dylan Baker <baker.dylan.c at gmail.com> wrote:
> Use super() instead of an explicit call to the parent class in one case,
> and make all classes descend from object (make them new-style classes)
>
> Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
> ---
>  framework/results.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/framework/results.py b/framework/results.py
> index 7762d39..356aefb 100644
> --- a/framework/results.py
> +++ b/framework/results.py
> @@ -53,7 +53,7 @@ def _piglit_encoder(obj):
>      return obj
>
>
> -class JSONWriter:
> +class JSONWriter(object):
>      '''
>      Writes to a JSON file stream
>
> @@ -181,7 +181,7 @@ class JSONWriter:
>
>  class TestResult(dict):
>      def __init__(self, *args):
> -        dict.__init__(self, *args)
> +        super(TestResult, self).__init__(*args)

I'm weak on the details, but I have an odd recollection of Guido
telling me not to do that unless I was doing funny things with
multiple inheritance. This was back when python 2.4 was cool. But if
you know what you're doing, this is fine too. (Might also have had
something to do with old- and new-style classes... it was a long time
ago.)

Acked-by: Ilia Mirkin <imirkin at alum.mit.edu>

>
>          # Replace the result with a status object
>          try:
> @@ -192,7 +192,7 @@ class TestResult(dict):
>              pass
>
>
> -class TestrunResult:
> +class TestrunResult(object):
>      def __init__(self, resultfile=None):
>          self.serialized_keys = ['options',
>                                  'name',
> --
> 2.0.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list