[O] Make directories constant

This commit is contained in:
Hykilpikonna
2021-11-24 10:24:51 -05:00
parent 20e9805c6c
commit 41b7df7090
4 changed files with 26 additions and 77 deletions
-22
View File
@@ -59,28 +59,6 @@ def debug(msg: object) -> None:
print(f'[DEBUG] {caller}: {msg}')
def normalize_directory(directory: str) -> str:
"""
Normalize a directory input: Ensure that the directory doesn't end with "/", and ensure that an
empty directory input will be relative (".")
>>> normalize_directory('')
'.'
>>> normalize_directory('path/')
'path'
>>> normalize_directory('path')
'path'
:param directory: Input directory
:return: Normalized directory
"""
if directory == '':
directory = '.'
if directory.endswith('/'):
directory = directory[:-1]
return directory
def calculate_rate_delay(rate_limit: float) -> float:
"""
Calculate the rate delay for each request given rate limit in request per minute