Fix keyword-arg-before-vararg warning

When trying to use a copy of code in loopingcall.py in
a neutron backport, it threw this pep8 warning:

  pep8: W1113: Keyword argument before variable positional
    arguments list in the definition of init function
    (keyword-arg-before-vararg)

We must be using slightly different versions of pylint
since I don't see the failure in oslo.service.

Changed the arguments around in a couple of places to
avoid the warning.

TrivialFix

Change-Id: I35995209981a6f48926a4359fbbf30d07cd5e1e6
This commit is contained in:
Brian Haley
2025-06-13 14:19:11 -04:00
parent 57ce3982d0
commit 0e4531adc7

View File

@@ -98,7 +98,7 @@ class LoopingCallBase:
_RUN_ONLY_ONE_MESSAGE = _(
"A looping call can only run one function at a time")
def __init__(self, f=None, *args, **kwargs):
def __init__(self, *args, f=None, **kwargs):
self.args = args
self.kwargs = kwargs
self.f = f
@@ -293,7 +293,7 @@ class BackOffLoopingCall(LoopingCallBase):
"A dynamic backoff interval looping call can only run one function at"
" a time")
def __init__(self, f=None, *args, **kwargs):
def __init__(self, *args, f=None, **kwargs):
super().__init__(f=f, *args, **kwargs)
self._error_time = 0
self._interval = 1