FileOutput¶
Bases: OutputElement
value: str
property
¶
Returns:
Type | Description |
---|---|
str
|
The path or list of paths for the output file(s): if paths are not absolute, then |
str
|
they are considered relative to the data output folder. See |
str
|
Best Practices With Data for more information. |
__init__(key, value, label=None, tags=None, kwargs)
¶
Basic information about the file, such as size and file path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
ID of the element. It must be unique as it is the key used to story data in
Project(), otherwise it will lead to conflicts at runtime in both execution and
Streamlit modes. The key will be transformed into snake case and slugified to avoid
any special character or whitespace. Note that an ID cannot start with |
required |
value |
str
|
Path to the output file. Unless absolute, a path is relative to the |
required |
label |
Optional[str]
|
Typically to be used by Streamlit for display purpose only. If not defined, it
will default to the |
None
|
tags |
Optional[List[str]]
|
Optional meta-data information about the expected file. This information is only used when the JSON output attributes are written to the output manifest. |
None
|
**kwargs |
Any
|
Extra user meta-data to attach to the element. Argument names cannot overwrite
existing attributes or methods name such as |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
if the |
AttributeError
|
if one the |
Example
from onecode import file_output, Mode, Project
Project().mode = Mode.CONSOLE
widget = file_output(
key="FileOutput",
value="/path/to/file.txt",
label="My FileOutput",
tags=['TXT']
)
print(widget)
"/path/to/file.txt"
_validate(value)
¶
No validation is performed.
streamlit()
staticmethod
¶
Returns:
Type | Description |
---|---|
str
|
The Streamlit code to show the basic output file information as text. |