Performed some general linting. More is needed along with cleanup
Some checks failed
Lint / Lint (push) Failing after 22s
Some checks failed
Lint / Lint (push) Failing after 22s
This commit is contained in:
@@ -1,22 +1,30 @@
|
||||
"""
|
||||
Utility functions for the library
|
||||
"""
|
||||
|
||||
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.
|
||||
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]))}"
|
||||
key_str = ','.join(str(val) for val in sorted(filters_dict[key]))
|
||||
filters_string = f"{key}={key_str}"
|
||||
else:
|
||||
filters_string = f"{filters_string}&{key}={','.join(str(val) for val in sorted(filters_dict[key]))}"
|
||||
key_str = ','.join(str(val) for val in sorted(filters_dict[key]))
|
||||
filters_string = f"{filters_string}&{key}={key_str}"
|
||||
filters_string = filters_string.strip()
|
||||
return filters_string
|
||||
|
||||
|
||||
def parse_tags_to_dict(tags):
|
||||
" This function parses a tag string into a dictionary "
|
||||
tagdict = {}
|
||||
if ':' not in tags:
|
||||
tagdict = {}
|
||||
else:
|
||||
else:
|
||||
for subtag in tags.split('&'):
|
||||
tagkey, taglist = subtag.split(':')
|
||||
taglist = taglist.split(',')
|
||||
|
||||
Reference in New Issue
Block a user