Add files using upload-large-folder tool
Browse files- lib/python3.10/site-packages/dash/__pycache__/__init__.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/dash/__pycache__/_patch.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/dash/__pycache__/_utils.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/dash/__pycache__/_validate.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/dash/__pycache__/_watch.cpython-310.pyc +0 -0
- lib/python3.10/site-packages/dash/background_callback/__init__.py +6 -0
- lib/python3.10/site-packages/dash/background_callback/_proxy_set_props.py +18 -0
- lib/python3.10/site-packages/dash/dash_table/.gitkeep +0 -0
- lib/python3.10/site-packages/dash/dash_table/DataTable.py +1795 -0
- lib/python3.10/site-packages/dash/dash_table/async-table.js.LICENSE.txt +18 -0
- lib/python3.10/site-packages/dash/dash_table/async-table.js.map +0 -0
- lib/python3.10/site-packages/dash/dash_table/bundle.js +2 -0
- lib/python3.10/site-packages/dash/dash_table/bundle.js.map +0 -0
- lib/python3.10/site-packages/dash/dash_table/demo.js +0 -0
- lib/python3.10/site-packages/narwhals/_sql/dataframe.py +30 -0
- lib/python3.10/site-packages/narwhals/_sql/expr.py +730 -0
- lib/python3.10/site-packages/narwhals/_sql/group_by.py +42 -0
- lib/python3.10/site-packages/narwhals/_sql/namespace.py +74 -0
- lib/python3.10/site-packages/narwhals/_sql/typing.py +14 -0
- lib/python3.10/site-packages/narwhals/_sql/when_then.py +106 -0
lib/python3.10/site-packages/dash/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (1.76 kB). View file
|
|
|
lib/python3.10/site-packages/dash/__pycache__/_patch.cpython-310.pyc
ADDED
|
Binary file (6.14 kB). View file
|
|
|
lib/python3.10/site-packages/dash/__pycache__/_utils.cpython-310.pyc
ADDED
|
Binary file (12.1 kB). View file
|
|
|
lib/python3.10/site-packages/dash/__pycache__/_validate.cpython-310.pyc
ADDED
|
Binary file (17.4 kB). View file
|
|
|
lib/python3.10/site-packages/dash/__pycache__/_watch.cpython-310.pyc
ADDED
|
Binary file (1.29 kB). View file
|
|
|
lib/python3.10/site-packages/dash/background_callback/__init__.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .managers.celery_manager import ( # noqa: F401,E402
|
| 2 |
+
CeleryManager,
|
| 3 |
+
)
|
| 4 |
+
from .managers.diskcache_manager import ( # noqa: F401,E402
|
| 5 |
+
DiskcacheManager,
|
| 6 |
+
)
|
lib/python3.10/site-packages/dash/background_callback/_proxy_set_props.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class ProxySetProps(dict):
|
| 2 |
+
"""
|
| 3 |
+
Defer dictionary item setter to run a custom function on change.
|
| 4 |
+
Used by background callback manager to save the `set_props` data.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
def __init__(self, on_change):
|
| 8 |
+
super().__init__()
|
| 9 |
+
self.on_change = on_change
|
| 10 |
+
self._data = {}
|
| 11 |
+
|
| 12 |
+
def __setitem__(self, key, value):
|
| 13 |
+
self.on_change(key, value)
|
| 14 |
+
self._data.setdefault(key, {})
|
| 15 |
+
self._data[key] = {**self._data[key], **value}
|
| 16 |
+
|
| 17 |
+
def get(self, key, default=None):
|
| 18 |
+
return self._data.get(key, default)
|
lib/python3.10/site-packages/dash/dash_table/.gitkeep
ADDED
|
File without changes
|
lib/python3.10/site-packages/dash/dash_table/DataTable.py
ADDED
|
@@ -0,0 +1,1795 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AUTO GENERATED FILE - DO NOT EDIT
|
| 2 |
+
|
| 3 |
+
import typing # noqa: F401
|
| 4 |
+
from typing_extensions import TypedDict, NotRequired, Literal # noqa: F401
|
| 5 |
+
from dash.development.base_component import Component, _explicitize_args
|
| 6 |
+
|
| 7 |
+
ComponentType = typing.Union[
|
| 8 |
+
str,
|
| 9 |
+
int,
|
| 10 |
+
float,
|
| 11 |
+
Component,
|
| 12 |
+
None,
|
| 13 |
+
typing.Sequence[typing.Union[str, int, float, Component, None]],
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
NumberType = typing.Union[
|
| 17 |
+
typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex
|
| 18 |
+
]
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class DataTable(Component):
|
| 22 |
+
"""A DataTable component.
|
| 23 |
+
Dash DataTable is an interactive table component designed for
|
| 24 |
+
viewing, editing, and exploring large datasets.
|
| 25 |
+
DataTable is rendered with standard, semantic HTML <table/> markup,
|
| 26 |
+
which makes it accessible, responsive, and easy to style. This
|
| 27 |
+
component was written from scratch in React.js specifically for the
|
| 28 |
+
Dash community. Its API was designed to be ergonomic and its behavior
|
| 29 |
+
is completely customizable through its properties.
|
| 30 |
+
|
| 31 |
+
Keyword arguments:
|
| 32 |
+
|
| 33 |
+
- data (list of dicts with strings as keys and values of type string | number | boolean; optional):
|
| 34 |
+
The contents of the table. The keys of each item in data should
|
| 35 |
+
match the column IDs. Each item can also have an 'id' key, whose
|
| 36 |
+
value is its row ID. If there is a column with ID='id' this will
|
| 37 |
+
display the row ID, otherwise it is just used to reference the row
|
| 38 |
+
for selections, filtering, etc. Example: [ {'column-1': 4.5,
|
| 39 |
+
'column-2': 'montreal', 'column-3': 'canada'}, {'column-1':
|
| 40 |
+
8, 'column-2': 'boston', 'column-3': 'america'} ].
|
| 41 |
+
|
| 42 |
+
- columns (list of dicts; optional):
|
| 43 |
+
Columns describes various aspects about each individual column.
|
| 44 |
+
`name` and `id` are the only required parameters.
|
| 45 |
+
|
| 46 |
+
`columns` is a list of dicts with keys:
|
| 47 |
+
|
| 48 |
+
- id (string; required):
|
| 49 |
+
The `id` of the column. The column `id` is used to match cells
|
| 50 |
+
in data with particular columns. The `id` is not visible in
|
| 51 |
+
the table.
|
| 52 |
+
|
| 53 |
+
- name (string | list of strings; required):
|
| 54 |
+
The `name` of the column, as it appears in the column header.
|
| 55 |
+
If `name` is a list of strings, then the columns will render
|
| 56 |
+
with multiple headers rows.
|
| 57 |
+
|
| 58 |
+
- type (a value equal to: 'any', 'numeric', 'text', 'datetime'; optional):
|
| 59 |
+
The data-type provides support for per column typing and
|
| 60 |
+
allows for data validation and coercion. 'numeric': represents
|
| 61 |
+
both floats and ints. 'text': represents a string. 'datetime':
|
| 62 |
+
a string representing a date or date-time, in the form:
|
| 63 |
+
'YYYY-MM-DD HH:MM:SS.ssssss' or some truncation thereof. Years
|
| 64 |
+
must have 4 digits, unless you use `validation.allow_YY:
|
| 65 |
+
True`. Also accepts 'T' or 't' between date and time, and
|
| 66 |
+
allows timezone info at the end. To convert these strings to
|
| 67 |
+
Python `datetime` objects, use `dateutil.parser.isoparse`.
|
| 68 |
+
In R use `parse_iso_8601` from the `parsedate` library.
|
| 69 |
+
WARNING: these parsers do not work with 2-digit years, if you
|
| 70 |
+
use `validation.allow_YY: True` and do not coerce to 4-digit
|
| 71 |
+
years. And parsers that do work with 2-digit years may make
|
| 72 |
+
a different guess about the century than we make on the
|
| 73 |
+
front end. 'any': represents any type of data. Defaults to
|
| 74 |
+
'any' if undefined.
|
| 75 |
+
|
| 76 |
+
- presentation (a value equal to: 'input', 'dropdown', 'markdown'; optional):
|
| 77 |
+
The `presentation` to use to display data. Markdown can be
|
| 78 |
+
used on columns with type 'text'. See 'dropdown' for more
|
| 79 |
+
info. Defaults to 'input' for ['datetime', 'numeric', 'text',
|
| 80 |
+
'any'].
|
| 81 |
+
|
| 82 |
+
- selectable (a value equal to: 'first', 'last' | boolean | list of booleans; optional):
|
| 83 |
+
If True, the user can select the column by clicking on the
|
| 84 |
+
checkbox or radio button in the column. If there are multiple
|
| 85 |
+
header rows, True will display the input on each row. If
|
| 86 |
+
`last`, the input will only appear on the last header row. If
|
| 87 |
+
`first` it will only appear on the first header row. These are
|
| 88 |
+
respectively shortcut equivalents to `[False, ..., False,
|
| 89 |
+
True]` and `[True, False, ..., False]`. If there are merged,
|
| 90 |
+
multi-header columns then you can choose which column header
|
| 91 |
+
row to display the input in by supplying an array of booleans.
|
| 92 |
+
For example, `[True, False]` will display the `selectable`
|
| 93 |
+
input on the first row, but now on the second row. If the
|
| 94 |
+
`selectable` input appears on a merged columns, then clicking
|
| 95 |
+
on that input will select *all* of the merged columns
|
| 96 |
+
associated with it. The table-level prop `column_selectable`
|
| 97 |
+
is used to determine the type of column selection to use.
|
| 98 |
+
|
| 99 |
+
- clearable (a value equal to: 'first', 'last' | boolean | list of booleans; optional):
|
| 100 |
+
If True, the user can clear the column by clicking on the
|
| 101 |
+
`clear` action button on the column. If there are multiple
|
| 102 |
+
header rows, True will display the action button on each row.
|
| 103 |
+
If `last`, the `clear` action button will only appear on the
|
| 104 |
+
last header row. If `first` it will only appear on the first
|
| 105 |
+
header row. These are respectively shortcut equivalents to
|
| 106 |
+
`[False, ..., False, True]` and `[True, False, ..., False]`.
|
| 107 |
+
If there are merged, multi-header columns then you can choose
|
| 108 |
+
which column header row to display the `clear` action button
|
| 109 |
+
in by supplying an array of booleans. For example, `[True,
|
| 110 |
+
False]` will display the `clear` action button on the first
|
| 111 |
+
row, but not the second row. If the `clear` action button
|
| 112 |
+
appears on a merged column, then clicking on that button will
|
| 113 |
+
clear *all* of the merged columns associated with it. Unlike
|
| 114 |
+
`column.deletable`, this action does not remove the column(s)
|
| 115 |
+
from the table. It only removed the associated entries from
|
| 116 |
+
`data`.
|
| 117 |
+
|
| 118 |
+
- deletable (a value equal to: 'first', 'last' | boolean | list of booleans; optional):
|
| 119 |
+
If True, the user can remove the column by clicking on the
|
| 120 |
+
`delete` action button on the column. If there are multiple
|
| 121 |
+
header rows, True will display the action button on each row.
|
| 122 |
+
If `last`, the `delete` action button will only appear on the
|
| 123 |
+
last header row. If `first` it will only appear on the first
|
| 124 |
+
header row. These are respectively shortcut equivalents to
|
| 125 |
+
`[False, ..., False, True]` and `[True, False, ..., False]`.
|
| 126 |
+
If there are merged, multi-header columns then you can choose
|
| 127 |
+
which column header row to display the `delete` action button
|
| 128 |
+
in by supplying an array of booleans. For example, `[True,
|
| 129 |
+
False]` will display the `delete` action button on the first
|
| 130 |
+
row, but not the second row. If the `delete` action button
|
| 131 |
+
appears on a merged column, then clicking on that button will
|
| 132 |
+
remove *all* of the merged columns associated with it.
|
| 133 |
+
|
| 134 |
+
- editable (boolean; optional):
|
| 135 |
+
There are two `editable` flags in the table. This is the
|
| 136 |
+
column-level editable flag and there is also the table-level
|
| 137 |
+
`editable` flag. These flags determine whether the contents of
|
| 138 |
+
the table are editable or not. If the column-level `editable`
|
| 139 |
+
flag is set it overrides the table-level `editable` flag for
|
| 140 |
+
that column.
|
| 141 |
+
|
| 142 |
+
- hideable (a value equal to: 'first', 'last' | boolean | list of booleans; optional):
|
| 143 |
+
If True, the user can hide the column by clicking on the
|
| 144 |
+
`hide` action button on the column. If there are multiple
|
| 145 |
+
header rows, True will display the action button on each row.
|
| 146 |
+
If `last`, the `hide` action button will only appear on the
|
| 147 |
+
last header row. If `first` it will only appear on the first
|
| 148 |
+
header row. These are respectively shortcut equivalents to
|
| 149 |
+
`[False, ..., False, True]` and `[True, False, ..., False]`.
|
| 150 |
+
If there are merged, multi-header columns then you can choose
|
| 151 |
+
which column header row to display the `hide` action button in
|
| 152 |
+
by supplying an array of booleans. For example, `[True,
|
| 153 |
+
False]` will display the `hide` action button on the first
|
| 154 |
+
row, but not the second row. If the `hide` action button
|
| 155 |
+
appears on a merged column, then clicking on that button will
|
| 156 |
+
hide *all* of the merged columns associated with it.
|
| 157 |
+
|
| 158 |
+
- renamable (a value equal to: 'first', 'last' | boolean | list of booleans; optional):
|
| 159 |
+
If True, the user can rename the column by clicking on the
|
| 160 |
+
`rename` action button on the column. If there are multiple
|
| 161 |
+
header rows, True will display the action button on each row.
|
| 162 |
+
If `last`, the `rename` action button will only appear on the
|
| 163 |
+
last header row. If `first` it will only appear on the first
|
| 164 |
+
header row. These are respectively shortcut equivalents to
|
| 165 |
+
`[False, ..., False, True]` and `[True, False, ..., False]`.
|
| 166 |
+
If there are merged, multi-header columns then you can choose
|
| 167 |
+
which column header row to display the `rename` action button
|
| 168 |
+
in by supplying an array of booleans. For example, `[True,
|
| 169 |
+
False]` will display the `rename` action button on the first
|
| 170 |
+
row, but not the second row. If the `rename` action button
|
| 171 |
+
appears on a merged column, then clicking on that button will
|
| 172 |
+
rename *all* of the merged columns associated with it.
|
| 173 |
+
|
| 174 |
+
- filter_options (dict; optional):
|
| 175 |
+
There are two `filter_options` props in the table. This is the
|
| 176 |
+
column-level filter_options prop and there is also the
|
| 177 |
+
table-level `filter_options` prop. If the column-level
|
| 178 |
+
`filter_options` prop is set it overrides the table-level
|
| 179 |
+
`filter_options` prop for that column.
|
| 180 |
+
|
| 181 |
+
`filter_options` is a dict with keys:
|
| 182 |
+
|
| 183 |
+
- case (a value equal to: 'sensitive', 'insensitive'; optional):
|
| 184 |
+
(default: 'sensitive') Determine whether the applicable
|
| 185 |
+
filter relational operators will default to `sensitive` or
|
| 186 |
+
`insensitive` comparison.
|
| 187 |
+
|
| 188 |
+
- placeholder_text (string; optional):
|
| 189 |
+
(default: 'filter data...') The filter cell placeholder
|
| 190 |
+
text.
|
| 191 |
+
|
| 192 |
+
- format (dict; optional):
|
| 193 |
+
The formatting applied to the column's data. This prop is
|
| 194 |
+
derived from the [d3-format](https://github.com/d3/d3-format)
|
| 195 |
+
library specification. Apart from being structured slightly
|
| 196 |
+
differently (under a single prop), the usage is the same. See
|
| 197 |
+
also dash_table.FormatTemplate. It contains helper functions
|
| 198 |
+
for typical number formats.
|
| 199 |
+
|
| 200 |
+
`format` is a dict with keys:
|
| 201 |
+
|
| 202 |
+
- locale (dict; optional):
|
| 203 |
+
Represents localization specific formatting information.
|
| 204 |
+
When left unspecified, will use the default value provided
|
| 205 |
+
by d3-format.
|
| 206 |
+
|
| 207 |
+
`locale` is a dict with keys:
|
| 208 |
+
|
| 209 |
+
- symbol (list of strings; optional):
|
| 210 |
+
(default: ['$', '']). A list of two strings
|
| 211 |
+
representing the prefix and suffix symbols. Typically
|
| 212 |
+
used for currency, and implemented using d3's
|
| 213 |
+
currency format, but you can use this for other
|
| 214 |
+
symbols such as measurement units.
|
| 215 |
+
|
| 216 |
+
- decimal (string; optional):
|
| 217 |
+
(default: '.'). The string used for the decimal
|
| 218 |
+
separator.
|
| 219 |
+
|
| 220 |
+
- group (string; optional):
|
| 221 |
+
(default: ','). The string used for the groups
|
| 222 |
+
separator.
|
| 223 |
+
|
| 224 |
+
- grouping (list of numbers; optional):
|
| 225 |
+
(default: [3]). A list of integers representing the
|
| 226 |
+
grouping pattern. The default is 3 for thousands.
|
| 227 |
+
|
| 228 |
+
- numerals (list of strings; optional):
|
| 229 |
+
A list of ten strings used as replacements for numbers
|
| 230 |
+
0-9.
|
| 231 |
+
|
| 232 |
+
- percent (string; optional):
|
| 233 |
+
(default: '%'). The string used for the percentage
|
| 234 |
+
symbol.
|
| 235 |
+
|
| 236 |
+
- separate_4digits (boolean; optional):
|
| 237 |
+
(default: True). Separates integers with 4-digits or
|
| 238 |
+
less.
|
| 239 |
+
|
| 240 |
+
- nully (boolean | number | string | dict | list; optional):
|
| 241 |
+
A value that will be used in place of the Noney value
|
| 242 |
+
during formatting. If the value type matches the column
|
| 243 |
+
type, it will be formatted normally.
|
| 244 |
+
|
| 245 |
+
- prefix (number; optional):
|
| 246 |
+
A number representing the SI unit to use during
|
| 247 |
+
formatting. See `dash_table.Format.Prefix` enumeration
|
| 248 |
+
for the list of valid values.
|
| 249 |
+
|
| 250 |
+
- specifier (string; optional):
|
| 251 |
+
(default: ''). Represents the d3 rules to apply when
|
| 252 |
+
formatting the number.
|
| 253 |
+
|
| 254 |
+
- on_change (dict; optional):
|
| 255 |
+
The `on_change` behavior of the column for user-initiated
|
| 256 |
+
modifications.
|
| 257 |
+
|
| 258 |
+
`on_change` is a dict with keys:
|
| 259 |
+
|
| 260 |
+
- action (a value equal to: 'coerce', 'none', 'validate'; optional):
|
| 261 |
+
(default 'coerce'): 'none': do not validate data;
|
| 262 |
+
'coerce': check if the data corresponds to the destination
|
| 263 |
+
type and attempts to coerce it into the destination type
|
| 264 |
+
if not; 'validate': check if the data corresponds to the
|
| 265 |
+
destination type (no coercion).
|
| 266 |
+
|
| 267 |
+
- failure (a value equal to: 'accept', 'default', 'reject'; optional):
|
| 268 |
+
(default 'reject'): What to do with the value if the
|
| 269 |
+
action fails. 'accept': use the invalid value;
|
| 270 |
+
'default': replace the provided value with
|
| 271 |
+
`validation.default`; 'reject': do not modify the
|
| 272 |
+
existing value.
|
| 273 |
+
|
| 274 |
+
- sort_as_null (list of string | number | booleans; optional):
|
| 275 |
+
An array of string, number and boolean values that are treated
|
| 276 |
+
as `None` (i.e. ignored and always displayed last) when
|
| 277 |
+
sorting. This value overrides the table-level `sort_as_None`.
|
| 278 |
+
|
| 279 |
+
- validation (dict; optional):
|
| 280 |
+
The `validation` options for user input processing that can
|
| 281 |
+
accept, reject or apply a default value.
|
| 282 |
+
|
| 283 |
+
`validation` is a dict with keys:
|
| 284 |
+
|
| 285 |
+
- allow_null (boolean; optional):
|
| 286 |
+
Allow the use of Noney values. (undefined, None, NaN)
|
| 287 |
+
(default: False).
|
| 288 |
+
|
| 289 |
+
- default (boolean | number | string | dict | list; optional):
|
| 290 |
+
The default value to apply with on_change.failure =
|
| 291 |
+
'default'. (default: None).
|
| 292 |
+
|
| 293 |
+
- allow_YY (boolean; optional):
|
| 294 |
+
This is for `datetime` columns only. Allow 2-digit years
|
| 295 |
+
(default: False). If True, we interpret years as ranging
|
| 296 |
+
from now-70 to now+29 - in 2019 this is 1949 to 2048 but
|
| 297 |
+
in 2020 it will be different. If used with `action:
|
| 298 |
+
'coerce'`, will convert user input to a 4-digit year.
|
| 299 |
+
|
| 300 |
+
- editable (boolean; default False):
|
| 301 |
+
If True, then the data in all of the cells is editable. When
|
| 302 |
+
`editable` is True, particular columns can be made uneditable by
|
| 303 |
+
setting `editable` to `False` inside the `columns` property. If
|
| 304 |
+
False, then the data in all of the cells is uneditable. When
|
| 305 |
+
`editable` is False, particular columns can be made editable by
|
| 306 |
+
setting `editable` to `True` inside the `columns` property.
|
| 307 |
+
|
| 308 |
+
- fixed_columns (dict; default { headers: False, data: 0}):
|
| 309 |
+
`fixed_columns` will \"fix\" the set of columns so that they
|
| 310 |
+
remain visible when scrolling horizontally across the unfixed
|
| 311 |
+
columns. `fixed_columns` fixes columns from left-to-right. If
|
| 312 |
+
`headers` is False, no columns are fixed. If `headers` is True,
|
| 313 |
+
all operation columns (see `row_deletable` and `row_selectable`)
|
| 314 |
+
are fixed. Additional data columns can be fixed by assigning a
|
| 315 |
+
number to `data`. Note that fixing columns introduces some
|
| 316 |
+
changes to the underlying markup of the table and may impact the
|
| 317 |
+
way that your columns are rendered or sized. View the
|
| 318 |
+
documentation examples to learn more.
|
| 319 |
+
|
| 320 |
+
`fixed_columns` is a dict with keys:
|
| 321 |
+
|
| 322 |
+
- data (number; optional):
|
| 323 |
+
Example `{'headers':False, 'data':0}` No columns are fixed
|
| 324 |
+
(the default).
|
| 325 |
+
|
| 326 |
+
- headers (boolean; optional)
|
| 327 |
+
|
| 328 |
+
- fixed_rows (dict; default { headers: False, data: 0}):
|
| 329 |
+
`fixed_rows` will \"fix\" the set of rows so that they remain
|
| 330 |
+
visible when scrolling vertically down the table. `fixed_rows`
|
| 331 |
+
fixes rows from top-to-bottom, starting from the headers. If
|
| 332 |
+
`headers` is False, no rows are fixed. If `headers` is True, all
|
| 333 |
+
header and filter rows (see `filter_action`) are fixed. Additional
|
| 334 |
+
data rows can be fixed by assigning a number to `data`. Note that
|
| 335 |
+
fixing rows introduces some changes to the underlying markup of
|
| 336 |
+
the table and may impact the way that your columns are rendered or
|
| 337 |
+
sized. View the documentation examples to learn more.
|
| 338 |
+
|
| 339 |
+
`fixed_rows` is a dict with keys:
|
| 340 |
+
|
| 341 |
+
- data (number; optional):
|
| 342 |
+
Example `{'headers':False, 'data':0}` No rows are fixed (the
|
| 343 |
+
default).
|
| 344 |
+
|
| 345 |
+
- headers (boolean; optional)
|
| 346 |
+
|
| 347 |
+
- column_selectable (a value equal to: 'single', 'multi', false; default False):
|
| 348 |
+
If `single`, then the user can select a single column or group of
|
| 349 |
+
merged columns via the radio button that will appear in the header
|
| 350 |
+
rows. If `multi`, then the user can select multiple columns or
|
| 351 |
+
groups of merged columns via the checkbox that will appear in the
|
| 352 |
+
header rows. If False, then the user will not be able to select
|
| 353 |
+
columns and no input will appear in the header rows. When a column
|
| 354 |
+
is selected, its id will be contained in `selected_columns` and
|
| 355 |
+
`derived_viewport_selected_columns`.
|
| 356 |
+
|
| 357 |
+
- cell_selectable (boolean; default True):
|
| 358 |
+
If True (default), then it is possible to click and navigate table
|
| 359 |
+
cells.
|
| 360 |
+
|
| 361 |
+
- row_selectable (a value equal to: 'single', 'multi', false; default False):
|
| 362 |
+
If `single`, then the user can select a single row via a radio
|
| 363 |
+
button that will appear next to each row. If `multi`, then the
|
| 364 |
+
user can select multiple rows via a checkbox that will appear next
|
| 365 |
+
to each row. If False, then the user will not be able to select
|
| 366 |
+
rows and no additional UI elements will appear. When a row is
|
| 367 |
+
selected, its index will be contained in `selected_rows`.
|
| 368 |
+
|
| 369 |
+
- row_deletable (boolean; optional):
|
| 370 |
+
If True, then a `x` will appear next to each `row` and the user
|
| 371 |
+
can delete the row.
|
| 372 |
+
|
| 373 |
+
- active_cell (dict; optional):
|
| 374 |
+
The row and column indices and IDs of the currently active cell.
|
| 375 |
+
`row_id` is only returned if the data rows have an `id` key.
|
| 376 |
+
|
| 377 |
+
`active_cell` is a dict with keys:
|
| 378 |
+
|
| 379 |
+
- row (number; optional)
|
| 380 |
+
|
| 381 |
+
- column (number; optional)
|
| 382 |
+
|
| 383 |
+
- row_id (string | number; optional)
|
| 384 |
+
|
| 385 |
+
- column_id (string; optional)
|
| 386 |
+
|
| 387 |
+
- selected_cells (list of dicts; optional):
|
| 388 |
+
`selected_cells` represents the set of cells that are selected, as
|
| 389 |
+
an array of objects, each item similar to `active_cell`. Multiple
|
| 390 |
+
cells can be selected by holding down shift and clicking on a
|
| 391 |
+
different cell or holding down shift and navigating with the arrow
|
| 392 |
+
keys.
|
| 393 |
+
|
| 394 |
+
`selected_cells` is a list of dicts with keys:
|
| 395 |
+
|
| 396 |
+
- row (number; optional)
|
| 397 |
+
|
| 398 |
+
- column (number; optional)
|
| 399 |
+
|
| 400 |
+
- row_id (string | number; optional)
|
| 401 |
+
|
| 402 |
+
- column_id (string; optional)
|
| 403 |
+
|
| 404 |
+
- selected_rows (list of numbers; optional):
|
| 405 |
+
`selected_rows` contains the indices of rows that are selected via
|
| 406 |
+
the UI elements that appear when `row_selectable` is `'single'` or
|
| 407 |
+
`'multi'`.
|
| 408 |
+
|
| 409 |
+
- selected_columns (list of strings; optional):
|
| 410 |
+
`selected_columns` contains the ids of columns that are selected
|
| 411 |
+
via the UI elements that appear when `column_selectable` is
|
| 412 |
+
`'single' or 'multi'`.
|
| 413 |
+
|
| 414 |
+
- selected_row_ids (list of string | numbers; optional):
|
| 415 |
+
`selected_row_ids` contains the ids of rows that are selected via
|
| 416 |
+
the UI elements that appear when `row_selectable` is `'single'` or
|
| 417 |
+
`'multi'`.
|
| 418 |
+
|
| 419 |
+
- start_cell (dict; optional):
|
| 420 |
+
When selecting multiple cells (via clicking on a cell and then
|
| 421 |
+
shift-clicking on another cell), `start_cell` represents the [row,
|
| 422 |
+
column] coordinates of the cell in one of the corners of the
|
| 423 |
+
region. `end_cell` represents the coordinates of the other corner.
|
| 424 |
+
|
| 425 |
+
`start_cell` is a dict with keys:
|
| 426 |
+
|
| 427 |
+
- row (number; optional)
|
| 428 |
+
|
| 429 |
+
- column (number; optional)
|
| 430 |
+
|
| 431 |
+
- row_id (string | number; optional)
|
| 432 |
+
|
| 433 |
+
- column_id (string; optional)
|
| 434 |
+
|
| 435 |
+
- end_cell (dict; optional):
|
| 436 |
+
When selecting multiple cells (via clicking on a cell and then
|
| 437 |
+
shift-clicking on another cell), `end_cell` represents the row /
|
| 438 |
+
column coordinates and IDs of the cell in one of the corners of
|
| 439 |
+
the region. `start_cell` represents the coordinates of the other
|
| 440 |
+
corner.
|
| 441 |
+
|
| 442 |
+
`end_cell` is a dict with keys:
|
| 443 |
+
|
| 444 |
+
- row (number; optional)
|
| 445 |
+
|
| 446 |
+
- column (number; optional)
|
| 447 |
+
|
| 448 |
+
- row_id (string | number; optional)
|
| 449 |
+
|
| 450 |
+
- column_id (string; optional)
|
| 451 |
+
|
| 452 |
+
- data_previous (list of dicts; optional):
|
| 453 |
+
The previous state of `data`. `data_previous` has the same
|
| 454 |
+
structure as `data` and it will be updated whenever `data`
|
| 455 |
+
changes, either through a callback or by editing the table. This
|
| 456 |
+
is a read-only property: setting this property will not have any
|
| 457 |
+
impact on the table.
|
| 458 |
+
|
| 459 |
+
- hidden_columns (list of strings; optional):
|
| 460 |
+
List of columns ids of the columns that are currently hidden. See
|
| 461 |
+
the associated nested prop `columns.hideable`.
|
| 462 |
+
|
| 463 |
+
- is_focused (boolean; optional):
|
| 464 |
+
If True, then the `active_cell` is in a focused state.
|
| 465 |
+
|
| 466 |
+
- merge_duplicate_headers (boolean; optional):
|
| 467 |
+
If True, then column headers that have neighbors with duplicate
|
| 468 |
+
names will be merged into a single cell. This will be applied for
|
| 469 |
+
single column headers and multi-column headers.
|
| 470 |
+
|
| 471 |
+
- data_timestamp (number; optional):
|
| 472 |
+
The unix timestamp when the data was last edited. Use this
|
| 473 |
+
property with other timestamp properties (such as
|
| 474 |
+
`n_clicks_timestamp` in `dash_html_components`) to determine which
|
| 475 |
+
property has changed within a callback.
|
| 476 |
+
|
| 477 |
+
- include_headers_on_copy_paste (boolean; default False):
|
| 478 |
+
If True, headers are included when copying from the table to
|
| 479 |
+
different tabs and elsewhere. Note that headers are ignored when
|
| 480 |
+
copying from the table onto itself and between two tables within
|
| 481 |
+
the same tab.
|
| 482 |
+
|
| 483 |
+
- export_columns (a value equal to: 'all', 'visible'; default 'visible'):
|
| 484 |
+
Denotes the columns that will be used in the export data file. If
|
| 485 |
+
`all`, all columns will be used (visible + hidden). If `visible`,
|
| 486 |
+
only the visible columns will be used. Defaults to `visible`.
|
| 487 |
+
|
| 488 |
+
- export_format (a value equal to: 'csv', 'xlsx', 'none'; default 'none'):
|
| 489 |
+
Denotes the type of the export data file, Defaults to `'none'`.
|
| 490 |
+
|
| 491 |
+
- export_headers (a value equal to: 'none', 'ids', 'names', 'display'; optional):
|
| 492 |
+
Denotes the format of the headers in the export data file. If
|
| 493 |
+
`'none'`, there will be no header. If `'display'`, then the header
|
| 494 |
+
of the data file will be how it is currently displayed. Note that
|
| 495 |
+
`'display'` is only supported for `'xlsx'` export_format and will
|
| 496 |
+
behave like `'names'` for `'csv'` export format. If `'ids'` or
|
| 497 |
+
`'names'`, then the headers of data file will be the column id or
|
| 498 |
+
the column names, respectively.
|
| 499 |
+
|
| 500 |
+
- page_action (a value equal to: 'custom', 'native', 'none'; default 'native'):
|
| 501 |
+
`page_action` refers to a mode of the table where not all of the
|
| 502 |
+
rows are displayed at once: only a subset are displayed (a
|
| 503 |
+
\"page\") and the next subset of rows can viewed by clicking
|
| 504 |
+
\"Next\" or \"Previous\" buttons at the bottom of the page.
|
| 505 |
+
Pagination is used to improve performance: instead of rendering
|
| 506 |
+
all of the rows at once (which can be expensive), we only display
|
| 507 |
+
a subset of them. With pagination, we can either page through data
|
| 508 |
+
that exists in the table (e.g. page through `10,000` rows in
|
| 509 |
+
`data` `100` rows at a time) or we can update the data on-the-fly
|
| 510 |
+
with callbacks when the user clicks on the \"Previous\" or
|
| 511 |
+
\"Next\" buttons. These modes can be toggled with this
|
| 512 |
+
`page_action` parameter: `'native'`: all data is passed to the
|
| 513 |
+
table up-front, paging logic is handled by the table; `'custom'`:
|
| 514 |
+
data is passed to the table one page at a time, paging logic is
|
| 515 |
+
handled via callbacks; `'none'`: disables paging, render all of
|
| 516 |
+
the data at once.
|
| 517 |
+
|
| 518 |
+
- page_current (number; default 0):
|
| 519 |
+
`page_current` represents which page the user is on. Use this
|
| 520 |
+
property to index through data in your callbacks with backend
|
| 521 |
+
paging.
|
| 522 |
+
|
| 523 |
+
- page_count (number; optional):
|
| 524 |
+
`page_count` represents the number of the pages in the paginated
|
| 525 |
+
table. This is really only useful when performing backend
|
| 526 |
+
pagination, since the front end is able to use the full size of
|
| 527 |
+
the table to calculate the number of pages.
|
| 528 |
+
|
| 529 |
+
- page_size (number; default 250):
|
| 530 |
+
`page_size` represents the number of rows that will be displayed
|
| 531 |
+
on a particular page when `page_action` is `'custom'` or
|
| 532 |
+
`'native'`.
|
| 533 |
+
|
| 534 |
+
- filter_query (string; default ''):
|
| 535 |
+
If `filter_action` is enabled, then the current filtering string
|
| 536 |
+
is represented in this `filter_query` property.
|
| 537 |
+
|
| 538 |
+
- filter_action (dict; default 'none'):
|
| 539 |
+
The `filter_action` property controls the behavior of the
|
| 540 |
+
`filtering` UI. If `'none'`, then the filtering UI is not
|
| 541 |
+
displayed. If `'native'`, then the filtering UI is displayed and
|
| 542 |
+
the filtering logic is handled by the table. That is, it is
|
| 543 |
+
performed on the data that exists in the `data` property. If
|
| 544 |
+
`'custom'`, then the filtering UI is displayed but it is the
|
| 545 |
+
responsibility of the developer to program the filtering through a
|
| 546 |
+
callback (where `filter_query` or `derived_filter_query_structure`
|
| 547 |
+
would be the input and `data` would be the output).
|
| 548 |
+
|
| 549 |
+
`filter_action` is a a value equal to: 'custom', 'native', 'none'
|
| 550 |
+
| dict with keys:
|
| 551 |
+
|
| 552 |
+
- type (a value equal to: 'custom', 'native'; required)
|
| 553 |
+
|
| 554 |
+
- operator (a value equal to: 'and', 'or'; optional)
|
| 555 |
+
|
| 556 |
+
- filter_options (dict; optional):
|
| 557 |
+
There are two `filter_options` props in the table. This is the
|
| 558 |
+
table-level filter_options prop and there is also the column-level
|
| 559 |
+
`filter_options` prop. If the column-level `filter_options` prop
|
| 560 |
+
is set it overrides the table-level `filter_options` prop for that
|
| 561 |
+
column.
|
| 562 |
+
|
| 563 |
+
`filter_options` is a dict with keys:
|
| 564 |
+
|
| 565 |
+
- case (a value equal to: 'sensitive', 'insensitive'; optional):
|
| 566 |
+
(default: 'sensitive') Determine whether the applicable filter
|
| 567 |
+
relational operators will default to `sensitive` or
|
| 568 |
+
`insensitive` comparison.
|
| 569 |
+
|
| 570 |
+
- placeholder_text (string; optional):
|
| 571 |
+
(default: 'filter data...') The filter cell placeholder text.
|
| 572 |
+
|
| 573 |
+
- sort_action (a value equal to: 'custom', 'native', 'none'; default 'none'):
|
| 574 |
+
The `sort_action` property enables data to be sorted on a
|
| 575 |
+
per-column basis. If `'none'`, then the sorting UI is not
|
| 576 |
+
displayed. If `'native'`, then the sorting UI is displayed and the
|
| 577 |
+
sorting logic is handled by the table. That is, it is performed on
|
| 578 |
+
the data that exists in the `data` property. If `'custom'`, the
|
| 579 |
+
sorting UI is displayed but it is the responsibility of the
|
| 580 |
+
developer to program the sorting through a callback (where
|
| 581 |
+
`sort_by` would be the input and `data` would be the output).
|
| 582 |
+
Clicking on the sort arrows will update the `sort_by` property.
|
| 583 |
+
|
| 584 |
+
- sort_mode (a value equal to: 'single', 'multi'; default 'single'):
|
| 585 |
+
Sorting can be performed across multiple columns (e.g. sort by
|
| 586 |
+
country, sort within each country, sort by year) or by a single
|
| 587 |
+
column. NOTE - With multi-column sort, it's currently not possible
|
| 588 |
+
to determine the order in which the columns were sorted through
|
| 589 |
+
the UI. See
|
| 590 |
+
[https://github.com/plotly/dash-table/issues/170](https://github.com/plotly/dash-table/issues/170).
|
| 591 |
+
|
| 592 |
+
- sort_by (list of dicts; optional):
|
| 593 |
+
`sort_by` describes the current state of the sorting UI. That is,
|
| 594 |
+
if the user clicked on the sort arrow of a column, then this
|
| 595 |
+
property will be updated with the column ID and the direction
|
| 596 |
+
(`asc` or `desc`) of the sort. For multi-column sorting, this will
|
| 597 |
+
be a list of sorting parameters, in the order in which they were
|
| 598 |
+
clicked.
|
| 599 |
+
|
| 600 |
+
`sort_by` is a list of dicts with keys:
|
| 601 |
+
|
| 602 |
+
- column_id (string; required)
|
| 603 |
+
|
| 604 |
+
- direction (a value equal to: 'asc', 'desc'; required)
|
| 605 |
+
|
| 606 |
+
- sort_as_null (list of string | number | booleans; optional):
|
| 607 |
+
An array of string, number and boolean values that are treated as
|
| 608 |
+
`None` (i.e. ignored and always displayed last) when sorting. This
|
| 609 |
+
value will be used by columns without `sort_as_None`. Defaults to
|
| 610 |
+
`[]`.
|
| 611 |
+
|
| 612 |
+
- dropdown (dict; optional):
|
| 613 |
+
`dropdown` specifies dropdown options for different columns. Each
|
| 614 |
+
entry refers to the column ID. The `clearable` property defines
|
| 615 |
+
whether the value can be deleted. The `options` property refers to
|
| 616 |
+
the `options` of the dropdown.
|
| 617 |
+
|
| 618 |
+
`dropdown` is a dict with strings as keys and values of type dict
|
| 619 |
+
with keys:
|
| 620 |
+
|
| 621 |
+
- clearable (boolean; optional)
|
| 622 |
+
|
| 623 |
+
- options (list of dicts; required)
|
| 624 |
+
|
| 625 |
+
`options` is a list of dicts with keys:
|
| 626 |
+
|
| 627 |
+
- label (string; required)
|
| 628 |
+
|
| 629 |
+
- value (number | string | boolean; required)
|
| 630 |
+
|
| 631 |
+
- dropdown_conditional (list of dicts; optional):
|
| 632 |
+
`dropdown_conditional` specifies dropdown options in various
|
| 633 |
+
columns and cells. This property allows you to specify different
|
| 634 |
+
dropdowns depending on certain conditions. For example, you may
|
| 635 |
+
render different \"city\" dropdowns in a row depending on the
|
| 636 |
+
current value in the \"state\" column.
|
| 637 |
+
|
| 638 |
+
`dropdown_conditional` is a list of dicts with keys:
|
| 639 |
+
|
| 640 |
+
- clearable (boolean; optional)
|
| 641 |
+
|
| 642 |
+
- if (dict; optional)
|
| 643 |
+
|
| 644 |
+
`if` is a dict with keys:
|
| 645 |
+
|
| 646 |
+
- column_id (string; optional)
|
| 647 |
+
|
| 648 |
+
- filter_query (string; optional)
|
| 649 |
+
|
| 650 |
+
- options (list of dicts; required)
|
| 651 |
+
|
| 652 |
+
`options` is a list of dicts with keys:
|
| 653 |
+
|
| 654 |
+
- label (string; required)
|
| 655 |
+
|
| 656 |
+
- value (number | string | boolean; required)
|
| 657 |
+
|
| 658 |
+
- dropdown_data (list of dicts; optional):
|
| 659 |
+
`dropdown_data` specifies dropdown options on a row-by-row,
|
| 660 |
+
column-by-column basis. Each item in the array corresponds to the
|
| 661 |
+
corresponding dropdowns for the `data` item at the same index.
|
| 662 |
+
Each entry in the item refers to the Column ID.
|
| 663 |
+
|
| 664 |
+
`dropdown_data` is a list of dicts with strings as keys and values
|
| 665 |
+
of type dict with keys:
|
| 666 |
+
|
| 667 |
+
- clearable (boolean; optional)
|
| 668 |
+
|
| 669 |
+
- options (list of dicts; required)
|
| 670 |
+
|
| 671 |
+
`options` is a list of dicts with keys:
|
| 672 |
+
|
| 673 |
+
- label (string; required)
|
| 674 |
+
|
| 675 |
+
- value (number | string | boolean; required)
|
| 676 |
+
|
| 677 |
+
- tooltip (dict; optional):
|
| 678 |
+
`tooltip` is the column based tooltip configuration applied to all
|
| 679 |
+
rows. The key is the column id and the value is a tooltip
|
| 680 |
+
configuration. Example: {i: {'value': i, 'use_with: 'both'} for i
|
| 681 |
+
in df.columns}.
|
| 682 |
+
|
| 683 |
+
`tooltip` is a dict with strings as keys and values of type string
|
| 684 |
+
| dict with keys:
|
| 685 |
+
|
| 686 |
+
- delay (number; optional):
|
| 687 |
+
Represents the delay in milliseconds before the tooltip is
|
| 688 |
+
shown when hovering a cell. This overrides the table's
|
| 689 |
+
`tooltip_delay` property. If set to `None`, the tooltip will
|
| 690 |
+
be shown immediately.
|
| 691 |
+
|
| 692 |
+
- duration (number; optional):
|
| 693 |
+
represents the duration in milliseconds during which the
|
| 694 |
+
tooltip is shown when hovering a cell. This overrides the
|
| 695 |
+
table's `tooltip_duration` property. If set to `None`, the
|
| 696 |
+
tooltip will not disappear.
|
| 697 |
+
|
| 698 |
+
- type (a value equal to: 'text', 'markdown'; optional):
|
| 699 |
+
refers to the type of tooltip syntax used for the tooltip
|
| 700 |
+
generation. Can either be `markdown` or `text`. Defaults to
|
| 701 |
+
`text`.
|
| 702 |
+
|
| 703 |
+
- use_with (a value equal to: 'both', 'data', 'header'; optional):
|
| 704 |
+
Refers to whether the tooltip will be shown only on data or
|
| 705 |
+
headers. Can be `both`, `data`, `header`. Defaults to `both`.
|
| 706 |
+
|
| 707 |
+
- value (string; required):
|
| 708 |
+
refers to the syntax-based content of the tooltip. This value
|
| 709 |
+
is required. Alternatively, the value of the property can also
|
| 710 |
+
be a plain string. The `text` syntax will be used in that
|
| 711 |
+
case.
|
| 712 |
+
|
| 713 |
+
- tooltip_conditional (list of dicts; optional):
|
| 714 |
+
`tooltip_conditional` represents the tooltip shown for different
|
| 715 |
+
columns and cells. This property allows you to specify different
|
| 716 |
+
tooltips depending on certain conditions. For example, you may
|
| 717 |
+
have different tooltips in the same column based on the value of a
|
| 718 |
+
certain data property. Priority is from first to last defined
|
| 719 |
+
conditional tooltip in the list. Higher priority (more specific)
|
| 720 |
+
conditional tooltips should be put at the beginning of the list.
|
| 721 |
+
|
| 722 |
+
`tooltip_conditional` is a list of dicts with keys:
|
| 723 |
+
|
| 724 |
+
- delay (number; optional):
|
| 725 |
+
The `delay` represents the delay in milliseconds before the
|
| 726 |
+
tooltip is shown when hovering a cell. This overrides the
|
| 727 |
+
table's `tooltip_delay` property. If set to `None`, the
|
| 728 |
+
tooltip will be shown immediately.
|
| 729 |
+
|
| 730 |
+
- duration (number; optional):
|
| 731 |
+
The `duration` represents the duration in milliseconds during
|
| 732 |
+
which the tooltip is shown when hovering a cell. This
|
| 733 |
+
overrides the table's `tooltip_duration` property. If set to
|
| 734 |
+
`None`, the tooltip will not disappear.
|
| 735 |
+
|
| 736 |
+
- if (dict; required):
|
| 737 |
+
The `if` refers to the condition that needs to be fulfilled in
|
| 738 |
+
order for the associated tooltip configuration to be used. If
|
| 739 |
+
multiple conditions are defined, all conditions must be met
|
| 740 |
+
for the tooltip to be used by a cell.
|
| 741 |
+
|
| 742 |
+
`if` is a dict with keys:
|
| 743 |
+
|
| 744 |
+
- column_id (string; optional):
|
| 745 |
+
`column_id` refers to the column ID that must be matched.
|
| 746 |
+
|
| 747 |
+
- filter_query (string; optional):
|
| 748 |
+
`filter_query` refers to the query that must evaluate to
|
| 749 |
+
True.
|
| 750 |
+
|
| 751 |
+
- row_index (number | a value equal to: 'odd', 'even'; optional):
|
| 752 |
+
`row_index` refers to the index of the row in the source
|
| 753 |
+
`data`.
|
| 754 |
+
|
| 755 |
+
- type (a value equal to: 'text', 'markdown'; optional):
|
| 756 |
+
The `type` refers to the type of tooltip syntax used for the
|
| 757 |
+
tooltip generation. Can either be `markdown` or `text`.
|
| 758 |
+
Defaults to `text`.
|
| 759 |
+
|
| 760 |
+
- value (string; required):
|
| 761 |
+
The `value` refers to the syntax-based content of the tooltip.
|
| 762 |
+
This value is required.
|
| 763 |
+
|
| 764 |
+
- tooltip_data (list of dicts; optional):
|
| 765 |
+
`tooltip_data` represents the tooltip shown for different columns
|
| 766 |
+
and cells. A list of dicts for which each key is a column id and
|
| 767 |
+
the value is a tooltip configuration.
|
| 768 |
+
|
| 769 |
+
`tooltip_data` is a list of dicts with strings as keys and values
|
| 770 |
+
of type string | dict with keys:
|
| 771 |
+
|
| 772 |
+
- delay (number; optional):
|
| 773 |
+
The `delay` represents the delay in milliseconds before the
|
| 774 |
+
tooltip is shown when hovering a cell. This overrides the
|
| 775 |
+
table's `tooltip_delay` property. If set to `None`, the
|
| 776 |
+
tooltip will be shown immediately.
|
| 777 |
+
|
| 778 |
+
- duration (number; optional):
|
| 779 |
+
The `duration` represents the duration in milliseconds during
|
| 780 |
+
which the tooltip is shown when hovering a cell. This
|
| 781 |
+
overrides the table's `tooltip_duration` property. If set to
|
| 782 |
+
`None`, the tooltip will not disappear. Alternatively, the
|
| 783 |
+
value of the property can also be a plain string. The `text`
|
| 784 |
+
syntax will be used in that case.
|
| 785 |
+
|
| 786 |
+
- type (a value equal to: 'text', 'markdown'; optional):
|
| 787 |
+
For each tooltip configuration, The `type` refers to the type
|
| 788 |
+
of tooltip syntax used for the tooltip generation. Can either
|
| 789 |
+
be `markdown` or `text`. Defaults to `text`.
|
| 790 |
+
|
| 791 |
+
- value (string; required):
|
| 792 |
+
The `value` refers to the syntax-based content of the tooltip.
|
| 793 |
+
This value is required.
|
| 794 |
+
|
| 795 |
+
- tooltip_header (dict; optional):
|
| 796 |
+
`tooltip_header` represents the tooltip shown for each header
|
| 797 |
+
column and optionally each header row. Example to show long column
|
| 798 |
+
names in a tooltip: {i: i for i in df.columns}. Example to show
|
| 799 |
+
different column names in a tooltip: {'Rep': 'Republican', 'Dem':
|
| 800 |
+
'Democrat'}. If the table has multiple rows of headers, then use a
|
| 801 |
+
list as the value of the `tooltip_header` items.
|
| 802 |
+
|
| 803 |
+
`tooltip_header` is a dict with strings as keys and values of type
|
| 804 |
+
string | dict with keys:
|
| 805 |
+
|
| 806 |
+
- delay (number; optional):
|
| 807 |
+
The `delay` represents the delay in milliseconds before the
|
| 808 |
+
tooltip is shown when hovering a cell. This overrides the
|
| 809 |
+
table's `tooltip_delay` property. If set to `None`, the
|
| 810 |
+
tooltip will be shown immediately.
|
| 811 |
+
|
| 812 |
+
- duration (number; optional):
|
| 813 |
+
The `duration` represents the duration in milliseconds during
|
| 814 |
+
which the tooltip is shown when hovering a cell. This
|
| 815 |
+
overrides the table's `tooltip_duration` property. If set to
|
| 816 |
+
`None`, the tooltip will not disappear. Alternatively, the
|
| 817 |
+
value of the property can also be a plain string. The `text`
|
| 818 |
+
syntax will be used in that case.
|
| 819 |
+
|
| 820 |
+
- type (a value equal to: 'text', 'markdown'; optional):
|
| 821 |
+
For each tooltip configuration, The `type` refers to the type
|
| 822 |
+
of tooltip syntax used for the tooltip generation. Can either
|
| 823 |
+
be `markdown` or `text`. Defaults to `text`.
|
| 824 |
+
|
| 825 |
+
- value (string; required):
|
| 826 |
+
The `value` refers to the syntax-based content of the tooltip.
|
| 827 |
+
This value is required.
|
| 828 |
+
|
| 829 |
+
Or list of a value equal to: null | string | dict with keys:
|
| 830 |
+
|
| 831 |
+
- delay (number; optional)
|
| 832 |
+
|
| 833 |
+
- duration (number; optional)
|
| 834 |
+
|
| 835 |
+
- type (a value equal to: 'text', 'markdown'; optional)
|
| 836 |
+
|
| 837 |
+
- value (string; required)s
|
| 838 |
+
|
| 839 |
+
- tooltip_delay (number; default 350):
|
| 840 |
+
`tooltip_delay` represents the table-wide delay in milliseconds
|
| 841 |
+
before the tooltip is shown when hovering a cell. If set to
|
| 842 |
+
`None`, the tooltip will be shown immediately. Defaults to 350.
|
| 843 |
+
|
| 844 |
+
- tooltip_duration (number; default 2000):
|
| 845 |
+
`tooltip_duration` represents the table-wide duration in
|
| 846 |
+
milliseconds during which the tooltip will be displayed when
|
| 847 |
+
hovering a cell. If set to `None`, the tooltip will not disappear.
|
| 848 |
+
Defaults to 2000.
|
| 849 |
+
|
| 850 |
+
- locale_format (dict; optional):
|
| 851 |
+
The localization specific formatting information applied to all
|
| 852 |
+
columns in the table. This prop is derived from the
|
| 853 |
+
[d3.formatLocale](https://github.com/d3/d3-format#formatLocale)
|
| 854 |
+
data structure specification. When left unspecified, each
|
| 855 |
+
individual nested prop will default to a pre-determined value.
|
| 856 |
+
|
| 857 |
+
`locale_format` is a dict with keys:
|
| 858 |
+
|
| 859 |
+
- symbol (list of strings; optional):
|
| 860 |
+
(default: ['$', '']). A list of two strings representing the
|
| 861 |
+
prefix and suffix symbols. Typically used for currency, and
|
| 862 |
+
implemented using d3's currency format, but you can use this
|
| 863 |
+
for other symbols such as measurement units.
|
| 864 |
+
|
| 865 |
+
- decimal (string; optional):
|
| 866 |
+
(default: '.'). The string used for the decimal separator.
|
| 867 |
+
|
| 868 |
+
- group (string; optional):
|
| 869 |
+
(default: ','). The string used for the groups separator.
|
| 870 |
+
|
| 871 |
+
- grouping (list of numbers; optional):
|
| 872 |
+
(default: [3]). A list of integers representing the grouping
|
| 873 |
+
pattern.
|
| 874 |
+
|
| 875 |
+
- numerals (list of strings; optional):
|
| 876 |
+
A list of ten strings used as replacements for numbers 0-9.
|
| 877 |
+
|
| 878 |
+
- percent (string; optional):
|
| 879 |
+
(default: '%'). The string used for the percentage symbol.
|
| 880 |
+
|
| 881 |
+
- separate_4digits (boolean; optional):
|
| 882 |
+
(default: True). Separate integers with 4-digits or less.
|
| 883 |
+
|
| 884 |
+
- style_as_list_view (boolean; default False):
|
| 885 |
+
If True, then the table will be styled like a list view and not
|
| 886 |
+
have borders between the columns.
|
| 887 |
+
|
| 888 |
+
- fill_width (boolean; default True):
|
| 889 |
+
`fill_width` toggles between a set of CSS for two common
|
| 890 |
+
behaviors: True: The table container's width will grow to fill the
|
| 891 |
+
available space; False: The table container's width will equal the
|
| 892 |
+
width of its content.
|
| 893 |
+
|
| 894 |
+
- markdown_options (dict; default { link_target: '_blank', html: False}):
|
| 895 |
+
The `markdown_options` property allows customization of the
|
| 896 |
+
markdown cells behavior.
|
| 897 |
+
|
| 898 |
+
`markdown_options` is a dict with keys:
|
| 899 |
+
|
| 900 |
+
- link_target (string | a value equal to: '_blank', '_parent', '_self', '_top'; optional):
|
| 901 |
+
(default: '_blank'). The link's behavior (_blank opens the
|
| 902 |
+
link in a new tab, _parent opens the link in the parent frame,
|
| 903 |
+
_self opens the link in the current tab, and _top opens the
|
| 904 |
+
link in the top frame) or a string.
|
| 905 |
+
|
| 906 |
+
- html (boolean; optional):
|
| 907 |
+
(default: False) If True, html may be used in markdown cells
|
| 908 |
+
Be careful enabling html if the content being rendered can
|
| 909 |
+
come from an untrusted user, as this may create an XSS
|
| 910 |
+
vulnerability.
|
| 911 |
+
|
| 912 |
+
- css (list of dicts; optional):
|
| 913 |
+
The `css` property is a way to embed CSS selectors and rules onto
|
| 914 |
+
the page. We recommend starting with the `style_*` properties
|
| 915 |
+
before using this `css` property. Example: [ {\"selector\":
|
| 916 |
+
\".dash-spreadsheet\", \"rule\": 'font-family: \"monospace\"'} ].
|
| 917 |
+
|
| 918 |
+
`css` is a list of dicts with keys:
|
| 919 |
+
|
| 920 |
+
- selector (string; required)
|
| 921 |
+
|
| 922 |
+
- rule (string; required)
|
| 923 |
+
|
| 924 |
+
- style_table (dict; optional):
|
| 925 |
+
CSS styles to be applied to the outer `table` container. This is
|
| 926 |
+
commonly used for setting properties like the width or the height
|
| 927 |
+
of the table.
|
| 928 |
+
|
| 929 |
+
- style_cell (dict; optional):
|
| 930 |
+
CSS styles to be applied to each individual cell of the table.
|
| 931 |
+
This includes the header cells, the `data` cells, and the filter
|
| 932 |
+
cells.
|
| 933 |
+
|
| 934 |
+
- style_data (dict; optional):
|
| 935 |
+
CSS styles to be applied to each individual data cell. That is,
|
| 936 |
+
unlike `style_cell`, it excludes the header and filter cells.
|
| 937 |
+
|
| 938 |
+
- style_filter (dict; optional):
|
| 939 |
+
CSS styles to be applied to the filter cells. Note that this may
|
| 940 |
+
change in the future as we build out a more complex filtering UI.
|
| 941 |
+
|
| 942 |
+
- style_header (dict; optional):
|
| 943 |
+
CSS styles to be applied to each individual header cell. That is,
|
| 944 |
+
unlike `style_cell`, it excludes the `data` and filter cells.
|
| 945 |
+
|
| 946 |
+
- style_cell_conditional (list of dicts; optional):
|
| 947 |
+
Conditional CSS styles for the cells. This can be used to apply
|
| 948 |
+
styles to cells on a per-column basis.
|
| 949 |
+
|
| 950 |
+
`style_cell_conditional` is a list of dicts with keys:
|
| 951 |
+
|
| 952 |
+
- if (dict; optional)
|
| 953 |
+
|
| 954 |
+
`if` is a dict with keys:
|
| 955 |
+
|
| 956 |
+
- column_id (string | list of strings; optional)
|
| 957 |
+
|
| 958 |
+
- column_type (a value equal to: 'any', 'numeric', 'text', 'datetime'; optional)
|
| 959 |
+
|
| 960 |
+
- style_data_conditional (list of dicts; optional):
|
| 961 |
+
Conditional CSS styles for the data cells. This can be used to
|
| 962 |
+
apply styles to data cells on a per-column basis.
|
| 963 |
+
|
| 964 |
+
`style_data_conditional` is a list of dicts with keys:
|
| 965 |
+
|
| 966 |
+
- if (dict; optional)
|
| 967 |
+
|
| 968 |
+
`if` is a dict with keys:
|
| 969 |
+
|
| 970 |
+
- column_id (string | list of strings; optional)
|
| 971 |
+
|
| 972 |
+
- column_type (a value equal to: 'any', 'numeric', 'text', 'datetime'; optional)
|
| 973 |
+
|
| 974 |
+
- filter_query (string; optional)
|
| 975 |
+
|
| 976 |
+
- state (a value equal to: 'active', 'selected'; optional)
|
| 977 |
+
|
| 978 |
+
- row_index (number | a value equal to: 'odd', 'even' | list of numbers; optional)
|
| 979 |
+
|
| 980 |
+
- column_editable (boolean; optional)
|
| 981 |
+
|
| 982 |
+
- style_filter_conditional (list of dicts; optional):
|
| 983 |
+
Conditional CSS styles for the filter cells. This can be used to
|
| 984 |
+
apply styles to filter cells on a per-column basis.
|
| 985 |
+
|
| 986 |
+
`style_filter_conditional` is a list of dicts with keys:
|
| 987 |
+
|
| 988 |
+
- if (dict; optional)
|
| 989 |
+
|
| 990 |
+
`if` is a dict with keys:
|
| 991 |
+
|
| 992 |
+
- column_id (string | list of strings; optional)
|
| 993 |
+
|
| 994 |
+
- column_type (a value equal to: 'any', 'numeric', 'text', 'datetime'; optional)
|
| 995 |
+
|
| 996 |
+
- column_editable (boolean; optional)
|
| 997 |
+
|
| 998 |
+
- style_header_conditional (list of dicts; optional):
|
| 999 |
+
Conditional CSS styles for the header cells. This can be used to
|
| 1000 |
+
apply styles to header cells on a per-column basis.
|
| 1001 |
+
|
| 1002 |
+
`style_header_conditional` is a list of dicts with keys:
|
| 1003 |
+
|
| 1004 |
+
- if (dict; optional)
|
| 1005 |
+
|
| 1006 |
+
`if` is a dict with keys:
|
| 1007 |
+
|
| 1008 |
+
- column_id (string | list of strings; optional)
|
| 1009 |
+
|
| 1010 |
+
- column_type (a value equal to: 'any', 'numeric', 'text', 'datetime'; optional)
|
| 1011 |
+
|
| 1012 |
+
- header_index (number | list of numbers | a value equal to: 'odd', 'even'; optional)
|
| 1013 |
+
|
| 1014 |
+
- column_editable (boolean; optional)
|
| 1015 |
+
|
| 1016 |
+
- virtualization (boolean; default False):
|
| 1017 |
+
This property tells the table to use virtualization when
|
| 1018 |
+
rendering. Assumptions are that: the width of the columns is
|
| 1019 |
+
fixed; the height of the rows is always the same; and runtime
|
| 1020 |
+
styling changes will not affect width and height vs. first
|
| 1021 |
+
rendering.
|
| 1022 |
+
|
| 1023 |
+
- derived_filter_query_structure (dict; optional):
|
| 1024 |
+
This property represents the current structure of `filter_query`
|
| 1025 |
+
as a tree structure. Each node of the query structure has: type
|
| 1026 |
+
(string; required): 'open-block', 'logical-operator',
|
| 1027 |
+
'relational-operator', 'unary-operator', or 'expression';
|
| 1028 |
+
subType (string; optional): 'open-block': '()',
|
| 1029 |
+
'logical-operator': '&&', '||', 'relational-operator': '=',
|
| 1030 |
+
'>=', '>', '<=', '<', '!=', 'contains', 'unary-operator': '!',
|
| 1031 |
+
'is bool', 'is even', 'is nil', 'is num', 'is object', 'is odd',
|
| 1032 |
+
'is prime', 'is str', 'expression': 'value', 'field'; value
|
| 1033 |
+
(any): 'expression, value': passed value, 'expression, field':
|
| 1034 |
+
the field/prop name. block (nested query structure; optional).
|
| 1035 |
+
left (nested query structure; optional). right (nested query
|
| 1036 |
+
structure; optional). If the query is invalid or empty, the
|
| 1037 |
+
`derived_filter_query_structure` will be `None`.
|
| 1038 |
+
|
| 1039 |
+
- derived_viewport_data (list of dicts; optional):
|
| 1040 |
+
This property represents the current state of `data` on the
|
| 1041 |
+
current page. This property will be updated on paging, sorting,
|
| 1042 |
+
and filtering.
|
| 1043 |
+
|
| 1044 |
+
- derived_viewport_indices (list of numbers; optional):
|
| 1045 |
+
`derived_viewport_indices` indicates the order in which the
|
| 1046 |
+
original rows appear after being filtered, sorted, and/or paged.
|
| 1047 |
+
`derived_viewport_indices` contains indices for the current page,
|
| 1048 |
+
while `derived_virtual_indices` contains indices across all pages.
|
| 1049 |
+
|
| 1050 |
+
- derived_viewport_row_ids (list of string | numbers; optional):
|
| 1051 |
+
`derived_viewport_row_ids` lists row IDs in the order they appear
|
| 1052 |
+
after being filtered, sorted, and/or paged.
|
| 1053 |
+
`derived_viewport_row_ids` contains IDs for the current page,
|
| 1054 |
+
while `derived_virtual_row_ids` contains IDs across all pages.
|
| 1055 |
+
|
| 1056 |
+
- derived_viewport_selected_columns (list of strings; optional):
|
| 1057 |
+
`derived_viewport_selected_columns` contains the ids of the
|
| 1058 |
+
`selected_columns` that are not currently hidden.
|
| 1059 |
+
|
| 1060 |
+
- derived_viewport_selected_rows (list of numbers; optional):
|
| 1061 |
+
`derived_viewport_selected_rows` represents the indices of the
|
| 1062 |
+
`selected_rows` from the perspective of the
|
| 1063 |
+
`derived_viewport_indices`.
|
| 1064 |
+
|
| 1065 |
+
- derived_viewport_selected_row_ids (list of string | numbers; optional):
|
| 1066 |
+
`derived_viewport_selected_row_ids` represents the IDs of the
|
| 1067 |
+
`selected_rows` on the currently visible page.
|
| 1068 |
+
|
| 1069 |
+
- derived_virtual_data (list of dicts; optional):
|
| 1070 |
+
This property represents the visible state of `data` across all
|
| 1071 |
+
pages after the front-end sorting and filtering as been applied.
|
| 1072 |
+
|
| 1073 |
+
- derived_virtual_indices (list of numbers; optional):
|
| 1074 |
+
`derived_virtual_indices` indicates the order in which the
|
| 1075 |
+
original rows appear after being filtered and sorted.
|
| 1076 |
+
`derived_viewport_indices` contains indices for the current page,
|
| 1077 |
+
while `derived_virtual_indices` contains indices across all pages.
|
| 1078 |
+
|
| 1079 |
+
- derived_virtual_row_ids (list of string | numbers; optional):
|
| 1080 |
+
`derived_virtual_row_ids` indicates the row IDs in the order in
|
| 1081 |
+
which they appear after being filtered and sorted.
|
| 1082 |
+
`derived_viewport_row_ids` contains IDs for the current page,
|
| 1083 |
+
while `derived_virtual_row_ids` contains IDs across all pages.
|
| 1084 |
+
|
| 1085 |
+
- derived_virtual_selected_rows (list of numbers; optional):
|
| 1086 |
+
`derived_virtual_selected_rows` represents the indices of the
|
| 1087 |
+
`selected_rows` from the perspective of the
|
| 1088 |
+
`derived_virtual_indices`.
|
| 1089 |
+
|
| 1090 |
+
- derived_virtual_selected_row_ids (list of string | numbers; optional):
|
| 1091 |
+
`derived_virtual_selected_row_ids` represents the IDs of the
|
| 1092 |
+
`selected_rows` as they appear after filtering and sorting, across
|
| 1093 |
+
all pages.
|
| 1094 |
+
|
| 1095 |
+
- id (string; optional):
|
| 1096 |
+
The ID of the table.
|
| 1097 |
+
|
| 1098 |
+
- loading_state (dict; optional):
|
| 1099 |
+
Object that holds the loading state object coming from
|
| 1100 |
+
dash-renderer.
|
| 1101 |
+
|
| 1102 |
+
`loading_state` is a dict with keys:
|
| 1103 |
+
|
| 1104 |
+
- is_loading (boolean; optional):
|
| 1105 |
+
Determines if the component is loading or not.
|
| 1106 |
+
|
| 1107 |
+
- prop_name (string; optional):
|
| 1108 |
+
Holds which property is loading.
|
| 1109 |
+
|
| 1110 |
+
- component_name (string; optional):
|
| 1111 |
+
Holds the name of the component that is loading.
|
| 1112 |
+
|
| 1113 |
+
- persistence (boolean | string | number; optional):
|
| 1114 |
+
Used to allow user interactions in this component to be persisted
|
| 1115 |
+
when the component - or the page - is refreshed. If `persisted` is
|
| 1116 |
+
truthy and hasn't changed from its previous value, any
|
| 1117 |
+
`persisted_props` that the user has changed while using the app
|
| 1118 |
+
will keep those changes, as long as the new prop value also
|
| 1119 |
+
matches what was given originally. Used in conjunction with
|
| 1120 |
+
`persistence_type` and `persisted_props`.
|
| 1121 |
+
|
| 1122 |
+
- persisted_props (list of a value equal to: 'columns.name', 'data', 'filter_query', 'hidden_columns', 'page_current', 'selected_columns', 'selected_rows', 'sort_by's; default [ 'columns.name', 'filter_query', 'hidden_columns', 'page_current', 'selected_columns', 'selected_rows', 'sort_by']):
|
| 1123 |
+
Properties whose user interactions will persist after refreshing
|
| 1124 |
+
the component or the page.
|
| 1125 |
+
|
| 1126 |
+
- persistence_type (a value equal to: 'local', 'session', 'memory'; default 'local'):
|
| 1127 |
+
Where persisted user changes will be stored: memory: only kept in
|
| 1128 |
+
memory, reset on page refresh. local: window.localStorage, data is
|
| 1129 |
+
kept after the browser quit. session: window.sessionStorage, data
|
| 1130 |
+
is cleared once the browser quit."""
|
| 1131 |
+
|
| 1132 |
+
_children_props = []
|
| 1133 |
+
_base_nodes = ["children"]
|
| 1134 |
+
_namespace = "dash_table"
|
| 1135 |
+
_type = "DataTable"
|
| 1136 |
+
ColumnsFilterOptions = TypedDict(
|
| 1137 |
+
"ColumnsFilterOptions",
|
| 1138 |
+
{
|
| 1139 |
+
"case": NotRequired[Literal["sensitive", "insensitive"]],
|
| 1140 |
+
"placeholder_text": NotRequired[str],
|
| 1141 |
+
},
|
| 1142 |
+
)
|
| 1143 |
+
|
| 1144 |
+
ColumnsFormatLocale = TypedDict(
|
| 1145 |
+
"ColumnsFormatLocale",
|
| 1146 |
+
{
|
| 1147 |
+
"symbol": NotRequired[typing.Sequence[str]],
|
| 1148 |
+
"decimal": NotRequired[str],
|
| 1149 |
+
"group": NotRequired[str],
|
| 1150 |
+
"grouping": NotRequired[typing.Sequence[NumberType]],
|
| 1151 |
+
"numerals": NotRequired[typing.Sequence[str]],
|
| 1152 |
+
"percent": NotRequired[str],
|
| 1153 |
+
"separate_4digits": NotRequired[bool],
|
| 1154 |
+
},
|
| 1155 |
+
)
|
| 1156 |
+
|
| 1157 |
+
ColumnsFormat = TypedDict(
|
| 1158 |
+
"ColumnsFormat",
|
| 1159 |
+
{
|
| 1160 |
+
"locale": NotRequired["ColumnsFormatLocale"],
|
| 1161 |
+
"nully": NotRequired[typing.Any],
|
| 1162 |
+
"prefix": NotRequired[NumberType],
|
| 1163 |
+
"specifier": NotRequired[str],
|
| 1164 |
+
},
|
| 1165 |
+
)
|
| 1166 |
+
|
| 1167 |
+
ColumnsOnChange = TypedDict(
|
| 1168 |
+
"ColumnsOnChange",
|
| 1169 |
+
{
|
| 1170 |
+
"action": NotRequired[Literal["coerce", "none", "validate"]],
|
| 1171 |
+
"failure": NotRequired[Literal["accept", "default", "reject"]],
|
| 1172 |
+
},
|
| 1173 |
+
)
|
| 1174 |
+
|
| 1175 |
+
ColumnsValidation = TypedDict(
|
| 1176 |
+
"ColumnsValidation",
|
| 1177 |
+
{
|
| 1178 |
+
"allow_null": NotRequired[bool],
|
| 1179 |
+
"default": NotRequired[typing.Any],
|
| 1180 |
+
"allow_YY": NotRequired[bool],
|
| 1181 |
+
},
|
| 1182 |
+
)
|
| 1183 |
+
|
| 1184 |
+
Columns = TypedDict(
|
| 1185 |
+
"Columns",
|
| 1186 |
+
{
|
| 1187 |
+
"id": str,
|
| 1188 |
+
"name": typing.Union[str, typing.Sequence[str]],
|
| 1189 |
+
"type": NotRequired[Literal["any", "numeric", "text", "datetime"]],
|
| 1190 |
+
"presentation": NotRequired[Literal["input", "dropdown", "markdown"]],
|
| 1191 |
+
"selectable": NotRequired[
|
| 1192 |
+
typing.Union[Literal["first", "last"], bool, typing.Sequence[bool]]
|
| 1193 |
+
],
|
| 1194 |
+
"clearable": NotRequired[
|
| 1195 |
+
typing.Union[Literal["first", "last"], bool, typing.Sequence[bool]]
|
| 1196 |
+
],
|
| 1197 |
+
"deletable": NotRequired[
|
| 1198 |
+
typing.Union[Literal["first", "last"], bool, typing.Sequence[bool]]
|
| 1199 |
+
],
|
| 1200 |
+
"editable": NotRequired[bool],
|
| 1201 |
+
"hideable": NotRequired[
|
| 1202 |
+
typing.Union[Literal["first", "last"], bool, typing.Sequence[bool]]
|
| 1203 |
+
],
|
| 1204 |
+
"renamable": NotRequired[
|
| 1205 |
+
typing.Union[Literal["first", "last"], bool, typing.Sequence[bool]]
|
| 1206 |
+
],
|
| 1207 |
+
"filter_options": NotRequired["ColumnsFilterOptions"],
|
| 1208 |
+
"format": NotRequired["ColumnsFormat"],
|
| 1209 |
+
"on_change": NotRequired["ColumnsOnChange"],
|
| 1210 |
+
"sort_as_null": NotRequired[
|
| 1211 |
+
typing.Sequence[typing.Union[str, NumberType, bool]]
|
| 1212 |
+
],
|
| 1213 |
+
"validation": NotRequired["ColumnsValidation"],
|
| 1214 |
+
},
|
| 1215 |
+
)
|
| 1216 |
+
|
| 1217 |
+
FixedColumns = TypedDict(
|
| 1218 |
+
"FixedColumns", {"data": NotRequired[NumberType], "headers": NotRequired[bool]}
|
| 1219 |
+
)
|
| 1220 |
+
|
| 1221 |
+
FixedRows = TypedDict(
|
| 1222 |
+
"FixedRows", {"data": NotRequired[NumberType], "headers": NotRequired[bool]}
|
| 1223 |
+
)
|
| 1224 |
+
|
| 1225 |
+
ActiveCell = TypedDict(
|
| 1226 |
+
"ActiveCell",
|
| 1227 |
+
{
|
| 1228 |
+
"row": NotRequired[NumberType],
|
| 1229 |
+
"column": NotRequired[NumberType],
|
| 1230 |
+
"row_id": NotRequired[typing.Union[str, NumberType]],
|
| 1231 |
+
"column_id": NotRequired[str],
|
| 1232 |
+
},
|
| 1233 |
+
)
|
| 1234 |
+
|
| 1235 |
+
SelectedCells = TypedDict(
|
| 1236 |
+
"SelectedCells",
|
| 1237 |
+
{
|
| 1238 |
+
"row": NotRequired[NumberType],
|
| 1239 |
+
"column": NotRequired[NumberType],
|
| 1240 |
+
"row_id": NotRequired[typing.Union[str, NumberType]],
|
| 1241 |
+
"column_id": NotRequired[str],
|
| 1242 |
+
},
|
| 1243 |
+
)
|
| 1244 |
+
|
| 1245 |
+
StartCell = TypedDict(
|
| 1246 |
+
"StartCell",
|
| 1247 |
+
{
|
| 1248 |
+
"row": NotRequired[NumberType],
|
| 1249 |
+
"column": NotRequired[NumberType],
|
| 1250 |
+
"row_id": NotRequired[typing.Union[str, NumberType]],
|
| 1251 |
+
"column_id": NotRequired[str],
|
| 1252 |
+
},
|
| 1253 |
+
)
|
| 1254 |
+
|
| 1255 |
+
EndCell = TypedDict(
|
| 1256 |
+
"EndCell",
|
| 1257 |
+
{
|
| 1258 |
+
"row": NotRequired[NumberType],
|
| 1259 |
+
"column": NotRequired[NumberType],
|
| 1260 |
+
"row_id": NotRequired[typing.Union[str, NumberType]],
|
| 1261 |
+
"column_id": NotRequired[str],
|
| 1262 |
+
},
|
| 1263 |
+
)
|
| 1264 |
+
|
| 1265 |
+
FilterAction = TypedDict(
|
| 1266 |
+
"FilterAction",
|
| 1267 |
+
{
|
| 1268 |
+
"type": Literal["custom", "native"],
|
| 1269 |
+
"operator": NotRequired[Literal["and", "or"]],
|
| 1270 |
+
},
|
| 1271 |
+
)
|
| 1272 |
+
|
| 1273 |
+
FilterOptions = TypedDict(
|
| 1274 |
+
"FilterOptions",
|
| 1275 |
+
{
|
| 1276 |
+
"case": NotRequired[Literal["sensitive", "insensitive"]],
|
| 1277 |
+
"placeholder_text": NotRequired[str],
|
| 1278 |
+
},
|
| 1279 |
+
)
|
| 1280 |
+
|
| 1281 |
+
SortBy = TypedDict(
|
| 1282 |
+
"SortBy", {"column_id": str, "direction": Literal["asc", "desc"]}
|
| 1283 |
+
)
|
| 1284 |
+
|
| 1285 |
+
DropdownOptions = TypedDict(
|
| 1286 |
+
"DropdownOptions", {"label": str, "value": typing.Union[NumberType, str, bool]}
|
| 1287 |
+
)
|
| 1288 |
+
|
| 1289 |
+
Dropdown = TypedDict(
|
| 1290 |
+
"Dropdown",
|
| 1291 |
+
{"clearable": NotRequired[bool], "options": typing.Sequence["DropdownOptions"]},
|
| 1292 |
+
)
|
| 1293 |
+
|
| 1294 |
+
DropdownConditionalIf = TypedDict(
|
| 1295 |
+
"DropdownConditionalIf",
|
| 1296 |
+
{"column_id": NotRequired[str], "filter_query": NotRequired[str]},
|
| 1297 |
+
)
|
| 1298 |
+
|
| 1299 |
+
DropdownConditionalOptions = TypedDict(
|
| 1300 |
+
"DropdownConditionalOptions",
|
| 1301 |
+
{"label": str, "value": typing.Union[NumberType, str, bool]},
|
| 1302 |
+
)
|
| 1303 |
+
|
| 1304 |
+
DropdownConditional = TypedDict(
|
| 1305 |
+
"DropdownConditional",
|
| 1306 |
+
{
|
| 1307 |
+
"clearable": NotRequired[bool],
|
| 1308 |
+
"if": NotRequired["DropdownConditionalIf"],
|
| 1309 |
+
"options": typing.Sequence["DropdownConditionalOptions"],
|
| 1310 |
+
},
|
| 1311 |
+
)
|
| 1312 |
+
|
| 1313 |
+
DropdownDataOptions = TypedDict(
|
| 1314 |
+
"DropdownDataOptions",
|
| 1315 |
+
{"label": str, "value": typing.Union[NumberType, str, bool]},
|
| 1316 |
+
)
|
| 1317 |
+
|
| 1318 |
+
DropdownData = TypedDict(
|
| 1319 |
+
"DropdownData",
|
| 1320 |
+
{
|
| 1321 |
+
"clearable": NotRequired[bool],
|
| 1322 |
+
"options": typing.Sequence["DropdownDataOptions"],
|
| 1323 |
+
},
|
| 1324 |
+
)
|
| 1325 |
+
|
| 1326 |
+
Tooltip = TypedDict(
|
| 1327 |
+
"Tooltip",
|
| 1328 |
+
{
|
| 1329 |
+
"delay": NotRequired[NumberType],
|
| 1330 |
+
"duration": NotRequired[NumberType],
|
| 1331 |
+
"type": NotRequired[Literal["text", "markdown"]],
|
| 1332 |
+
"use_with": NotRequired[Literal["both", "data", "header"]],
|
| 1333 |
+
"value": str,
|
| 1334 |
+
},
|
| 1335 |
+
)
|
| 1336 |
+
|
| 1337 |
+
TooltipConditionalIf = TypedDict(
|
| 1338 |
+
"TooltipConditionalIf",
|
| 1339 |
+
{
|
| 1340 |
+
"column_id": NotRequired[str],
|
| 1341 |
+
"filter_query": NotRequired[str],
|
| 1342 |
+
"row_index": NotRequired[typing.Union[NumberType, Literal["odd", "even"]]],
|
| 1343 |
+
},
|
| 1344 |
+
)
|
| 1345 |
+
|
| 1346 |
+
TooltipConditional = TypedDict(
|
| 1347 |
+
"TooltipConditional",
|
| 1348 |
+
{
|
| 1349 |
+
"delay": NotRequired[NumberType],
|
| 1350 |
+
"duration": NotRequired[NumberType],
|
| 1351 |
+
"if": "TooltipConditionalIf",
|
| 1352 |
+
"type": NotRequired[Literal["text", "markdown"]],
|
| 1353 |
+
"value": str,
|
| 1354 |
+
},
|
| 1355 |
+
)
|
| 1356 |
+
|
| 1357 |
+
TooltipData = TypedDict(
|
| 1358 |
+
"TooltipData",
|
| 1359 |
+
{
|
| 1360 |
+
"delay": NotRequired[NumberType],
|
| 1361 |
+
"duration": NotRequired[NumberType],
|
| 1362 |
+
"type": NotRequired[Literal["text", "markdown"]],
|
| 1363 |
+
"value": str,
|
| 1364 |
+
},
|
| 1365 |
+
)
|
| 1366 |
+
|
| 1367 |
+
TooltipHeader = TypedDict(
|
| 1368 |
+
"TooltipHeader",
|
| 1369 |
+
{
|
| 1370 |
+
"delay": NotRequired[NumberType],
|
| 1371 |
+
"duration": NotRequired[NumberType],
|
| 1372 |
+
"type": NotRequired[Literal["text", "markdown"]],
|
| 1373 |
+
"value": str,
|
| 1374 |
+
},
|
| 1375 |
+
)
|
| 1376 |
+
|
| 1377 |
+
LocaleFormat = TypedDict(
|
| 1378 |
+
"LocaleFormat",
|
| 1379 |
+
{
|
| 1380 |
+
"symbol": NotRequired[typing.Sequence[str]],
|
| 1381 |
+
"decimal": NotRequired[str],
|
| 1382 |
+
"group": NotRequired[str],
|
| 1383 |
+
"grouping": NotRequired[typing.Sequence[NumberType]],
|
| 1384 |
+
"numerals": NotRequired[typing.Sequence[str]],
|
| 1385 |
+
"percent": NotRequired[str],
|
| 1386 |
+
"separate_4digits": NotRequired[bool],
|
| 1387 |
+
},
|
| 1388 |
+
)
|
| 1389 |
+
|
| 1390 |
+
MarkdownOptions = TypedDict(
|
| 1391 |
+
"MarkdownOptions",
|
| 1392 |
+
{
|
| 1393 |
+
"link_target": NotRequired[
|
| 1394 |
+
typing.Union[str, Literal["_blank", "_parent", "_self", "_top"]]
|
| 1395 |
+
],
|
| 1396 |
+
"html": NotRequired[bool],
|
| 1397 |
+
},
|
| 1398 |
+
)
|
| 1399 |
+
|
| 1400 |
+
Css = TypedDict("Css", {"selector": str, "rule": str})
|
| 1401 |
+
|
| 1402 |
+
StyleCellConditionalIf = TypedDict(
|
| 1403 |
+
"StyleCellConditionalIf",
|
| 1404 |
+
{
|
| 1405 |
+
"column_id": NotRequired[typing.Union[str, typing.Sequence[str]]],
|
| 1406 |
+
"column_type": NotRequired[Literal["any", "numeric", "text", "datetime"]],
|
| 1407 |
+
},
|
| 1408 |
+
)
|
| 1409 |
+
|
| 1410 |
+
StyleCellConditional = TypedDict(
|
| 1411 |
+
"StyleCellConditional", {"if": NotRequired["StyleCellConditionalIf"]}
|
| 1412 |
+
)
|
| 1413 |
+
|
| 1414 |
+
StyleDataConditionalIf = TypedDict(
|
| 1415 |
+
"StyleDataConditionalIf",
|
| 1416 |
+
{
|
| 1417 |
+
"column_id": NotRequired[typing.Union[str, typing.Sequence[str]]],
|
| 1418 |
+
"column_type": NotRequired[Literal["any", "numeric", "text", "datetime"]],
|
| 1419 |
+
"filter_query": NotRequired[str],
|
| 1420 |
+
"state": NotRequired[Literal["active", "selected"]],
|
| 1421 |
+
"row_index": NotRequired[
|
| 1422 |
+
typing.Union[
|
| 1423 |
+
NumberType, Literal["odd", "even"], typing.Sequence[NumberType]
|
| 1424 |
+
]
|
| 1425 |
+
],
|
| 1426 |
+
"column_editable": NotRequired[bool],
|
| 1427 |
+
},
|
| 1428 |
+
)
|
| 1429 |
+
|
| 1430 |
+
StyleDataConditional = TypedDict(
|
| 1431 |
+
"StyleDataConditional", {"if": NotRequired["StyleDataConditionalIf"]}
|
| 1432 |
+
)
|
| 1433 |
+
|
| 1434 |
+
StyleFilterConditionalIf = TypedDict(
|
| 1435 |
+
"StyleFilterConditionalIf",
|
| 1436 |
+
{
|
| 1437 |
+
"column_id": NotRequired[typing.Union[str, typing.Sequence[str]]],
|
| 1438 |
+
"column_type": NotRequired[Literal["any", "numeric", "text", "datetime"]],
|
| 1439 |
+
"column_editable": NotRequired[bool],
|
| 1440 |
+
},
|
| 1441 |
+
)
|
| 1442 |
+
|
| 1443 |
+
StyleFilterConditional = TypedDict(
|
| 1444 |
+
"StyleFilterConditional", {"if": NotRequired["StyleFilterConditionalIf"]}
|
| 1445 |
+
)
|
| 1446 |
+
|
| 1447 |
+
StyleHeaderConditionalIf = TypedDict(
|
| 1448 |
+
"StyleHeaderConditionalIf",
|
| 1449 |
+
{
|
| 1450 |
+
"column_id": NotRequired[typing.Union[str, typing.Sequence[str]]],
|
| 1451 |
+
"column_type": NotRequired[Literal["any", "numeric", "text", "datetime"]],
|
| 1452 |
+
"header_index": NotRequired[
|
| 1453 |
+
typing.Union[
|
| 1454 |
+
NumberType, typing.Sequence[NumberType], Literal["odd", "even"]
|
| 1455 |
+
]
|
| 1456 |
+
],
|
| 1457 |
+
"column_editable": NotRequired[bool],
|
| 1458 |
+
},
|
| 1459 |
+
)
|
| 1460 |
+
|
| 1461 |
+
StyleHeaderConditional = TypedDict(
|
| 1462 |
+
"StyleHeaderConditional", {"if": NotRequired["StyleHeaderConditionalIf"]}
|
| 1463 |
+
)
|
| 1464 |
+
|
| 1465 |
+
LoadingState = TypedDict(
|
| 1466 |
+
"LoadingState",
|
| 1467 |
+
{
|
| 1468 |
+
"is_loading": NotRequired[bool],
|
| 1469 |
+
"prop_name": NotRequired[str],
|
| 1470 |
+
"component_name": NotRequired[str],
|
| 1471 |
+
},
|
| 1472 |
+
)
|
| 1473 |
+
|
| 1474 |
+
def __init__(
|
| 1475 |
+
self,
|
| 1476 |
+
data: typing.Optional[
|
| 1477 |
+
typing.Sequence[
|
| 1478 |
+
typing.Dict[
|
| 1479 |
+
typing.Union[str, float, int], typing.Union[str, NumberType, bool]
|
| 1480 |
+
]
|
| 1481 |
+
]
|
| 1482 |
+
] = None,
|
| 1483 |
+
columns: typing.Optional[typing.Sequence["Columns"]] = None,
|
| 1484 |
+
editable: typing.Optional[bool] = None,
|
| 1485 |
+
fixed_columns: typing.Optional["FixedColumns"] = None,
|
| 1486 |
+
fixed_rows: typing.Optional["FixedRows"] = None,
|
| 1487 |
+
column_selectable: typing.Optional[Literal["single", "multi", False]] = None,
|
| 1488 |
+
cell_selectable: typing.Optional[bool] = None,
|
| 1489 |
+
row_selectable: typing.Optional[Literal["single", "multi", False]] = None,
|
| 1490 |
+
row_deletable: typing.Optional[bool] = None,
|
| 1491 |
+
active_cell: typing.Optional["ActiveCell"] = None,
|
| 1492 |
+
selected_cells: typing.Optional[typing.Sequence["SelectedCells"]] = None,
|
| 1493 |
+
selected_rows: typing.Optional[typing.Sequence[NumberType]] = None,
|
| 1494 |
+
selected_columns: typing.Optional[typing.Sequence[str]] = None,
|
| 1495 |
+
selected_row_ids: typing.Optional[
|
| 1496 |
+
typing.Sequence[typing.Union[str, NumberType]]
|
| 1497 |
+
] = None,
|
| 1498 |
+
start_cell: typing.Optional["StartCell"] = None,
|
| 1499 |
+
end_cell: typing.Optional["EndCell"] = None,
|
| 1500 |
+
data_previous: typing.Optional[typing.Sequence[dict]] = None,
|
| 1501 |
+
hidden_columns: typing.Optional[typing.Sequence[str]] = None,
|
| 1502 |
+
is_focused: typing.Optional[bool] = None,
|
| 1503 |
+
merge_duplicate_headers: typing.Optional[bool] = None,
|
| 1504 |
+
data_timestamp: typing.Optional[NumberType] = None,
|
| 1505 |
+
include_headers_on_copy_paste: typing.Optional[bool] = None,
|
| 1506 |
+
export_columns: typing.Optional[Literal["all", "visible"]] = None,
|
| 1507 |
+
export_format: typing.Optional[Literal["csv", "xlsx", "none"]] = None,
|
| 1508 |
+
export_headers: typing.Optional[
|
| 1509 |
+
Literal["none", "ids", "names", "display"]
|
| 1510 |
+
] = None,
|
| 1511 |
+
page_action: typing.Optional[Literal["custom", "native", "none"]] = None,
|
| 1512 |
+
page_current: typing.Optional[NumberType] = None,
|
| 1513 |
+
page_count: typing.Optional[NumberType] = None,
|
| 1514 |
+
page_size: typing.Optional[NumberType] = None,
|
| 1515 |
+
filter_query: typing.Optional[str] = None,
|
| 1516 |
+
filter_action: typing.Optional[
|
| 1517 |
+
typing.Union[Literal["custom", "native", "none"], "FilterAction"]
|
| 1518 |
+
] = None,
|
| 1519 |
+
filter_options: typing.Optional["FilterOptions"] = None,
|
| 1520 |
+
sort_action: typing.Optional[Literal["custom", "native", "none"]] = None,
|
| 1521 |
+
sort_mode: typing.Optional[Literal["single", "multi"]] = None,
|
| 1522 |
+
sort_by: typing.Optional[typing.Sequence["SortBy"]] = None,
|
| 1523 |
+
sort_as_null: typing.Optional[
|
| 1524 |
+
typing.Sequence[typing.Union[str, NumberType, bool]]
|
| 1525 |
+
] = None,
|
| 1526 |
+
dropdown: typing.Optional[
|
| 1527 |
+
typing.Dict[typing.Union[str, float, int], "Dropdown"]
|
| 1528 |
+
] = None,
|
| 1529 |
+
dropdown_conditional: typing.Optional[
|
| 1530 |
+
typing.Sequence["DropdownConditional"]
|
| 1531 |
+
] = None,
|
| 1532 |
+
dropdown_data: typing.Optional[
|
| 1533 |
+
typing.Sequence[typing.Dict[typing.Union[str, float, int], "DropdownData"]]
|
| 1534 |
+
] = None,
|
| 1535 |
+
tooltip: typing.Optional[
|
| 1536 |
+
typing.Dict[typing.Union[str, float, int], typing.Union[str, "Tooltip"]]
|
| 1537 |
+
] = None,
|
| 1538 |
+
tooltip_conditional: typing.Optional[
|
| 1539 |
+
typing.Sequence["TooltipConditional"]
|
| 1540 |
+
] = None,
|
| 1541 |
+
tooltip_data: typing.Optional[
|
| 1542 |
+
typing.Sequence[
|
| 1543 |
+
typing.Dict[
|
| 1544 |
+
typing.Union[str, float, int], typing.Union[str, "TooltipData"]
|
| 1545 |
+
]
|
| 1546 |
+
]
|
| 1547 |
+
] = None,
|
| 1548 |
+
tooltip_header: typing.Optional[
|
| 1549 |
+
typing.Dict[
|
| 1550 |
+
typing.Union[str, float, int],
|
| 1551 |
+
typing.Union[
|
| 1552 |
+
str,
|
| 1553 |
+
"TooltipHeader",
|
| 1554 |
+
typing.Sequence[typing.Union[Literal[None], str, "TooltipHeader"]],
|
| 1555 |
+
],
|
| 1556 |
+
]
|
| 1557 |
+
] = None,
|
| 1558 |
+
tooltip_delay: typing.Optional[NumberType] = None,
|
| 1559 |
+
tooltip_duration: typing.Optional[NumberType] = None,
|
| 1560 |
+
locale_format: typing.Optional["LocaleFormat"] = None,
|
| 1561 |
+
style_as_list_view: typing.Optional[bool] = None,
|
| 1562 |
+
fill_width: typing.Optional[bool] = None,
|
| 1563 |
+
markdown_options: typing.Optional["MarkdownOptions"] = None,
|
| 1564 |
+
css: typing.Optional[typing.Sequence["Css"]] = None,
|
| 1565 |
+
style_table: typing.Optional[dict] = None,
|
| 1566 |
+
style_cell: typing.Optional[dict] = None,
|
| 1567 |
+
style_data: typing.Optional[dict] = None,
|
| 1568 |
+
style_filter: typing.Optional[dict] = None,
|
| 1569 |
+
style_header: typing.Optional[dict] = None,
|
| 1570 |
+
style_cell_conditional: typing.Optional[
|
| 1571 |
+
typing.Sequence["StyleCellConditional"]
|
| 1572 |
+
] = None,
|
| 1573 |
+
style_data_conditional: typing.Optional[
|
| 1574 |
+
typing.Sequence["StyleDataConditional"]
|
| 1575 |
+
] = None,
|
| 1576 |
+
style_filter_conditional: typing.Optional[
|
| 1577 |
+
typing.Sequence["StyleFilterConditional"]
|
| 1578 |
+
] = None,
|
| 1579 |
+
style_header_conditional: typing.Optional[
|
| 1580 |
+
typing.Sequence["StyleHeaderConditional"]
|
| 1581 |
+
] = None,
|
| 1582 |
+
virtualization: typing.Optional[bool] = None,
|
| 1583 |
+
derived_filter_query_structure: typing.Optional[dict] = None,
|
| 1584 |
+
derived_viewport_data: typing.Optional[typing.Sequence[dict]] = None,
|
| 1585 |
+
derived_viewport_indices: typing.Optional[typing.Sequence[NumberType]] = None,
|
| 1586 |
+
derived_viewport_row_ids: typing.Optional[
|
| 1587 |
+
typing.Sequence[typing.Union[str, NumberType]]
|
| 1588 |
+
] = None,
|
| 1589 |
+
derived_viewport_selected_columns: typing.Optional[typing.Sequence[str]] = None,
|
| 1590 |
+
derived_viewport_selected_rows: typing.Optional[
|
| 1591 |
+
typing.Sequence[NumberType]
|
| 1592 |
+
] = None,
|
| 1593 |
+
derived_viewport_selected_row_ids: typing.Optional[
|
| 1594 |
+
typing.Sequence[typing.Union[str, NumberType]]
|
| 1595 |
+
] = None,
|
| 1596 |
+
derived_virtual_data: typing.Optional[typing.Sequence[dict]] = None,
|
| 1597 |
+
derived_virtual_indices: typing.Optional[typing.Sequence[NumberType]] = None,
|
| 1598 |
+
derived_virtual_row_ids: typing.Optional[
|
| 1599 |
+
typing.Sequence[typing.Union[str, NumberType]]
|
| 1600 |
+
] = None,
|
| 1601 |
+
derived_virtual_selected_rows: typing.Optional[
|
| 1602 |
+
typing.Sequence[NumberType]
|
| 1603 |
+
] = None,
|
| 1604 |
+
derived_virtual_selected_row_ids: typing.Optional[
|
| 1605 |
+
typing.Sequence[typing.Union[str, NumberType]]
|
| 1606 |
+
] = None,
|
| 1607 |
+
id: typing.Optional[typing.Union[str, dict]] = None,
|
| 1608 |
+
loading_state: typing.Optional["LoadingState"] = None,
|
| 1609 |
+
persistence: typing.Optional[typing.Union[bool, str, NumberType]] = None,
|
| 1610 |
+
persisted_props: typing.Optional[
|
| 1611 |
+
typing.Sequence[
|
| 1612 |
+
Literal[
|
| 1613 |
+
"columns.name",
|
| 1614 |
+
"data",
|
| 1615 |
+
"filter_query",
|
| 1616 |
+
"hidden_columns",
|
| 1617 |
+
"page_current",
|
| 1618 |
+
"selected_columns",
|
| 1619 |
+
"selected_rows",
|
| 1620 |
+
"sort_by",
|
| 1621 |
+
]
|
| 1622 |
+
]
|
| 1623 |
+
] = None,
|
| 1624 |
+
persistence_type: typing.Optional[Literal["local", "session", "memory"]] = None,
|
| 1625 |
+
**kwargs
|
| 1626 |
+
):
|
| 1627 |
+
self._prop_names = [
|
| 1628 |
+
"data",
|
| 1629 |
+
"columns",
|
| 1630 |
+
"editable",
|
| 1631 |
+
"fixed_columns",
|
| 1632 |
+
"fixed_rows",
|
| 1633 |
+
"column_selectable",
|
| 1634 |
+
"cell_selectable",
|
| 1635 |
+
"row_selectable",
|
| 1636 |
+
"row_deletable",
|
| 1637 |
+
"active_cell",
|
| 1638 |
+
"selected_cells",
|
| 1639 |
+
"selected_rows",
|
| 1640 |
+
"selected_columns",
|
| 1641 |
+
"selected_row_ids",
|
| 1642 |
+
"start_cell",
|
| 1643 |
+
"end_cell",
|
| 1644 |
+
"data_previous",
|
| 1645 |
+
"hidden_columns",
|
| 1646 |
+
"is_focused",
|
| 1647 |
+
"merge_duplicate_headers",
|
| 1648 |
+
"data_timestamp",
|
| 1649 |
+
"include_headers_on_copy_paste",
|
| 1650 |
+
"export_columns",
|
| 1651 |
+
"export_format",
|
| 1652 |
+
"export_headers",
|
| 1653 |
+
"page_action",
|
| 1654 |
+
"page_current",
|
| 1655 |
+
"page_count",
|
| 1656 |
+
"page_size",
|
| 1657 |
+
"filter_query",
|
| 1658 |
+
"filter_action",
|
| 1659 |
+
"filter_options",
|
| 1660 |
+
"sort_action",
|
| 1661 |
+
"sort_mode",
|
| 1662 |
+
"sort_by",
|
| 1663 |
+
"sort_as_null",
|
| 1664 |
+
"dropdown",
|
| 1665 |
+
"dropdown_conditional",
|
| 1666 |
+
"dropdown_data",
|
| 1667 |
+
"tooltip",
|
| 1668 |
+
"tooltip_conditional",
|
| 1669 |
+
"tooltip_data",
|
| 1670 |
+
"tooltip_header",
|
| 1671 |
+
"tooltip_delay",
|
| 1672 |
+
"tooltip_duration",
|
| 1673 |
+
"locale_format",
|
| 1674 |
+
"style_as_list_view",
|
| 1675 |
+
"fill_width",
|
| 1676 |
+
"markdown_options",
|
| 1677 |
+
"css",
|
| 1678 |
+
"style_table",
|
| 1679 |
+
"style_cell",
|
| 1680 |
+
"style_data",
|
| 1681 |
+
"style_filter",
|
| 1682 |
+
"style_header",
|
| 1683 |
+
"style_cell_conditional",
|
| 1684 |
+
"style_data_conditional",
|
| 1685 |
+
"style_filter_conditional",
|
| 1686 |
+
"style_header_conditional",
|
| 1687 |
+
"virtualization",
|
| 1688 |
+
"derived_filter_query_structure",
|
| 1689 |
+
"derived_viewport_data",
|
| 1690 |
+
"derived_viewport_indices",
|
| 1691 |
+
"derived_viewport_row_ids",
|
| 1692 |
+
"derived_viewport_selected_columns",
|
| 1693 |
+
"derived_viewport_selected_rows",
|
| 1694 |
+
"derived_viewport_selected_row_ids",
|
| 1695 |
+
"derived_virtual_data",
|
| 1696 |
+
"derived_virtual_indices",
|
| 1697 |
+
"derived_virtual_row_ids",
|
| 1698 |
+
"derived_virtual_selected_rows",
|
| 1699 |
+
"derived_virtual_selected_row_ids",
|
| 1700 |
+
"id",
|
| 1701 |
+
"loading_state",
|
| 1702 |
+
"persistence",
|
| 1703 |
+
"persisted_props",
|
| 1704 |
+
"persistence_type",
|
| 1705 |
+
]
|
| 1706 |
+
self._valid_wildcard_attributes = []
|
| 1707 |
+
self.available_properties = [
|
| 1708 |
+
"data",
|
| 1709 |
+
"columns",
|
| 1710 |
+
"editable",
|
| 1711 |
+
"fixed_columns",
|
| 1712 |
+
"fixed_rows",
|
| 1713 |
+
"column_selectable",
|
| 1714 |
+
"cell_selectable",
|
| 1715 |
+
"row_selectable",
|
| 1716 |
+
"row_deletable",
|
| 1717 |
+
"active_cell",
|
| 1718 |
+
"selected_cells",
|
| 1719 |
+
"selected_rows",
|
| 1720 |
+
"selected_columns",
|
| 1721 |
+
"selected_row_ids",
|
| 1722 |
+
"start_cell",
|
| 1723 |
+
"end_cell",
|
| 1724 |
+
"data_previous",
|
| 1725 |
+
"hidden_columns",
|
| 1726 |
+
"is_focused",
|
| 1727 |
+
"merge_duplicate_headers",
|
| 1728 |
+
"data_timestamp",
|
| 1729 |
+
"include_headers_on_copy_paste",
|
| 1730 |
+
"export_columns",
|
| 1731 |
+
"export_format",
|
| 1732 |
+
"export_headers",
|
| 1733 |
+
"page_action",
|
| 1734 |
+
"page_current",
|
| 1735 |
+
"page_count",
|
| 1736 |
+
"page_size",
|
| 1737 |
+
"filter_query",
|
| 1738 |
+
"filter_action",
|
| 1739 |
+
"filter_options",
|
| 1740 |
+
"sort_action",
|
| 1741 |
+
"sort_mode",
|
| 1742 |
+
"sort_by",
|
| 1743 |
+
"sort_as_null",
|
| 1744 |
+
"dropdown",
|
| 1745 |
+
"dropdown_conditional",
|
| 1746 |
+
"dropdown_data",
|
| 1747 |
+
"tooltip",
|
| 1748 |
+
"tooltip_conditional",
|
| 1749 |
+
"tooltip_data",
|
| 1750 |
+
"tooltip_header",
|
| 1751 |
+
"tooltip_delay",
|
| 1752 |
+
"tooltip_duration",
|
| 1753 |
+
"locale_format",
|
| 1754 |
+
"style_as_list_view",
|
| 1755 |
+
"fill_width",
|
| 1756 |
+
"markdown_options",
|
| 1757 |
+
"css",
|
| 1758 |
+
"style_table",
|
| 1759 |
+
"style_cell",
|
| 1760 |
+
"style_data",
|
| 1761 |
+
"style_filter",
|
| 1762 |
+
"style_header",
|
| 1763 |
+
"style_cell_conditional",
|
| 1764 |
+
"style_data_conditional",
|
| 1765 |
+
"style_filter_conditional",
|
| 1766 |
+
"style_header_conditional",
|
| 1767 |
+
"virtualization",
|
| 1768 |
+
"derived_filter_query_structure",
|
| 1769 |
+
"derived_viewport_data",
|
| 1770 |
+
"derived_viewport_indices",
|
| 1771 |
+
"derived_viewport_row_ids",
|
| 1772 |
+
"derived_viewport_selected_columns",
|
| 1773 |
+
"derived_viewport_selected_rows",
|
| 1774 |
+
"derived_viewport_selected_row_ids",
|
| 1775 |
+
"derived_virtual_data",
|
| 1776 |
+
"derived_virtual_indices",
|
| 1777 |
+
"derived_virtual_row_ids",
|
| 1778 |
+
"derived_virtual_selected_rows",
|
| 1779 |
+
"derived_virtual_selected_row_ids",
|
| 1780 |
+
"id",
|
| 1781 |
+
"loading_state",
|
| 1782 |
+
"persistence",
|
| 1783 |
+
"persisted_props",
|
| 1784 |
+
"persistence_type",
|
| 1785 |
+
]
|
| 1786 |
+
self.available_wildcard_properties = []
|
| 1787 |
+
_explicit_args = kwargs.pop("_explicit_args")
|
| 1788 |
+
_locals = locals()
|
| 1789 |
+
_locals.update(kwargs) # For wildcard attrs and excess named props
|
| 1790 |
+
args = {k: _locals[k] for k in _explicit_args}
|
| 1791 |
+
|
| 1792 |
+
super(DataTable, self).__init__(**args)
|
| 1793 |
+
|
| 1794 |
+
|
| 1795 |
+
setattr(DataTable, "__init__", _explicitize_args(DataTable.__init__))
|
lib/python3.10/site-packages/dash/dash_table/async-table.js.LICENSE.txt
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
Copyright (c) 2018 Jed Watson.
|
| 3 |
+
Licensed under the MIT License (MIT), see
|
| 4 |
+
http://jedwatson.github.io/classnames
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
/*!
|
| 8 |
+
Copyright (c) 2018 Jed Watson.
|
| 9 |
+
Licensed under the MIT License (MIT), see
|
| 10 |
+
http://jedwatson.github.io/react-select
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
/*!
|
| 14 |
+
* Font Awesome Free 5.15.4 by @fontawesome - https://fontawesome.com
|
| 15 |
+
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
lib/python3.10/site-packages/dash/dash_table/async-table.js.map
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lib/python3.10/site-packages/dash/dash_table/bundle.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(()=>{var e,t,r,n,o={845:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(5564);function o(e,t,r){return function(){if(0===arguments.length)return r();var o=arguments[arguments.length-1];if(!(0,n.A)(o)){for(var i=0;i<e.length;){if("function"==typeof o[e[i]])return o[e[i]].apply(o,Array.prototype.slice.call(arguments,0,-1));i+=1}if(function(e){return null!=e&&"function"==typeof e["@@transducer/step"]}(o))return t.apply(null,Array.prototype.slice.call(arguments,0,-1))(o)}return r.apply(this,arguments)}}},1069:(e,t,r)=>{"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(t,e)}r.d(t,{A:()=>n})},1609:e=>{"use strict";e.exports=window.React},1647:(e,t,r)=>{"use strict";var n=(0,r(3579).A)(function(e){return null==e});t.A=n},1878:(e,t)=>{"use strict";t.A={init:function(){return this.xf["@@transducer/init"]()},result:function(e){return this.xf["@@transducer/result"](e)}}},2039:(e,t,r)=>{"use strict";var n=r(7660),o=(0,r(3579).A)(function(e){var t,r=!1;return(0,n.A)(e.length,function(){return r?t:(r=!0,t=e.apply(this,arguments))})});t.A=o},2173:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var n=r(3579),o=r(2254),i=r(2808);function a(e){return function t(r,a,s){switch(arguments.length){case 0:return t;case 1:return(0,i.A)(r)?t:(0,o.A)(function(t,n){return e(r,t,n)});case 2:return(0,i.A)(r)&&(0,i.A)(a)?t:(0,i.A)(r)?(0,o.A)(function(t,r){return e(t,a,r)}):(0,i.A)(a)?(0,o.A)(function(t,n){return e(r,t,n)}):(0,n.A)(function(t){return e(r,a,t)});default:return(0,i.A)(r)&&(0,i.A)(a)&&(0,i.A)(s)?t:(0,i.A)(r)&&(0,i.A)(a)?(0,o.A)(function(t,r){return e(t,r,s)}):(0,i.A)(r)&&(0,i.A)(s)?(0,o.A)(function(t,r){return e(t,a,r)}):(0,i.A)(a)&&(0,i.A)(s)?(0,o.A)(function(t,n){return e(r,t,n)}):(0,i.A)(r)?(0,n.A)(function(t){return e(t,a,s)}):(0,i.A)(a)?(0,n.A)(function(t){return e(r,t,s)}):(0,i.A)(s)?(0,n.A)(function(t){return e(r,a,t)}):e(r,a,s)}}}},2205:function(e,t,r){var n;n=void 0!==r.g?r.g:this,e.exports=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,r=String(e),n=r.length,o=-1,i="",a=r.charCodeAt(0);++o<n;)0!=(t=r.charCodeAt(o))?i+=t>=1&&t<=31||127==t||0==o&&t>=48&&t<=57||1==o&&t>=48&&t<=57&&45==a?"\\"+t.toString(16)+" ":0==o&&1==n&&45==t||!(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?"\\"+r.charAt(o):r.charAt(o):i+="�";return i};return e.CSS||(e.CSS={}),e.CSS.escape=t,t}(n)},2254:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(3579),o=r(2808);function i(e){return function t(r,i){switch(arguments.length){case 0:return t;case 1:return(0,o.A)(r)?t:(0,n.A)(function(t){return e(r,t)});default:return(0,o.A)(r)&&(0,o.A)(i)?t:(0,o.A)(r)?(0,n.A)(function(t){return e(t,i)}):(0,o.A)(i)?(0,n.A)(function(t){return e(r,t)}):e(r,i)}}}},2270:(e,t,r)=>{"use strict";r.d(t,{A:()=>u});var n=r(2173),o=r(1069),i=r(4279),a=r(5564),s=r(1647),u=(0,n.A)(function e(t,r,n){if(0===t.length)return r;var u=t[0];if(t.length>1){var c=!(0,s.A)(n)&&(0,o.A)(u,n)&&"object"==typeof n[u]?n[u]:(0,i.A)(t[1])?[]:{};r=e(Array.prototype.slice.call(t,1),r,c)}return function(e,t,r){if((0,i.A)(e)&&(0,a.A)(r)){var n=[].concat(r);return n[e]=t,n}var o={};for(var s in r)o[s]=r[s];return o[e]=t,o}(u,r,n)})},2314:(e,t,r)=>{"use strict";var n;r.d(t,{q$:()=>i,$b:()=>a,Ay:()=>d}),function(e){e[e.DEBUG=6]="DEBUG",e[e.NONE=7]="NONE"}(n||(n={}));var o,i=n;!function(e){e[e.TRACE=0]="TRACE",e[e.INFO=1]="INFO",e[e.WARNING=2]="WARNING",e[e.ERROR=3]="ERROR",e[e.FATAL=4]="FATAL",e[e.NONE=5]="NONE"}(o||(o={}));var a=o,s=[];s[a.TRACE]="trace",s[a.INFO]="info",s[a.WARNING]="warning",s[a.ERROR]="error",s[a.FATAL]="fatal",s[a.NONE]="none",s[i.DEBUG]="debug",s[i.NONE]="trace";var u=a.NONE,c=i.NONE;function l(e,t){if(e<t)return()=>{};var r;switch(e){case a.TRACE:case a.INFO:r=window.console.log;break;case i.DEBUG:case a.WARNING:r=window.console.warn;break;case a.ERROR:case a.FATAL:r=window.console.error;break;default:throw new Error("Unknown log ".concat(e))}var n="".concat("","[").concat(s[e].toUpperCase(),"]");return r.bind(window.console,n)}var f={setDebugLevel(e){c=e},setLogLevel(e){u=e}};Object.defineProperties(f,{trace:{get:()=>l(a.TRACE,u),configurable:!1,enumerable:!1},info:{get:()=>l(a.INFO,u),configurable:!1,enumerable:!1},warning:{get:()=>l(a.WARNING,u),configurable:!1,enumerable:!1},error:{get:()=>l(a.ERROR,u),configurable:!1,enumerable:!1},fatal:{get:()=>l(a.FATAL,u),configurable:!1,enumerable:!1},debug:{get:()=>l(i.DEBUG,c),configurable:!1,enumerable:!1}}),Object.freeze(f);var d=f},2598:(e,t,r)=>{"use strict";var n=r(3430),o=r(2254),i=r(845),a=r(8267),s=r(9607),u=r(5845),c=r(2959),l=(0,o.A)((0,i.A)(["fantasy-land/map","map"],s.A,function(e,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return(0,u.A)(t.length,function(){return e.call(this,t.apply(this,arguments))});case"[object Object]":return(0,n.A)(function(r,n){return r[n]=e(t[n]),r},{},(0,c.A)(t));default:return(0,a.A)(e,t)}}));t.A=l},2808:(e,t,r)=>{"use strict";function n(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}r.d(t,{A:()=>n})},2959:(e,t,r)=>{"use strict";r.d(t,{A:()=>f});var n=r(3579),o=r(1069),i=Object.prototype.toString,a=function(){return"[object Arguments]"===i.call(arguments)?function(e){return"[object Arguments]"===i.call(e)}:function(e){return(0,o.A)("callee",e)}}(),s=!{toString:null}.propertyIsEnumerable("toString"),u=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],c=function(){return arguments.propertyIsEnumerable("length")}(),l=function(e,t){for(var r=0;r<e.length;){if(e[r]===t)return!0;r+=1}return!1},f="function"!=typeof Object.keys||c?(0,n.A)(function(e){if(Object(e)!==e)return[];var t,r,n=[],i=c&&a(e);for(t in e)!(0,o.A)(t,e)||i&&"length"===t||(n[n.length]=t);if(s)for(r=u.length-1;r>=0;)t=u[r],(0,o.A)(t,e)&&!l(n,t)&&(n[n.length]=t),r-=1;return n}):(0,n.A)(function(e){return Object(e)!==e?[]:Object.keys(e)})},3430:(e,t,r)=>{"use strict";function n(e,t,r){for(var n=0,o=r.length;n<o;)t=e(t,r[n]),n+=1;return t}r.d(t,{A:()=>n})},3579:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(2808);function o(e){return function t(r){return 0===arguments.length||(0,n.A)(r)?t:e.apply(this,arguments)}}},3847:(e,t,r)=>{"use strict";var n=r(2173),o=r(2270),i=(0,n.A)(function(e,t,r){return(0,o.A)([e],t,r)});t.A=i},4279:(e,t)=>{"use strict";t.A=Number.isInteger||function(e){return(0|e)===e}},4296:(e,t,r)=>{var n;window,e.exports=(n=r(1609),function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t){e.exports=n},function(e,t,r){"use strict";r.r(t),r.d(t,"asyncDecorator",function(){return a}),r.d(t,"inheritAsyncDecorator",function(){return s}),r.d(t,"isReady",function(){return u}),r.d(t,"History",function(){return f});var n=r(0);function o(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function s(e){o(a,n,i,s,u,"next",e)}function u(e){o(a,n,i,s,u,"throw",e)}s(void 0)})}}var a=function(e,t){var r,o={isReady:new Promise(function(e){r=e}),get:Object(n.lazy)(function(){return Promise.resolve(t()).then(function(e){return setTimeout(i(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r(!0);case 2:o.isReady=!0;case 3:case"end":return e.stop()}},e)})),0),e})})};return Object.defineProperty(e,"_dashprivate_isLazyComponentReady",{get:function(){return o.isReady}}),o.get},s=function(e,t){Object.defineProperty(e,"_dashprivate_isLazyComponentReady",{get:function(){return u(t)}})},u=function(e){return e&&e._dashprivate_isLazyComponentReady};function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var l="_dashprivate_historychange",f=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r;return t=e,r=[{key:"dispatchChangeEvent",value:function(){window.dispatchEvent(new CustomEvent(l))}},{key:"onChange",value:function(e){return window.addEventListener(l,e),function(){return window.removeEventListener(l,e)}}}],null&&c(t.prototype,null),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}()}]))},5564:(e,t)=>{"use strict";t.A=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)}},5795:e=>{"use strict";e.exports=window.ReactDOM},5845:(e,t,r)=>{"use strict";var n=r(7660),o=r(3579),i=r(2254),a=r(9034),s=(0,i.A)(function(e,t){return 1===e?(0,o.A)(t):(0,n.A)(e,(0,a.A)(e,[],t))});t.A=s},5987:(e,t,r)=>{"use strict";var n=r(2254),o=r(4279),i=r(6359),a=(0,n.A)(function(e,t){if(null!=t)return(0,o.A)(e)?(0,i.A)(e,t):t[e]});t.A=a},6120:e=>{"use strict";e.exports=window.PropTypes},6359:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var n=r(8228);function o(e,t){var r=e<0?t.length+e:e;return(0,n.A)(t)?t.charAt(r):t[r]}},7246:(e,t,r)=>{"use strict";r.d(t,{A:()=>b});var n,o,i,a=r(2039);class s{static delete(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/";if(s.enabled()){var n=new Date(Date.now()-864e5).toUTCString();document.cookie="".concat(e,"=;expires=").concat(n,";domain=").concat(t,";path=").concat(r)}}static get(e){if(e.length&&s.enabled())return e=e.toLowerCase(),(document.cookie.split(";").map(e=>{var t=e.split("=");return{id:t[0].trim(),value:t[1]}}).find(t=>e===t.id.toLocaleLowerCase())||{}).value}static set(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"/";if(s.enabled()){var o=new Date(Date.now()+63072e7).toUTCString(),i="".concat(e,"=").concat(t,";expires=").concat(o,";domain=").concat(r,";path=").concat(n);s.get(e)&&s.delete(e,r,n),document.cookie=i}}}n=s,o="enabled",i=a.A(()=>{try{document.cookie="cookietest=1";var e=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(e){return!1}}),(o=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(o))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i;var u,c,l,f=r(2314);function d(e,t,r){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var p="dash_debug",y="dash_log";class b{static get searchParams(){return"undefined"!=typeof URL&&URL.prototype&&URL.prototype.constructor&&new URL(window.location.href).searchParams||{get:()=>null}}static get debugLevel(){var e=this.searchParams.get(p)||s.get(p);return e&&f.q$[e]||f.q$.NONE}static get logLevel(){var e=this.searchParams.get(y)||s.get(y);return e&&f.$b[e]||f.$b.ERROR}static get defaultEdge(){return"1px solid #d3d3d3"}static get activeEdge(){return b._activeEdge}static get supportsCssVariables(){return b._supportsCssVariables}}u=b,d(b,"_supportsCssVariables",Boolean(null===(c=window.CSS)||void 0===c||null===(l=c.supports)||void 0===l?void 0:l.call(c,".some-selector","var(--some-var)"))),d(b,"_activeEdge",u._supportsCssVariables?"1px solid var(--accent)":"1px solid hotpink")},7660:(e,t,r)=>{"use strict";function n(e,t){switch(e){case 0:return function(){return t.apply(this,arguments)};case 1:return function(e){return t.apply(this,arguments)};case 2:return function(e,r){return t.apply(this,arguments)};case 3:return function(e,r,n){return t.apply(this,arguments)};case 4:return function(e,r,n,o){return t.apply(this,arguments)};case 5:return function(e,r,n,o,i){return t.apply(this,arguments)};case 6:return function(e,r,n,o,i,a){return t.apply(this,arguments)};case 7:return function(e,r,n,o,i,a,s){return t.apply(this,arguments)};case 8:return function(e,r,n,o,i,a,s,u){return t.apply(this,arguments)};case 9:return function(e,r,n,o,i,a,s,u,c){return t.apply(this,arguments)};case 10:return function(e,r,n,o,i,a,s,u,c,l){return t.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}r.d(t,{A:()=>n})},8228:(e,t,r)=>{"use strict";function n(e){return"[object String]"===Object.prototype.toString.call(e)}r.d(t,{A:()=>n})},8267:(e,t,r)=>{"use strict";function n(e,t){for(var r=0,n=t.length,o=Array(n);r<n;)o[r]=e(t[r]),r+=1;return o}r.d(t,{A:()=>n})},8935:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>d,tu:()=>y});var n=r(9849),o=(0,r(2173).A)(function(e,t,r){for(var n=Math.min(t.length,r.length),o=Array(n),i=0;i<n;)o[i]=e(t[i],r[i]),i+=1;return o}),i=r(3847),a=r(1609),s=r.n(a),u=r(6120),c=r.n(u),l=r(4296),f=r(9734);class d extends a.Component{render(){return s().createElement(a.Suspense,{fallback:null},s().createElement(p,this.props))}}var p=(0,l.asyncDecorator)(d,f.A.table),y={data:c().arrayOf(c().objectOf(c().oneOfType([c().string,c().number,c().bool]))),columns:c().arrayOf(c().exact({id:c().string.isRequired,name:c().oneOfType([c().string,c().arrayOf(c().string)]).isRequired,type:c().oneOf(["any","numeric","text","datetime"]),presentation:c().oneOf(["input","dropdown","markdown"]),selectable:c().oneOfType([c().oneOf(["first","last"]),c().bool,c().arrayOf(c().bool)]),clearable:c().oneOfType([c().oneOf(["first","last"]),c().bool,c().arrayOf(c().bool)]),deletable:c().oneOfType([c().oneOf(["first","last"]),c().bool,c().arrayOf(c().bool)]),editable:c().bool,hideable:c().oneOfType([c().oneOf(["first","last"]),c().bool,c().arrayOf(c().bool)]),renamable:c().oneOfType([c().oneOf(["first","last"]),c().bool,c().arrayOf(c().bool)]),filter_options:c().shape({case:c().oneOf(["sensitive","insensitive"]),placeholder_text:c().string}),format:c().exact({locale:c().exact({symbol:c().arrayOf(c().string),decimal:c().string,group:c().string,grouping:c().arrayOf(c().number),numerals:c().arrayOf(c().string),percent:c().string,separate_4digits:c().bool}),nully:c().any,prefix:c().number,specifier:c().string}),on_change:c().exact({action:c().oneOf(["coerce","none","validate"]),failure:c().oneOf(["accept","default","reject"])}),sort_as_null:c().arrayOf(c().oneOfType([c().string,c().number,c().bool])),validation:c().exact({allow_null:c().bool,default:c().any,allow_YY:c().bool})})),editable:c().bool,fixed_columns:c().exact({data:c().number,headers:c().bool}),fixed_rows:c().exact({data:c().number,headers:c().bool}),column_selectable:c().oneOf(["single","multi",!1]),cell_selectable:c().bool,row_selectable:c().oneOf(["single","multi",!1]),row_deletable:c().bool,active_cell:c().exact({row:c().number,column:c().number,row_id:c().oneOfType([c().string,c().number]),column_id:c().string}),selected_cells:c().arrayOf(c().exact({row:c().number,column:c().number,row_id:c().oneOfType([c().string,c().number]),column_id:c().string})),selected_rows:c().arrayOf(c().number),selected_columns:c().arrayOf(c().string),selected_row_ids:c().arrayOf(c().oneOfType([c().string,c().number])),start_cell:c().exact({row:c().number,column:c().number,row_id:c().oneOfType([c().string,c().number]),column_id:c().string}),end_cell:c().exact({row:c().number,column:c().number,row_id:c().oneOfType([c().string,c().number]),column_id:c().string}),data_previous:c().arrayOf(c().object),hidden_columns:c().arrayOf(c().string),is_focused:c().bool,merge_duplicate_headers:c().bool,data_timestamp:c().number,include_headers_on_copy_paste:c().bool,export_columns:c().oneOf(["all","visible"]),export_format:c().oneOf(["csv","xlsx","none"]),export_headers:c().oneOf(["none","ids","names","display"]),page_action:c().oneOf(["custom","native","none"]),page_current:c().number,page_count:c().number,page_size:c().number,filter_query:c().string,filter_action:c().oneOfType([c().oneOf(["custom","native","none"]),c().shape({type:c().oneOf(["custom","native"]).isRequired,operator:c().oneOf(["and","or"])})]),filter_options:c().shape({case:c().oneOf(["sensitive","insensitive"]),placeholder_text:c().string}),sort_action:c().oneOf(["custom","native","none"]),sort_mode:c().oneOf(["single","multi"]),sort_by:c().arrayOf(c().exact({column_id:c().string.isRequired,direction:c().oneOf(["asc","desc"]).isRequired})),sort_as_null:c().arrayOf(c().oneOfType([c().string,c().number,c().bool])),dropdown:c().objectOf(c().exact({clearable:c().bool,options:c().arrayOf(c().exact({label:c().string.isRequired,value:c().oneOfType([c().number,c().string,c().bool]).isRequired})).isRequired})),dropdown_conditional:c().arrayOf(c().exact({clearable:c().bool,if:c().exact({column_id:c().string,filter_query:c().string}),options:c().arrayOf(c().exact({label:c().string.isRequired,value:c().oneOfType([c().number,c().string,c().bool]).isRequired})).isRequired})),dropdown_data:c().arrayOf(c().objectOf(c().exact({clearable:c().bool,options:c().arrayOf(c().exact({label:c().string.isRequired,value:c().oneOfType([c().number,c().string,c().bool]).isRequired})).isRequired}))),tooltip:c().objectOf(c().oneOfType([c().string,c().exact({delay:c().number,duration:c().number,type:c().oneOf(["text","markdown"]),use_with:c().oneOf(["both","data","header"]),value:c().string.isRequired})])),tooltip_conditional:c().arrayOf(c().exact({delay:c().number,duration:c().number,if:c().exact({column_id:c().string,filter_query:c().string,row_index:c().oneOfType([c().number,c().oneOf(["odd","even"])])}).isRequired,type:c().oneOf(["text","markdown"]),value:c().string.isRequired})),tooltip_data:c().arrayOf(c().objectOf(c().oneOfType([c().string,c().exact({delay:c().number,duration:c().number,type:c().oneOf(["text","markdown"]),value:c().string.isRequired})]))),tooltip_header:c().objectOf(c().oneOfType([c().string,c().exact({delay:c().number,duration:c().number,type:c().oneOf(["text","markdown"]),value:c().string.isRequired}),c().arrayOf(c().oneOfType([c().oneOf([null]),c().string,c().exact({delay:c().number,duration:c().number,type:c().oneOf(["text","markdown"]),value:c().string.isRequired})]))])),tooltip_delay:c().number,tooltip_duration:c().number,locale_format:c().exact({symbol:c().arrayOf(c().string),decimal:c().string,group:c().string,grouping:c().arrayOf(c().number),numerals:c().arrayOf(c().string),percent:c().string,separate_4digits:c().bool}),style_as_list_view:c().bool,fill_width:c().bool,markdown_options:c().exact({link_target:c().oneOfType([c().string,c().oneOf(["_blank","_parent","_self","_top"])]),html:c().bool}),css:c().arrayOf(c().exact({selector:c().string.isRequired,rule:c().string.isRequired})),style_table:c().object,style_cell:c().object,style_data:c().object,style_filter:c().object,style_header:c().object,style_cell_conditional:c().arrayOf(c().shape({if:c().exact({column_id:c().oneOfType([c().string,c().arrayOf(c().string)]),column_type:c().oneOf(["any","numeric","text","datetime"])})})),style_data_conditional:c().arrayOf(c().shape({if:c().exact({column_id:c().oneOfType([c().string,c().arrayOf(c().string)]),column_type:c().oneOf(["any","numeric","text","datetime"]),filter_query:c().string,state:c().oneOf(["active","selected"]),row_index:c().oneOfType([c().number,c().oneOf(["odd","even"]),c().arrayOf(c().number)]),column_editable:c().bool})})),style_filter_conditional:c().arrayOf(c().shape({if:c().exact({column_id:c().oneOfType([c().string,c().arrayOf(c().string)]),column_type:c().oneOf(["any","numeric","text","datetime"]),column_editable:c().bool})})),style_header_conditional:c().arrayOf(c().shape({if:c().exact({column_id:c().oneOfType([c().string,c().arrayOf(c().string)]),column_type:c().oneOf(["any","numeric","text","datetime"]),header_index:c().oneOfType([c().number,c().arrayOf(c().number),c().oneOf(["odd","even"])]),column_editable:c().bool})})),virtualization:c().bool,derived_filter_query_structure:c().object,derived_viewport_data:c().arrayOf(c().object),derived_viewport_indices:c().arrayOf(c().number),derived_viewport_row_ids:c().arrayOf(c().oneOfType([c().string,c().number])),derived_viewport_selected_columns:c().arrayOf(c().string),derived_viewport_selected_rows:c().arrayOf(c().number),derived_viewport_selected_row_ids:c().arrayOf(c().oneOfType([c().string,c().number])),derived_virtual_data:c().arrayOf(c().object),derived_virtual_indices:c().arrayOf(c().number),derived_virtual_row_ids:c().arrayOf(c().oneOfType([c().string,c().number])),derived_virtual_selected_rows:c().arrayOf(c().number),derived_virtual_selected_row_ids:c().arrayOf(c().oneOfType([c().string,c().number])),id:c().string,setProps:c().func,loading_state:c().shape({is_loading:c().bool,prop_name:c().string,component_name:c().string}),persistence:c().oneOfType([c().bool,c().string,c().number]),persisted_props:c().arrayOf(c().oneOf(["columns.name","data","filter_query","hidden_columns","page_current","selected_columns","selected_rows","sort_by"])),persistence_type:c().oneOf(["local","session","memory"])};d.persistenceTransforms={columns:{name:{extract:e=>n.A("name",e),apply:(e,t)=>o(i.A("name"),e,t)}}},d.defaultProps={page_action:"native",page_current:0,page_size:250,css:[],filter_query:"",filter_action:"none",sort_as_null:[],sort_action:"none",sort_mode:"single",sort_by:[],style_as_list_view:!1,derived_viewport_data:[],derived_viewport_indices:[],derived_viewport_row_ids:[],derived_viewport_selected_rows:[],derived_viewport_selected_row_ids:[],derived_virtual_data:[],derived_virtual_indices:[],derived_virtual_row_ids:[],derived_virtual_selected_rows:[],derived_virtual_selected_row_ids:[],dropdown:{},dropdown_conditional:[],dropdown_data:[],fill_width:!0,filter_options:{},fixed_columns:{headers:!1,data:0},fixed_rows:{headers:!1,data:0},markdown_options:{link_target:"_blank",html:!1},tooltip:{},tooltip_conditional:[],tooltip_data:[],tooltip_header:{},tooltip_delay:350,tooltip_duration:2e3,column_selectable:!1,editable:!1,export_columns:"visible",export_format:"none",include_headers_on_copy_paste:!1,selected_cells:[],selected_columns:[],selected_rows:[],selected_row_ids:[],cell_selectable:!0,row_selectable:!1,style_table:{},style_cell_conditional:[],style_data_conditional:[],style_filter_conditional:[],style_header_conditional:[],virtualization:!1,persisted_props:["columns.name","filter_query","hidden_columns","page_current","selected_columns","selected_rows","sort_by"],persistence_type:"local"},d.propTypes=y},9034:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var n=r(7660),o=r(2808);function i(e,t,r){return function(){for(var a=[],s=0,u=e,c=0,l=!1;c<t.length||s<arguments.length;){var f;c<t.length&&(!(0,o.A)(t[c])||s>=arguments.length)?f=t[c]:(f=arguments[s],s+=1),a[c]=f,(0,o.A)(f)?l=!0:u-=1,c+=1}return!l&&u<=0?r.apply(this,a):(0,n.A)(Math.max(0,u),i(e,a,r))}}},9607:(e,t,r)=>{"use strict";var n=r(1878),o=function(){function e(e,t){this.xf=t,this.f=e}return e.prototype["@@transducer/init"]=n.A.init,e.prototype["@@transducer/result"]=n.A.result,e.prototype["@@transducer/step"]=function(e,t){return this.xf["@@transducer/step"](e,this.f(t))},e}();t.A=function(e){return function(t){return new o(e,t)}}},9734:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});class n{static get xlsx(){return r.e(404).then(r.t.bind(r,7063,23))}static get hljs(){return Promise.resolve(window.hljs||r.e(254).then(r.bind(r,3948)).then(e=>e.default))}static table(){return Promise.all([r.e(254),r.e(214)]).then(r.bind(r,3838))}}},9849:(e,t,r)=>{"use strict";var n=r(2254),o=r(2598),i=r(5987),a=(0,n.A)(function(e,t){return(0,o.A)((0,i.A)(e),t)});t.A=a}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={id:e,exports:{}};return o[e].call(r.exports,r,r.exports,a),r.exports}a.m=o,a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(r,n){if(1&n&&(r=this(r)),8&n)return r;if("object"==typeof r&&r){if(4&n&&r.__esModule)return r;if(16&n&&"function"==typeof r.then)return r}var o=Object.create(null);a.r(o);var i={};e=e||[null,t({}),t([]),t(t)];for(var s=2&n&&r;("object"==typeof s||"function"==typeof s)&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach(e=>i[e]=()=>r[e]);return i.default=()=>r,a.d(o,i),o},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,r)=>(a.f[r](e,t),t),[])),a.u=e=>({214:"async-table",254:"async-highlight",404:"async-export"}[e]+".js"),a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},n="dash_table:",a.l=(e,t,o,i)=>{if(r[e])r[e].push(t);else{var s,u;if(void 0!==o)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var f=c[l];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==n+o){s=f;break}}s||(u=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.setAttribute("data-webpack",n+o),s.src=e),r[e]=[t];var d=(t,n)=>{s.onerror=s.onload=null,clearTimeout(p);var o=r[e];if(delete r[e],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach(e=>e(n)),t)return t(n)},p=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),u&&document.head.appendChild(s)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var r=t.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=r[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})();var s,u=function(){var e=document.currentScript;if(!e){for(var t=document.getElementsByTagName("script"),r=[],n=0;n<t.length;n++)r.push(t[n]);e=(r=r.filter(function(e){return!e.async&&!e.text&&!e.textContent})).slice(-1)[0]}return e};if(Object.defineProperty(a,"p",{get:(s=u().src.split("/").slice(0,-1).join("/")+"/",function(){return s})}),"undefined"!=typeof jsonpScriptSrc){var c=jsonpScriptSrc;jsonpScriptSrc=function(e){var t,r=(t=u(),/\/_dash-component-suites\//.test(t.src)),n=c(e);if(!r)return n;var o=n.split("/"),i=o.slice(-1)[0].split(".");return i.splice(1,0,"v6_0_4m1753987258"),o.splice(-1,1,i.join(".")),o.join("/")}}(()=>{var e={23:0};a.f.j=(t,r)=>{var n=a.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=o);var i=a.p+a.u(t),s=new Error;a.l(i,r=>{if(a.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;s.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",s.name="ChunkLoadError",s.type=o,s.request=i,n[1](s)}},"chunk-"+t,t)}};var t=(t,r)=>{var n,o,i=r[0],s=r[1],u=r[2],c=0;if(i.some(t=>0!==e[t])){for(n in s)a.o(s,n)&&(a.m[n]=s[n]);u&&u(a)}for(t&&t(r);c<i.length;c++)o=i[c],a.o(e,o)&&e[o]&&e[o][0](),e[o]=0},r=self.webpackChunkdash_table=self.webpackChunkdash_table||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})(),a.nc=void 0;var l={};(()=>{"use strict";a.r(l),a.d(l,{DataTable:()=>r.Ay}),a(2205);var e=a(7246),t=a(2314),r=a(8935);t.Ay.setDebugLevel(e.A.debugLevel),t.Ay.setLogLevel(e.A.logLevel)})(),window.dash_table=l})();
|
| 2 |
+
//# sourceMappingURL=bundle.js.map
|
lib/python3.10/site-packages/dash/dash_table/bundle.js.map
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lib/python3.10/site-packages/dash/dash_table/demo.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lib/python3.10/site-packages/narwhals/_sql/dataframe.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING, Any, Protocol
|
| 4 |
+
|
| 5 |
+
from narwhals._compliant.dataframe import CompliantLazyFrame
|
| 6 |
+
from narwhals._compliant.typing import CompliantExprT_contra, NativeExprT, NativeFrameT
|
| 7 |
+
from narwhals._translate import ToNarwhalsT_co
|
| 8 |
+
|
| 9 |
+
if TYPE_CHECKING:
|
| 10 |
+
from typing_extensions import Self, TypeAlias
|
| 11 |
+
|
| 12 |
+
from narwhals._compliant.window import WindowInputs
|
| 13 |
+
from narwhals._sql.expr import SQLExpr
|
| 14 |
+
|
| 15 |
+
Incomplete: TypeAlias = Any
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class SQLLazyFrame(
|
| 19 |
+
CompliantLazyFrame[CompliantExprT_contra, NativeFrameT, ToNarwhalsT_co],
|
| 20 |
+
Protocol[CompliantExprT_contra, NativeFrameT, ToNarwhalsT_co],
|
| 21 |
+
):
|
| 22 |
+
def _evaluate_window_expr(
|
| 23 |
+
self,
|
| 24 |
+
expr: SQLExpr[Self, NativeExprT],
|
| 25 |
+
/,
|
| 26 |
+
window_inputs: WindowInputs[NativeExprT],
|
| 27 |
+
) -> NativeExprT:
|
| 28 |
+
result = expr.window_function(self, window_inputs)
|
| 29 |
+
assert len(result) == 1 # debug assertion # noqa: S101
|
| 30 |
+
return result[0]
|
lib/python3.10/site-packages/narwhals/_sql/expr.py
ADDED
|
@@ -0,0 +1,730 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING, Any, Callable, Literal, Protocol, cast
|
| 4 |
+
|
| 5 |
+
from narwhals._compliant.expr import LazyExpr
|
| 6 |
+
from narwhals._compliant.typing import (
|
| 7 |
+
AliasNames,
|
| 8 |
+
EvalNames,
|
| 9 |
+
EvalSeries,
|
| 10 |
+
NativeExprT,
|
| 11 |
+
WindowFunction,
|
| 12 |
+
)
|
| 13 |
+
from narwhals._compliant.window import WindowInputs
|
| 14 |
+
from narwhals._expression_parsing import (
|
| 15 |
+
combine_alias_output_names,
|
| 16 |
+
combine_evaluate_output_names,
|
| 17 |
+
)
|
| 18 |
+
from narwhals._sql.typing import SQLLazyFrameT
|
| 19 |
+
from narwhals._utils import Implementation, Version, not_implemented
|
| 20 |
+
|
| 21 |
+
if TYPE_CHECKING:
|
| 22 |
+
from collections.abc import Iterable, Sequence
|
| 23 |
+
|
| 24 |
+
from typing_extensions import Self, TypeIs
|
| 25 |
+
|
| 26 |
+
from narwhals._compliant.typing import AliasNames, WindowFunction
|
| 27 |
+
from narwhals._expression_parsing import ExprMetadata
|
| 28 |
+
from narwhals._sql.namespace import SQLNamespace
|
| 29 |
+
from narwhals.typing import NumericLiteral, PythonLiteral, RankMethod, TemporalLiteral
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class SQLExpr(LazyExpr[SQLLazyFrameT, NativeExprT], Protocol[SQLLazyFrameT, NativeExprT]):
|
| 33 |
+
_call: EvalSeries[SQLLazyFrameT, NativeExprT]
|
| 34 |
+
_evaluate_output_names: EvalNames[SQLLazyFrameT]
|
| 35 |
+
_alias_output_names: AliasNames | None
|
| 36 |
+
_version: Version
|
| 37 |
+
_implementation: Implementation
|
| 38 |
+
_metadata: ExprMetadata | None
|
| 39 |
+
_window_function: WindowFunction[SQLLazyFrameT, NativeExprT] | None
|
| 40 |
+
|
| 41 |
+
def __init__(
|
| 42 |
+
self,
|
| 43 |
+
call: EvalSeries[SQLLazyFrameT, NativeExprT],
|
| 44 |
+
window_function: WindowFunction[SQLLazyFrameT, NativeExprT] | None = None,
|
| 45 |
+
*,
|
| 46 |
+
evaluate_output_names: EvalNames[SQLLazyFrameT],
|
| 47 |
+
alias_output_names: AliasNames | None,
|
| 48 |
+
version: Version,
|
| 49 |
+
implementation: Implementation = Implementation.DUCKDB,
|
| 50 |
+
) -> None: ...
|
| 51 |
+
|
| 52 |
+
def __call__(self, df: SQLLazyFrameT) -> Sequence[NativeExprT]:
|
| 53 |
+
return self._call(df)
|
| 54 |
+
|
| 55 |
+
def __narwhals_namespace__(
|
| 56 |
+
self,
|
| 57 |
+
) -> SQLNamespace[SQLLazyFrameT, Self, Any, NativeExprT]: ...
|
| 58 |
+
|
| 59 |
+
def _callable_to_eval_series(
|
| 60 |
+
self, call: Callable[..., NativeExprT], /, **expressifiable_args: Self | Any
|
| 61 |
+
) -> EvalSeries[SQLLazyFrameT, NativeExprT]:
|
| 62 |
+
def func(df: SQLLazyFrameT) -> list[NativeExprT]:
|
| 63 |
+
native_series_list = self(df)
|
| 64 |
+
other_native_series = {
|
| 65 |
+
key: df._evaluate_expr(value)
|
| 66 |
+
if self._is_expr(value)
|
| 67 |
+
else self._lit(value)
|
| 68 |
+
for key, value in expressifiable_args.items()
|
| 69 |
+
}
|
| 70 |
+
return [
|
| 71 |
+
call(native_series, **other_native_series)
|
| 72 |
+
for native_series in native_series_list
|
| 73 |
+
]
|
| 74 |
+
|
| 75 |
+
return func
|
| 76 |
+
|
| 77 |
+
def _push_down_window_function(
|
| 78 |
+
self, call: Callable[..., NativeExprT], /, **expressifiable_args: Self | Any
|
| 79 |
+
) -> WindowFunction[SQLLazyFrameT, NativeExprT]:
|
| 80 |
+
def window_f(
|
| 81 |
+
df: SQLLazyFrameT, window_inputs: WindowInputs[NativeExprT]
|
| 82 |
+
) -> Sequence[NativeExprT]:
|
| 83 |
+
# If a function `f` is elementwise, and `g` is another function, then
|
| 84 |
+
# - `f(g) over (window)`
|
| 85 |
+
# - `f(g over (window))
|
| 86 |
+
# are equivalent.
|
| 87 |
+
# Make sure to only use with if `call` is elementwise!
|
| 88 |
+
native_series_list = self.window_function(df, window_inputs)
|
| 89 |
+
other_native_series = {
|
| 90 |
+
key: df._evaluate_window_expr(value, window_inputs)
|
| 91 |
+
if self._is_expr(value)
|
| 92 |
+
else self._lit(value)
|
| 93 |
+
for key, value in expressifiable_args.items()
|
| 94 |
+
}
|
| 95 |
+
return [
|
| 96 |
+
call(native_series, **other_native_series)
|
| 97 |
+
for native_series in native_series_list
|
| 98 |
+
]
|
| 99 |
+
|
| 100 |
+
return window_f
|
| 101 |
+
|
| 102 |
+
def _with_window_function(
|
| 103 |
+
self, window_function: WindowFunction[SQLLazyFrameT, NativeExprT]
|
| 104 |
+
) -> Self:
|
| 105 |
+
return self.__class__(
|
| 106 |
+
self._call,
|
| 107 |
+
window_function,
|
| 108 |
+
evaluate_output_names=self._evaluate_output_names,
|
| 109 |
+
alias_output_names=self._alias_output_names,
|
| 110 |
+
version=self._version,
|
| 111 |
+
implementation=self._implementation,
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
def _with_callable(
|
| 115 |
+
self, call: Callable[..., NativeExprT], /, **expressifiable_args: Self | Any
|
| 116 |
+
) -> Self:
|
| 117 |
+
return self.__class__(
|
| 118 |
+
self._callable_to_eval_series(call, **expressifiable_args),
|
| 119 |
+
evaluate_output_names=self._evaluate_output_names,
|
| 120 |
+
alias_output_names=self._alias_output_names,
|
| 121 |
+
version=self._version,
|
| 122 |
+
implementation=self._implementation,
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
def _with_elementwise(
|
| 126 |
+
self, call: Callable[..., NativeExprT], /, **expressifiable_args: Self | Any
|
| 127 |
+
) -> Self:
|
| 128 |
+
return self.__class__(
|
| 129 |
+
self._callable_to_eval_series(call, **expressifiable_args),
|
| 130 |
+
self._push_down_window_function(call, **expressifiable_args),
|
| 131 |
+
evaluate_output_names=self._evaluate_output_names,
|
| 132 |
+
alias_output_names=self._alias_output_names,
|
| 133 |
+
version=self._version,
|
| 134 |
+
implementation=self._implementation,
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
def _with_binary(self, op: Callable[..., NativeExprT], other: Self | Any) -> Self:
|
| 138 |
+
return self.__class__(
|
| 139 |
+
self._callable_to_eval_series(op, other=other),
|
| 140 |
+
self._push_down_window_function(op, other=other),
|
| 141 |
+
evaluate_output_names=self._evaluate_output_names,
|
| 142 |
+
alias_output_names=self._alias_output_names,
|
| 143 |
+
version=self._version,
|
| 144 |
+
implementation=self._implementation,
|
| 145 |
+
)
|
| 146 |
+
|
| 147 |
+
def _with_alias_output_names(self, func: AliasNames | None, /) -> Self:
|
| 148 |
+
current_alias_output_names = self._alias_output_names
|
| 149 |
+
alias_output_names = (
|
| 150 |
+
None
|
| 151 |
+
if func is None
|
| 152 |
+
else func
|
| 153 |
+
if current_alias_output_names is None
|
| 154 |
+
else lambda output_names: func(current_alias_output_names(output_names))
|
| 155 |
+
)
|
| 156 |
+
return type(self)(
|
| 157 |
+
self._call,
|
| 158 |
+
self._window_function,
|
| 159 |
+
evaluate_output_names=self._evaluate_output_names,
|
| 160 |
+
alias_output_names=alias_output_names,
|
| 161 |
+
version=self._version,
|
| 162 |
+
implementation=self._implementation,
|
| 163 |
+
)
|
| 164 |
+
|
| 165 |
+
@property
|
| 166 |
+
def window_function(self) -> WindowFunction[SQLLazyFrameT, NativeExprT]:
|
| 167 |
+
def default_window_func(
|
| 168 |
+
df: SQLLazyFrameT, inputs: WindowInputs[NativeExprT]
|
| 169 |
+
) -> Sequence[NativeExprT]:
|
| 170 |
+
assert not inputs.order_by # noqa: S101
|
| 171 |
+
return [
|
| 172 |
+
self._window_expression(expr, inputs.partition_by, inputs.order_by)
|
| 173 |
+
for expr in self(df)
|
| 174 |
+
]
|
| 175 |
+
|
| 176 |
+
return self._window_function or default_window_func
|
| 177 |
+
|
| 178 |
+
def _function(self, name: str, *args: NativeExprT | PythonLiteral) -> NativeExprT:
|
| 179 |
+
return self.__narwhals_namespace__()._function(name, *args)
|
| 180 |
+
|
| 181 |
+
def _lit(self, value: Any) -> NativeExprT:
|
| 182 |
+
return self.__narwhals_namespace__()._lit(value)
|
| 183 |
+
|
| 184 |
+
def _when(self, condition: NativeExprT, value: NativeExprT) -> NativeExprT:
|
| 185 |
+
return self.__narwhals_namespace__()._when(condition, value)
|
| 186 |
+
|
| 187 |
+
def _coalesce(self, *expr: NativeExprT) -> NativeExprT:
|
| 188 |
+
return self.__narwhals_namespace__()._coalesce(*expr)
|
| 189 |
+
|
| 190 |
+
def _count_star(self) -> NativeExprT: ...
|
| 191 |
+
|
| 192 |
+
def _window_expression(
|
| 193 |
+
self,
|
| 194 |
+
expr: NativeExprT,
|
| 195 |
+
partition_by: Sequence[str | NativeExprT] = (),
|
| 196 |
+
order_by: Sequence[str | NativeExprT] = (),
|
| 197 |
+
rows_start: int | None = None,
|
| 198 |
+
rows_end: int | None = None,
|
| 199 |
+
*,
|
| 200 |
+
descending: Sequence[bool] | None = None,
|
| 201 |
+
nulls_last: Sequence[bool] | None = None,
|
| 202 |
+
) -> NativeExprT: ...
|
| 203 |
+
|
| 204 |
+
def _cum_window_func(
|
| 205 |
+
self,
|
| 206 |
+
func_name: Literal["sum", "max", "min", "count", "product"],
|
| 207 |
+
*,
|
| 208 |
+
reverse: bool,
|
| 209 |
+
) -> WindowFunction[SQLLazyFrameT, NativeExprT]:
|
| 210 |
+
def func(
|
| 211 |
+
df: SQLLazyFrameT, inputs: WindowInputs[NativeExprT]
|
| 212 |
+
) -> Sequence[NativeExprT]:
|
| 213 |
+
return [
|
| 214 |
+
self._window_expression(
|
| 215 |
+
self._function(func_name, expr),
|
| 216 |
+
inputs.partition_by,
|
| 217 |
+
inputs.order_by,
|
| 218 |
+
descending=[reverse] * len(inputs.order_by),
|
| 219 |
+
nulls_last=[reverse] * len(inputs.order_by),
|
| 220 |
+
rows_end=0,
|
| 221 |
+
)
|
| 222 |
+
for expr in self(df)
|
| 223 |
+
]
|
| 224 |
+
|
| 225 |
+
return func
|
| 226 |
+
|
| 227 |
+
def _rolling_window_func(
|
| 228 |
+
self,
|
| 229 |
+
func_name: Literal["sum", "mean", "std", "var"],
|
| 230 |
+
window_size: int,
|
| 231 |
+
min_samples: int,
|
| 232 |
+
ddof: int | None = None,
|
| 233 |
+
*,
|
| 234 |
+
center: bool,
|
| 235 |
+
) -> WindowFunction[SQLLazyFrameT, NativeExprT]:
|
| 236 |
+
supported_funcs = ["sum", "mean", "std", "var"]
|
| 237 |
+
if center:
|
| 238 |
+
half = (window_size - 1) // 2
|
| 239 |
+
remainder = (window_size - 1) % 2
|
| 240 |
+
start = -(half + remainder)
|
| 241 |
+
end = half
|
| 242 |
+
else:
|
| 243 |
+
start = -(window_size - 1)
|
| 244 |
+
end = 0
|
| 245 |
+
|
| 246 |
+
def func(
|
| 247 |
+
df: SQLLazyFrameT, inputs: WindowInputs[NativeExprT]
|
| 248 |
+
) -> Sequence[NativeExprT]:
|
| 249 |
+
if func_name in {"sum", "mean"}:
|
| 250 |
+
func_: str = func_name
|
| 251 |
+
elif func_name == "var" and ddof == 0:
|
| 252 |
+
func_ = "var_pop"
|
| 253 |
+
elif func_name in "var" and ddof == 1:
|
| 254 |
+
func_ = "var_samp"
|
| 255 |
+
elif func_name == "std" and ddof == 0:
|
| 256 |
+
func_ = "stddev_pop"
|
| 257 |
+
elif func_name == "std" and ddof == 1:
|
| 258 |
+
func_ = "stddev_samp"
|
| 259 |
+
elif func_name in {"var", "std"}: # pragma: no cover
|
| 260 |
+
msg = f"Only ddof=0 and ddof=1 are currently supported for rolling_{func_name}."
|
| 261 |
+
raise ValueError(msg)
|
| 262 |
+
else: # pragma: no cover
|
| 263 |
+
msg = f"Only the following functions are supported: {supported_funcs}.\nGot: {func_name}."
|
| 264 |
+
raise ValueError(msg)
|
| 265 |
+
window_kwargs: Any = {
|
| 266 |
+
"partition_by": inputs.partition_by,
|
| 267 |
+
"order_by": inputs.order_by,
|
| 268 |
+
"rows_start": start,
|
| 269 |
+
"rows_end": end,
|
| 270 |
+
}
|
| 271 |
+
return [
|
| 272 |
+
self._when(
|
| 273 |
+
self._window_expression( # type: ignore[operator]
|
| 274 |
+
self._function("count", expr), **window_kwargs
|
| 275 |
+
)
|
| 276 |
+
>= self._lit(min_samples),
|
| 277 |
+
self._window_expression(self._function(func_, expr), **window_kwargs),
|
| 278 |
+
)
|
| 279 |
+
for expr in self(df)
|
| 280 |
+
]
|
| 281 |
+
|
| 282 |
+
return func
|
| 283 |
+
|
| 284 |
+
@classmethod
|
| 285 |
+
def _is_expr(cls, obj: Self | Any) -> TypeIs[Self]:
|
| 286 |
+
return hasattr(obj, "__narwhals_expr__")
|
| 287 |
+
|
| 288 |
+
@property
|
| 289 |
+
def _backend_version(self) -> tuple[int, ...]:
|
| 290 |
+
return self._implementation._backend_version()
|
| 291 |
+
|
| 292 |
+
@classmethod
|
| 293 |
+
def _alias_native(cls, expr: NativeExprT, name: str, /) -> NativeExprT: ...
|
| 294 |
+
|
| 295 |
+
@classmethod
|
| 296 |
+
def _from_elementwise_horizontal_op(
|
| 297 |
+
cls, func: Callable[[Iterable[NativeExprT]], NativeExprT], *exprs: Self
|
| 298 |
+
) -> Self:
|
| 299 |
+
def call(df: SQLLazyFrameT) -> Sequence[NativeExprT]:
|
| 300 |
+
cols = (col for _expr in exprs for col in _expr(df))
|
| 301 |
+
return [func(cols)]
|
| 302 |
+
|
| 303 |
+
def window_function(
|
| 304 |
+
df: SQLLazyFrameT, window_inputs: WindowInputs[NativeExprT]
|
| 305 |
+
) -> Sequence[NativeExprT]:
|
| 306 |
+
cols = (
|
| 307 |
+
col for _expr in exprs for col in _expr.window_function(df, window_inputs)
|
| 308 |
+
)
|
| 309 |
+
return [func(cols)]
|
| 310 |
+
|
| 311 |
+
context = exprs[0]
|
| 312 |
+
return cls(
|
| 313 |
+
call,
|
| 314 |
+
window_function=window_function,
|
| 315 |
+
evaluate_output_names=combine_evaluate_output_names(*exprs),
|
| 316 |
+
alias_output_names=combine_alias_output_names(*exprs),
|
| 317 |
+
version=context._version,
|
| 318 |
+
implementation=context._implementation,
|
| 319 |
+
)
|
| 320 |
+
|
| 321 |
+
# Binary
|
| 322 |
+
def __eq__(self, other: Self) -> Self: # type: ignore[override]
|
| 323 |
+
return self._with_binary(lambda expr, other: expr.__eq__(other), other)
|
| 324 |
+
|
| 325 |
+
def __ne__(self, other: Self) -> Self: # type: ignore[override]
|
| 326 |
+
return self._with_binary(lambda expr, other: expr.__ne__(other), other)
|
| 327 |
+
|
| 328 |
+
def __add__(self, other: Self) -> Self:
|
| 329 |
+
return self._with_binary(lambda expr, other: expr.__add__(other), other)
|
| 330 |
+
|
| 331 |
+
def __sub__(self, other: Self) -> Self:
|
| 332 |
+
return self._with_binary(lambda expr, other: expr.__sub__(other), other)
|
| 333 |
+
|
| 334 |
+
def __rsub__(self, other: Self) -> Self:
|
| 335 |
+
return self._with_binary(lambda expr, other: other - expr, other).alias("literal")
|
| 336 |
+
|
| 337 |
+
def __mul__(self, other: Self) -> Self:
|
| 338 |
+
return self._with_binary(lambda expr, other: expr.__mul__(other), other)
|
| 339 |
+
|
| 340 |
+
def __truediv__(self, other: Self) -> Self:
|
| 341 |
+
return self._with_binary(lambda expr, other: expr.__truediv__(other), other)
|
| 342 |
+
|
| 343 |
+
def __rtruediv__(self, other: Self) -> Self:
|
| 344 |
+
return self._with_binary(lambda expr, other: other / expr, other).alias("literal")
|
| 345 |
+
|
| 346 |
+
def __floordiv__(self, other: Self) -> Self:
|
| 347 |
+
return self._with_binary(lambda expr, other: expr.__floordiv__(other), other)
|
| 348 |
+
|
| 349 |
+
def __rfloordiv__(self, other: Self) -> Self:
|
| 350 |
+
return self._with_binary(lambda expr, other: other // expr, other).alias(
|
| 351 |
+
"literal"
|
| 352 |
+
)
|
| 353 |
+
|
| 354 |
+
def __pow__(self, other: Self) -> Self:
|
| 355 |
+
return self._with_binary(lambda expr, other: expr.__pow__(other), other)
|
| 356 |
+
|
| 357 |
+
def __rpow__(self, other: Self) -> Self:
|
| 358 |
+
return self._with_binary(lambda expr, other: other**expr, other).alias("literal")
|
| 359 |
+
|
| 360 |
+
def __mod__(self, other: Self) -> Self:
|
| 361 |
+
return self._with_binary(lambda expr, other: expr.__mod__(other), other)
|
| 362 |
+
|
| 363 |
+
def __rmod__(self, other: Self) -> Self:
|
| 364 |
+
return self._with_binary(lambda expr, other: other % expr, other).alias("literal")
|
| 365 |
+
|
| 366 |
+
def __ge__(self, other: Self) -> Self:
|
| 367 |
+
return self._with_binary(lambda expr, other: expr.__ge__(other), other)
|
| 368 |
+
|
| 369 |
+
def __gt__(self, other: Self) -> Self:
|
| 370 |
+
return self._with_binary(lambda expr, other: expr.__gt__(other), other)
|
| 371 |
+
|
| 372 |
+
def __le__(self, other: Self) -> Self:
|
| 373 |
+
return self._with_binary(lambda expr, other: expr.__le__(other), other)
|
| 374 |
+
|
| 375 |
+
def __lt__(self, other: Self) -> Self:
|
| 376 |
+
return self._with_binary(lambda expr, other: expr.__lt__(other), other)
|
| 377 |
+
|
| 378 |
+
def __and__(self, other: Self) -> Self:
|
| 379 |
+
return self._with_binary(lambda expr, other: expr.__and__(other), other)
|
| 380 |
+
|
| 381 |
+
def __or__(self, other: Self) -> Self:
|
| 382 |
+
return self._with_binary(lambda expr, other: expr.__or__(other), other)
|
| 383 |
+
|
| 384 |
+
# Aggregations
|
| 385 |
+
def all(self) -> Self:
|
| 386 |
+
def f(expr: NativeExprT) -> NativeExprT:
|
| 387 |
+
return self._coalesce(self._function("bool_and", expr), self._lit(True)) # noqa: FBT003
|
| 388 |
+
|
| 389 |
+
def window_f(
|
| 390 |
+
df: SQLLazyFrameT, inputs: WindowInputs[NativeExprT]
|
| 391 |
+
) -> Sequence[NativeExprT]:
|
| 392 |
+
return [
|
| 393 |
+
self._coalesce(
|
| 394 |
+
self._window_expression(
|
| 395 |
+
self._function("bool_and", expr), inputs.partition_by
|
| 396 |
+
),
|
| 397 |
+
self._lit(True), # noqa: FBT003
|
| 398 |
+
)
|
| 399 |
+
for expr in self(df)
|
| 400 |
+
]
|
| 401 |
+
|
| 402 |
+
return self._with_callable(f)._with_window_function(window_f)
|
| 403 |
+
|
| 404 |
+
def any(self) -> Self:
|
| 405 |
+
def f(expr: NativeExprT) -> NativeExprT:
|
| 406 |
+
return self._coalesce(self._function("bool_or", expr), self._lit(False)) # noqa: FBT003
|
| 407 |
+
|
| 408 |
+
def window_f(
|
| 409 |
+
df: SQLLazyFrameT, inputs: WindowInputs[NativeExprT]
|
| 410 |
+
) -> Sequence[NativeExprT]:
|
| 411 |
+
return [
|
| 412 |
+
self._coalesce(
|
| 413 |
+
self._window_expression(
|
| 414 |
+
self._function("bool_or", expr), inputs.partition_by
|
| 415 |
+
),
|
| 416 |
+
self._lit(False), # noqa: FBT003
|
| 417 |
+
)
|
| 418 |
+
for expr in self(df)
|
| 419 |
+
]
|
| 420 |
+
|
| 421 |
+
return self._with_callable(f)._with_window_function(window_f)
|
| 422 |
+
|
| 423 |
+
def max(self) -> Self:
|
| 424 |
+
return self._with_callable(lambda expr: self._function("max", expr))
|
| 425 |
+
|
| 426 |
+
def mean(self) -> Self:
|
| 427 |
+
return self._with_callable(lambda expr: self._function("mean", expr))
|
| 428 |
+
|
| 429 |
+
def median(self) -> Self:
|
| 430 |
+
return self._with_callable(lambda expr: self._function("median", expr))
|
| 431 |
+
|
| 432 |
+
def min(self) -> Self:
|
| 433 |
+
return self._with_callable(lambda expr: self._function("min", expr))
|
| 434 |
+
|
| 435 |
+
def count(self) -> Self:
|
| 436 |
+
return self._with_callable(lambda expr: self._function("count", expr))
|
| 437 |
+
|
| 438 |
+
def sum(self) -> Self:
|
| 439 |
+
def f(expr: NativeExprT) -> NativeExprT:
|
| 440 |
+
return self._coalesce(self._function("sum", expr), self._lit(0))
|
| 441 |
+
|
| 442 |
+
def window_f(
|
| 443 |
+
df: SQLLazyFrameT, inputs: WindowInputs[NativeExprT]
|
| 444 |
+
) -> Sequence[NativeExprT]:
|
| 445 |
+
return [
|
| 446 |
+
self._coalesce(
|
| 447 |
+
self._window_expression(
|
| 448 |
+
self._function("sum", expr), inputs.partition_by
|
| 449 |
+
),
|
| 450 |
+
self._lit(0),
|
| 451 |
+
)
|
| 452 |
+
for expr in self(df)
|
| 453 |
+
]
|
| 454 |
+
|
| 455 |
+
return self._with_callable(f)._with_window_function(window_f)
|
| 456 |
+
|
| 457 |
+
# Elementwise
|
| 458 |
+
def abs(self) -> Self:
|
| 459 |
+
return self._with_elementwise(lambda expr: self._function("abs", expr))
|
| 460 |
+
|
| 461 |
+
def clip(
|
| 462 |
+
self,
|
| 463 |
+
lower_bound: Self | NumericLiteral | TemporalLiteral | None,
|
| 464 |
+
upper_bound: Self | NumericLiteral | TemporalLiteral | None,
|
| 465 |
+
) -> Self:
|
| 466 |
+
def _clip_lower(expr: NativeExprT, lower_bound: Any) -> NativeExprT:
|
| 467 |
+
return self._function("greatest", expr, lower_bound)
|
| 468 |
+
|
| 469 |
+
def _clip_upper(expr: NativeExprT, upper_bound: Any) -> NativeExprT:
|
| 470 |
+
return self._function("least", expr, upper_bound)
|
| 471 |
+
|
| 472 |
+
def _clip_both(
|
| 473 |
+
expr: NativeExprT, lower_bound: Any, upper_bound: Any
|
| 474 |
+
) -> NativeExprT:
|
| 475 |
+
return self._function(
|
| 476 |
+
"greatest", self._function("least", expr, upper_bound), lower_bound
|
| 477 |
+
)
|
| 478 |
+
|
| 479 |
+
if lower_bound is None:
|
| 480 |
+
return self._with_elementwise(_clip_upper, upper_bound=upper_bound)
|
| 481 |
+
if upper_bound is None:
|
| 482 |
+
return self._with_elementwise(_clip_lower, lower_bound=lower_bound)
|
| 483 |
+
return self._with_elementwise(
|
| 484 |
+
_clip_both, lower_bound=lower_bound, upper_bound=upper_bound
|
| 485 |
+
)
|
| 486 |
+
|
| 487 |
+
def is_null(self) -> Self:
|
| 488 |
+
return self._with_elementwise(lambda expr: self._function("isnull", expr))
|
| 489 |
+
|
| 490 |
+
def round(self, decimals: int) -> Self:
|
| 491 |
+
return self._with_elementwise(
|
| 492 |
+
lambda expr: self._function("round", expr, self._lit(decimals))
|
| 493 |
+
)
|
| 494 |
+
|
| 495 |
+
def exp(self) -> Self:
|
| 496 |
+
return self._with_elementwise(lambda expr: self._function("exp", expr))
|
| 497 |
+
|
| 498 |
+
# Cumulative
|
| 499 |
+
def cum_sum(self, *, reverse: bool) -> Self:
|
| 500 |
+
return self._with_window_function(self._cum_window_func("sum", reverse=reverse))
|
| 501 |
+
|
| 502 |
+
def cum_max(self, *, reverse: bool) -> Self:
|
| 503 |
+
return self._with_window_function(self._cum_window_func("max", reverse=reverse))
|
| 504 |
+
|
| 505 |
+
def cum_min(self, *, reverse: bool) -> Self:
|
| 506 |
+
return self._with_window_function(self._cum_window_func("min", reverse=reverse))
|
| 507 |
+
|
| 508 |
+
def cum_count(self, *, reverse: bool) -> Self:
|
| 509 |
+
return self._with_window_function(self._cum_window_func("count", reverse=reverse))
|
| 510 |
+
|
| 511 |
+
def cum_prod(self, *, reverse: bool) -> Self:
|
| 512 |
+
return self._with_window_function(
|
| 513 |
+
self._cum_window_func("product", reverse=reverse)
|
| 514 |
+
)
|
| 515 |
+
|
| 516 |
+
# Rolling
|
| 517 |
+
def rolling_sum(self, window_size: int, *, min_samples: int, center: bool) -> Self:
|
| 518 |
+
return self._with_window_function(
|
| 519 |
+
self._rolling_window_func("sum", window_size, min_samples, center=center)
|
| 520 |
+
)
|
| 521 |
+
|
| 522 |
+
def rolling_mean(self, window_size: int, *, min_samples: int, center: bool) -> Self:
|
| 523 |
+
return self._with_window_function(
|
| 524 |
+
self._rolling_window_func("mean", window_size, min_samples, center=center)
|
| 525 |
+
)
|
| 526 |
+
|
| 527 |
+
def rolling_var(
|
| 528 |
+
self, window_size: int, *, min_samples: int, center: bool, ddof: int
|
| 529 |
+
) -> Self:
|
| 530 |
+
return self._with_window_function(
|
| 531 |
+
self._rolling_window_func(
|
| 532 |
+
"var", window_size, min_samples, ddof=ddof, center=center
|
| 533 |
+
)
|
| 534 |
+
)
|
| 535 |
+
|
| 536 |
+
def rolling_std(
|
| 537 |
+
self, window_size: int, *, min_samples: int, center: bool, ddof: int
|
| 538 |
+
) -> Self:
|
| 539 |
+
return self._with_window_function(
|
| 540 |
+
self._rolling_window_func(
|
| 541 |
+
"std", window_size, min_samples, ddof=ddof, center=center
|
| 542 |
+
)
|
| 543 |
+
)
|
| 544 |
+
|
| 545 |
+
# Other window functions
|
| 546 |
+
def diff(self) -> Self:
|
| 547 |
+
def func(
|
| 548 |
+
df: SQLLazyFrameT, inputs: WindowInputs[NativeExprT]
|
| 549 |
+
) -> Sequence[NativeExprT]:
|
| 550 |
+
return [
|
| 551 |
+
expr # type: ignore[operator]
|
| 552 |
+
- self._window_expression(
|
| 553 |
+
self._function("lag", expr), inputs.partition_by, inputs.order_by
|
| 554 |
+
)
|
| 555 |
+
for expr in self(df)
|
| 556 |
+
]
|
| 557 |
+
|
| 558 |
+
return self._with_window_function(func)
|
| 559 |
+
|
| 560 |
+
def shift(self, n: int) -> Self:
|
| 561 |
+
def func(
|
| 562 |
+
df: SQLLazyFrameT, inputs: WindowInputs[NativeExprT]
|
| 563 |
+
) -> Sequence[NativeExprT]:
|
| 564 |
+
return [
|
| 565 |
+
self._window_expression(
|
| 566 |
+
self._function("lag", expr, n), inputs.partition_by, inputs.order_by
|
| 567 |
+
)
|
| 568 |
+
for expr in self(df)
|
| 569 |
+
]
|
| 570 |
+
|
| 571 |
+
return self._with_window_function(func)
|
| 572 |
+
|
| 573 |
+
def is_first_distinct(self) -> Self:
|
| 574 |
+
def func(
|
| 575 |
+
df: SQLLazyFrameT, inputs: WindowInputs[NativeExprT]
|
| 576 |
+
) -> Sequence[NativeExprT]:
|
| 577 |
+
# pyright checkers think the return type is `list[bool]` because of `==`
|
| 578 |
+
return [
|
| 579 |
+
cast(
|
| 580 |
+
"NativeExprT",
|
| 581 |
+
self._window_expression(
|
| 582 |
+
self._function("row_number"),
|
| 583 |
+
(*inputs.partition_by, expr),
|
| 584 |
+
inputs.order_by,
|
| 585 |
+
)
|
| 586 |
+
== self._lit(1),
|
| 587 |
+
)
|
| 588 |
+
for expr in self(df)
|
| 589 |
+
]
|
| 590 |
+
|
| 591 |
+
return self._with_window_function(func)
|
| 592 |
+
|
| 593 |
+
def is_last_distinct(self) -> Self:
|
| 594 |
+
def func(
|
| 595 |
+
df: SQLLazyFrameT, inputs: WindowInputs[NativeExprT]
|
| 596 |
+
) -> Sequence[NativeExprT]:
|
| 597 |
+
return [
|
| 598 |
+
cast(
|
| 599 |
+
"NativeExprT",
|
| 600 |
+
self._window_expression(
|
| 601 |
+
self._function("row_number"),
|
| 602 |
+
(*inputs.partition_by, expr),
|
| 603 |
+
inputs.order_by,
|
| 604 |
+
descending=[True] * len(inputs.order_by),
|
| 605 |
+
nulls_last=[True] * len(inputs.order_by),
|
| 606 |
+
)
|
| 607 |
+
== self._lit(1),
|
| 608 |
+
)
|
| 609 |
+
for expr in self(df)
|
| 610 |
+
]
|
| 611 |
+
|
| 612 |
+
return self._with_window_function(func)
|
| 613 |
+
|
| 614 |
+
def rank(self, method: RankMethod, *, descending: bool) -> Self:
|
| 615 |
+
if method in {"min", "max", "average"}:
|
| 616 |
+
func = self._function("rank")
|
| 617 |
+
elif method == "dense":
|
| 618 |
+
func = self._function("dense_rank")
|
| 619 |
+
else: # method == "ordinal"
|
| 620 |
+
func = self._function("row_number")
|
| 621 |
+
|
| 622 |
+
def _rank(
|
| 623 |
+
expr: NativeExprT,
|
| 624 |
+
partition_by: Sequence[str | NativeExprT] = (),
|
| 625 |
+
order_by: Sequence[str | NativeExprT] = (),
|
| 626 |
+
*,
|
| 627 |
+
descending: Sequence[bool],
|
| 628 |
+
nulls_last: Sequence[bool],
|
| 629 |
+
) -> NativeExprT:
|
| 630 |
+
count_expr = self._count_star()
|
| 631 |
+
window_kwargs: dict[str, Any] = {
|
| 632 |
+
"partition_by": partition_by,
|
| 633 |
+
"order_by": (expr, *order_by),
|
| 634 |
+
"descending": descending,
|
| 635 |
+
"nulls_last": nulls_last,
|
| 636 |
+
}
|
| 637 |
+
count_window_kwargs: dict[str, Any] = {"partition_by": (*partition_by, expr)}
|
| 638 |
+
if method == "max":
|
| 639 |
+
rank_expr = (
|
| 640 |
+
self._window_expression(func, **window_kwargs) # type: ignore[operator]
|
| 641 |
+
+ self._window_expression(count_expr, **count_window_kwargs)
|
| 642 |
+
- self._lit(1)
|
| 643 |
+
)
|
| 644 |
+
elif method == "average":
|
| 645 |
+
rank_expr = self._window_expression(func, **window_kwargs) + (
|
| 646 |
+
self._window_expression(count_expr, **count_window_kwargs) # type: ignore[operator]
|
| 647 |
+
- self._lit(1)
|
| 648 |
+
) / self._lit(2.0)
|
| 649 |
+
else:
|
| 650 |
+
rank_expr = self._window_expression(func, **window_kwargs)
|
| 651 |
+
return self._when(~self._function("isnull", expr), rank_expr) # type: ignore[operator]
|
| 652 |
+
|
| 653 |
+
def _unpartitioned_rank(expr: NativeExprT) -> NativeExprT:
|
| 654 |
+
return _rank(expr, descending=[descending], nulls_last=[True])
|
| 655 |
+
|
| 656 |
+
def _partitioned_rank(
|
| 657 |
+
df: SQLLazyFrameT, inputs: WindowInputs[NativeExprT]
|
| 658 |
+
) -> Sequence[NativeExprT]:
|
| 659 |
+
# node: when `descending` / `nulls_last` are supported in `.over`, they should be respected here
|
| 660 |
+
# https://github.com/narwhals-dev/narwhals/issues/2790
|
| 661 |
+
return [
|
| 662 |
+
_rank(
|
| 663 |
+
expr,
|
| 664 |
+
inputs.partition_by,
|
| 665 |
+
inputs.order_by,
|
| 666 |
+
descending=[descending] + [False] * len(inputs.order_by),
|
| 667 |
+
nulls_last=[True] + [False] * len(inputs.order_by),
|
| 668 |
+
)
|
| 669 |
+
for expr in self(df)
|
| 670 |
+
]
|
| 671 |
+
|
| 672 |
+
return self._with_callable(_unpartitioned_rank)._with_window_function(
|
| 673 |
+
_partitioned_rank
|
| 674 |
+
)
|
| 675 |
+
|
| 676 |
+
def is_unique(self) -> Self:
|
| 677 |
+
def _is_unique(
|
| 678 |
+
expr: NativeExprT, *partition_by: str | NativeExprT
|
| 679 |
+
) -> NativeExprT:
|
| 680 |
+
return cast(
|
| 681 |
+
"NativeExprT",
|
| 682 |
+
self._window_expression(self._count_star(), (expr, *partition_by))
|
| 683 |
+
== self._lit(1),
|
| 684 |
+
)
|
| 685 |
+
|
| 686 |
+
def _unpartitioned_is_unique(expr: NativeExprT) -> NativeExprT:
|
| 687 |
+
return _is_unique(expr)
|
| 688 |
+
|
| 689 |
+
def _partitioned_is_unique(
|
| 690 |
+
df: SQLLazyFrameT, inputs: WindowInputs[NativeExprT]
|
| 691 |
+
) -> Sequence[NativeExprT]:
|
| 692 |
+
assert not inputs.order_by # noqa: S101
|
| 693 |
+
return [_is_unique(expr, *inputs.partition_by) for expr in self(df)]
|
| 694 |
+
|
| 695 |
+
return self._with_callable(_unpartitioned_is_unique)._with_window_function(
|
| 696 |
+
_partitioned_is_unique
|
| 697 |
+
)
|
| 698 |
+
|
| 699 |
+
# Other
|
| 700 |
+
def over(
|
| 701 |
+
self, partition_by: Sequence[str | NativeExprT], order_by: Sequence[str]
|
| 702 |
+
) -> Self:
|
| 703 |
+
def func(df: SQLLazyFrameT) -> Sequence[NativeExprT]:
|
| 704 |
+
return self.window_function(df, WindowInputs(partition_by, order_by))
|
| 705 |
+
|
| 706 |
+
return self.__class__(
|
| 707 |
+
func,
|
| 708 |
+
evaluate_output_names=self._evaluate_output_names,
|
| 709 |
+
alias_output_names=self._alias_output_names,
|
| 710 |
+
version=self._version,
|
| 711 |
+
implementation=self._implementation,
|
| 712 |
+
)
|
| 713 |
+
|
| 714 |
+
arg_max: not_implemented = not_implemented()
|
| 715 |
+
arg_min: not_implemented = not_implemented()
|
| 716 |
+
arg_true: not_implemented = not_implemented()
|
| 717 |
+
drop_nulls: not_implemented = not_implemented()
|
| 718 |
+
ewm_mean: not_implemented = not_implemented()
|
| 719 |
+
gather_every: not_implemented = not_implemented()
|
| 720 |
+
head: not_implemented = not_implemented()
|
| 721 |
+
map_batches: not_implemented = not_implemented()
|
| 722 |
+
mode: not_implemented = not_implemented()
|
| 723 |
+
replace_strict: not_implemented = not_implemented()
|
| 724 |
+
sort: not_implemented = not_implemented()
|
| 725 |
+
tail: not_implemented = not_implemented()
|
| 726 |
+
sample: not_implemented = not_implemented()
|
| 727 |
+
unique: not_implemented = not_implemented()
|
| 728 |
+
|
| 729 |
+
# namespaces
|
| 730 |
+
cat: not_implemented = not_implemented() # type: ignore[assignment]
|
lib/python3.10/site-packages/narwhals/_sql/group_by.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING, Protocol
|
| 4 |
+
|
| 5 |
+
from narwhals._compliant.group_by import CompliantGroupBy, ParseKeysGroupBy
|
| 6 |
+
from narwhals._compliant.typing import CompliantLazyFrameT_co, NativeExprT_co
|
| 7 |
+
from narwhals._sql.typing import SQLExprT_contra
|
| 8 |
+
|
| 9 |
+
if TYPE_CHECKING:
|
| 10 |
+
from collections.abc import Iterable, Iterator
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class SQLGroupBy(
|
| 14 |
+
ParseKeysGroupBy[CompliantLazyFrameT_co, SQLExprT_contra],
|
| 15 |
+
CompliantGroupBy[CompliantLazyFrameT_co, SQLExprT_contra],
|
| 16 |
+
Protocol[CompliantLazyFrameT_co, SQLExprT_contra, NativeExprT_co],
|
| 17 |
+
):
|
| 18 |
+
_keys: list[str]
|
| 19 |
+
_output_key_names: list[str]
|
| 20 |
+
|
| 21 |
+
def _evaluate_expr(self, expr: SQLExprT_contra, /) -> Iterator[NativeExprT_co]:
|
| 22 |
+
output_names = expr._evaluate_output_names(self.compliant)
|
| 23 |
+
aliases = (
|
| 24 |
+
expr._alias_output_names(output_names)
|
| 25 |
+
if expr._alias_output_names
|
| 26 |
+
else output_names
|
| 27 |
+
)
|
| 28 |
+
native_exprs = expr(self.compliant)
|
| 29 |
+
if expr._is_multi_output_unnamed():
|
| 30 |
+
exclude = {*self._keys, *self._output_key_names}
|
| 31 |
+
for native_expr, name, alias in zip(native_exprs, output_names, aliases):
|
| 32 |
+
if name not in exclude:
|
| 33 |
+
yield expr._alias_native(native_expr, alias)
|
| 34 |
+
else:
|
| 35 |
+
for native_expr, alias in zip(native_exprs, aliases):
|
| 36 |
+
yield expr._alias_native(native_expr, alias)
|
| 37 |
+
|
| 38 |
+
def _evaluate_exprs(
|
| 39 |
+
self, exprs: Iterable[SQLExprT_contra], /
|
| 40 |
+
) -> Iterator[NativeExprT_co]:
|
| 41 |
+
for expr in exprs:
|
| 42 |
+
yield from self._evaluate_expr(expr)
|
lib/python3.10/site-packages/narwhals/_sql/namespace.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import operator
|
| 4 |
+
from functools import reduce
|
| 5 |
+
from typing import TYPE_CHECKING, Any, Protocol
|
| 6 |
+
|
| 7 |
+
from narwhals._compliant import LazyNamespace
|
| 8 |
+
from narwhals._compliant.typing import NativeExprT, NativeFrameT_co
|
| 9 |
+
from narwhals._sql.typing import SQLExprT, SQLLazyFrameT
|
| 10 |
+
|
| 11 |
+
if TYPE_CHECKING:
|
| 12 |
+
from collections.abc import Iterable
|
| 13 |
+
|
| 14 |
+
from narwhals.typing import PythonLiteral
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class SQLNamespace(
|
| 18 |
+
LazyNamespace[SQLLazyFrameT, SQLExprT, NativeFrameT_co],
|
| 19 |
+
Protocol[SQLLazyFrameT, SQLExprT, NativeFrameT_co, NativeExprT],
|
| 20 |
+
):
|
| 21 |
+
def _function(self, name: str, *args: NativeExprT | PythonLiteral) -> NativeExprT: ...
|
| 22 |
+
def _lit(self, value: Any) -> NativeExprT: ...
|
| 23 |
+
def _when(self, condition: NativeExprT, value: NativeExprT) -> NativeExprT: ...
|
| 24 |
+
def _coalesce(self, *exprs: NativeExprT) -> NativeExprT: ...
|
| 25 |
+
|
| 26 |
+
# Horizontal functions
|
| 27 |
+
def any_horizontal(self, *exprs: SQLExprT, ignore_nulls: bool) -> SQLExprT:
|
| 28 |
+
def func(cols: Iterable[NativeExprT]) -> NativeExprT:
|
| 29 |
+
it = (
|
| 30 |
+
(self._coalesce(col, self._lit(False)) for col in cols) # noqa: FBT003
|
| 31 |
+
if ignore_nulls
|
| 32 |
+
else cols
|
| 33 |
+
)
|
| 34 |
+
return reduce(operator.or_, it)
|
| 35 |
+
|
| 36 |
+
return self._expr._from_elementwise_horizontal_op(func, *exprs)
|
| 37 |
+
|
| 38 |
+
def all_horizontal(self, *exprs: SQLExprT, ignore_nulls: bool) -> SQLExprT:
|
| 39 |
+
def func(cols: Iterable[NativeExprT]) -> NativeExprT:
|
| 40 |
+
it = (
|
| 41 |
+
(self._coalesce(col, self._lit(True)) for col in cols) # noqa: FBT003
|
| 42 |
+
if ignore_nulls
|
| 43 |
+
else cols
|
| 44 |
+
)
|
| 45 |
+
return reduce(operator.and_, it)
|
| 46 |
+
|
| 47 |
+
return self._expr._from_elementwise_horizontal_op(func, *exprs)
|
| 48 |
+
|
| 49 |
+
def max_horizontal(self, *exprs: SQLExprT) -> SQLExprT:
|
| 50 |
+
def func(cols: Iterable[NativeExprT]) -> NativeExprT:
|
| 51 |
+
return self._function("greatest", *cols)
|
| 52 |
+
|
| 53 |
+
return self._expr._from_elementwise_horizontal_op(func, *exprs)
|
| 54 |
+
|
| 55 |
+
def min_horizontal(self, *exprs: SQLExprT) -> SQLExprT:
|
| 56 |
+
def func(cols: Iterable[NativeExprT]) -> NativeExprT:
|
| 57 |
+
return self._function("least", *cols)
|
| 58 |
+
|
| 59 |
+
return self._expr._from_elementwise_horizontal_op(func, *exprs)
|
| 60 |
+
|
| 61 |
+
def sum_horizontal(self, *exprs: SQLExprT) -> SQLExprT:
|
| 62 |
+
def func(cols: Iterable[NativeExprT]) -> NativeExprT:
|
| 63 |
+
return reduce(
|
| 64 |
+
operator.add, (self._coalesce(col, self._lit(0)) for col in cols)
|
| 65 |
+
)
|
| 66 |
+
|
| 67 |
+
return self._expr._from_elementwise_horizontal_op(func, *exprs)
|
| 68 |
+
|
| 69 |
+
# Other
|
| 70 |
+
def coalesce(self, *exprs: SQLExprT) -> SQLExprT:
|
| 71 |
+
def func(cols: Iterable[NativeExprT]) -> NativeExprT:
|
| 72 |
+
return self._coalesce(*cols)
|
| 73 |
+
|
| 74 |
+
return self._expr._from_elementwise_horizontal_op(func, *exprs)
|
lib/python3.10/site-packages/narwhals/_sql/typing.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING, Any, TypeVar
|
| 4 |
+
|
| 5 |
+
if TYPE_CHECKING:
|
| 6 |
+
from narwhals._sql.dataframe import SQLLazyFrame
|
| 7 |
+
from narwhals._sql.expr import SQLExpr
|
| 8 |
+
|
| 9 |
+
SQLExprAny = SQLExpr[Any, Any]
|
| 10 |
+
SQLLazyFrameAny = SQLLazyFrame[Any, Any, Any]
|
| 11 |
+
|
| 12 |
+
SQLExprT = TypeVar("SQLExprT", bound="SQLExprAny")
|
| 13 |
+
SQLExprT_contra = TypeVar("SQLExprT_contra", bound="SQLExprAny", contravariant=True)
|
| 14 |
+
SQLLazyFrameT = TypeVar("SQLLazyFrameT", bound="SQLLazyFrameAny")
|
lib/python3.10/site-packages/narwhals/_sql/when_then.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING, Protocol
|
| 4 |
+
|
| 5 |
+
from narwhals._compliant.typing import NativeExprT
|
| 6 |
+
from narwhals._compliant.when_then import CompliantThen, CompliantWhen
|
| 7 |
+
from narwhals._sql.typing import SQLExprT, SQLLazyFrameT
|
| 8 |
+
|
| 9 |
+
if TYPE_CHECKING:
|
| 10 |
+
from collections.abc import Sequence
|
| 11 |
+
|
| 12 |
+
from typing_extensions import Self
|
| 13 |
+
|
| 14 |
+
from narwhals._compliant.typing import WindowFunction
|
| 15 |
+
from narwhals._compliant.when_then import IntoExpr
|
| 16 |
+
from narwhals._compliant.window import WindowInputs
|
| 17 |
+
from narwhals._utils import _LimitedContext
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class SQLWhen(
|
| 21 |
+
CompliantWhen[SQLLazyFrameT, NativeExprT, SQLExprT],
|
| 22 |
+
Protocol[SQLLazyFrameT, NativeExprT, SQLExprT],
|
| 23 |
+
):
|
| 24 |
+
@property
|
| 25 |
+
def _then(self) -> type[SQLThen[SQLLazyFrameT, NativeExprT, SQLExprT]]: ...
|
| 26 |
+
|
| 27 |
+
def __call__(self, df: SQLLazyFrameT) -> Sequence[NativeExprT]:
|
| 28 |
+
is_expr = self._condition._is_expr
|
| 29 |
+
when = df.__narwhals_namespace__()._when
|
| 30 |
+
lit = df.__narwhals_namespace__()._lit
|
| 31 |
+
condition = df._evaluate_expr(self._condition)
|
| 32 |
+
then_ = self._then_value
|
| 33 |
+
then = df._evaluate_expr(then_) if is_expr(then_) else lit(then_)
|
| 34 |
+
other_ = self._otherwise_value
|
| 35 |
+
if other_ is None:
|
| 36 |
+
result = when(condition, then)
|
| 37 |
+
else:
|
| 38 |
+
otherwise = df._evaluate_expr(other_) if is_expr(other_) else lit(other_)
|
| 39 |
+
result = when(condition, then).otherwise(otherwise)
|
| 40 |
+
return [result]
|
| 41 |
+
|
| 42 |
+
@classmethod
|
| 43 |
+
def from_expr(cls, condition: SQLExprT, /, *, context: _LimitedContext) -> Self:
|
| 44 |
+
obj = cls.__new__(cls)
|
| 45 |
+
obj._condition = condition
|
| 46 |
+
obj._then_value = None
|
| 47 |
+
obj._otherwise_value = None
|
| 48 |
+
obj._implementation = context._implementation
|
| 49 |
+
obj._version = context._version
|
| 50 |
+
return obj
|
| 51 |
+
|
| 52 |
+
def _window_function(
|
| 53 |
+
self, df: SQLLazyFrameT, window_inputs: WindowInputs[NativeExprT]
|
| 54 |
+
) -> Sequence[NativeExprT]:
|
| 55 |
+
when = df.__narwhals_namespace__()._when
|
| 56 |
+
lit = df.__narwhals_namespace__()._lit
|
| 57 |
+
is_expr = self._condition._is_expr
|
| 58 |
+
condition = self._condition.window_function(df, window_inputs)[0]
|
| 59 |
+
then_ = self._then_value
|
| 60 |
+
then = (
|
| 61 |
+
then_.window_function(df, window_inputs)[0] if is_expr(then_) else lit(then_)
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
other_ = self._otherwise_value
|
| 65 |
+
if other_ is None:
|
| 66 |
+
result = when(condition, then)
|
| 67 |
+
else:
|
| 68 |
+
other = (
|
| 69 |
+
other_.window_function(df, window_inputs)[0]
|
| 70 |
+
if is_expr(other_)
|
| 71 |
+
else lit(other_)
|
| 72 |
+
)
|
| 73 |
+
result = when(condition, then).otherwise(other)
|
| 74 |
+
return [result]
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class SQLThen(
|
| 78 |
+
CompliantThen[
|
| 79 |
+
SQLLazyFrameT,
|
| 80 |
+
NativeExprT,
|
| 81 |
+
SQLExprT,
|
| 82 |
+
SQLWhen[SQLLazyFrameT, NativeExprT, SQLExprT],
|
| 83 |
+
],
|
| 84 |
+
Protocol[SQLLazyFrameT, NativeExprT, SQLExprT],
|
| 85 |
+
):
|
| 86 |
+
_window_function: WindowFunction[SQLLazyFrameT, NativeExprT] | None
|
| 87 |
+
|
| 88 |
+
@classmethod
|
| 89 |
+
def from_when(
|
| 90 |
+
cls,
|
| 91 |
+
when: SQLWhen[SQLLazyFrameT, NativeExprT, SQLExprT],
|
| 92 |
+
then: IntoExpr[NativeExprT, SQLExprT],
|
| 93 |
+
/,
|
| 94 |
+
) -> Self:
|
| 95 |
+
when._then_value = then
|
| 96 |
+
obj = cls.__new__(cls)
|
| 97 |
+
obj._call = when
|
| 98 |
+
obj._window_function = when._window_function
|
| 99 |
+
obj._when_value = when
|
| 100 |
+
obj._evaluate_output_names = getattr(
|
| 101 |
+
then, "_evaluate_output_names", lambda _df: ["literal"]
|
| 102 |
+
)
|
| 103 |
+
obj._alias_output_names = getattr(then, "_alias_output_names", None)
|
| 104 |
+
obj._implementation = when._implementation
|
| 105 |
+
obj._version = when._version
|
| 106 |
+
return obj
|