df
Disk information.
Attributes
| Attribute | Type | Description |
|---|---|---|
| path | `str | bytes |
| total_blocks | float | The total size of the file system in kilobytes, calculated from the block count and fragment size. |
| available | float | The amount of free space available to unprivileged users in kilobytes. |
| capacity | int | The percentage of disk space currently in use, rounded up to the nearest integer. |
| stat | os.statvfs_result | The cached raw file system statistics obtained from the os.statvfs call for the specified path. |
Constructor
Signature
def df(
path: str | bytes | os.PathLike
) - > None
Parameters
| Name | Type | Description |
|---|---|---|
| path | `str | bytes |
Signature
def df(
path: str | bytes | os.PathLike
) - > None
Parameters
| Name | Type | Description |
|---|---|---|
| path | `str | bytes |
Methods
total_blocks()
@classmethod
def total_blocks() - > float
Calculates the total size of the filesystem in kilobytes.
Returns
| Type | Description |
|---|---|
float | The total capacity of the filesystem expressed in KB |
available()
@classmethod
def available() - > float
Calculates the amount of free space available to unprivileged users.
Returns
| Type | Description |
|---|---|
float | The available free space on the filesystem expressed in KB |
capacity()
@classmethod
def capacity() - > int
Calculates the percentage of disk space currently in use.
Returns
| Type | Description |
|---|---|
int | The usage percentage rounded up to the nearest integer |
stat()
@classmethod
def stat() - > os.statvfs_result
Retrieves the raw filesystem statistics using the statvfs system call.
Returns
| Type | Description |
|---|---|
os.statvfs_result | An object containing low-level filesystem attributes like block size and counts |