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
34 35 36 | |
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
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
get_script_path ¶
get_script_path() -> SPath
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
get_user_data_dir ¶
get_user_data_dir() -> Path
Get user data dir path.
Source code in jetpytools/utils/file.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |