Skip to content

Commit

Permalink
Merge branch 'jldbc:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelGFagan authored Aug 27, 2024
2 parents 4a24ad9 + 691dbe3 commit 48bf6c5
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pybaseball/cache/cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import abc
import datetime
import functools
import glob
import os
Expand Down Expand Up @@ -74,7 +75,22 @@ def _safe_get_func_data(self, func: _CacheFunc, args: Any, kwargs: Any) -> Dict:
arglist = list(args) # tuple won't come through the JSONify well
if arglist and isinstance(arglist[0], abc.ABC): # remove the table classes when they're self
arglist = arglist[1:]
return {'func': func_name, 'args': arglist, 'kwargs': kwargs}

arglist = [
(
arg.isoformat()
if any(
map(
lambda dtype: isinstance(arg, dtype),
[datetime.datetime, datetime.date],
)
)
else arg
)
for arg in arglist
]

return {"func": func_name, "args": arglist, "kwargs": kwargs}
except: # pylint: disable=bare-except
return {}

Expand Down

0 comments on commit 48bf6c5

Please sign in to comment.