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)
| 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): |
nothing calls this directly
no test coverage detected