@@ -43,34 +43,34 @@ pip install python-backpack
4343
4444### File Utils (` backpack.file_utils ` )
4545
46- - ` replace_strings_in_file(ascii_file: str, strings: list , new_string: str) -> None `
46+ - ` replace_strings_in_file(ascii_file: str, strings: Sequence[str] , new_string: str) -> None `
4747 - Replaces multiple string occurrences in a text file.
48- - ` remove_line_from_file(ascii_file: str, strings: list , verbose: bool = False) -> None `
49- - Removes exact matching lines from a text file .
48+ - ` remove_line_from_file(ascii_file: str, strings: Sequence[str] , verbose: bool = False) -> None `
49+ - Removes every exact matching line while preserving retained line endings .
5050- ` file_is_writeable(filepath: str) -> bool `
5151 - Checks whether a file can be opened for read/write.
5252- ` get_version_from_filename(filename: str) -> str `
5353 - Extracts a numeric version token from a filename.
5454
5555### Folder Utils (` backpack.folder_utils ` )
5656
57- - ` browse_folder(folder: str) -> bool `
58- - Opens a folder in Windows Explorer.
59- - ` create_folders(folders: list , force_empty: bool = False, verbose: bool = False) `
57+ - ` browse_folder(folder: str | None ) -> bool `
58+ - Opens a valid folder in Windows Explorer and returns ` False ` if it cannot be opened .
59+ - ` create_folders(folders: Sequence[str] , force_empty: bool = False, verbose: bool = False) -> None `
6060 - Creates multiple folders.
61- - ` create_folder(path: str, force_empty: bool = False, verbose: bool = True) `
61+ - ` create_folder(path: str, force_empty: bool = False, verbose: bool = True) -> bool `
6262 - Creates a folder and optionally clears it if it already exists.
63- - ` remove_files_in_dir(path: str) `
63+ - ` remove_files_in_dir(path: str) -> None `
6464 - Removes all files and subdirectories inside a directory.
65- - ` recursive_dir_copy(source_path: str, target_path: str) `
65+ - ` recursive_dir_copy(source_path: str, target_path: str) -> None `
6666 - Recursively copies files and subfolders from source to target.
6767
6868### JSON Utils (` backpack.json_utils ` )
6969
7070- ` json_load(json_file: str) -> dict `
7171 - Loads JSON data from file with validation and error handling.
72- - ` json_save(data: dict , json_file: str) -> bool `
73- - Saves a dictionary to JSON file .
72+ - ` json_save(data: object , json_file: str) -> bool `
73+ - Saves a JSON-serializable value as UTF-8 and returns whether it succeeded .
7474
7575### JSON Metadata (` backpack.json_metadata ` )
7676
@@ -90,7 +90,7 @@ pip install python-backpack
9090- ` JsonUserSettings(folder: str, name: str) `
9191 - Saves and loads JSON settings in the current user's home directory.
9292 - Main public methods:
93- - ` save_settings(data: dict | None = None) -> bool | None `
93+ - ` save_settings(data: dict | None = None) -> bool `
9494 - ` load_settings() -> dict | bool `
9595
9696### Logger (` backpack.logger ` )
@@ -121,8 +121,8 @@ pip install python-backpack
121121
122122- ` random_string(length: int = 10) -> str `
123123 - Generates a random lowercase string.
124- - ` time_function_decorator(method: type) `
125- - Decorator that logs execution time.
124+ - ` time_function_decorator(method: Callable[P, R]) -> Callable[P, R] `
125+ - Decorator that logs execution time while preserving function metadata and return values .
126126
127127## Quick Example
128128
@@ -134,7 +134,7 @@ from backpack.json_utils import json_save, json_load
134134
135135@timed_lru_cache (seconds = 60 )
136136def expensive_call ():
137- return {' ok' : True }
137+ return {' ok' : True }
138138
139139
140140value = camelcase_to_snakecase(' HTTPServer' )
0 commit comments