etlplus 0.12.4__py3-none-any.whl → 0.12.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
etlplus/file/_pandas.py DELETED
@@ -1,58 +0,0 @@
1
- """
2
- :mod:`etlplus.file._pandas` module.
3
-
4
- Shared helpers for optional pandas usage.
5
- """
6
-
7
- from __future__ import annotations
8
-
9
- from typing import Any
10
-
11
- # SECTION: EXPORTS ========================================================== #
12
-
13
-
14
- __all__ = [
15
- 'get_pandas',
16
- ]
17
-
18
- # SECTION: INTERNAL CONSTANTS =============================================== #
19
-
20
-
21
- _PANDAS_CACHE: dict[str, Any] = {}
22
-
23
-
24
- # SECTION: FUNCTIONS ======================================================== #
25
-
26
-
27
- def get_pandas(format_name: str) -> Any:
28
- """
29
- Return the pandas module, importing it on first use.
30
-
31
- Parameters
32
- ----------
33
- format_name : str
34
- Human-readable format name for error messages.
35
-
36
- Returns
37
- -------
38
- Any
39
- The pandas module.
40
-
41
- Raises
42
- ------
43
- ImportError
44
- If the optional dependency is missing.
45
- """
46
- mod = _PANDAS_CACHE.get('mod')
47
- if mod is not None: # pragma: no cover - tiny branch
48
- return mod
49
- try:
50
- _pd = __import__('pandas') # type: ignore[assignment]
51
- except ImportError as e: # pragma: no cover
52
- raise ImportError(
53
- f'{format_name} support requires optional dependency "pandas".\n'
54
- 'Install with: pip install pandas',
55
- ) from e
56
- _PANDAS_CACHE['mod'] = _pd
57
-
58
- return _pd