Skip to content

Commit 476742b

Browse files
committed
Add type hints
1 parent fdf7315 commit 476742b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import math
66
from typing import Union
7-
from datetime import datetime
7+
from datetime import datetime, timedelta
88
from flask import Flask, render_template, redirect, url_for, request
99
from flask_migrate import Migrate as MigrateClass
1010
from flask_sqlalchemy import SQLAlchemy
@@ -59,9 +59,11 @@ def add_xp(self, amount: float) -> None: # add XP
5959
Add XP (experience points) to the user.
6060
amount - the amount to add XP.
6161
"""
62-
current_time = datetime.utcnow() # get current time
63-
time_difference = current_time - self.last_time_clicked # get time difference
64-
time_difference_seconds = (
62+
current_time: datetime = datetime.utcnow() # get current time
63+
time_difference: timedelta = (
64+
current_time - self.last_time_clicked
65+
) # get time difference
66+
time_difference_seconds: float = (
6567
time_difference.total_seconds()
6668
) # get time difference in seconds
6769
if (

0 commit comments

Comments
 (0)