Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
)
val = [[",".join(val)]]
if prop["type"] in ["person"]:
userlist = []
if not isinstance(val, list):
val = [val]
for user in val:
user_id = user if isinstance(user, str) else user.id
userlist += [["‣", [["u", user_id]]], [","]]
val = userlist[:-1]
if prop["type"] in ["email", "phone_number", "url"]:
val = [[val, [["a", val]]]]
if prop["type"] in ["date"]:
if isinstance(val, date) or isinstance(val, datetime):
val = NotionDate(val)
if isinstance(val, NotionDate):
val = val.to_notion()
else:
val = []
if prop["type"] in ["file"]:
filelist = []
if not isinstance(val, list):
val = [val]
for url in val:
url = remove_signed_prefix_as_needed(url)
filename = url.split("/")[-1]
filelist += [[filename, [["a", url]]], [","]]
val = filelist[:-1]
if prop["type"] in ["checkbox"]:
if not isinstance(val, bool):
raise TypeError(
"Value passed to property '{}' must be a bool.".format(identifier)
)
)
val = [[",".join(val)]]
if prop["type"] in ["person"]:
userlist = []
if not isinstance(val, list):
val = [val]
for user in val:
user_id = user if isinstance(user, str) else user.id
userlist += [["‣", [["u", user_id]]], [","]]
val = userlist[:-1]
if prop["type"] in ["email", "phone_number", "url"]:
val = [[val, [["a", val]]]]
if prop["type"] in ["date"]:
if isinstance(val, date) or isinstance(val, datetime):
val = NotionDate(val)
if isinstance(val, NotionDate):
val = val.to_notion()
else:
val = []
if prop["type"] in ["file"]:
filelist = []
if not isinstance(val, list):
val = [val]
for url in val:
url = remove_signed_prefix_as_needed(url)
filename = url.split("/")[-1]
filelist += [[filename, [["a", url]]], [","]]
val = filelist[:-1]
if prop["type"] in ["checkbox"]:
if not isinstance(val, bool):
raise TypeError(