Optionally surface exceptions that happen under executors by reading
[python_utils.git] / persistent.py
index 5c2b132448ebce64271c0165a8848337db5e69c8..d62dd6754eeffc78c1c09adea7c82e778f8450b3 100644 (file)
@@ -65,11 +65,7 @@ def was_file_written_today(filename: str) -> bool:
 
     mtime = file_utils.get_file_mtime_as_datetime(filename)
     now = datetime.datetime.now()
-    return (
-        mtime.month == now.month
-        and mtime.day == now.day
-        and mtime.year == now.year
-    )
+    return mtime.month == now.month and mtime.day == now.day and mtime.year == now.year
 
 
 def was_file_written_within_n_seconds(
@@ -144,16 +140,12 @@ class persistent_autoloaded_singleton(object):
 
             # Otherwise, try to load it from persisted state.
             was_loaded = False
-            logger.debug(
-                f'Attempting to load {cls.__name__} from persisted state.'
-            )
+            logger.debug(f'Attempting to load {cls.__name__} from persisted state.')
             self.instance = cls.load()
             if not self.instance:
                 msg = 'Loading from cache failed.'
                 logger.warning(msg)
-                logger.debug(
-                    f'Attempting to instantiate {cls.__name__} directly.'
-                )
+                logger.debug(f'Attempting to instantiate {cls.__name__} directly.')
                 self.instance = cls(*args, **kwargs)
             else:
                 logger.debug(