Operations
provide.foundation.archive.operations
¶
TODO: Add module docstring.
Classes¶
ArchiveOperations
¶
Helper class for common archive operation patterns.
Provides convenient methods for common archive formats.
Functions¶
create_tar_bz2
staticmethod
¶
Create .tar.bz2 archive in one step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Path
|
Source file or directory |
required |
output
|
Path
|
Output path (should end with .tar.bz2) |
required |
deterministic
|
bool
|
Create reproducible archive |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to created archive |
Raises:
| Type | Description |
|---|---|
ArchiveError
|
If creation fails |
Source code in provide/foundation/archive/operations.py
create_tar_gz
staticmethod
¶
Create .tar.gz archive in one step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Path
|
Source file or directory |
required |
output
|
Path
|
Output path (should end with .tar.gz) |
required |
deterministic
|
bool
|
Create reproducible archive |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to created archive |
Raises:
| Type | Description |
|---|---|
ArchiveError
|
If creation fails |
Source code in provide/foundation/archive/operations.py
detect_format
staticmethod
¶
Detect archive format and return operation chain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
Path
|
File path to analyze |
required |
Returns:
| Type | Description |
|---|---|
list[ArchiveOperation]
|
List of operations needed to extract |
Raises:
| Type | Description |
|---|---|
ArchiveError
|
If format cannot be detected |
Source code in provide/foundation/archive/operations.py
extract_tar_bz2
staticmethod
¶
Extract .tar.bz2 archive in one step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
archive
|
Path
|
Archive path |
required |
output
|
Path
|
Output directory |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to extraction directory |
Raises:
| Type | Description |
|---|---|
ArchiveError
|
If extraction fails |
Source code in provide/foundation/archive/operations.py
extract_tar_gz
staticmethod
¶
Extract .tar.gz archive in one step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
archive
|
Path
|
Archive path |
required |
output
|
Path
|
Output directory |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to extraction directory |
Raises:
| Type | Description |
|---|---|
ArchiveError
|
If extraction fails |
Source code in provide/foundation/archive/operations.py
OperationChain
¶
Chain multiple archive operations together.
Enables complex operations like tar.gz, tar.bz2, etc. Operations are executed in order for creation, reversed for extraction.
Functions¶
execute
¶
Execute operation chain on source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Path
|
Source file or directory |
required |
output
|
Path
|
Final output path |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to final output |
Raises:
| Type | Description |
|---|---|
ArchiveError
|
If any operation fails |
Source code in provide/foundation/archive/operations.py
reverse
¶
Reverse operation chain (extract/decompress).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Path
|
Source archive |
required |
output
|
Path
|
Final output path |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to final output |
Raises:
| Type | Description |
|---|---|
ArchiveError
|
If any operation fails |