Observed since 20 Oct, 19:51 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
ArrowDrive is a Python module that allows you to create and manage virtual disks. The module ensures that the virtual disk's size does not exceed a specified maximum limit.
ArrowDrive is available on PyPI. You can install it using pip:
pip install adrv
Alternatively, you can clone the repository:
git clone https://github.com/arr-setup/arrowdrive.git
Create a new instance of the Disk class:
import adrv
disk = adrv.Disk(name='myDisk', path='./disks', max_size=1000 ** 2)
adrv.Disk(name: str = 'vDisk', path: str = './', max_size: int = 1000 ** 2)Initializes a Disk instance.
read(vPath: str) -> FileResponseReads a file from the disk.
write(vPath: str, content: str | bytes = b'', mode: str = 'a') -> intWrites content to a file in the disk.
delete(vPath: str) -> intDeletes a file from the disk.
format_disk(modelPath: str | None = None)Formats the disk. Optionally, a model path can be provided to initialize the disk with predefined files.
extract_all(target: str)Extracts all files from the disk to a target directory.
f_list(include_ts: bool = False, sys: bool = False) -> list[str | dict]Lists files in the disk.
diagnosis(snooze: bool = False) -> DiagnoseResponseEvaluates the health of the disk.
import adrv
# Create a new disk
disk = adrv.Disk(name='myDisk', path='./storage', max_size=1000**2)
# Write a file
disk.write('hello.txt', 'Hello, world!', mode='w')
# Read a file
file = disk.read('hello.txt')
print(file.content.decode())
# List files
files = disk.f_list()
print(files)
# Delete a file
disk.delete('hello.txt')
The module raises specific exceptions for different error conditions:
FileIsDirectoryError: Raised when attempting to read a directory as a file.FileNotFoundError: Raised when a file is not found.FullDiskError: Raised when attempting to write content that exceeds the disk's maximum size.BrokenDiskError: Raised when the disk is detected to be in a corrupted state.utils.parserparse(data: str, keys: list, mode: int = 1) -> list | dict | list[dict]Parses the provided data string into different formats based on the mode.
1: Splits data by new lines and zips with keys.2: Splits data by new lines and then by '=' for key-value pairs.3: Splits data by '::' and optionally zips with keys.4: Splits data by new lines.Returns a list, dictionary, or list of dictionaries based on the mode.
unparse(data, mode: int = 1) -> strUnparses data into a string based on the mode.
1: Joins values with new lines.2: Joins key-value pairs with '=' and new lines.3: Joins dictionary values with '::'.4: Joins list items with new lines.Returns the unparsed string.
utils.unitsSizeA class to handle size representation and conversion.
init(value: int | float)
literal() -> str
units: 1 byte.kilo: 1 kilobyte (1,000 bytes).mega: 1 megabyte (1,000,000 bytes).giga: 1 gigabyte (1,000,000,000 bytes).tera: 1 terabyte (1,000,000,000,000 bytes).convert(val: float, _from: str, _to: str) -> floatConverts a value from one unit to another.
Returns the converted value.
bridgePhysicalBridgeA class to handle physical file transfer to and from the virtual disk.
init(disk: Disk)
bring(vPath: str, newPath: str)
send(filePath: str, vPath: str)
VirtualBridgeA class to handle file transfer between two virtual disks.
init(firstDisk: Disk, secondDisk: Disk)
cross(targetPath: str, finalPath: str = '/shore', rtl: bool = False)
True, transfers from the second disk to the first; otherwise, transfers from the first to the second.Contributions are welcome! Please submit a pull request or open an issue to discuss any changes.
This project is licensed under the GPLv3 License.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 2.0.0 | 19 Sept 2024 | 0 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 19:51 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:cf24a11581f2ab9121015fa46605db0956c5356e83b710a2c87c23005404a708