msticpy.config.query_editor module
Query Editor.
- class msticpy.config.query_editor.CustomChange(new: Any)
Bases:
object
Dummy ipywidgets change event.
- new: Any
- class msticpy.config.query_editor.IPyDisplayMixin
Bases:
object
IPython display mixin class.
- display()
Display the interactive widgets.
- class msticpy.config.query_editor.MetadataEditWidget(metadata: QueryMetadata | None = None)
Bases:
IPyDisplayMixin
A class for editing Metadata properties.
Initialize a MetadataEditWidget object.
- Parameters:
metadata (Metadata) – A Metadata object.
- property changed_data
Return True if data has changed.
- display()
Display the GUI widget.
- populate_widgets()
Populate the widgets with the metadata of the Metadata object.
- reset_changed_data()
Reset changed data flag.
- save_metadata(button)
Save the values to the Metadata object.
- set_metadata(metadata: QueryMetadata)
Set the metadata object.
- class msticpy.config.query_editor.QueryEditWidget(query_collection: QueryCollection)
Bases:
IPyDisplayMixin
A class for editing queries.
Initialize a QueryEditWidget object.
- Parameters:
query_collection (QueryCollection) – A collection of queries.
- add_query(button)
Add a new query.
- Parameters:
button (Button) – The button object.
- property changed_data
Return True if data has changed.
- delete_query(button)
Delete a query.
- Parameters:
button (Button) – The button object.
- display()
Display the interactive widgets.
- populate_query_dropdown(change: Any) None
Populate the query dropdown widget.
- Parameters:
change (Any) – The change event.
- populate_widgets(change)
Populate the query widgets with the data of a query.
- Parameters:
change (Any) – The change event.
- reset_changed_data()
Reset changed data flag.
- save_query(button)
Save the data of a query.
- Parameters:
button (Button) – The button object.
- set_query_collection(query_collection: QueryCollection)
Set the query collection.
- class msticpy.config.query_editor.QueryEditor(query_file: QueryCollection | Path | str | None = None)
Bases:
IPyDisplayMixin
Query template editor.
Initialize the QueryEditor.
- Parameters:
query_file (Union[QueryCollection, Path, str, None], optional) – The query collection to edit, can be a string or pathlib Path object for a file to load, or a QueryCollection object. By default None
- property current_file: str
Return the current file name.
- display()
Display the interactive widgets.
- class msticpy.config.query_editor.QueryParameterEditWidget(container: Query | QueryDefaults)
Bases:
IPyDisplayMixin
Class to manage editing of query parameters.
This class provides a graphical user interface for editing query parameters. It allows users to add, modify, and delete parameters, as well as specify their names, descriptions, types, default values, and whether they are mandatory.
- _changed_data
A flag indicating whether the data has been changed.
- Type:
bool
- param_container
The container for the query parameters.
- Type:
Union[Query, QueryDefaults]
- parameter_dropdown
A widget for selecting a parameter to edit.
- Type:
ipywidgets.Select
- parameter_name_widget
A widget for editing the name of a parameter.
- Type:
ipywidgets.Text
- description_widget
A widget for editing the description of a parameter.
- Type:
ipywidgets.Text
- type_widget
A widget for selecting the type of a parameter.
- Type:
ipywidgets.Dropdown
- default_reqd_widget
A widget for indicating whether a default value is required for a parameter.
- Type:
ipywidgets.Checkbox
Initialize the class.
- add_parameter(button)
Add a new parameter.
- property changed_data
Return True if data has changed.
- delete_parameter(button)
Delete parameter item.
- display()
Display the interactive widgets.
- populate_widgets(change)
Populate parameter value in widgets.
- reset_changed_data()
Reset changed data flag.
- save_parameter(button)
Save currently edited parameter.
- set_param_container(container: Query | QueryDefaults)
Set the parameter container.
- msticpy.config.query_editor.box_layout()
Return a dictionary with layout and style for a box widget.
- Returns:
A dictionary with layout and style for a select widget.
- Return type:
Dict
- msticpy.config.query_editor.load_queries_from_yaml(yaml_file: str | Path)
Load a YAML file into a QueryCollection.
- Parameters:
yaml_file (Union[str, Path]) – The path to the YAML file to load.
- Returns:
A QueryCollection object containing the loaded queries.
- Return type:
- msticpy.config.query_editor.replace_in_query(param_name: str, param: QueryParameter, src_name: str, query: str) str
Replace a parameter in a query string with a formatted string.
- Parameters:
param_name (str) – The name of the parameter to replace.
param (Parameter) – The parameter object containing the datatype of the parameter.
src_name (str) – The name of the source to replace in the query string.
query (str) – The query string to replace the source in.
- Returns:
The query string with the source replaced by the formatted parameter string.
- Return type:
str
- msticpy.config.query_editor.save_queries_to_yaml(query_collection: QueryCollection, yaml_file: str | Path)
Save a QueryCollection to a YAML file.
- Parameters:
query_collection (QueryCollection) – The QueryCollection object to save to YAML.
yaml_file (Union[str, Path]) – The path to the YAML file to save.
- msticpy.config.query_editor.sel_fmt(width: str = '40%', height: str = '150px') Dict
Return a dictionary with layout and style for a select widget.
- Parameters:
width (str, optional) – The width of the widget, by default “40%”
height (str, optional) – The height of the widget, by default “150px”
- Returns:
A dictionary with layout and style for a select widget.
- Return type:
Dict
- msticpy.config.query_editor.txt_fmt(width: str = '70%') Dict
Return a dictionary with layout and style for a text widget.
- Parameters:
width (str, optional) – The width of the widget, by default “70%”
height (str, optional) – The height of the widget, by default “20px”
- Returns:
A dictionary with layout and style for a text widget.
- Return type:
Dict
- msticpy.config.query_editor.txtarea_fmt(width: str = '70%', height: str = '150px') Dict
Return a dictionary with layout and style for a textarea widget.
- Parameters:
width (str, optional) – The width of the widget, by default “70%”
height (str, optional) – The height of the widget, by default “150px”
- Returns:
A dictionary with layout and style for a textarea widget.
- Return type:
Dict