pylint: use yield_from for trivial cases

Follow pylint recommendations (turned errors in recent pylint updates)
and use PEP-380 syntax for subgenerators. This is supported by all
Python 3 versions since ~2011.

Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Thomas Woerner <twoerner@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Rafael Guterres Jeffman <rjeffman@redhat.com>
This commit is contained in:
Alexander Bokovoy 2024-05-17 11:34:37 +03:00 committed by Antonio Torres
parent c325f9c045
commit 6cc0a0b9a8
No known key found for this signature in database
GPG Key ID: 359FAF777296F653
2 changed files with 7 additions and 14 deletions

View File

@ -920,8 +920,7 @@ class Command(HasParam):
determined. For an example of why this can be useful, see the
`ipalib.crud.Create` subclass.
"""
for arg in self._get_param_iterable('args'):
yield arg
yield from self._get_param_iterable('args')
def check_args(self, args):
"""
@ -960,8 +959,7 @@ class Command(HasParam):
determined. For an example of why this can be useful, see the
`ipalib.crud.Create` subclass.
"""
for option in self._get_param_iterable('options'):
yield option
yield from self._get_param_iterable('options')
for o in self.has_output:
if isinstance(o, (Entry, ListOfEntries)):
yield Flag('all',
@ -1015,8 +1013,7 @@ class Command(HasParam):
o.validate(self, value, version)
def get_output_params(self):
for param in self._get_param_iterable('output_params', verb='has'):
yield param
yield from self._get_param_iterable('output_params', verb='has')
def get_summary_default(self, output):
if self.msg_summary:
@ -1454,8 +1451,7 @@ class Method(Attribute, Command):
if 'no_output' in param.flags:
continue
yield param
for param in super(Method, self).get_output_params():
yield param
yield from super(Method, self).get_output_params()
class Updater(Plugin):

View File

@ -560,8 +560,7 @@ class BaseCertMethod(Method):
def get_options(self):
yield self.obj.params['cacn'].clone(query=True)
for option in super(BaseCertMethod, self).get_options():
yield option
yield from super(BaseCertMethod, self).get_options()
@register()
@ -1342,8 +1341,7 @@ class cert(BaseCertObject):
class CertMethod(BaseCertMethod):
def get_options(self):
for option in super(CertMethod, self).get_options():
yield option
yield from super(CertMethod, self).get_options()
for o in self.has_output:
if isinstance(o, (output.Entry, output.ListOfEntries)):
@ -1443,8 +1441,7 @@ class cert_revoke(PKQuery, CertMethod, VirtualCommand):
autofill=True,
)
for option in super(cert_revoke, self).get_options():
yield option
yield from super(cert_revoke, self).get_options()
def execute(self, serial_number, **kw):
ca_enabled_check(self.api)