Args: data: A python object to attach to the report (e.g. a dictionary) file: Path to a file to attach to the report (e.g. a csv file) filename: Name to be used when downloading the file (optional) caption: A caption to display below the file
(
self,
data: t.Optional[t.Any] = None,
file: t.Optional[NPath] = None,
filename: t.Optional[str] = None,
caption: t.Optional[str] = None,
name: BlockId = None,
label: str = None,
)
| 88 | _tag = "Attachment" |
| 89 | |
| 90 | def __init__( |
| 91 | self, |
| 92 | data: t.Optional[t.Any] = None, |
| 93 | file: t.Optional[NPath] = None, |
| 94 | filename: t.Optional[str] = None, |
| 95 | caption: t.Optional[str] = None, |
| 96 | name: BlockId = None, |
| 97 | label: str = None, |
| 98 | ): |
| 99 | """ |
| 100 | Args: |
| 101 | data: A python object to attach to the report (e.g. a dictionary) |
| 102 | file: Path to a file to attach to the report (e.g. a csv file) |
| 103 | filename: Name to be used when downloading the file (optional) |
| 104 | caption: A caption to display below the file (optional) |
| 105 | name: A unique name for the block to reference when adding text or embedding (optional) |
| 106 | label: A label used when displaying the block (optional) |
| 107 | |
| 108 | !!! note |
| 109 | |
| 110 | Either `data` or `file` must be provided |
| 111 | """ |
| 112 | if file: |
| 113 | file = Path(file).expanduser() |
| 114 | filename = filename or file.name |
| 115 | elif data: |
| 116 | filename = filename or "test.data" |
| 117 | |
| 118 | super().__init__(data=data, file=file, filename=filename, name=name, caption=caption, label=label) |
| 119 | |
| 120 | |
| 121 | class Plot(AssetBlock): |