sda.api.parse_utils#

Cleaned Excel file loading utilities - Pure Polars approach.

This module provides simplified Excel table reading using only Polars native table support. No pandas fallbacks, no XML parsing, no sheet reading - just fast, simple table reading.

Functions#

convert_windows_path_to_wsl(path)

Convert a Windows-style path to WSL mount path format.

convert_wsl_path_to_windows_if_needed(path)

Convert WSL paths back to Windows format if needed.

is_wsl_environment()

Detect if we're running in a WSL (Windows Subsystem for Linux) environment.

onedrive_shared_to_sharepoint_synced_syntax(path)

Convert a local path in a OneDrive-shared site to a SharePoint-synced path.

sharepoint_synced_to_onedrive_shared_syntax(path)

Convert a local path in a Sharepoint-synced site to a OneDrive-shared path.

Module Contents#

sda.api.parse_utils.convert_windows_path_to_wsl(path)#

Convert a Windows-style path to WSL mount path format.

This function converts paths from Windows format (e.g., ~/Documents) to WSL mount format (e.g., /mnt/c/Users/username/Documents).

Parameters:

path (Path) – Windows-style path to convert

Returns:

WSL mount path, or original path if conversion not needed/possible

Return type:

Path

Examples

>>> from pathlib import Path
>>> path = Path("~/Spark Cleantech/6. DATA 2025 S1 - Documents")
>>> converted = convert_windows_path_to_wsl(path)
>>> str(converted)
"/mnt/c/Users/username/Spark Cleantech/6. DATA 2025 S1 - Documents"
sda.api.parse_utils.convert_wsl_path_to_windows_if_needed(path)#

Convert WSL paths back to Windows format if needed.

Parameters:

path (Path) – Path to potentially convert

Returns:

Converted path or original path if no conversion needed

Return type:

Path

sda.api.parse_utils.is_wsl_environment()#

Detect if we’re running in a WSL (Windows Subsystem for Linux) environment.

Returns:

True if running in WSL, False otherwise

Return type:

bool

sda.api.parse_utils.onedrive_shared_to_sharepoint_synced_syntax(path)#

Convert a local path in a OneDrive-shared site to a SharePoint-synced path.

OneDrive-shared paths are obtained by using the “Add a shortcut to my Drive” button. Typical names:

"~/OneDrive - Spark Cleantech/Documents partages - 6. DATA 2024 S2"

Sharepoint-synced paths are obtained by using the “Sync” button. Typical names:

"~/Spark Cleantech/6. DATA 2024 S2 - Documents"
Parameters:

path (Path or str)

Returns:

Converted path in SharePoint-synced format, or original path if no conversion needed

Return type:

Path

Examples

>>> from pathlib import Path
>>> path = Path(
...     "~/OneDrive - Spark Cleantech/Documents partages - 6. DATA 2024 S2/subfolder"
... )
>>> converted = onedrive_shared_to_sharepoint_synced_syntax(path)
>>> str(converted)
"~/Spark Cleantech/6. DATA 2024 S2 - Documents/subfolder"
sda.api.parse_utils.sharepoint_synced_to_onedrive_shared_syntax(path)#

Convert a local path in a Sharepoint-synced site to a OneDrive-shared path.

Sharepoint-synced local paths are obtained by using the “Sync” button. Typical names:

"~/Spark Cleantech/6. DATA 2024 S2 - Documents"

OneDrive-shared paths are obtained by using the “Add a shortcut to my Drive” button. Typical names:

"~/OneDrive - Spark Cleantech/Documents partages - 6. DATA 2024 S2"
Parameters:

path (Path or str)

Returns:

Converted path in OneDrive-shared format, or original path if no conversion needed

Return type:

Path

Examples

>>> from pathlib import Path
>>> path = Path("~/Spark Cleantech/6. DATA 2024 S2 - Documents/subfolder")
>>> converted = sharepoint_synced_to_onedrive_shared_syntax(path)
>>> str(converted)
"~/OneDrive - Spark Cleantech/Documents partages - 6. DATA 2024 S2/subfolder"