Add files via upload

This commit is contained in:
David Rotermund 2023-05-15 20:08:48 +02:00 committed by GitHub
parent 65d8f4a31f
commit 98b3a720dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,16 @@
def add_item_to_authordb(item: str, author_db: dict):
was_found: bool = False
for the_keys in author_db.keys():
assert isinstance(author_db[the_keys], list) is True
if str(the_keys) == str(item):
return
for i in author_db[the_keys]:
print(i)
if str(i) == str(item):
return
if was_found is False:
author_db.update({f"{item}": []})

19
bib/add_item_to_typedb.py Normal file
View file

@ -0,0 +1,19 @@
def add_item_to_typedb(item: str, types_db: dict):
was_found: bool = False
for the_keys in types_db.keys():
assert isinstance(types_db[the_keys], list) is True
assert len(types_db[the_keys]) == 3
assert isinstance(types_db[the_keys][0], list) is True
assert isinstance(types_db[the_keys][1], str) is True
assert isinstance(types_db[the_keys][2], str) is True
if str(the_keys) == str(item):
return
for i in types_db[the_keys][0]:
if str(i) == str(item):
return
if was_found is False:
types_db.update({f"{item}": [[], f"{item}", f"{item}"]})

View file

@ -1,4 +1,12 @@
import html
def filter_string(input):
return str(html.escape(input).encode("ascii", "xmlcharrefreplace").decode())
def shorten_authorname(input: str) -> str:
input = filter_string(input)
temp = input.split(",")
name: str = temp[0].lstrip().rstrip() + str(",")
temp = temp[1].lstrip().rstrip().split(" ")