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

Method __init__

python-client/src/datapane/blocks/text.py:44–60  ·  view source on GitHub ↗

Args: text: The markdown formatted text, use triple-quotes, (`\"\"\"# My Title\"\"\"`) to create multi-line markdown text file: Path to a file containing markdown text name: A unique name for the block to reference when adding text or embedding (optional)

(self, text: str = None, file: NPath = None, name: BlockId = None, label: str = None)

Source from the content-addressed store, hash-verified

42 _tag = "Text"
43
44 def __init__(self, text: str = None, file: NPath = None, name: BlockId = None, label: str = None):
45 """
46 Args:
47 text: The markdown formatted text, use triple-quotes, (`\"\"\"# My Title\"\"\"`) to create multi-line markdown text
48 file: Path to a file containing markdown text
49 name: A unique name for the block to reference when adding text or embedding (optional)
50 label: A label used when displaying the block (optional)
51
52 !!! note
53 File encodings are auto-detected, if this fails please read the file manually with an explicit encoding and use the text parameter on dp.Attachment
54 """
55 if text:
56 text = textwrap.dedent(text).strip()
57
58 assert text or file
59 content = text or utf_read_text(Path(file).expanduser())
60 super().__init__(content=content, name=name, label=label)
61
62 def format(self, *args: BlockOrPrimitive, **kwargs: BlockOrPrimitive) -> Group:
63 """

Callers 5

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 1

utf_read_textFunction · 0.90

Tested by

no test coverage detected