additions from backlog and conversions to git

This commit is contained in:
Trilarion
2019-09-26 15:41:09 +02:00
parent fd9491dcb2
commit a4529af611
70 changed files with 965 additions and 314 deletions

View File

@ -52,6 +52,8 @@ def canonical_game_name(name):
name = regex_sanitize_name.sub('', name)
name = regex_sanitize_name_space_eater.sub('_', name)
name = name.replace('_-_', '-')
name = name.replace('--', '-')
name = name.replace('--', '-')
return name

View File

@ -269,10 +269,7 @@ def unzip(zip_file, destination_directory):
def strip_url(url):
for prefix in ('http://', 'https://'):
if url.startswith(prefix):
url = url[len(prefix):]
for prefix in ('www.',):
for prefix in ('http://', 'https://', 'www.'):
if url.startswith(prefix):
url = url[len(prefix):]
for suffix in ('/', '.git', '/en', '/index.html'):
@ -295,4 +292,17 @@ def load_properties(filepath, sep='=', comment_char='#'):
key = line[0].strip()
value = line[1].strip()
properties[key] = value
return properties
return properties
def unique_elements_and_occurrences(elements):
"""
"""
unique_elements = {}
for element in elements:
unique_elements[element] = unique_elements.get(element, 0) + 1
unique_elements = list(unique_elements.items())
unique_elements.sort(key=lambda x: -x[1])
unique_elements = ['{}({})'.format(k, v) for k, v in unique_elements]
return unique_elements