diff --git a/pylintrc b/pylintrc index a5b6cb4138..2df5debe1d 100644 --- a/pylintrc +++ b/pylintrc @@ -407,8 +407,8 @@ timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests. [EXCEPTIONS] # Exceptions that will emit a warning when caught. -overgeneral-exceptions=BaseException, - Exception +overgeneral-exceptions=builtins.BaseException, + builtins.Exception [REFACTORING] diff --git a/src/cfnlint/core.py b/src/cfnlint/core.py index 16c0f26ff5..1f65fb1720 100644 --- a/src/cfnlint/core.py +++ b/src/cfnlint/core.py @@ -181,12 +181,10 @@ def get_matches(filenames: str, args: cfnlint.config.ConfigMixIn) -> Iterator[Ma args.registry_schemas, args.mandatory_checks, ) - for match in matches: - yield match + yield from iter(matches) else: if errors: - for match in errors: - yield match + yield from iter(errors) LOGGER.debug("Completed linting of file: %s", str(filename)) diff --git a/src/cfnlint/helpers.py b/src/cfnlint/helpers.py index e67c23a15f..b99aac1eb3 100644 --- a/src/cfnlint/helpers.py +++ b/src/cfnlint/helpers.py @@ -357,6 +357,7 @@ def load_resource(package, filename="us-east-1.json"): .joinpath(filename) .read_text(encoding="utf-8") ) + # pylint: disable=W4902 return json.loads(pkg_resources.read_text(package, filename, encoding="utf-8")) diff --git a/src/cfnlint/template/transforms/_language_extensions.py b/src/cfnlint/template/transforms/_language_extensions.py index 59bd6b2251..563d481382 100644 --- a/src/cfnlint/template/transforms/_language_extensions.py +++ b/src/cfnlint/template/transforms/_language_extensions.py @@ -502,8 +502,7 @@ def values( ) except _ResolveError: if self._fn.hash in collection_cache: - for item in collection_cache[self._fn.hash]: - yield item + yield from iter(collection_cache[self._fn.hash]) else: collection_cache[self._fn.hash] = [] for _ in range(0, 2): @@ -543,5 +542,4 @@ def __init__( def items(self, cfn: Any) -> Iterable[Tuple[str, str]]: items = self._collection.values(cfn, self._collection_cache) - for item in items: - yield item + yield from iter(items)