Skip to content

Commit

Permalink
Cache get_pre_loads results (#140)
Browse files Browse the repository at this point in the history
* Cache get_pre_loads results

* Use functools.cache
  • Loading branch information
Pliner authored Dec 11, 2023
1 parent dc94685 commit 654fdcf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions marshmallow_recipe/hooks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import collections.abc
import functools
import inspect
from typing import Any

Expand All @@ -11,6 +12,7 @@ def pre_load(fn: collections.abc.Callable[..., Any]) -> collections.abc.Callable
return fn


@functools.cache
def get_pre_loads(cls: type) -> list[collections.abc.Callable[..., Any]]:
result = []
for _, method in inspect.getmembers(cls):
Expand Down

0 comments on commit 654fdcf

Please sign in to comment.