remove unnecessary `str()`

pull/31/head
justcool393 2022-11-29 14:29:27 -06:00
parent a3fa96242c
commit 67bfe5a5bd
6 changed files with 6 additions and 7 deletions

View File

@ -85,7 +85,7 @@ class Submission(Base):
@property
@lazy
def created_datetime(self):
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
return time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc))
@property
@lazy

View File

@ -365,7 +365,6 @@ class User(Base):
@property
@lazy
def created_date(self):
return time.strftime("%d %b %Y", time.gmtime(self.created_utc))
@property
@ -373,7 +372,7 @@ class User(Base):
def last_active_date(self):
if self.last_active == 0:
return "never"
return str(time.strftime("%d %b %Y", time.gmtime(self.last_active)))
return time.strftime("%d %b %Y", time.gmtime(self.last_active))
@property
@lazy

View File

@ -366,7 +366,7 @@ def execute_blackjack_custom(v, target, body, type):
v.is_muted = True
g.db.add(v)
with open(f"/under_siege.log", "a", encoding="utf-8") as f:
t = str(time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(time.time())))
t = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(time.time()))
f.write(f"[{t}] {v.id} @{v.username} {type} {v.age}s\n")
from files.helpers.discord import discord_message_send
discord_message_send("1041917843094110239",

View File

@ -100,7 +100,7 @@ def stats(site=None):
active_users = set(posters) | set(commenters) | set(voters) | set(commentvoters)
stats = {
"time": str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(now))),
"time": time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(now)),
"marseys": "{:,}".format(g.db.query(Marsey).filter(Marsey.submitter_id==None).count()),
"users": "{:,}".format(g.db.query(User).count()),
"private users": "{:,}".format(g.db.query(User).filter_by(is_private=True).count()),

View File

@ -116,7 +116,7 @@ def log_failed_admin_login_attempt(account:User, type:str):
print(f"Admin user from {ip} failed to login to account @{account.user_name} (invalid {type})")
try:
with open("/admin_failed_logins", "a+", encoding="utf-8") as f:
t = str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time())))
t = time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time()))
f.write(f"{t}, {ip}, {account.username}, {type}\n")
except:
pass

View File

@ -95,7 +95,7 @@ def get_logged_in_user():
with open("/eg", "r+", encoding="utf-8") as f:
ip = request.headers.get('CF-Connecting-IP')
if f'@{v.username}, ' not in f.read():
t = str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time())))
t = time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(time.time()))
f.write(f'@{v.username}, {v.truescore}, {ip}, {t}\n')
return v