Skip to content

Commit

Permalink
cloudpickle isinstance() (#487)
Browse files Browse the repository at this point in the history
* cloudpickle isinstance()

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update backend.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
jan-janssen and pre-commit-ci[bot] authored Nov 9, 2024
1 parent 649ef6c commit b314e72
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions executorlib/cache/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ def backend_load_file(file_name: str) -> dict:
"""
apply_dict = load(file_name=file_name)
apply_dict["args"] = [
arg if not isinstance(arg, FutureItem) else arg.result()
arg if not _isinstance(arg, FutureItem) else arg.result()
for arg in apply_dict["args"]
]
apply_dict["kwargs"] = {
key: arg if not isinstance(arg, FutureItem) else arg.result()
key: arg if not _isinstance(arg, FutureItem) else arg.result()
for key, arg in apply_dict["kwargs"].items()
}
return apply_dict
Expand Down Expand Up @@ -62,3 +62,7 @@ def backend_execute_task_in_file(file_name: str) -> None:
file_name=file_name,
output=result,
)


def _isinstance(obj: Any, cls: type) -> bool:
return str(obj.__class__) == str(cls)

0 comments on commit b314e72

Please sign in to comment.