msticpy.nbtools.nbwidgets package
Submodules
msticpy.nbtools.nbwidgets.core module
Module for pre-defined widget layouts.
- class msticpy.nbtools.nbwidgets.core.IPyDisplayMixin
Bases:
object
IPython display mixin class.
- display()
Display the interactive widgets.
- class msticpy.nbtools.nbwidgets.core.RegisteredWidget(id_vals: typing.Optional[typing.List[typing.Any]] = None, val_attrs: typing.Optional[typing.List[str]] = None, nb_params: typing.Optional[typing.Dict[str, str]] = None, name_space: typing.Dict[str, typing.Any] = {'ABC': <class 'abc.ABC'>, 'Any': typing.Any, 'Dict': typing.Dict, 'IPyDisplayMixin': <class 'msticpy.nbtools.nbwidgets.core.IPyDisplayMixin'>, 'IntEnum': <enum 'IntEnum'>, 'List': typing.List, 'Optional': typing.Optional, 'RegisteredWidget': <class 'msticpy.nbtools.nbwidgets.core.RegisteredWidget'>, 'TimeUnit': <enum 'TimeUnit'>, 'VERSION': '1.8.1', 'WeakValueDictionary': <class 'weakref.WeakValueDictionary'>, '_WIDGET_REG': <WeakValueDictionary>, '__annotations__': {'_WIDGET_REG': <class 'weakref.WeakValueDictionary'>}, '__author__': 'Ian Hellen', '__builtins__': {'ArithmeticError': <class 'ArithmeticError'>, 'AssertionError': <class 'AssertionError'>, 'AttributeError': <class 'AttributeError'>, 'BaseException': <class 'BaseException'>, 'BlockingIOError': <class 'BlockingIOError'>, 'BrokenPipeError': <class 'BrokenPipeError'>, 'BufferError': <class 'BufferError'>, 'BytesWarning': <class 'BytesWarning'>, 'ChildProcessError': <class 'ChildProcessError'>, 'ConnectionAbortedError': <class 'ConnectionAbortedError'>, 'ConnectionError': <class 'ConnectionError'>, 'ConnectionRefusedError': <class 'ConnectionRefusedError'>, 'ConnectionResetError': <class 'ConnectionResetError'>, 'DeprecationWarning': <class 'DeprecationWarning'>, 'EOFError': <class 'EOFError'>, 'Ellipsis': Ellipsis, 'EnvironmentError': <class 'OSError'>, 'Exception': <class 'Exception'>, 'False': False, 'FileExistsError': <class 'FileExistsError'>, 'FileNotFoundError': <class 'FileNotFoundError'>, 'FloatingPointError': <class 'FloatingPointError'>, 'FutureWarning': <class 'FutureWarning'>, 'GeneratorExit': <class 'GeneratorExit'>, 'IOError': <class 'OSError'>, 'ImportError': <class 'ImportError'>, 'ImportWarning': <class 'ImportWarning'>, 'IndentationError': <class 'IndentationError'>, 'IndexError': <class 'IndexError'>, 'InterruptedError': <class 'InterruptedError'>, 'IsADirectoryError': <class 'IsADirectoryError'>, 'KeyError': <class 'KeyError'>, 'KeyboardInterrupt': <class 'KeyboardInterrupt'>, 'LookupError': <class 'LookupError'>, 'MemoryError': <class 'MemoryError'>, 'ModuleNotFoundError': <class 'ModuleNotFoundError'>, 'NameError': <class 'NameError'>, 'None': None, 'NotADirectoryError': <class 'NotADirectoryError'>, 'NotImplemented': NotImplemented, 'NotImplementedError': <class 'NotImplementedError'>, 'OSError': <class 'OSError'>, 'OverflowError': <class 'OverflowError'>, 'PendingDeprecationWarning': <class 'PendingDeprecationWarning'>, 'PermissionError': <class 'PermissionError'>, 'ProcessLookupError': <class 'ProcessLookupError'>, 'RecursionError': <class 'RecursionError'>, 'ReferenceError': <class 'ReferenceError'>, 'ResourceWarning': <class 'ResourceWarning'>, 'RuntimeError': <class 'RuntimeError'>, 'RuntimeWarning': <class 'RuntimeWarning'>, 'StopAsyncIteration': <class 'StopAsyncIteration'>, 'StopIteration': <class 'StopIteration'>, 'SyntaxError': <class 'SyntaxError'>, 'SyntaxWarning': <class 'SyntaxWarning'>, 'SystemError': <class 'SystemError'>, 'SystemExit': <class 'SystemExit'>, 'TabError': <class 'TabError'>, 'TimeoutError': <class 'TimeoutError'>, 'True': True, 'TypeError': <class 'TypeError'>, 'UnboundLocalError': <class 'UnboundLocalError'>, 'UnicodeDecodeError': <class 'UnicodeDecodeError'>, 'UnicodeEncodeError': <class 'UnicodeEncodeError'>, 'UnicodeError': <class 'UnicodeError'>, 'UnicodeTranslateError': <class 'UnicodeTranslateError'>, 'UnicodeWarning': <class 'UnicodeWarning'>, 'UserWarning': <class 'UserWarning'>, 'ValueError': <class 'ValueError'>, 'Warning': <class 'Warning'>, 'ZeroDivisionError': <class 'ZeroDivisionError'>, '__build_class__': <built-in function __build_class__>, '__debug__': True, '__doc__': "Built-in functions, exceptions, and other objects.\n\nNoteworthy: None is the `nil' object; Ellipsis represents `...' in slices.", '__import__': <built-in function __import__>, '__loader__': <class '_frozen_importlib.BuiltinImporter'>, '__name__': 'builtins', '__package__': '', '__spec__': ModuleSpec(name='builtins', loader=<class '_frozen_importlib.BuiltinImporter'>), 'abs': <built-in function abs>, 'all': <built-in function all>, 'any': <built-in function any>, 'ascii': <built-in function ascii>, 'bin': <built-in function bin>, 'bool': <class 'bool'>, 'breakpoint': <built-in function breakpoint>, 'bytearray': <class 'bytearray'>, 'bytes': <class 'bytes'>, 'callable': <built-in function callable>, 'chr': <built-in function chr>, 'classmethod': <class 'classmethod'>, 'compile': <built-in function compile>, 'complex': <class 'complex'>, 'copyright': Copyright (c) 2001-2020 Python Software Foundation. All Rights Reserved. Copyright (c) 2000 BeOpen.com. All Rights Reserved. Copyright (c) 1995-2001 Corporation for National Research Initiatives. All Rights Reserved. Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. All Rights Reserved., 'credits': Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information., 'delattr': <built-in function delattr>, 'dict': <class 'dict'>, 'dir': <built-in function dir>, 'divmod': <built-in function divmod>, 'enumerate': <class 'enumerate'>, 'eval': <built-in function eval>, 'exec': <built-in function exec>, 'exit': Use exit() or Ctrl-D (i.e. EOF) to exit, 'filter': <class 'filter'>, 'float': <class 'float'>, 'format': <built-in function format>, 'frozenset': <class 'frozenset'>, 'getattr': <built-in function getattr>, 'globals': <built-in function globals>, 'hasattr': <built-in function hasattr>, 'hash': <built-in function hash>, 'help': Type help() for interactive help, or help(object) for help about object., 'hex': <built-in function hex>, 'id': <built-in function id>, 'input': <built-in function input>, 'int': <class 'int'>, 'isinstance': <built-in function isinstance>, 'issubclass': <built-in function issubclass>, 'iter': <built-in function iter>, 'len': <built-in function len>, 'license': Type license() to see the full license text, 'list': <class 'list'>, 'locals': <built-in function locals>, 'map': <class 'map'>, 'max': <built-in function max>, 'memoryview': <class 'memoryview'>, 'min': <built-in function min>, 'next': <built-in function next>, 'object': <class 'object'>, 'oct': <built-in function oct>, 'open': <built-in function open>, 'ord': <built-in function ord>, 'pow': <built-in function pow>, 'print': <built-in function print>, 'property': <class 'property'>, 'quit': Use quit() or Ctrl-D (i.e. EOF) to exit, 'range': <class 'range'>, 'repr': <built-in function repr>, 'reversed': <class 'reversed'>, 'round': <built-in function round>, 'set': <class 'set'>, 'setattr': <built-in function setattr>, 'slice': <class 'slice'>, 'sorted': <built-in function sorted>, 'staticmethod': <class 'staticmethod'>, 'str': <class 'str'>, 'sum': <built-in function sum>, 'super': <class 'super'>, 'tuple': <class 'tuple'>, 'type': <class 'type'>, 'vars': <built-in function vars>, 'zip': <class 'zip'>}, '__cached__': '/home/docs/checkouts/readthedocs.org/user_builds/msticpy/envs/v1.8.0/lib/python3.7/site-packages/msticpy/nbtools/nbwidgets/__pycache__/core.cpython-37.pyc', '__doc__': 'Module for pre-defined widget layouts.', '__file__': '/home/docs/checkouts/readthedocs.org/user_builds/msticpy/envs/v1.8.0/lib/python3.7/site-packages/msticpy/nbtools/nbwidgets/core.py', '__loader__': <_frozen_importlib_external.SourceFileLoader object>, '__name__': 'msticpy.nbtools.nbwidgets.core', '__package__': 'msticpy.nbtools.nbwidgets', '__spec__': ModuleSpec(name='msticpy.nbtools.nbwidgets.core', loader=<_frozen_importlib_external.SourceFileLoader object>, origin='/home/docs/checkouts/readthedocs.org/user_builds/msticpy/envs/v1.8.0/lib/python3.7/site-packages/msticpy/nbtools/nbwidgets/core.py'), '__version__': '1.8.1', 'default_before_after': <function default_before_after>, 'default_max_buffer': <function default_max_buffer>, 'display': IPython.display.display, 'parse_time_unit': <function parse_time_unit>}, register: bool = True, **kwargs)
Bases:
abc.ABC
Register widget in the widget registry.
Registered widgets will store their values in the register. Each widget has an ID that that is derived from one or more of the initialization parameters. If an instance of the same widget class is created with the same parameters, its previous value will be repopulated from the registry. This is especially useful in notebooks where people accidentally re-run the same cell after entering values.
Initialize a registered widget.
- Parameters
id_vals (Optional[List[Any]], optional) – The list of parameter values to use to identify this widget instance, by default None
val_attrs (Optional[List[str]], optional) – The names of the attributes to persist in the registry and recall, by default [“value”]
nb_params (Optional[Dict[str, str]], optional) – A dictionary of attribute names and global variables. If the variable exists in the global namespace it will be used to populate the corresponding widget attribute. This is only done if the widget attribute currently has no value (i.e. restoring a value from the registry takes priority over this), by default None
name_space (Dict[str, Any], optional) – Namespace to look for global variables, by default None
register (bool) – Do not register the widget or retrieve values from previously- registered instance.
- ALLOWED_KWARGS = ['id_vals', 'val_attrs', 'nb_params', 'name_space', 'register']
- class msticpy.nbtools.nbwidgets.core.TimeUnit(value)
Bases:
enum.IntEnum
Time unit enumeration and value.
- DAY = 86400
- HOUR = 3600
- MINUTE = 60
- SECOND = 1
- WEEK = 604800
- msticpy.nbtools.nbwidgets.core.default_before_after(default: Optional[int], unit: msticpy.nbtools.nbwidgets.core.TimeUnit) int
Return default before and after bounds for a TimeUnit.
- msticpy.nbtools.nbwidgets.core.default_max_buffer(max_default: Optional[int], default: int, unit: msticpy.nbtools.nbwidgets.core.TimeUnit) int
Return the max time buffer for a give time unit.
- msticpy.nbtools.nbwidgets.core.parse_time_unit(unit_str: str) msticpy.nbtools.nbwidgets.core.TimeUnit
Return the TimeUnit enum matching the input string.
msticpy.nbtools.nbwidgets.get_environment_key module
Module for pre-defined widget layouts.
- class msticpy.nbtools.nbwidgets.get_environment_key.GetEnvironmentKey(env_var: str, help_str: Optional[str] = None, description: str = 'Enter the value: ', auto_display: bool = False, **kwargs)
Bases:
msticpy.nbtools.nbwidgets.core.RegisteredWidget
,msticpy.nbtools.nbwidgets.core.IPyDisplayMixin
GetEnvironmentKey.
Tries to retrieve an environment variable value. The value can be changed/set and optionally saved back to the system environment.
Create a new instance of GetEnvironmentKey.
- Parameters
env_var (str) – Name of the environment variable.
help_str (str, optional) – Help to display if the environment variable is not set. (the default is None)
description (str, optional) – Prompt to display with the text box. (the default is “Enter the value: “) “prompt” is a alias for this parameter
auto_display (bool, optional) – Whether to display on instantiation (the default is False)
- ALLOWED_KWARGS = ['id_vals', 'val_attrs', 'nb_params', 'name_space', 'register']
- display()
Display the interactive widgets.
- property layout
Return underlying widget collection.
- property name
Get the current name of the key.
- property value
Get the current value of the key.
msticpy.nbtools.nbwidgets.get_text module
Module for pre-defined widget layouts.
- class msticpy.nbtools.nbwidgets.get_text.GetText(default: Optional[str] = None, description: str = 'Enter the value: ', auto_display: bool = False, **kwargs)
Bases:
msticpy.nbtools.nbwidgets.core.RegisteredWidget
,msticpy.nbtools.nbwidgets.core.IPyDisplayMixin
GetText.
Widget to set text value.
Create a new instance of GetEnvironmentKey.
- Parameters
default (str) – Default value.
description (str, optional) – Prompt to display with the text box. (the default is “Enter the value: “) “prompt” is a alias for this parameter
auto_display (bool, optional) – Whether to display on instantiation (the default is False)
See also
RegisteredWidget
- ALLOWED_KWARGS = ['id_vals', 'val_attrs', 'nb_params', 'name_space', 'register']
- display()
Display the interactive widgets.
- property layout
Return underlying widget collection.
- property value
Get the current value of the widget.
msticpy.nbtools.nbwidgets.lookback module
Module for pre-defined widget layouts.
- class msticpy.nbtools.nbwidgets.lookback.Lookback(default: Optional[int] = None, description: str = 'Select time ({units}) to look back', origin_time: Optional[datetime.datetime] = None, min_value: Optional[int] = None, max_value: Optional[int] = None, units: str = 'hour', auto_display: bool = False, **kwargs)
Bases:
msticpy.nbtools.nbwidgets.core.IPyDisplayMixin
Time lookback slider.
Create an instance of the lookback slider widget.
- Parameters
default (int, optional) – The default ‘lookback’ time (the default is 4)
description (str, optional) – The description to display (the default is ‘Select time ({units}) to look back’)
origin_time (datetime, optional) – The origin time (the default is datetime.utcnow())
min_value (int, optional) – Minimum value (the default is 1)
max_value (int, optional) – Maximum value (the default is 240)
units (str, optional) – Time unit (the default is ‘hour’) Permissable values are ‘day’, ‘hour’, ‘minute’, ‘second’, ‘week’ These can all be abbreviated down to initial characters (‘d’, ‘m’, etc.)
auto_display (bool, optional) – Whether to display on instantiation (the default is False)
- display()
Display the interactive widgets.
- property layout
Return underlying widget.
- property lookback
Return current widget lookback value.
- property value
Return current widget lookback value.
msticpy.nbtools.nbwidgets.progress module
Module for pre-defined widget layouts.
- class msticpy.nbtools.nbwidgets.progress.Progress(completed_len: int, visible: bool = True)
Bases:
msticpy.nbtools.nbwidgets.core.IPyDisplayMixin
UI Progress bar.
Instantiate new _Progress UI.
- Parameters
completed_len (int) – The expected value that indicates 100% done.
visible (bool) – If True start the progress UI visible, by default True.
- display()
Display the interactive widgets.
- hide()
Hide the controls.
- property max: int
Return the current progress maximum value.
- Returns
Max value
- Return type
int
- show()
Make the controls visible.
- update_progress(new_total: int = 0, delta: int = 0)
Update progress UI by increment or new total.
- Parameters
new_total (int, optional) – New total, by default 0
delta (int, optional) – Increment to update current total, by default 0
- property value: int
Return the current progress value.
- Returns
Progess value
- Return type
int
msticpy.nbtools.nbwidgets.query_time module
Module for pre-defined widget layouts.
- class msticpy.nbtools.nbwidgets.query_time.QueryTime(**kwargs)
Bases:
msticpy.nbtools.nbwidgets.core.RegisteredWidget
,msticpy.nbtools.nbwidgets.core.IPyDisplayMixin
QueryTime.
Composite widget to capture date and time origin and set start and end times for queries.
See also
RegisteredWidget
Create new instance of QueryTime.
- Parameters
origin_time (datetime, optional) – The origin time (the default is datetime.utcnow())
description (str, optional) – The description to display (the default is ‘Select time ({units}) to look back’) label is an alias for this parameter
before (int, optional) – The default number of units before the origin_time (the default varies based on the unit)
after (int, optional) – The default number of units after the origin_time (the default varies based on the unit)
start (Union[datetime, str]) – Start of query time - alternative to specifying origin, before, after
end (Union[datetime, str]) – End of query time - alternative to specifying origin, before, after
timespan (TimeSpan) – TimeSpan of query time - alternative to specifying origin, before, after
max_before (int, optional) – The largest value for before (the default varies based on the unit)
max_after (int, optional) – The largest value for after (the default varies based on the unit)
units (str, optional) – Time unit (the default is ‘hour’) Permissable values are ‘day’, ‘hour’, ‘minute’, ‘second’, ‘week’ These can all be abbreviated down to initial characters (‘d’, ‘m’, etc.)
auto_display (bool, optional) – Whether to display on instantiation (the default is False)
- ALLOWED_KWARGS = ['id_vals', 'val_attrs', 'nb_params', 'name_space', 'register']
- IDS_ATTRIBS = ['before', 'after', '_query_start', '_query_end', '_label']
- display()
Display the interactive widgets.
- property end
Query end time.
- set_time(timespan: Optional[msticpy.common.timespan.TimeSpan] = None, start: Optional[Union[str, datetime.datetime]] = None, end: Optional[Union[str, datetime.datetime]] = None)
Change the time attributes.
- Parameters
start (Union[datetime, str]) – Start time - (must specify end)
end (Union[datetime, str]) – Start time - (must also specify end)
timespan (TimeSpan) – TimeSpan for query time.
- property start
Query start time.
- property timespan
Return the timespan as a TimeSpan object.
- property units
Time units used by control.
- property value
Return the timespan as a TimeSpan object.
msticpy.nbtools.nbwidgets.select_alert module
Module for pre-defined widget layouts.
- class msticpy.nbtools.nbwidgets.select_alert.AlertSelector(*args, **kwargs)
Bases:
msticpy.nbtools.nbwidgets.select_alert.SelectAlert
AlertSelector.
View list of alerts and select one for investigation. Optionally provide and action to call with the selected alert as a parameter (typically used to display the alert.)
- selected_alert
The selected alert
- Type
- alert_id
The SystemAlertId of the selected alert
- Type
str
- alerts
The current alert list (DataFrame)
- Type
List[SecurityAlert]
- action
The callback action to execute on selection of an alert.
- Type
Callable[…, None]
- .. deprecated:: 0.5.2
Superceded by SelectAlert. Please use that version
Create a new instance of AlertSelector.
- Parameters
alerts (pd.DataFrame) – DataFrame of alerts.
action (Callable[..., None], optional) – Optional function to execute for each selected alert. (the default is None)
columns (List[str], optional) – Override the default column names to use from alerts (the default is [‘StartTimeUtc’, ‘AlertName’, ‘CompromisedEntity’, ‘SystemAlertId’])
auto_display (bool, optional) – Whether to display on instantiation (the default is False)
- display()
Display the interactive widgets.
- property query_params
Query parameters derived from alert.
- Return type
dict(str, str) – Dictionary of parameter names
- property value
Return selected alert.
- class msticpy.nbtools.nbwidgets.select_alert.SelectAlert(alerts: pandas.core.frame.DataFrame, action: Optional[Callable[[...], Optional[Tuple]]] = None, columns: Optional[List[str]] = None, time_col: str = 'StartTimeUtc', id_col: str = 'SystemAlertId', auto_display: bool = False)
Bases:
msticpy.nbtools.nbwidgets.core.IPyDisplayMixin
Alert Selector.
View list of alerts and select one for investigation. Optionally provide and action to call with the selected alert as a parameter (typically used to display the alert.)
- selected_alert
The selected alert
- Type
- alert_id
The SystemAlertId of the selected alert
- Type
str
- alerts
The current alert list (DataFrame)
- Type
List[SecurityAlert]
- action
The callback action to execute on selection of an alert.
- Type
Callable[…, Optional[Tuple[…]]]
Create a new instance of AlertSelector.
- Parameters
alerts (pd.DataFrame) – DataFrame of alerts.
action (Callable[..., Optional[Tuple]], optional) – Optional function to execute for each selected alert. If the function returns one or a tuple of displayable objects these will be displayed.
columns (List[str], optional) – Override the default column names to use from alerts to generate the select list item summary (the default is [‘AlertName’, ‘ProductName’])
time_col (str, optional) – The column in your alerts that determines when it was created Default is ‘StartTimeUtc’ with a fallback to ‘TimeGenerated’.
id_col (str, optional) – The column in your data that determines the alert id Default is ‘SystemAlertId’.
auto_display (bool, optional) – Whether to display on instantiation (the default is False)
- display()
Display the interactive widgets.
- property value
Return selected alert.
msticpy.nbtools.nbwidgets.select_item module
Module for pre-defined widget layouts.
- class msticpy.nbtools.nbwidgets.select_item.SelectItem(description: str = 'Select an item', options: Optional[Union[List[str], Dict[str, Any]]] = None, action: Optional[Callable[[...], Optional[Tuple]]] = None, value: str = '', **kwargs)
Bases:
msticpy.nbtools.nbwidgets.core.IPyDisplayMixin
Selection list from list or dict.
- value
The selected value.
- Type
Any
- item_action
Action to call for each selection.
- Type
Callable[…, Optional[Tuple]]
Select an item from a list or dict.
- Parameters
description (str, optional) – The widget label to display. (the default is ‘Select an item’)
options (Union[List[str], Dict[str, Any]]) – Either: A list of items to select from (the default is None) A dict of items to select from. When using item_dict the values are displayed as the selectable items and key corresponding to the selected value is set as the value property.
action (Callable[..., Optional[Tuple[...]]], optional) – function to call when item selected (passed a single parameter - the value of the currently selected item) (the default is None). If the function returns one or a tuple of displayable objects these will be displayed.
value (str, optional) – A default value to pre-populate the filter with.
item_list (List[str], optional) – A list of items to select from (the default is None)
item_dict (Dict[str, str], optional) – A dict of items to select from. When using item_dict the keys are displayed as the selectable items and value corresponding to the selected key is set as the value property. (the default is None)
auto_display (bool, optional) – Whether to display on instantiation (the default is False)
height (str, optional) – Selection list height (the default is ‘100px’)
width (str, optional) – Selection list width (the default is ‘50%’)
display_filter (bool, optional) – Whether to display item filter (the default is True)
- display()
Display the interactive widget.
- property label
Return current display item.
- property layout
Return underlying widget collection.
- property value
Return the currently selected item.
- class msticpy.nbtools.nbwidgets.select_item.SelectString(*args, **kwargs)
Bases:
msticpy.nbtools.nbwidgets.select_item.SelectItem
Selection list from list or dict.
- value
The selected value.
- Type
Any
- item_action
Action to call for each selection.
- Type
Callable[…, None]
- .. deprecated:: 0.5.2
Superceded by SelectItem. Please use that version
Select an item from a list or dict.
- Parameters
description (str, optional) – The widget label to display. (the default is ‘Select an item’)
item_list (List[str], optional) – A list of items to select from (the default is None)
item_dict (Dict[str, str], optional) – A dict of items to select from. When using item_dict the keys are displayed as the selectable items and value corresponding to the selected key is set as the value property. (the default is None)
action (Callable[..., None], optional) – function to call when item selected (passed a single parameter - the value of the currently selected item) (the default is None)
auto_display (bool, optional) – Whether to display on instantiation (the default is False)
height (str, optional) – Selection list height (the default is ‘100px’)
width (str, optional) – Selection list width (the default is ‘50%’)
display_filter (bool, optional) – Whether to display item filter (the default is True)
- display()
Display the interactive widget.
- property label
Return current display item.
- property layout
Return underlying widget collection.
- property value
Return the currently selected item.
msticpy.nbtools.nbwidgets.select_subset module
Module for pre-defined widget layouts.
- class msticpy.nbtools.nbwidgets.select_subset.SelectSubset(source_items: Union[Dict[str, str], List[Any]], default_selected: Optional[Union[Dict[str, str], List[Any]]] = None, display_filter: bool = True, auto_display: bool = True)
Bases:
msticpy.nbtools.nbwidgets.core.IPyDisplayMixin
Class to select a subset from an input list.
Create instance of SelectSubset widget.
- Parameters
source_items (Union[Dict[str, str], List[Any]]) – List of source items - either a dictionary(label, value), a simple list or a list of (label, value) tuples.
default_selected (Union[Dict[str, str], List[Any]]) – Populate the selected list with values - either a dictionary(label, value), a simple list or a list of (label, value) tuples.
display_filter (bool, optional) – Whether to display item filter (the default is True)
auto_display (bool, optional) – Whether to display on instantiation (the default is True)
- display()
Display the interactive widgets.
- property selected_items: List[Any]
Return a list of the selected items.
If the input list is a list of tuples, this returns a list of the selected tuples.
- Returns
List of items in the selected list.
- Return type
List[Any]
- property selected_values: List[Any]
Return list of selected values.
If the input list is a list of tuples, this returns a list of values of the items.
- Returns
List of selected item values.
- Return type
List[Any]
- property value: List[Any]
Return currently selected value or values.
Module contents
Widgets sub-package.