Skip to content

Commit

Permalink
Python code is blacked
Browse files Browse the repository at this point in the history
  • Loading branch information
theyosh authored and github-actions[bot] committed Sep 18, 2024
1 parent 8afb1cf commit 964e6c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion terrariumArea.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def make_time_table(begin, end, on_period=0, off_period=0):
logger.debug(f"Begin time is bigger then end time (swap). Add 24 hours to end time (next day) {self}")
end += datetime.timedelta(hours=24)
if begin <= now + datetime.timedelta(hours=24) < end:
#Calculating this at a timestamp before the begin time, can case a power down, while the end time has not passed (previous day on)
# Calculating this at a timestamp before the begin time, can case a power down, while the end time has not passed (previous day on)
begin -= datetime.timedelta(hours=24)
end -= datetime.timedelta(hours=24)

Expand Down
8 changes: 6 additions & 2 deletions terrariumWebserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ def decorator(func):
@functools.wraps(func)
def wrapper(*a, **ka):
# Get user info from auth request, then from cookie or else nothing
user, password = request.auth or json.loads(request.get_cookie("auth", secret=self.cookie_secret) or "[null, null]")
user, password = request.auth or json.loads(
request.get_cookie("auth", secret=self.cookie_secret) or "[null, null]"
)

if int(self.engine.settings["always_authenticate"]) != -1 and (
required or terrariumUtils.is_true(self.engine.settings["always_authenticate"])
Expand Down Expand Up @@ -359,7 +361,9 @@ def url_for(self, name, **kwargs):
return url

def __login(self):
response.set_cookie("auth", json.dumps(request.auth), secret=self.cookie_secret, **{"max_age": 3600, "path": "/"})
response.set_cookie(
"auth", json.dumps(request.auth), secret=self.cookie_secret, **{"max_age": 3600, "path": "/"}
)
if request.is_ajax:
return {"location": self.url_for("home"), "message": "User logged in."}

Expand Down

0 comments on commit 964e6c0

Please sign in to comment.