file ¶
Functions:
-
add_script_path_hook– -
check_perms–Confirm whether the user has write/read access to a file.
-
get_script_path– -
get_user_data_dir–Get user data dir path.
-
remove_script_path_hook–
add_script_path_hook ¶
Source code in jetpytools/utils/file.py
22 23 | |
check_perms ¶
check_perms(
file: FilePathType,
mode: OpenTextMode | OpenBinaryMode,
strict: bool = False,
*,
func: FuncExcept | None = None
) -> bool
Confirm whether the user has write/read access to a file.
Parameters:
-
(file¶FilePathType) –Path to file.
-
(mode¶OpenTextMode | OpenBinaryMode) –Read/Write mode.
-
(func¶FuncExcept | None, default:None) –Function that this was called from, only useful to *func writers.
:param: True if the user has write/read access, else False.
Raises:
-
FileNotExistsError–File could not be found.
-
FilePermissionError–User does not have access to the file.
-
FileIsADirectoryError–Given path is a directory, not a file.
-
FileWasNotFoundError–Parent directories exist, but the given file could not be found.
Source code in jetpytools/utils/file.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
get_script_path ¶
get_script_path() -> SPath
Source code in jetpytools/utils/file.py
30 31 32 33 34 35 36 37 38 39 40 41 | |
get_user_data_dir ¶
get_user_data_dir() -> Path
Get user data dir path.
Source code in jetpytools/utils/file.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |