Reorganized the repository files for packaging purposes

This commit is contained in:
2023-08-30 03:35:56 +03:00
parent 5b77cab243
commit c234f7b1ce
5 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
def sorted_params_string(filters_dict):
"""
This function takes a dict and returns it in a sorted form for the url filter, it's primarily used for cache purposes.
"""
filters_string = ''
for key in sorted(filters_dict.keys()):
if filters_string == '':
filters_string = f"{key}={','.join(str(val) for val in sorted(filters_dict[key]))}"
else:
filters_string = f"{filters_string}&{key}={','.join(str(val) for val in sorted(filters_dict[key]))}"
filters_string = filters_string.strip()
return filters_string
def parse_tags_to_dict(tags):
tagdict = {}
if ':' not in tags:
tagdict = {}
else:
for subtag in tags.split('&'):
tagkey, taglist = subtag.split(':')
taglist = taglist.split(',')
tagdict[tagkey] = set(taglist)
return tagdict