MCPcopy Create free account
hub / github.com/datapane/datapane / __init__

Method __init__

python-client/src/datapane/blocks/asset.py:90–118  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

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
121class Plot(AssetBlock):

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected