Merge "Fix pylint error"

This commit is contained in:
Zuul 2024-02-27 03:27:54 +00:00 committed by Gerrit Code Review
commit 30ce858564
3 changed files with 4 additions and 8 deletions

View File

@ -38,8 +38,7 @@ class BaseOS(object):
@classmethod
def _get_subclasses(cls):
for subclass in cls.__subclasses__():
for sc in subclass._get_subclasses():
yield sc
yield from subclass._get_subclasses()
yield subclass
@classmethod

View File

@ -164,16 +164,14 @@ def _parse_pkcs7_bundle(pkcs7):
if PKCS7_BEG in pkcs7:
try:
for substrate in _read_pem_blocks(pkcs7):
for cert in _get_certs_from_pkcs7_substrate(substrate):
yield cert
yield from _get_certs_from_pkcs7_substrate(substrate)
except Exception as e:
LOG.exception('Unreadable Certificate.')
raise exceptions.UnreadableCert from e
# If no PEM encoding, assume this is DER encoded and try to decode
else:
for cert in _get_certs_from_pkcs7_substrate(pkcs7):
yield cert
yield from _get_certs_from_pkcs7_substrate(pkcs7)
def _read_pem_blocks(data):

View File

@ -204,8 +204,7 @@ class NoopManager(object):
return len(self.known_subnets) + 1
def __iter__(self):
for subnet_id in self.known_subnets:
yield subnet_id
yield from self.known_subnets
subnet = network_models.Subnet(id=uuidutils.generate_uuid(),
network_id=self.network.id)
self.known_subnets[subnet.id] = subnet