Skip to content

Commit

Permalink
Delete unused webtool helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
stijn-uva committed Nov 29, 2024
1 parent 8da18b3 commit 0abe885
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions webtool/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,6 @@ def error(code=200, **kwargs):
return response


def string_to_timestamp(string):
"""
Convert dd-mm-yyyy date to unix time
:param string: Date string to parse
:return: The unix time, or 0 if value could not be parsed
"""
bits = string.split("-")
if re.match(r"[0-9]{4}-[0-9]{2}-[0-9]{2}", string):
bits = list(reversed(bits))

if len(bits) != 3:
return 0

try:
day = int(bits[0])
month = int(bits[1])
year = int(bits[2])
date = datetime.datetime(year, month, day)
except ValueError:
return 0

return int(date.timestamp())

def pad_interval(intervals, first_interval=None, last_interval=None):
"""
Pad an interval so all intermediate intervals are filled
Expand Down Expand Up @@ -299,25 +275,6 @@ def generate_css_colours(force=False):
)


def get_preview(query):
"""
Generate a data preview of 25 rows of a results csv
:param query
:return list:
"""
preview = []
with query.get_results_path().open(encoding="utf-8") as resultfile:
posts = csv.DictReader(resultfile)
i = 0
for post in posts:
i += 1
preview.append(post)
if i > 25:
break
return preview


def format_chan_post(post):
"""
Format a plain-text imageboard post post for HTML display
Expand Down

0 comments on commit 0abe885

Please sign in to comment.