mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-21 01:12:18 +01:00
Enable DTZ005: add timezone to datetime.now() calls
This commit is contained in:
parent
1f9061e1c9
commit
4e178be185
@ -1,7 +1,7 @@
|
|||||||
"""Generate random colorful JPEG images with configurable parameters."""
|
"""Generate random colorful JPEG images with configurable parameters."""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from datetime import datetime
|
from datetime import datetime, timezone
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
@ -125,7 +125,7 @@ if __name__ == "__main__":
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Create folder named after the current timestamp
|
# Create folder named after the current timestamp
|
||||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
timestamp = datetime.now(tz=timezone.utc).strftime("%Y%m%d_%H%M%S")
|
||||||
folder = f"generated_images_{timestamp}"
|
folder = f"generated_images_{timestamp}"
|
||||||
|
|
||||||
# Display used parameters
|
# Display used parameters
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
Requires user to log their workout to unlock the screen.
|
Requires user to log their workout to unlock the screen.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime, timezone
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -635,7 +635,7 @@ class ScreenLocker:
|
|||||||
with open(self.log_file) as f:
|
with open(self.log_file) as f:
|
||||||
logs = json.load(f)
|
logs = json.load(f)
|
||||||
|
|
||||||
today = datetime.now().strftime("%Y-%m-%d")
|
today = datetime.now(tz=timezone.utc).strftime("%Y-%m-%d")
|
||||||
return today in logs
|
return today in logs
|
||||||
except (OSError, json.JSONDecodeError):
|
except (OSError, json.JSONDecodeError):
|
||||||
return False
|
return False
|
||||||
@ -652,9 +652,9 @@ class ScreenLocker:
|
|||||||
logs = {}
|
logs = {}
|
||||||
|
|
||||||
# Add today's workout
|
# Add today's workout
|
||||||
today = datetime.now().strftime("%Y-%m-%d")
|
today = datetime.now(tz=timezone.utc).strftime("%Y-%m-%d")
|
||||||
logs[today] = {
|
logs[today] = {
|
||||||
"timestamp": datetime.now().isoformat(),
|
"timestamp": datetime.now(tz=timezone.utc).isoformat(),
|
||||||
"workout_data": self.workout_data,
|
"workout_data": self.workout_data,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,7 +61,6 @@ ignore = [
|
|||||||
"S311", # suspicious-non-cryptographic-random - not security critical
|
"S311", # suspicious-non-cryptographic-random - not security critical
|
||||||
"S310", # suspicious-url-open - acceptable for scripts
|
"S310", # suspicious-url-open - acceptable for scripts
|
||||||
"S110", # try-except-pass - common pattern in scripts
|
"S110", # try-except-pass - common pattern in scripts
|
||||||
"DTZ005", # datetime.now without tz - acceptable for local scripts
|
|
||||||
"PERF401", # manual-list-comprehension - style preference
|
"PERF401", # manual-list-comprehension - style preference
|
||||||
"RUF005", # collection-literal-concatenation - style preference
|
"RUF005", # collection-literal-concatenation - style preference
|
||||||
"SIM102", # collapsible-if - style preference
|
"SIM102", # collapsible-if - style preference
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user