fix: Re-add typings with conditional import to avoid circular import issue
This commit is contained in:
parent
75e5a6fcdc
commit
834b33e6a8
1 changed files with 9 additions and 6 deletions
|
@ -11,7 +11,10 @@ from multiprocessing import Process
|
|||
|
||||
from datetime import datetime
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional, List, Dict, Union, IO
|
||||
from typing import Optional, List, Dict, Union, IO, TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .index.schema import Link, ArchiveResult
|
||||
|
||||
from .util import enforce_types
|
||||
from .config import (
|
||||
|
@ -282,7 +285,7 @@ def log_archiving_finished(num_links: int):
|
|||
print(' archivebox server')
|
||||
|
||||
|
||||
def log_link_archiving_started(link, link_dir: str, is_new: bool):
|
||||
def log_link_archiving_started(link: "Link", link_dir: str, is_new: bool):
|
||||
# [*] [2019-03-22 13:46:45] "Log Structured Merge Trees - ben stopford"
|
||||
# http://www.benstopford.com/2015/02/14/log-structured-merge-trees/
|
||||
# > output/archive/1478739709
|
||||
|
@ -300,7 +303,7 @@ def log_link_archiving_started(link, link_dir: str, is_new: bool):
|
|||
pretty_path(link_dir),
|
||||
))
|
||||
|
||||
def log_link_archiving_finished(link, link_dir: str, is_new: bool, stats: dict):
|
||||
def log_link_archiving_finished(link: "Link", link_dir: str, is_new: bool, stats: dict):
|
||||
total = sum(stats.values())
|
||||
|
||||
if stats['failed'] > 0 :
|
||||
|
@ -315,7 +318,7 @@ def log_archive_method_started(method: str):
|
|||
print(' > {}'.format(method))
|
||||
|
||||
|
||||
def log_archive_method_finished(result):
|
||||
def log_archive_method_finished(result: "ArchiveResult"):
|
||||
"""quote the argument with whitespace in a command so the user can
|
||||
copy-paste the outputted string directly to run the cmd
|
||||
"""
|
||||
|
@ -372,7 +375,7 @@ def log_list_finished(links):
|
|||
print()
|
||||
|
||||
|
||||
def log_removal_started(links, yes: bool, delete: bool):
|
||||
def log_removal_started(links: List["Link"], yes: bool, delete: bool):
|
||||
print('{lightyellow}[i] Found {} matching URLs to remove.{reset}'.format(len(links), **ANSI))
|
||||
if delete:
|
||||
file_counts = [link.num_outputs for link in links if os.path.exists(link.link_dir)]
|
||||
|
@ -446,7 +449,7 @@ def printable_filesize(num_bytes: Union[int, float]) -> str:
|
|||
|
||||
|
||||
@enforce_types
|
||||
def printable_folders(folders,
|
||||
def printable_folders(folders: Dict[str, Optional["Link"]],
|
||||
json: bool=False,
|
||||
csv: Optional[str]=None) -> str:
|
||||
if json:
|
||||
|
|
Loading…
Reference in a new issue