Procházet zdrojové kódy

Merge pull request #64 from ChlodAlejandro/python3

Parse string-type datetime in checker
pull/65/head
Ben Kurtovic před 5 měsíci
committed by GitHub
rodič
revize
b7bb289c30
V databázi nebyl nalezen žádný známý klíč pro tento podpis ID GPG klíče: B5690EEEBB952194
1 změnil soubory, kde provedl 5 přidání a 1 odebrání
  1. +5
    -1
      src/copyvios/checker.py

+ 5
- 1
src/copyvios/checker.py Zobrazit soubor

@@ -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):


Načítá se…
Zrušit
Uložit