diff --git a/backend/python/app/sources/external/microsoft/one_note/one_note.py b/backend/python/app/sources/external/microsoft/one_note/one_note.py index 76dbc9ad19..2a0c593faa 100644 --- a/backend/python/app/sources/external/microsoft/one_note/one_note.py +++ b/backend/python/app/sources/external/microsoft/one_note/one_note.py @@ -1,5 +1,3 @@ - - import json import logging from dataclasses import asdict @@ -8098,34 +8096,31 @@ async def me_onenote_notebooks_delete_sections( """ # Build query parameters including OData for OneNote try: - # Use typed query parameters - query_params = RequestConfiguration() + # Inline construction for performance/memory, avoid unnecessary assignments + config = RequestConfiguration() + query_params = config # set config and query_params as the same object + # Set query parameters using typed object properties - if select: + if select is not None: query_params.select = select if isinstance(select, list) else [select] - if expand: + if expand is not None: query_params.expand = expand if isinstance(expand, list) else [expand] - if filter: + if filter is not None: query_params.filter = filter - if orderby: + if orderby is not None: query_params.orderby = orderby - if search: + if search is not None: query_params.search = search if top is not None: query_params.top = top if skip is not None: query_params.skip = skip - # Create proper typed request configuration - config = RequestConfiguration() - config.query_parameters = query_params - - if headers: + if headers is not None: config.headers = headers - - # Add consistency level for search operations in OneNote - if search: - if not config.headers: + # Only set consistency if searching + if search is not None: + if not hasattr(config, "headers") or config.headers is None: config.headers = {} config.headers['ConsistencyLevel'] = 'eventual'