Skip to content

Commit 94da323

Browse files
authored
Fix some issues from pylint (#3077)
1 parent 6e46e9d commit 94da323

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

pylintrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.
407407
[EXCEPTIONS]
408408

409409
# Exceptions that will emit a warning when caught.
410-
overgeneral-exceptions=BaseException,
411-
Exception
410+
overgeneral-exceptions=builtins.BaseException,
411+
builtins.Exception
412412

413413

414414
[REFACTORING]

src/cfnlint/core.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,10 @@ def get_matches(filenames: str, args: cfnlint.config.ConfigMixIn) -> Iterator[Ma
181181
args.registry_schemas,
182182
args.mandatory_checks,
183183
)
184-
for match in matches:
185-
yield match
184+
yield from iter(matches)
186185
else:
187186
if errors:
188-
for match in errors:
189-
yield match
187+
yield from iter(errors)
190188
LOGGER.debug("Completed linting of file: %s", str(filename))
191189

192190

src/cfnlint/helpers.py

+1
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ def load_resource(package, filename="us-east-1.json"):
357357
.joinpath(filename)
358358
.read_text(encoding="utf-8")
359359
)
360+
# pylint: disable=W4902
360361
return json.loads(pkg_resources.read_text(package, filename, encoding="utf-8"))
361362

362363

src/cfnlint/template/transforms/_language_extensions.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,7 @@ def values(
502502
)
503503
except _ResolveError:
504504
if self._fn.hash in collection_cache:
505-
for item in collection_cache[self._fn.hash]:
506-
yield item
505+
yield from iter(collection_cache[self._fn.hash])
507506
else:
508507
collection_cache[self._fn.hash] = []
509508
for _ in range(0, 2):
@@ -543,5 +542,4 @@ def __init__(
543542

544543
def items(self, cfn: Any) -> Iterable[Tuple[str, str]]:
545544
items = self._collection.values(cfn, self._collection_cache)
546-
for item in items:
547-
yield item
545+
yield from iter(items)

0 commit comments

Comments
 (0)