From ae8be4ac7d9366b25299defb759ca3443f464516 Mon Sep 17 00:00:00 2001 From: Julian Berman Date: Fri, 15 Apr 2022 12:19:13 -0400 Subject: [PATCH] Ignore a style warning from bugbear. Creating lots of RefResolvers shouldn't be common (as creating lots of Validators should be reasonably uncommon itself), and even if one did so, we have a fixed size LRU cache, so this seems OK. Refs: PyCQA/flake8-bugbear#218 --- jsonschema/validators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsonschema/validators.py b/jsonschema/validators.py index 8d4f2a797..ccf4e2cb0 100644 --- a/jsonschema/validators.py +++ b/jsonschema/validators.py @@ -802,7 +802,7 @@ def resolving(self, ref): def _find_in_referrer(self, key): return self._get_subschemas_cache()[key] - @lru_cache() + @lru_cache() # noqa: B019 def _get_subschemas_cache(self): cache = {key: [] for key in _SUBSCHEMAS_KEYWORDS} for keyword, subschema in _utils.search_schema( @@ -811,7 +811,7 @@ def _get_subschemas_cache(self): cache[keyword].append(subschema) return cache - @lru_cache() + @lru_cache() # noqa: B019 def _find_in_subschemas(self, url): subschemas = self._get_subschemas_cache()["$id"] if not subschemas: