summaryrefslogtreecommitdiff
path: root/persistent.py
diff options
context:
space:
mode:
authorScott <[email protected]>2022-02-02 13:47:36 -0800
committerScott <[email protected]>2022-02-02 13:47:36 -0800
commit7ff2af6fe7bffea90dc4a31c93140c189917c659 (patch)
tree34cb138c3a572037b5bc1d1b52ad9d25a2604ccb /persistent.py
parent6ba90a1f30f1c0cf4df12fcd0c62181f29bc3668 (diff)
Let's be explicit with asserts; there was a bug in histogram
caused by assert foo when foo was an int with valid valid 0.
Diffstat (limited to 'persistent.py')
-rw-r--r--persistent.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/persistent.py b/persistent.py
index 8832572..16f51c0 100644
--- a/persistent.py
+++ b/persistent.py
@@ -64,7 +64,7 @@ def was_file_written_today(filename: str) -> bool:
return False
mtime = file_utils.get_file_mtime_as_datetime(filename)
- assert mtime
+ assert mtime is not None
now = datetime.datetime.now()
return mtime.month == now.month and mtime.day == now.day and mtime.year == now.year
@@ -81,7 +81,7 @@ def was_file_written_within_n_seconds(
return False
mtime = file_utils.get_file_mtime_as_datetime(filename)
- assert mtime
+ assert mtime is not None
now = datetime.datetime.now()
return (now - mtime).total_seconds() <= limit_seconds