update comment

This commit is contained in:
seehi 2024-08-14 16:07:24 +08:00
parent a7f0a387f7
commit 6be9e10175
3 changed files with 4 additions and 4 deletions

View file

@ -121,7 +121,7 @@ class SerializationMixin(BaseModel, extra="forbid"):
if class_type is None:
# TODO could try dynamic import
raise TypeError("Trying to instantiate {class_full_name}, which has not yet been defined!")
raise TypeError(f"Trying to instantiate {class_full_name}, which has not yet been defined!")
return class_type(**value)

View file

@ -75,7 +75,7 @@ class Browser(BaseModel):
page: Optional[Page] = None
accessibility_tree: list = Field(default_factory=list)
headless: bool = True
proxy: Optional[str] = Field(default_factory=get_proxy_from_env)
proxy: Optional[dict] = Field(default_factory=get_proxy_from_env)
is_empty_page: bool = True
reporter: BrowserReporter = Field(default_factory=BrowserReporter)

View file

@ -566,7 +566,7 @@ def general_after_log(i: "loguru.Logger", sec_format: str = "%0.3f") -> Callable
return log_it
def read_json_file(json_file: str, encoding="utf-8") -> list[Any]:
def read_json_file(json_file: str, encoding: str = "utf-8") -> list[Any]:
if not Path(json_file).exists():
raise FileNotFoundError(f"json_file: {json_file} not exist, return []")
@ -595,7 +595,7 @@ def handle_unknown_serialization(x: Any) -> str:
return f"<Unserializable {type(x).__name__} object>"
def write_json_file(json_file: str, data: Any, encoding: str = None, indent: int = 4, use_fallback: bool = False):
def write_json_file(json_file: str, data: Any, encoding: str = "utf-8", indent: int = 4, use_fallback: bool = False):
folder_path = Path(json_file).parent
if not folder_path.exists():
folder_path.mkdir(parents=True, exist_ok=True)