From b4eb3a5d37ab7f8de09ee699d4695ec0c1a54e57 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Thu, 14 Nov 2024 16:12:26 +0100 Subject: backend/scraper: Bind loop variables correctly This was uncovered by bugbear, but did not seem to have tripped our test. Fix it anyway. --- src/hircine/scraper/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/hircine/scraper/utils.py b/src/hircine/scraper/utils.py index 6afa2ed..1c1fbee 100644 --- a/src/hircine/scraper/utils.py +++ b/src/hircine/scraper/utils.py @@ -27,11 +27,11 @@ def parse_dict(parsers, data): value = data[field] if isinstance(value, list): - yield from [lambda i=x: parser(i) for x in value] + yield from [lambda x=x, parser=parser: parser(x) for x in value] elif isinstance(value, dict): yield from parse_dict(parser, value) else: - yield lambda: parser(value) + yield lambda parser=parser, value=value: parser(value) @contextmanager -- cgit v1.2.3-2-gb3c3