get default value from numnber check, check for advertisement

This commit is contained in:
jb-alvarado 2021-02-03 17:26:12 +01:00
parent d0306f493f
commit 7ec0a1de96

View File

@ -657,26 +657,29 @@ def get_date(seek_day):
return d.strftime('%Y-%m-%d') return d.strftime('%Y-%m-%d')
def is_float(value): def is_float(value, default=False):
""" """
test if value is float test if value is float
""" """
try: try:
float(value) return float(value)
return True
except (ValueError, TypeError): except (ValueError, TypeError):
return False return default
def is_int(value): def is_int(value, default=False):
""" """
test if value is int test if value is int
""" """
try: try:
int(value) return int(value)
return True
except ValueError: except ValueError:
return False return default
def is_advertisement(node):
if 'category' in node and node["category"] == 'advertisement':
return True
def valid_json(file): def valid_json(file):