Skip to content

support generator functions #37

@yarikoptic

Description

@yarikoptic

the simplest implementation would be to detect if a function to be wrapped is producing a generator function (inspect.isgeneratorfunction), and thus fscacher would cache all yielded results and wrapped function would also be a generator possibly just re-yielding them from the cache.

use case which inspired it -- caching of hash computation which would yield progress status while computing it: dandi/dandi-cli#400 . But I think, although could be used, in this case we need some different construct since we would not be interested in all the progress indicators if value is cached. So, although inspired by the use case, and could be used, it would be not a complete optimal solution for it.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions