monkey_wrench.input_output._types module
- monkey_wrench.input_output._types.ensure_path_does_not_end_with_slash(path: Path) Path[source]
Check that the path does not end with a slash, and therefore, it does not point to a directory.
- monkey_wrench.input_output._types.AbsolutePath
Type annotation and Pydantic validator to represent (convert to) an absolute and normalized path.
alias of
Annotated[PathType,AfterValidator(func=~monkey_wrench.input_output._types.)]
- monkey_wrench.input_output._types.ExistingFilePath
Type annotation and Pydantic validator for an existing file path.
Note
After the validation, the path will be normalized and made into an absolute path.
Warning
The path must not end with / or
\.alias of
Annotated[Path,PathType(path_type=file),AfterValidator(func=~monkey_wrench.input_output._types.),AfterValidator(func=ensure_path_does_not_end_with_slash)]
- monkey_wrench.input_output._types.NewFilePath
Type annotation and Pydantic validator for a non-existing file path.
Note
After the validation, the path will be normalized and made into an absolute path.
Warning
The path must not end with / or
\.alias of
Annotated[Path,PathType(path_type=new),AfterValidator(func=~monkey_wrench.input_output._types.),AfterValidator(func=ensure_path_does_not_end_with_slash)]
- monkey_wrench.input_output._types.ExistingDirectoryPath
Type annotation and Pydantic validator for an existing directory path.
Note
After the validation, the path will be normalized and made into an absolute path.
Note
The path can optionally end with / or
\.alias of
Annotated[Path,PathType(path_type=dir),AfterValidator(func=~monkey_wrench.input_output._types.)]
- monkey_wrench.input_output._types.NewDirectoryPath
Type annotation and Pydantic validator for a non-existing directory path.
Note
After the validation, the path will be normalized and made into an absolute path.
Note
The path can optionally end with / or
\.alias of
Annotated[Path,PathType(path_type=new),AfterValidator(func=~monkey_wrench.input_output._types.)]
- monkey_wrench.input_output._types.OpenMode
Type alias for the union of a literal
"a"(for appending to), or"w"(for overwriting an existing file).This only concerns ASCII (text) files.
alias of
Literal[‘w’, ‘a’]