Sfoglia il codice sorgente

Merge pull request #64 from ChlodAlejandro/python3

Parse string-type datetime in checker
pull/65/head
Ben Kurtovic 5 mesi fa
committed by GitHub
parent
commit
b7bb289c30
Non sono state trovate chiavi note per questa firma nel database ID Chiave GPG: B5690EEEBB952194
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni
  1. +5
    -1
      src/copyvios/checker.py

+ 5
- 1
src/copyvios/checker.py Vedi File

@@ -229,7 +229,11 @@ def _get_cached_results(
return None

if not isinstance(cache_time, datetime):
cache_time = datetime.fromtimestamp(cache_time, tz=UTC)
if isinstance(cache_time, (int, float)):
cache_time = datetime.fromtimestamp(cache_time, tz=UTC)
else:
# Y-M-D H:M:S
cache_time = datetime.strptime(cache_time, "%Y-%m-%d %H:%M:%S").replace(tzinfo=UTC)
elif cache_time.tzinfo is None:
cache_time = cache_time.replace(tzinfo=UTC)
if datetime.now(UTC) - cache_time > timedelta(days=3):


Caricamento…
Annulla
Salva