Way3: A Python Module for File Operations
Way3 is a Python module for performing file operations such as creating, appending to, and deleting files. It provides a convenient and easy-to-use interface for performing file operations.
Installation
To install Way3, you can use pip:
pip install way3
or use poetry:
poetry add way3
Usage
Here are the functions provided by Way3:
create_file(file_name: str, content: str, file_path: Union[str, os.PathLike] = ".", force_rewrite: bool = True) -> tuple[bool, str]
Creates a new file with the given file name and content. If the file already exists and force_rewrite is set to True, the file will be overwritten.
Example:
import way3
result = way3.create_file("test.txt", "test")
print(result[1]) # prints the absolute path of the created file
add_to_file_end(file_name: str, content: str, file_path: Union[str, os.PathLike] = ".", create_if_not_exist: bool = True) -> tuple[bool, str]
Appends the given content to the end of the file with the given file name. If the file does not exist and create_if_not_exist is set to True, a new file will be created.
Example:
import way3
result = way3.add_to_file_end("test.txt", "test")
print(result[1]) # prints the absolute path of the file
delete_file(file_name: str, file_path: Union[str, os.PathLike] = ".") -> tuple[bool, str]
Deletes the file with the given file name.
Example:
import way3
result = way3.delete_file("test.txt")
print(result[1]) # prints the absolute path of the deleted file
get_current_dir(instance=file) -> str
Returns the current working directory.
Example:
import way3
result = way3.get_current_dir()
print(result) # prints the current working directory
create_directory(directory_name: str, directory_path: Union[str, os.PathLike] = ".") -> str
Creates a new directory with the given name.
Example:
import way3
result = way3.create_directory("my_directory")
print(result) # prints the absolute path of the created directory
rename_directory(original_name: str, new_name: str) -> str
Renames a directory with a new name.
Example:
import way3
result = way3.rename_directory("old_directory", "new_directory")
print(result) # prints the absolute path of the renamed directory
delete_directory(directory_name: str, directory_path: Union[str, os.PathLike] = ".") -> str
Deletes a directory and all its contents.
Example:
import way3
result = way3.delete_directory("my_directory")
print(result) # prints the absolute path of the deleted directory
Let me know if you need any further modifications!
Testing
To run the tests, you can use the following command:
python3 -m unittest discover -s tests
License
Way3 is released under the MIT License. See LICENSE for details.
I hope you find Way3 useful! If you have any questions or feedback, please open an issue or pull request.
Metadata
Release files for way3 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| way3-1.0.4.tar.gz | 10.6 kB | Without provenance | Details for way3-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| way3-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for way3-1.0.4-py3-none-any.whl |
Total release size: 24.5 kB
Release files / way3-1.0.4.tar.gz
| Download URL | way3-1.0.4.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0c3d11460c77b104d6195ae489e4943eaf3511d21934fc7ab0631ff6e6d3457
|
|
BLAKE2b-256 checksum How to use checksums |
d989ba193f93bbdb1c78be54ad1b95049a9cbfd688b352680be19ea9de86c7e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.6
|
Release files / way3-1.0.4-py3-none-any.whl
| Download URL | way3-1.0.4-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efc0e212e75d692a4a7cf2a734ce996f05adfa41a3bc2127b52811615cc8eb8d
|
|
BLAKE2b-256 checksum How to use checksums |
8683fc2eb727e05a58bc32afd6b7fab527ee43d4df42b32eb466bc3d66a89f1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.6
|
Security for way3 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.