pyflightstream.workspace.excel_bridge (stable)¶
Generated from the docstrings at build time: every one of the 6 names in the __all__ of pyflightstream.workspace.excel_bridge has an entry below. The names a guide or an example uses come first; the others follow under Advanced.
A text bridge for the embedded workbook controls; Excel remains the cell writer.
Used in the guides¶
pyflightstream.workspace.excel_bridge.main
¶
main(argv: list[str] | None = None) -> int
Handle one explicitly selected workbook bridge operation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
argv
|
list of str
|
The command-line arguments, |
None
|
Returns:
| Type | Description |
|---|---|
int
|
The exit code :func: |
Advanced¶
pyflightstream.workspace.excel_bridge.bridge
¶
bridge(
action: str, request: Path, response: Path, batch: Path
) -> int
Execute only the explicitly selected action and write a reviewable response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
action
|
str
|
|
required |
request
|
Path
|
The UTF-8 snapshot the workbook's macro wrote. |
required |
response
|
Path
|
Where the reviewable response is written. |
required |
batch
|
Path
|
The preview batch: written by |
required |
Returns:
| Type | Description |
|---|---|
int
|
0 when the action ran; 1 when it was refused, the reason written to the response and
nothing changed by the refused step, or when an apply stopped partway (its PARTIAL
record, and the cells and files it did write, are in the response). A refusal
is 1 here; |
pyflightstream.workspace.excel_bridge.escape
¶
escape(value: str) -> str
Encode delimiters without losing literal text or backslashes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
Literal text. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The text with backslashes, tabs, carriage returns and newlines escaped. |
pyflightstream.workspace.excel_bridge.preview_from_json
¶
preview_from_json(data: dict[str, Any]) -> SyncPreview
Reconstruct the captured synchronization decision without recomputing it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict of str to object
|
A preview as the batch file stores it. |
required |
Returns:
| Type | Description |
|---|---|
SyncPreview
|
The preview, its changes and mappings rebuilt as objects. |
Raises:
| Type | Description |
|---|---|
ExcelSyncError
|
If the batch does not hold a preview's fields. |
pyflightstream.workspace.excel_bridge.read_request
¶
read_request(
path: Path,
) -> tuple[dict[str, str], WorkbookSnapshot]
Read a UTF-8 snapshot written by VBA, never a workbook file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The snapshot file the workbook's macro wrote. |
required |
Returns:
| Type | Description |
|---|---|
tuple of (dict of str to str, WorkbookSnapshot)
|
The request's metadata and the workbook snapshot it carries. |
Raises:
| Type | Description |
|---|---|
ExcelSyncError
|
If the file holds a record kind this runtime does not know, or a record shorter than its kind or with a cell position that is not a number; the message names the line. |
pyflightstream.workspace.excel_bridge.unescape
¶
unescape(value: str) -> str
Decode the bridge's reversible text encoding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
Text :func: |
required |
Returns:
| Type | Description |
|---|---|
str
|
The literal text. |