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

Method __init__

python-client/src/datapane/blocks/base.py:38–54  ·  view source on GitHub ↗

Args: name: A unique name to reference the block, used when referencing blocks via the report editor and when embedding

(self, name: t.Optional[BlockId] = None, **kwargs: t.Any)

Source from the content-addressed store, hash-verified

36 _tag: str
37
38 def __init__(self, name: t.Optional[BlockId] = None, **kwargs: t.Any):
39 """
40 Args:
41 name: A unique name to reference the block, used when referencing blocks via the report editor and when embedding
42 """
43 self._block_name: str = self._tag.lower()
44 self.name = name
45
46 # validate name
47 if name and not is_valid_id(name):
48 raise DPClientError(f"Invalid name '{name}' for block")
49
50 self._attributes: t.Dict[str, str] = dict()
51 self._add_attributes(name=name, **kwargs)
52
53 self._truncate_strings(kwargs, "caption", 512)
54 self._truncate_strings(kwargs, "label", 256)
55
56 @staticmethod
57 def _truncate_strings(kwargs: dict, key: str, max_length: int):

Callers

nothing calls this directly

Calls 4

_add_attributesMethod · 0.95
_truncate_stringsMethod · 0.95
is_valid_idFunction · 0.90
DPClientErrorClass · 0.90

Tested by

no test coverage detected