Decorators#

Reusable decorators that add cross-cutting behaviour (caching, retries, …) to any callable. Unlike the Lambda-specific decorators under Decorators, these are framework-agnostic and work with plain functions, ETL methods, or any other callable.

Note

Serialization format (pickle)

Cached values are serialized with Python’s pickle module. Bandit flags pickle by default (rules B403 and B301) because deserializing data from an untrusted source can execute arbitrary code.

That risk does not apply here: the only data ever passed to pickle.loads() is data that this library previously wrote with pickle.dumps(). There is no user-controlled input anywhere in the deserialization path, so the Bandit warnings are suppressed with # nosec B403 / # nosec B301.

Do not point these decorators at S3 objects or DynamoDB items that are writable by untrusted parties.