The idea is to enable users to filter the Excel data imported according to their needs.
An example in the documentation could look like this:
.. needservice:: Excel
:query: type == 'req' and status in ['open', 'reopen']
Tasks
[x] Provide a query option (directive and conf.py)
[x] Filter Excel rows based on this query
[x] Documentation
[x] Tests - (named as test_excel_filter())
Mechanism used
Created a function called filter_excel_data(context: list[dict], filter_string: str) -> list[dict] that filters the data imported from Excel and returns the filtered version.
Inside the function, we use the eval() to evaluate the given filter string in the context (i.e. dict object of the data imported) like this, eval('filter_string', {}, data_imported).
If the evaluation is true, we add the data_imported to a list of filtered data and then return it.
The idea is to enable users to filter the Excel data imported according to their needs. An example in the documentation could look like this:
Tasks
test_excel_filter()
)Mechanism used
filter_excel_data(context: list[dict], filter_string: str) -> list[dict]
that filters the data imported from Excel and returns the filtered version.eval()
to evaluate the given filter string in the context (i.e. dict object of the data imported) like this,eval('filter_string', {}, data_imported)
.