dara-components 1.21.9__py3-none-any.whl → 1.21.23__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. dara/components/__init__.py +2 -1
  2. dara/components/common/accordion.py +11 -17
  3. dara/components/common/anchor.py +6 -5
  4. dara/components/common/base_component.py +5 -5
  5. dara/components/common/bullet_list.py +1 -3
  6. dara/components/common/button.py +11 -6
  7. dara/components/common/button_bar.py +6 -6
  8. dara/components/common/card.py +3 -5
  9. dara/components/common/carousel.py +5 -5
  10. dara/components/common/checkbox_group.py +8 -8
  11. dara/components/common/code.py +3 -3
  12. dara/components/common/component_select_list.py +6 -8
  13. dara/components/common/datepicker.py +6 -6
  14. dara/components/common/dropdown_menu.py +9 -9
  15. dara/components/common/dropzone.py +11 -14
  16. dara/components/common/form.py +3 -5
  17. dara/components/common/form_page.py +2 -4
  18. dara/components/common/grid.py +13 -13
  19. dara/components/common/heading.py +2 -3
  20. dara/components/common/icon.py +1 -3
  21. dara/components/common/if_cmp.py +8 -8
  22. dara/components/common/input.py +5 -7
  23. dara/components/common/label.py +3 -5
  24. dara/components/common/markdown.py +2 -4
  25. dara/components/common/overlay.py +1 -3
  26. dara/components/common/progress_bar.py +2 -4
  27. dara/components/common/radio_group.py +8 -8
  28. dara/components/common/select.py +10 -10
  29. dara/components/common/slider.py +11 -11
  30. dara/components/common/spacer.py +2 -4
  31. dara/components/common/stack.py +3 -4
  32. dara/components/common/switch.py +3 -5
  33. dara/components/common/tabbed_card.py +2 -4
  34. dara/components/common/table.py +38 -34
  35. dara/components/common/text.py +3 -5
  36. dara/components/common/textarea.py +5 -5
  37. dara/components/common/time_utils.py +1 -2
  38. dara/components/common/tooltip.py +3 -5
  39. dara/components/common/utils.py +22 -22
  40. dara/components/graphs/components/base_graph_component.py +19 -19
  41. dara/components/graphs/components/causal_graph_viewer.py +2 -4
  42. dara/components/graphs/components/edge_encoder.py +13 -13
  43. dara/components/graphs/components/node_hierarchy_builder.py +12 -12
  44. dara/components/graphs/definitions.py +21 -16
  45. dara/components/graphs/graph_layout.py +36 -37
  46. dara/components/plotting/bokeh/bokeh.py +5 -5
  47. dara/components/plotting/bokeh/utils.py +1 -3
  48. dara/components/plotting/plotly/plotly.py +8 -8
  49. dara/components/plotting/plotly/themes.py +3 -3
  50. dara/components/smart/chat/config.py +1 -1
  51. dara/components/smart/chat/types.py +3 -5
  52. dara/components/smart/code_editor/code_editor.py +2 -2
  53. dara/components/smart/code_editor/util.py +4 -4
  54. dara/components/smart/data_slicer/data_slicer.py +4 -6
  55. dara/components/smart/data_slicer/data_slicer_modal.py +1 -3
  56. dara/components/smart/data_slicer/extension/data_slicer_filter.py +2 -3
  57. dara/components/smart/data_slicer/extension/filter_status_button.py +1 -3
  58. dara/components/smart/data_slicer/utils/core.py +14 -14
  59. dara/components/smart/data_slicer/utils/data_preview.py +1 -3
  60. dara/components/smart/hierarchy.py +5 -5
  61. dara/components/umd/dara.components.umd.js +116 -38
  62. {dara_components-1.21.9.dist-info → dara_components-1.21.23.dist-info}/METADATA +4 -5
  63. dara_components-1.21.23.dist-info/RECORD +87 -0
  64. dara_components-1.21.9.dist-info/RECORD +0 -87
  65. {dara_components-1.21.9.dist-info → dara_components-1.21.23.dist-info}/LICENSE +0 -0
  66. {dara_components-1.21.9.dist-info → dara_components-1.21.23.dist-info}/WHEEL +0 -0
@@ -17,7 +17,7 @@ limitations under the License.
17
17
 
18
18
  import os
19
19
  from enum import Enum
20
- from typing import Any, Optional, Union
20
+ from typing import Any
21
21
 
22
22
  from dara.core.base_definitions import DaraBaseModel as BaseModel
23
23
  from dara.core.definitions import ComponentInstanceType
@@ -26,7 +26,7 @@ from dara.core.definitions import ComponentInstanceType
26
26
  class ItemBadge(BaseModel):
27
27
  """Add a badge to an item in a list"""
28
28
 
29
- color: Optional[str] = None
29
+ color: str | None = None
30
30
  label: str
31
31
 
32
32
 
@@ -35,17 +35,17 @@ class Item(BaseModel):
35
35
  A class for serializing a list of options for the select to show
36
36
  """
37
37
 
38
- badge: Optional[ItemBadge] = None
39
- image: Optional[str] = None
38
+ badge: ItemBadge | None = None
39
+ image: str | None = None
40
40
  label: str
41
- value: Union[str, int, float, BaseModel]
41
+ value: str | int | float | BaseModel
42
42
 
43
43
  def __init__(
44
44
  self,
45
- value: Union[str, int, float, BaseModel],
45
+ value: str | int | float | BaseModel,
46
46
  label: str,
47
- badge: Optional[ItemBadge] = None,
48
- image: Optional[str] = None,
47
+ badge: ItemBadge | None = None,
48
+ image: str | None = None,
49
49
  ):
50
50
  # Handle general enums in the value field
51
51
  if isinstance(value, Enum):
@@ -98,23 +98,23 @@ class CarouselItem(BaseModel):
98
98
  :param image_width: Optional string containing the width the image should take
99
99
  """
100
100
 
101
- title: Optional[str] = None
102
- subtitle: Optional[str] = None
103
- component: Optional[ComponentInstanceType] = None
104
- image: Optional[str] = None
105
- image_alt: Optional[str] = None
106
- image_height: Optional[str] = None
107
- image_width: Optional[str] = None
101
+ title: str | None = None
102
+ subtitle: str | None = None
103
+ component: ComponentInstanceType | None = None
104
+ image: str | None = None
105
+ image_alt: str | None = None
106
+ image_height: str | None = None
107
+ image_width: str | None = None
108
108
 
109
109
  def __init__(
110
110
  self,
111
- title: Optional[str] = None,
112
- subtitle: Optional[str] = None,
113
- component: Optional[ComponentInstanceType] = None,
114
- image: Optional[str] = None,
115
- image_alt: Optional[str] = None,
116
- image_height: Optional[str] = None,
117
- image_width: Optional[str] = None,
111
+ title: str | None = None,
112
+ subtitle: str | None = None,
113
+ component: ComponentInstanceType | None = None,
114
+ image: str | None = None,
115
+ image_alt: str | None = None,
116
+ image_height: str | None = None,
117
+ image_width: str | None = None,
118
118
  ):
119
119
  super().__init__(
120
120
  title=title,
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
15
15
  limitations under the License.
16
16
  """
17
17
 
18
- from typing import Any, Dict, List, Optional, Union
18
+ from typing import Any
19
19
 
20
20
  from pydantic import ConfigDict, SerializerFunctionWrapHandler, field_serializer
21
21
 
@@ -57,24 +57,24 @@ class BaseGraphComponent(StyledComponentInstance):
57
57
  :param zoom_thresholds: Optional user-defined zoom thresholds. See [ZoomThresholds](../definitions/#zoomthresholds) for more details.
58
58
  """
59
59
 
60
- additional_legends: Optional[List[GraphLegend]] = None
61
- allow_selection_when_not_editable: Optional[bool] = False
62
- available_inputs: Optional[List[str]] = None
63
- default_legends: Dict[Union[EditorMode, str], List[GraphLegend]] = DEFAULT_LEGENDS
64
- disable_edge_add: Optional[bool] = None
65
- disable_latent_node_add: Optional[bool] = None
66
- disable_node_removal: Optional[bool] = None
67
- editable: Optional[bool] = False
68
- graph_layout: Optional[GraphLayout] = FcoseLayout()
69
- non_removable_nodes: Optional[List[str]] = None
70
- on_click_edge: Optional[Action] = None
71
- on_click_node: Optional[Action] = None
72
- on_update: Optional[Action] = None
73
- require_focus_to_zoom: Optional[bool] = True
74
- simultaneous_edge_node_selection: Optional[bool] = False
75
- tooltip_size: Optional[int] = None
76
- verbose_descriptions: Optional[bool] = None
77
- zoom_thresholds: Optional[ZoomThresholds] = None
60
+ additional_legends: list[GraphLegend] | None = None
61
+ allow_selection_when_not_editable: bool | None = False
62
+ available_inputs: list[str] | None = None
63
+ default_legends: dict[EditorMode | str, list[GraphLegend]] = DEFAULT_LEGENDS
64
+ disable_edge_add: bool | None = None
65
+ disable_latent_node_add: bool | None = None
66
+ disable_node_removal: bool | None = None
67
+ editable: bool | None = False
68
+ graph_layout: GraphLayout | None = FcoseLayout()
69
+ non_removable_nodes: list[str] | None = None
70
+ on_click_edge: Action | None = None
71
+ on_click_node: Action | None = None
72
+ on_update: Action | None = None
73
+ require_focus_to_zoom: bool | None = True
74
+ simultaneous_edge_node_selection: bool | None = False
75
+ tooltip_size: int | None = None
76
+ verbose_descriptions: bool | None = None
77
+ zoom_thresholds: ZoomThresholds | None = None
78
78
 
79
79
  model_config = ConfigDict(
80
80
  arbitrary_types_allowed=True,
@@ -15,8 +15,6 @@ See the License for the specific language governing permissions and
15
15
  limitations under the License.
16
16
  """
17
17
 
18
- from typing import Optional, Union
19
-
20
18
  from pydantic import field_validator, model_validator
21
19
 
22
20
  from cai_causal_graph import CausalGraph, Skeleton
@@ -248,8 +246,8 @@ class CausalGraphViewer(BaseGraphComponent):
248
246
 
249
247
  js_module = '@darajs/components'
250
248
 
251
- causal_graph: Union[CausalGraph, DerivedVariable, Variable, dict, Skeleton]
252
- editor_mode: Optional[EditorMode] = None
249
+ causal_graph: CausalGraph | DerivedVariable | Variable | dict | Skeleton
250
+ editor_mode: EditorMode | None = None
253
251
 
254
252
  @field_validator('causal_graph')
255
253
  @classmethod
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
15
15
  limitations under the License.
16
16
  """
17
17
 
18
- from typing import Any, Dict, List, Optional, Union
18
+ from typing import Any
19
19
 
20
20
  from fastapi.encoders import jsonable_encoder
21
21
  from pydantic import (
@@ -129,18 +129,18 @@ class VisualEdgeEncoder(StyledComponentInstance):
129
129
 
130
130
  js_module = '@darajs/components'
131
131
 
132
- additional_legends: Optional[List[GraphLegend]] = None
133
- allow_selection_when_not_editable: Optional[bool] = False
134
- default_legends: Dict[Union[EditorMode, str], List[GraphLegend]] = DEFAULT_LEGENDS
135
- editable: Optional[bool] = False
136
- graph_layout: Optional[GraphLayout] = MarketingLayout()
137
- initial_constraints: Optional[Union[List[EdgeConstraint], ClientVariable]] = None
138
- nodes: Union[List[str], Dict[str, Node], ClientVariable]
139
- on_click_edge: Optional[Action] = None
140
- on_click_node: Optional[Action] = None
141
- on_update: Optional[Action] = None
142
- require_focus_to_zoom: Optional[bool] = True
143
- tooltip_size: Optional[str] = None
132
+ additional_legends: list[GraphLegend] | None = None
133
+ allow_selection_when_not_editable: bool | None = False
134
+ default_legends: dict[EditorMode | str, list[GraphLegend]] = DEFAULT_LEGENDS
135
+ editable: bool | None = False
136
+ graph_layout: GraphLayout | None = MarketingLayout()
137
+ initial_constraints: list[EdgeConstraint] | ClientVariable | None = None
138
+ nodes: list[str] | dict[str, Node] | ClientVariable
139
+ on_click_edge: Action | None = None
140
+ on_click_node: Action | None = None
141
+ on_update: Action | None = None
142
+ require_focus_to_zoom: bool | None = True
143
+ tooltip_size: str | None = None
144
144
 
145
145
  model_config = ConfigDict(
146
146
  arbitrary_types_allowed=True,
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
15
15
  limitations under the License.
16
16
  """
17
17
 
18
- from typing import Any, Dict, List, Optional, Union
18
+ from typing import Any, ClassVar
19
19
 
20
20
  from pydantic import field_validator
21
21
 
@@ -26,17 +26,17 @@ from dara.core.interactivity import ClientVariable
26
26
 
27
27
 
28
28
  class NodeMeta(BaseModel):
29
- label_size: Optional[int] = None
30
- wrap_text: Optional[bool] = None
31
- label: Optional[str] = None
32
- tooltip: Optional[Union[str, Dict[str, str]]] = None
29
+ label_size: int | None = None
30
+ wrap_text: bool | None = None
31
+ label: str | None = None
32
+ tooltip: str | dict[str, str] | None = None
33
33
 
34
34
 
35
35
  class Node(BaseModel):
36
36
  name: str
37
- meta: Optional[NodeMeta] = None
37
+ meta: NodeMeta | None = None
38
38
 
39
- Meta = NodeMeta
39
+ Meta: ClassVar[type[NodeMeta]] = NodeMeta
40
40
 
41
41
 
42
42
  class NodeHierarchyBuilder(StyledComponentInstance):
@@ -109,15 +109,15 @@ class NodeHierarchyBuilder(StyledComponentInstance):
109
109
  js_module = '@darajs/components'
110
110
 
111
111
  editable: bool = True
112
- nodes: Union[List[List[str]], List[str], List[Node], List[List[Node]], ClientVariable]
113
- node_font_size: Optional[int] = None
114
- node_size: Optional[int] = None
115
- on_update: Optional[Action] = None
112
+ nodes: list[list[str]] | list[str] | list[Node] | list[list[Node]] | ClientVariable
113
+ node_font_size: int | None = None
114
+ node_size: int | None = None
115
+ on_update: Action | None = None
116
116
  wrap_node_text: bool = True
117
117
 
118
118
  @field_validator('nodes')
119
119
  @classmethod
120
- def validate_nodes(cls, nodes: Any) -> Union[ClientVariable, List[List[str]], List[List[Node]]]:
120
+ def validate_nodes(cls, nodes: Any) -> ClientVariable | list[list[str]] | list[list[Node]]:
121
121
  if isinstance(nodes, ClientVariable):
122
122
  return nodes
123
123
  if not isinstance(nodes, list):
@@ -16,7 +16,7 @@ limitations under the License.
16
16
  """
17
17
 
18
18
  from enum import Enum
19
- from typing import ClassVar, Dict, List, Literal, Optional, Type, Union
19
+ from typing import ClassVar, Literal
20
20
 
21
21
  from pydantic import Field
22
22
 
@@ -49,12 +49,17 @@ class CenterSymbol(str, Enum):
49
49
  BIDIRECTED = 'bidirected'
50
50
 
51
51
 
52
+ EdgeLegendType = type['EdgeLegend']
53
+ SpacerLegendType = type['SpacerLegend']
54
+ NodeLegendType = type['NodeLegend']
55
+
56
+
52
57
  class Legend(BaseModel):
53
58
  type: str
54
59
 
55
- Edge: ClassVar[Type['EdgeLegend']]
56
- Spacer: ClassVar[Type['SpacerLegend']]
57
- Node: ClassVar[Type['NodeLegend']]
60
+ Edge: ClassVar[EdgeLegendType]
61
+ Spacer: ClassVar[SpacerLegendType]
62
+ Node: ClassVar[NodeLegendType]
58
63
 
59
64
 
60
65
  class SpacerLegend(Legend):
@@ -65,7 +70,7 @@ class SpacerLegend(Legend):
65
70
  """
66
71
 
67
72
  type: Literal['spacer'] = Field(default='spacer', frozen=True) # type: ignore
68
- label: Optional[str] = None
73
+ label: str | None = None
69
74
 
70
75
 
71
76
  class EdgeLegend(Legend):
@@ -80,11 +85,11 @@ class EdgeLegend(Legend):
80
85
  """
81
86
 
82
87
  type: Literal['edge'] = Field(default='edge', frozen=True) # type: ignore
83
- label: Optional[str] = None
84
- arrow_type: Optional[ArrowType] = ArrowType.NORMAL
85
- center_symbol: Optional[CenterSymbol] = CenterSymbol.NONE
86
- color: Optional[str] = 'theme.grey5'
87
- dash_array: Optional[str] = None
88
+ label: str | None = None
89
+ arrow_type: ArrowType | None = ArrowType.NORMAL
90
+ center_symbol: CenterSymbol | None = CenterSymbol.NONE
91
+ color: str | None = 'theme.grey5'
92
+ dash_array: str | None = None
88
93
 
89
94
 
90
95
  class NodeLegend(Legend):
@@ -97,25 +102,25 @@ class NodeLegend(Legend):
97
102
  """
98
103
 
99
104
  type: Literal['node'] = Field(default='node', frozen=True) # type: ignore
100
- label: Optional[str] = None
101
- color: Optional[str] = 'theme.blue4'
102
- highlight_color: Optional[str] = 'theme.primary'
105
+ label: str | None = None
106
+ color: str | None = 'theme.blue4'
107
+ highlight_color: str | None = 'theme.primary'
103
108
 
104
109
 
105
110
  Legend.Edge = EdgeLegend
106
111
  Legend.Spacer = SpacerLegend
107
112
  Legend.Node = NodeLegend
108
113
 
109
- GraphLegend = Union[EdgeLegend, SpacerLegend, NodeLegend]
114
+ GraphLegend = EdgeLegend | SpacerLegend | NodeLegend
110
115
 
111
- DEFAULT_NODE_LEGENDS: List[GraphLegend] = [
116
+ DEFAULT_NODE_LEGENDS: list[GraphLegend] = [
112
117
  Legend.Node(color='theme.blue1', label='Latent'),
113
118
  Legend.Node(color='theme.secondary', label='Target'),
114
119
  Legend.Node(label='Other'),
115
120
  ]
116
121
 
117
122
  # Default legends for each editor mode
118
- DEFAULT_LEGENDS: Dict[Union[EditorMode, str], List[GraphLegend]] = {
123
+ DEFAULT_LEGENDS: dict[EditorMode | str, list[GraphLegend]] = {
119
124
  EditorMode.DEFAULT: DEFAULT_NODE_LEGENDS,
120
125
  EditorMode.PAG: [
121
126
  *DEFAULT_NODE_LEGENDS,
@@ -17,7 +17,6 @@ limitations under the License.
17
17
 
18
18
  import abc
19
19
  from enum import Enum
20
- from typing import List, Optional, Union
21
20
 
22
21
  from pydantic import Field
23
22
 
@@ -49,7 +48,7 @@ class LayeringAlgorithm(Enum):
49
48
  SIMPLEX = 'simplex'
50
49
 
51
50
 
52
- Number = Union[int, float]
51
+ Number = int | float
53
52
 
54
53
 
55
54
  class GraphLayout(BaseModel, abc.ABC):
@@ -60,8 +59,8 @@ class GraphLayout(BaseModel, abc.ABC):
60
59
  :param node_font_size: node font size in pixels
61
60
  """
62
61
 
63
- node_size: Optional[int] = None
64
- node_font_size: Optional[int] = None
62
+ node_size: int | None = None
63
+ node_font_size: int | None = None
65
64
 
66
65
 
67
66
  class TiersConfig(BaseModel):
@@ -77,8 +76,8 @@ class TiersConfig(BaseModel):
77
76
  """
78
77
 
79
78
  group: str
80
- order_nodes_by: Optional[str] = None
81
- rank: Optional[List[str]] = None
79
+ order_nodes_by: str | None = None
80
+ rank: list[str] | None = None
82
81
 
83
82
 
84
83
  class TieringLayout(BaseModel):
@@ -135,8 +134,8 @@ class TieringLayout(BaseModel):
135
134
  :param orientation: Orientation the tiers are displayed in default is horizontal
136
135
  """
137
136
 
138
- tiers: Optional[Union[TiersConfig, List[List[str]]]] = None
139
- orientation: Optional[DirectionType] = DirectionType.HORIZONTAL
137
+ tiers: TiersConfig | list[list[str]] | None = None
138
+ orientation: DirectionType | None = DirectionType.HORIZONTAL
140
139
 
141
140
 
142
141
  class GroupingLayout(BaseModel):
@@ -170,7 +169,7 @@ class GroupingLayout(BaseModel):
170
169
  :param group: Path within node to group property which defines the group it belong to,
171
170
  """
172
171
 
173
- group: Optional[str] = None
172
+ group: str | None = None
174
173
 
175
174
 
176
175
  class CircularLayout(GraphLayout):
@@ -232,16 +231,16 @@ class FcoseLayout(GraphLayout, TieringLayout, GroupingLayout):
232
231
 
233
232
  layout_type: GraphLayoutType = Field(default=GraphLayoutType.FCOSE, frozen=True)
234
233
 
235
- edge_elasticity: Optional[Number] = 0.45
236
- edge_length: Optional[Number] = 3
237
- energy: Optional[Number] = 0.1
238
- gravity: Optional[Number] = 35
239
- gravity_range: Optional[Number] = 80
240
- high_quality: Optional[bool] = True
241
- iterations: Optional[int] = 2500
242
- node_repulsion: Optional[Number] = 6_500
243
- node_separation: Optional[Number] = 75
244
- tier_separation: Optional[Number] = 200
234
+ edge_elasticity: Number | None = 0.45
235
+ edge_length: Number | None = 3
236
+ energy: Number | None = 0.1
237
+ gravity: Number | None = 35
238
+ gravity_range: Number | None = 80
239
+ high_quality: bool | None = True
240
+ iterations: int | None = 2500
241
+ node_repulsion: Number | None = 6_500
242
+ node_separation: Number | None = 75
243
+ tier_separation: Number | None = 200
245
244
 
246
245
 
247
246
  class ForceAtlasLayout(GraphLayout):
@@ -270,14 +269,14 @@ class ForceAtlasLayout(GraphLayout):
270
269
 
271
270
  layout_type: GraphLayoutType = Field(default=GraphLayoutType.FORCE_ATLAS, frozen=True)
272
271
 
273
- barnes_hut_optimize: Optional[bool] = False
274
- edge_weight_influence: Optional[Number] = 1
275
- gravity: Optional[Number] = 0.2
276
- iterations: Optional[int] = 10_000
277
- lin_log_mode: Optional[bool] = True
278
- outbound_attraction_distribution: Optional[bool] = True
279
- scaling_ratio: Optional[Number] = 8
280
- strong_gravity_mode: Optional[bool] = False
272
+ barnes_hut_optimize: bool | None = False
273
+ edge_weight_influence: Number | None = 1
274
+ gravity: Number | None = 0.2
275
+ iterations: int | None = 10_000
276
+ lin_log_mode: bool | None = True
277
+ outbound_attraction_distribution: bool | None = True
278
+ scaling_ratio: Number | None = 8
279
+ strong_gravity_mode: bool | None = False
281
280
 
282
281
 
283
282
  class MarketingLayout(GraphLayout, TieringLayout):
@@ -291,8 +290,8 @@ class MarketingLayout(GraphLayout, TieringLayout):
291
290
  """
292
291
 
293
292
  layout_type: GraphLayoutType = Field(default=GraphLayoutType.MARKETING, frozen=True)
294
- target_location: Optional[TargetLocation] = None
295
- tier_separation: Optional[Number] = 300
293
+ target_location: TargetLocation | None = None
294
+ tier_separation: Number | None = 300
296
295
 
297
296
 
298
297
  class PlanarLayout(GraphLayout, TieringLayout):
@@ -308,8 +307,8 @@ class PlanarLayout(GraphLayout, TieringLayout):
308
307
  """
309
308
 
310
309
  layout_type: GraphLayoutType = Field(default=GraphLayoutType.PLANAR, frozen=True)
311
- layering_algorithm: Optional[LayeringAlgorithm] = LayeringAlgorithm.SIMPLEX
312
- orientation: Optional[DirectionType] = None
310
+ layering_algorithm: LayeringAlgorithm | None = LayeringAlgorithm.SIMPLEX
311
+ orientation: DirectionType | None = None
313
312
 
314
313
 
315
314
  class SpringLayout(GraphLayout, TieringLayout, GroupingLayout):
@@ -329,9 +328,9 @@ class SpringLayout(GraphLayout, TieringLayout, GroupingLayout):
329
328
 
330
329
  layout_type: GraphLayoutType = Field(default=GraphLayoutType.SPRING, frozen=True)
331
330
 
332
- collision_force: Optional[Number] = 2
333
- gravity: Optional[Number] = -50
334
- link_force: Optional[Number] = 5
335
- warmup_ticks: Optional[Number] = 100
336
- tier_separation: Optional[Number] = 300
337
- group_repel_strength: Optional[Number] = 2000
331
+ collision_force: Number | None = 2
332
+ gravity: Number | None = -50
333
+ link_force: Number | None = 5
334
+ warmup_ticks: Number | None = 100
335
+ tier_separation: Number | None = 300
336
+ group_repel_strength: Number | None = 2000
@@ -16,7 +16,7 @@ limitations under the License.
16
16
  """
17
17
 
18
18
  from json import dumps
19
- from typing import Any, List, Optional, Tuple
19
+ from typing import Any
20
20
 
21
21
  from bokeh.document import Document
22
22
  from bokeh.themes import Theme
@@ -29,7 +29,7 @@ from dara.core.definitions import StyledComponentInstance
29
29
  SETTINGS = {'THEME': light_theme}
30
30
 
31
31
 
32
- def _get_theme(theme_input: Optional[dict]):
32
+ def _get_theme(theme_input: dict | None):
33
33
  if theme_input is not None:
34
34
  return Theme(json=theme_input)
35
35
  else:
@@ -52,7 +52,7 @@ class Bokeh(StyledComponentInstance):
52
52
  js_module = '@darajs/components'
53
53
 
54
54
  document: str
55
- events: Optional[List[Tuple[str, Action]]] = None
55
+ events: list[tuple[str, Action]] | None = None
56
56
 
57
57
  model_config = ConfigDict(arbitrary_types_allowed=True, use_enum_values=True)
58
58
 
@@ -60,8 +60,8 @@ class Bokeh(StyledComponentInstance):
60
60
  self,
61
61
  figure: Any = None,
62
62
  document: Any = None,
63
- theme: Optional[dict] = None,
64
- events: Optional[List[Tuple[str, Action]]] = None,
63
+ theme: dict | None = None,
64
+ events: list[tuple[str, Action]] | None = None,
65
65
  **kwargs,
66
66
  ):
67
67
  """
@@ -15,8 +15,6 @@ See the License for the specific language governing permissions and
15
15
  limitations under the License.
16
16
  """
17
17
 
18
- from typing import Union
19
-
20
18
  from bokeh.models import CustomJS
21
19
  from bokeh.plotting import figure
22
20
 
@@ -37,7 +35,7 @@ def figure_events(fig: figure):
37
35
  :param
38
36
  """
39
37
 
40
- def generate_event(args: Union[dict, None] = None):
38
+ def generate_event(args: dict | None = None):
41
39
  """
42
40
  Generate a CustomJS event with the code, event name and arguments provided
43
41
 
@@ -16,7 +16,7 @@ limitations under the License.
16
16
  """
17
17
 
18
18
  from enum import Enum
19
- from typing import Any, List, Optional
19
+ from typing import Any, ClassVar
20
20
 
21
21
  import plotly.graph_objects as go
22
22
  import plotly.io as pio
@@ -80,8 +80,8 @@ class PlotlyEvent(BaseModel):
80
80
  """
81
81
 
82
82
  event_name: PlotlyEventName
83
- actions: Optional[List[Action]] = None
84
- custom_js: Optional[str] = None
83
+ actions: list[Action] | None = None
84
+ custom_js: str | None = None
85
85
 
86
86
 
87
87
  class Plotly(StyledComponentInstance):
@@ -112,10 +112,10 @@ class Plotly(StyledComponentInstance):
112
112
  js_module = '@darajs/components'
113
113
 
114
114
  figure: str
115
- events: Optional[List[PlotlyEvent]] = None
115
+ events: list[PlotlyEvent] | None = None
116
116
 
117
- EventName = PlotlyEventName
118
- Event = PlotlyEvent
117
+ EventName: ClassVar[type[PlotlyEventName]] = PlotlyEventName
118
+ Event: ClassVar[type[PlotlyEvent]] = PlotlyEvent
119
119
 
120
120
  model_config = ConfigDict(
121
121
  arbitrary_types_allowed=True,
@@ -125,8 +125,8 @@ class Plotly(StyledComponentInstance):
125
125
  def __init__(
126
126
  self,
127
127
  figure: Any = None,
128
- theme: Optional[dict] = None,
129
- events: Optional[List[PlotlyEvent]] = None,
128
+ theme: dict | None = None,
129
+ events: list[PlotlyEvent] | None = None,
130
130
  **kwargs,
131
131
  ):
132
132
  if theme is None and figure is not None:
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
15
15
  limitations under the License.
16
16
  """
17
17
 
18
- from typing import Any, Dict
18
+ from typing import Any
19
19
 
20
20
  from dara.components.plotting.palettes import CategoricalDark10, CategoricalLight10
21
21
  from dara.core.visual.themes import dark, light
@@ -25,7 +25,7 @@ assert light_colors is not None
25
25
  dark_colors = dark.Dark.colors
26
26
  assert dark_colors is not None
27
27
 
28
- light_theme: Dict[str, Dict[str, Any]] = {
28
+ light_theme: dict[str, dict[str, Any]] = {
29
29
  'layout': {
30
30
  'paper_bgcolor': 'rgba(255,255,255,0)', # Set the background color of the plot
31
31
  'plot_bgcolor': 'rgba(255,255,255,0)', # Set the background color of the plot area
@@ -85,7 +85,7 @@ light_theme: Dict[str, Dict[str, Any]] = {
85
85
  },
86
86
  }
87
87
 
88
- dark_theme: Dict[str, Dict[str, Any]] = {
88
+ dark_theme: dict[str, dict[str, Any]] = {
89
89
  'layout': {
90
90
  'paper_bgcolor': 'rgba(255,255,255,0)', # Set the background color of the plot
91
91
  'plot_bgcolor': 'rgba(255,255,255,0)', # Set the background color of the plot area
@@ -2,7 +2,7 @@
2
2
  Copyright (c) 2023 by Impulse Innovations Ltd. Private and confidential. Part of the causaLens product.
3
3
  """
4
4
 
5
- from typing import Callable
5
+ from collections.abc import Callable
6
6
 
7
7
  from dara.components.smart.chat.types import NewMessageBody
8
8
  from dara.core.definitions import EndpointConfiguration
@@ -2,8 +2,6 @@
2
2
  Copyright (c) 2023 by Impulse Innovations Ltd. Private and confidential. Part of the causaLens product.
3
3
  """
4
4
 
5
- from typing import List, Optional
6
-
7
5
  from dara.core.base_definitions import DaraBaseModel as BaseModel
8
6
 
9
7
 
@@ -17,9 +15,9 @@ class ChatUserData(BaseModel):
17
15
  :param groups: list of groups user belongs to
18
16
  """
19
17
 
20
- id: Optional[str] = None
18
+ id: str | None = None
21
19
  name: str
22
- email: Optional[str] = None
20
+ email: str | None = None
23
21
 
24
22
 
25
23
  class ChatMessage(BaseModel):
@@ -50,5 +48,5 @@ class NewMessageBody(BaseModel):
50
48
  """
51
49
 
52
50
  app_url: str
53
- users: List[ChatUserData]
51
+ users: list[ChatUserData]
54
52
  content: ChatMessage
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
15
15
  limitations under the License.
16
16
  """
17
17
 
18
- from typing import Literal, Optional, Union
18
+ from typing import Literal
19
19
 
20
20
  from dara.core.definitions import StyledComponentInstance
21
21
  from dara.core.interactivity import ClientVariable
@@ -45,4 +45,4 @@ class CodeEditor(StyledComponentInstance):
45
45
 
46
46
  script: ClientVariable
47
47
 
48
- language: Optional[Union[Literal['json'], Literal['python'], Literal['markdown'], Literal['sql']]] = None
48
+ language: Literal['json'] | Literal['python'] | Literal['markdown'] | Literal['sql'] | None = None