[libcamera-devel,1/8] utils: checkstyle.py: Drop arguments to super() when possible
diff mbox series

Message ID 20201224122855.22200-2-laurent.pinchart@ideasonboard.com
State Accepted
Delegated to: Laurent Pinchart
Headers show
Series
  • checkstyle.py: Ensure meson.build is updated when adding header
Related show

Commit Message

Laurent Pinchart Dec. 24, 2020, 12:28 p.m. UTC
The super() call is a shortcut syntax for super(__class__, <first arg>).
Drom the arguments when they match the default.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 utils/checkstyle.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Niklas Söderlund Dec. 27, 2020, 10:24 a.m. UTC | #1
Hi Laurent,

Thanks for your work.

On 2020-12-24 14:28:48 +0200, Laurent Pinchart wrote:
> The super() call is a shortcut syntax for super(__class__, <first arg>).
> Drom the arguments when they match the default.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  utils/checkstyle.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/checkstyle.py b/utils/checkstyle.py
> index 7225cac47a4e..c04bf3850dcd 100755
> --- a/utils/checkstyle.py
> +++ b/utils/checkstyle.py
> @@ -198,7 +198,7 @@ _style_checkers = []
>  
>  class StyleCheckerRegistry(type):
>      def __new__(cls, clsname, bases, attrs):
> -        newclass = super(StyleCheckerRegistry, cls).__new__(cls, clsname, bases, attrs)
> +        newclass = super().__new__(cls, clsname, bases, attrs)
>          if clsname != 'StyleChecker':
>              _style_checkers.append(newclass)
>          return newclass
> @@ -387,7 +387,7 @@ _formatters = []
>  
>  class FormatterRegistry(type):
>      def __new__(cls, clsname, bases, attrs):
> -        newclass = super(FormatterRegistry, cls).__new__(cls, clsname, bases, attrs)
> +        newclass = super().__new__(cls, clsname, bases, attrs)
>          if clsname != 'Formatter':
>              _formatters.append(newclass)
>          return newclass
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Paul Elder Dec. 28, 2020, 5:03 a.m. UTC | #2
Hi Laurent,

On Thu, Dec 24, 2020 at 02:28:48PM +0200, Laurent Pinchart wrote:
> The super() call is a shortcut syntax for super(__class__, <first arg>).
> Drom the arguments when they match the default.

s/Drom/Drop

> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  utils/checkstyle.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/checkstyle.py b/utils/checkstyle.py
> index 7225cac47a4e..c04bf3850dcd 100755
> --- a/utils/checkstyle.py
> +++ b/utils/checkstyle.py
> @@ -198,7 +198,7 @@ _style_checkers = []
>  
>  class StyleCheckerRegistry(type):
>      def __new__(cls, clsname, bases, attrs):
> -        newclass = super(StyleCheckerRegistry, cls).__new__(cls, clsname, bases, attrs)
> +        newclass = super().__new__(cls, clsname, bases, attrs)
>          if clsname != 'StyleChecker':
>              _style_checkers.append(newclass)
>          return newclass
> @@ -387,7 +387,7 @@ _formatters = []
>  
>  class FormatterRegistry(type):
>      def __new__(cls, clsname, bases, attrs):
> -        newclass = super(FormatterRegistry, cls).__new__(cls, clsname, bases, attrs)
> +        newclass = super().__new__(cls, clsname, bases, attrs)
>          if clsname != 'Formatter':
>              _formatters.append(newclass)
>          return newclass
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch
diff mbox series

diff --git a/utils/checkstyle.py b/utils/checkstyle.py
index 7225cac47a4e..c04bf3850dcd 100755
--- a/utils/checkstyle.py
+++ b/utils/checkstyle.py
@@ -198,7 +198,7 @@  _style_checkers = []
 
 class StyleCheckerRegistry(type):
     def __new__(cls, clsname, bases, attrs):
-        newclass = super(StyleCheckerRegistry, cls).__new__(cls, clsname, bases, attrs)
+        newclass = super().__new__(cls, clsname, bases, attrs)
         if clsname != 'StyleChecker':
             _style_checkers.append(newclass)
         return newclass
@@ -387,7 +387,7 @@  _formatters = []
 
 class FormatterRegistry(type):
     def __new__(cls, clsname, bases, attrs):
-        newclass = super(FormatterRegistry, cls).__new__(cls, clsname, bases, attrs)
+        newclass = super().__new__(cls, clsname, bases, attrs)
         if clsname != 'Formatter':
             _formatters.append(newclass)
         return newclass