allow Path args to get_dir_size and copy_and_overwrite
This commit is contained in:
parent
ca77d90a8f
commit
e727af6f22
2 changed files with 4 additions and 3 deletions
|
@ -68,10 +68,11 @@ TEMPLATES = [
|
||||||
|
|
||||||
WSGI_APPLICATION = 'core.wsgi.application'
|
WSGI_APPLICATION = 'core.wsgi.application'
|
||||||
|
|
||||||
|
DATABASE_FILE = Path(OUTPUT_DIR) / SQL_INDEX_FILENAME
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': str(Path(OUTPUT_DIR) / SQL_INDEX_FILENAME),
|
'NAME': str(DATABASE_FILE),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ def chmod_file(path: str, cwd: str='.', permissions: str=OUTPUT_PERMISSIONS) ->
|
||||||
|
|
||||||
|
|
||||||
@enforce_types
|
@enforce_types
|
||||||
def copy_and_overwrite(from_path: str, to_path: str):
|
def copy_and_overwrite(from_path: Union[str, Path], to_path: Union[str, Path]):
|
||||||
"""copy a given file or directory to a given path, overwriting the destination"""
|
"""copy a given file or directory to a given path, overwriting the destination"""
|
||||||
if Path(from_path).is_dir():
|
if Path(from_path).is_dir():
|
||||||
shutil.rmtree(to_path, ignore_errors=True)
|
shutil.rmtree(to_path, ignore_errors=True)
|
||||||
|
@ -74,7 +74,7 @@ def copy_and_overwrite(from_path: str, to_path: str):
|
||||||
|
|
||||||
|
|
||||||
@enforce_types
|
@enforce_types
|
||||||
def get_dir_size(path: str, recursive: bool=True, pattern: Optional[str]=None) -> Tuple[int, int, int]:
|
def get_dir_size(path: Union[str, Path], recursive: bool=True, pattern: Optional[str]=None) -> Tuple[int, int, int]:
|
||||||
"""get the total disk size of a given directory, optionally summing up
|
"""get the total disk size of a given directory, optionally summing up
|
||||||
recursively and limiting to a given filter list
|
recursively and limiting to a given filter list
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue