Remove redundant set operations

This commit is contained in:
Kamil Monicz 2024-03-07 13:26:14 +01:00
parent 39d53d0570
commit 23d036b2d5
No known key found for this signature in database
GPG Key ID: F9FB19F1C1DC9C23
1 changed files with 2 additions and 6 deletions

View File

@ -262,11 +262,6 @@ def jsonable_encoder(
return obj
if isinstance(obj, dict):
encoded_dict = {}
allowed_keys = set(obj.keys())
if include is not None:
allowed_keys &= set(include)
if exclude is not None:
allowed_keys -= set(exclude)
for key, value in obj.items():
if (
(
@ -275,7 +270,8 @@ def jsonable_encoder(
or (not key.startswith("_sa"))
)
and (value is not None or not exclude_none)
and key in allowed_keys
and (include is None or key in include)
and (exclude is None or key not in exclude)
):
encoded_key = jsonable_encoder(
key,