etlplus 0.12.10__py3-none-any.whl → 0.12.12__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/cfg.py +2 -2
- etlplus/file/conf.py +2 -2
- etlplus/file/dta.py +77 -0
- etlplus/file/enums.py +9 -3
- etlplus/file/hbs.py +78 -0
- etlplus/file/hdf5.py +78 -0
- etlplus/file/jinja2.py +78 -0
- etlplus/file/mat.py +78 -0
- etlplus/file/mustache.py +78 -0
- etlplus/file/nc.py +78 -0
- etlplus/file/numbers.py +75 -0
- etlplus/file/ods.py +79 -0
- etlplus/file/properties.py +13 -13
- etlplus/file/rda.py +78 -0
- etlplus/file/rds.py +78 -0
- etlplus/file/sas7bdat.py +78 -0
- etlplus/file/sav.py +77 -0
- etlplus/file/sylk.py +77 -0
- etlplus/file/toml.py +1 -1
- etlplus/file/vm.py +78 -0
- etlplus/file/wks.py +77 -0
- etlplus/file/xlsm.py +79 -0
- etlplus/file/xpt.py +78 -0
- etlplus/file/zsav.py +77 -0
- {etlplus-0.12.10.dist-info → etlplus-0.12.12.dist-info}/METADATA +1 -1
- {etlplus-0.12.10.dist-info → etlplus-0.12.12.dist-info}/RECORD +30 -11
- {etlplus-0.12.10.dist-info → etlplus-0.12.12.dist-info}/WHEEL +0 -0
- {etlplus-0.12.10.dist-info → etlplus-0.12.12.dist-info}/entry_points.txt +0 -0
- {etlplus-0.12.10.dist-info → etlplus-0.12.12.dist-info}/licenses/LICENSE +0 -0
- {etlplus-0.12.10.dist-info → etlplus-0.12.12.dist-info}/top_level.txt +0 -0
etlplus/file/ods.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""
|
|
2
|
+
:mod:`etlplus.file.ods` module.
|
|
3
|
+
|
|
4
|
+
Helpers for reading/writing OpenDocument (ODS) spreadsheet files.
|
|
5
|
+
|
|
6
|
+
Notes
|
|
7
|
+
-----
|
|
8
|
+
- An ODS file is a spreadsheet file created using the OpenDocument format.
|
|
9
|
+
- Common cases:
|
|
10
|
+
- Spreadsheet files created by LibreOffice Calc, Apache OpenOffice Calc, or
|
|
11
|
+
other applications that support the OpenDocument format.
|
|
12
|
+
- Spreadsheet files exchanged in open standards environments.
|
|
13
|
+
- Spreadsheet files used in government or educational institutions
|
|
14
|
+
promoting open formats.
|
|
15
|
+
- Rule of thumb:
|
|
16
|
+
- If the file follows the OpenDocument specification, use this module for
|
|
17
|
+
reading and writing.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
from pathlib import Path
|
|
23
|
+
|
|
24
|
+
from ..types import JSONData
|
|
25
|
+
from ..types import JSONList
|
|
26
|
+
from . import stub
|
|
27
|
+
|
|
28
|
+
# SECTION: EXPORTS ========================================================== #
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
'read',
|
|
33
|
+
'write',
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# SECTION: FUNCTIONS ======================================================== #
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def read(
|
|
41
|
+
path: Path,
|
|
42
|
+
) -> JSONList:
|
|
43
|
+
"""
|
|
44
|
+
Read ODS content from ``path``.
|
|
45
|
+
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
path : Path
|
|
49
|
+
Path to the ODS file on disk.
|
|
50
|
+
|
|
51
|
+
Returns
|
|
52
|
+
-------
|
|
53
|
+
JSONList
|
|
54
|
+
The list of dictionaries read from the ODS file.
|
|
55
|
+
"""
|
|
56
|
+
return stub.read(path, format_name='ODS')
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def write(
|
|
60
|
+
path: Path,
|
|
61
|
+
data: JSONData,
|
|
62
|
+
) -> int:
|
|
63
|
+
"""
|
|
64
|
+
Write ``data`` to ODS file at ``path`` and return record count.
|
|
65
|
+
|
|
66
|
+
Parameters
|
|
67
|
+
----------
|
|
68
|
+
path : Path
|
|
69
|
+
Path to the ODS file on disk.
|
|
70
|
+
data : JSONData
|
|
71
|
+
Data to write as ODS file. Should be a list of dictionaries or a
|
|
72
|
+
single dictionary.
|
|
73
|
+
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
int
|
|
77
|
+
The number of rows written to the ODS file.
|
|
78
|
+
"""
|
|
79
|
+
return stub.write(path, data, format_name='ODS')
|
etlplus/file/properties.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"""
|
|
2
|
-
:mod:`etlplus.file.
|
|
2
|
+
:mod:`etlplus.file.properties` module.
|
|
3
3
|
|
|
4
|
-
Helpers for reading/writing properties (
|
|
4
|
+
Helpers for reading/writing properties (PROPERTIES) files.
|
|
5
5
|
|
|
6
6
|
Notes
|
|
7
7
|
-----
|
|
8
|
-
- A
|
|
9
|
-
|
|
8
|
+
- A PROPERTIES file is a properties file that typically uses key-value pairs,
|
|
9
|
+
often with a simple syntax.
|
|
10
10
|
- Common cases:
|
|
11
11
|
- Java-style properties files with ``key=value`` pairs.
|
|
12
12
|
- INI-style files without sections.
|
|
@@ -40,19 +40,19 @@ def read(
|
|
|
40
40
|
path: Path,
|
|
41
41
|
) -> JSONList:
|
|
42
42
|
"""
|
|
43
|
-
Read
|
|
43
|
+
Read PROPERTIES content from ``path``.
|
|
44
44
|
|
|
45
45
|
Parameters
|
|
46
46
|
----------
|
|
47
47
|
path : Path
|
|
48
|
-
Path to the
|
|
48
|
+
Path to the PROPERTIES file on disk.
|
|
49
49
|
|
|
50
50
|
Returns
|
|
51
51
|
-------
|
|
52
52
|
JSONList
|
|
53
|
-
The list of dictionaries read from the
|
|
53
|
+
The list of dictionaries read from the PROPERTIES file.
|
|
54
54
|
"""
|
|
55
|
-
return stub.read(path, format_name='
|
|
55
|
+
return stub.read(path, format_name='PROPERTIES')
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
def write(
|
|
@@ -60,19 +60,19 @@ def write(
|
|
|
60
60
|
data: JSONData,
|
|
61
61
|
) -> int:
|
|
62
62
|
"""
|
|
63
|
-
Write ``data`` to
|
|
63
|
+
Write ``data`` to PROPERTIES at ``path`` and return record count.
|
|
64
64
|
|
|
65
65
|
Parameters
|
|
66
66
|
----------
|
|
67
67
|
path : Path
|
|
68
|
-
Path to the
|
|
68
|
+
Path to the PROPERTIES file on disk.
|
|
69
69
|
data : JSONData
|
|
70
|
-
Data to write as
|
|
70
|
+
Data to write as PROPERTIES. Should be a list of dictionaries or a
|
|
71
71
|
single dictionary.
|
|
72
72
|
|
|
73
73
|
Returns
|
|
74
74
|
-------
|
|
75
75
|
int
|
|
76
|
-
The number of rows written to the
|
|
76
|
+
The number of rows written to the PROPERTIES file.
|
|
77
77
|
"""
|
|
78
|
-
return stub.write(path, data, format_name='
|
|
78
|
+
return stub.write(path, data, format_name='PROPERTIES')
|
etlplus/file/rda.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""
|
|
2
|
+
:mod:`etlplus.file.rda` module.
|
|
3
|
+
|
|
4
|
+
Helpers for reading/writing RData workspace/object bundle (RDA) files.
|
|
5
|
+
|
|
6
|
+
Notes
|
|
7
|
+
-----
|
|
8
|
+
- A RDA file is a binary file format used by R to store workspace objects,
|
|
9
|
+
including data frames, lists, and other R objects.
|
|
10
|
+
- Common cases:
|
|
11
|
+
- Storing R data objects for later use.
|
|
12
|
+
- Sharing R datasets between users.
|
|
13
|
+
- Loading R data into Python for analysis.
|
|
14
|
+
- Rule of thumb:
|
|
15
|
+
- If the file follows the RDA specification, use this module for reading
|
|
16
|
+
and writing.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
from ..types import JSONData
|
|
24
|
+
from ..types import JSONList
|
|
25
|
+
from . import stub
|
|
26
|
+
|
|
27
|
+
# SECTION: EXPORTS ========================================================== #
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
'read',
|
|
32
|
+
'write',
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# SECTION: FUNCTIONS ======================================================== #
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def read(
|
|
40
|
+
path: Path,
|
|
41
|
+
) -> JSONList:
|
|
42
|
+
"""
|
|
43
|
+
Read RDA content from ``path``.
|
|
44
|
+
|
|
45
|
+
Parameters
|
|
46
|
+
----------
|
|
47
|
+
path : Path
|
|
48
|
+
Path to the RDA file on disk.
|
|
49
|
+
|
|
50
|
+
Returns
|
|
51
|
+
-------
|
|
52
|
+
JSONList
|
|
53
|
+
The list of dictionaries read from the RDA file.
|
|
54
|
+
"""
|
|
55
|
+
return stub.read(path, format_name='RDA')
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def write(
|
|
59
|
+
path: Path,
|
|
60
|
+
data: JSONData,
|
|
61
|
+
) -> int:
|
|
62
|
+
"""
|
|
63
|
+
Write ``data`` to RDA file at ``path`` and return record count.
|
|
64
|
+
|
|
65
|
+
Parameters
|
|
66
|
+
----------
|
|
67
|
+
path : Path
|
|
68
|
+
Path to the RDA file on disk.
|
|
69
|
+
data : JSONData
|
|
70
|
+
Data to write as RDA file. Should be a list of dictionaries or a
|
|
71
|
+
single dictionary.
|
|
72
|
+
|
|
73
|
+
Returns
|
|
74
|
+
-------
|
|
75
|
+
int
|
|
76
|
+
The number of rows written to the RDA file.
|
|
77
|
+
"""
|
|
78
|
+
return stub.write(path, data, format_name='RDA')
|
etlplus/file/rds.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""
|
|
2
|
+
:mod:`etlplus.file.rds` module.
|
|
3
|
+
|
|
4
|
+
Helpers for reading/writing R (RDS) data files.
|
|
5
|
+
|
|
6
|
+
Notes
|
|
7
|
+
-----
|
|
8
|
+
- An RDS file is a binary file format used by R to store a single R object,
|
|
9
|
+
such as a data frame, list, or vector.
|
|
10
|
+
- Common cases:
|
|
11
|
+
- Storing R objects for later use.
|
|
12
|
+
- Sharing R data between users.
|
|
13
|
+
- Loading R data into Python for analysis.
|
|
14
|
+
- Rule of thumb:
|
|
15
|
+
- If the file follows the RDS specification, use this module for reading
|
|
16
|
+
and writing.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
from ..types import JSONData
|
|
24
|
+
from ..types import JSONList
|
|
25
|
+
from . import stub
|
|
26
|
+
|
|
27
|
+
# SECTION: EXPORTS ========================================================== #
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
'read',
|
|
32
|
+
'write',
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# SECTION: FUNCTIONS ======================================================== #
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def read(
|
|
40
|
+
path: Path,
|
|
41
|
+
) -> JSONList:
|
|
42
|
+
"""
|
|
43
|
+
Read RDS content from ``path``.
|
|
44
|
+
|
|
45
|
+
Parameters
|
|
46
|
+
----------
|
|
47
|
+
path : Path
|
|
48
|
+
Path to the RDS file on disk.
|
|
49
|
+
|
|
50
|
+
Returns
|
|
51
|
+
-------
|
|
52
|
+
JSONList
|
|
53
|
+
The list of dictionaries read from the RDS file.
|
|
54
|
+
"""
|
|
55
|
+
return stub.read(path, format_name='RDS')
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def write(
|
|
59
|
+
path: Path,
|
|
60
|
+
data: JSONData,
|
|
61
|
+
) -> int:
|
|
62
|
+
"""
|
|
63
|
+
Write ``data`` to RDS file at ``path`` and return record count.
|
|
64
|
+
|
|
65
|
+
Parameters
|
|
66
|
+
----------
|
|
67
|
+
path : Path
|
|
68
|
+
Path to the RDS file on disk.
|
|
69
|
+
data : JSONData
|
|
70
|
+
Data to write as RDS file. Should be a list of dictionaries or a
|
|
71
|
+
single dictionary.
|
|
72
|
+
|
|
73
|
+
Returns
|
|
74
|
+
-------
|
|
75
|
+
int
|
|
76
|
+
The number of rows written to the RDS file.
|
|
77
|
+
"""
|
|
78
|
+
return stub.write(path, data, format_name='RDS')
|
etlplus/file/sas7bdat.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""
|
|
2
|
+
:mod:`etlplus.file.sas7bdat` module.
|
|
3
|
+
|
|
4
|
+
Helpers for reading/writing SAS (SAS7BDAT) data files.
|
|
5
|
+
|
|
6
|
+
Notes
|
|
7
|
+
-----
|
|
8
|
+
- A SAS7BDAT file is a binary file format used by SAS to store datasets,
|
|
9
|
+
including variables, labels, and data types.
|
|
10
|
+
- Common cases:
|
|
11
|
+
- Delimited text files (e.g., CSV, TSV).
|
|
12
|
+
- Fixed-width formatted files.
|
|
13
|
+
- Custom formats specific to certain applications.
|
|
14
|
+
- Rule of thumb:
|
|
15
|
+
- If the file does not follow a specific standard format, use this module
|
|
16
|
+
for reading and writing.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
from ..types import JSONData
|
|
24
|
+
from ..types import JSONList
|
|
25
|
+
from . import stub
|
|
26
|
+
|
|
27
|
+
# SECTION: EXPORTS ========================================================== #
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
'read',
|
|
32
|
+
'write',
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# SECTION: FUNCTIONS ======================================================== #
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def read(
|
|
40
|
+
path: Path,
|
|
41
|
+
) -> JSONList:
|
|
42
|
+
"""
|
|
43
|
+
Read DAT content from ``path``.
|
|
44
|
+
|
|
45
|
+
Parameters
|
|
46
|
+
----------
|
|
47
|
+
path : Path
|
|
48
|
+
Path to the SAS7BDAT file on disk.
|
|
49
|
+
|
|
50
|
+
Returns
|
|
51
|
+
-------
|
|
52
|
+
JSONList
|
|
53
|
+
The list of dictionaries read from the SAS7BDAT file.
|
|
54
|
+
"""
|
|
55
|
+
return stub.read(path, format_name='SAS7BDAT')
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def write(
|
|
59
|
+
path: Path,
|
|
60
|
+
data: JSONData,
|
|
61
|
+
) -> int:
|
|
62
|
+
"""
|
|
63
|
+
Write ``data`` to SAS7BDAT file at ``path`` and return record count.
|
|
64
|
+
|
|
65
|
+
Parameters
|
|
66
|
+
----------
|
|
67
|
+
path : Path
|
|
68
|
+
Path to the SAS7BDAT file on disk.
|
|
69
|
+
data : JSONData
|
|
70
|
+
Data to write as SAS7BDAT file. Should be a list of dictionaries or a
|
|
71
|
+
single dictionary.
|
|
72
|
+
|
|
73
|
+
Returns
|
|
74
|
+
-------
|
|
75
|
+
int
|
|
76
|
+
The number of rows written to the SAS7BDAT file.
|
|
77
|
+
"""
|
|
78
|
+
return stub.write(path, data, format_name='SAS7BDAT')
|
etlplus/file/sav.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""
|
|
2
|
+
:mod:`etlplus.file.sav` module.
|
|
3
|
+
|
|
4
|
+
Helpers for reading/writing SPSS (SAV) data files.
|
|
5
|
+
|
|
6
|
+
Notes
|
|
7
|
+
-----
|
|
8
|
+
- A SAV file is a binary file format used by SPSS to store datasets, including
|
|
9
|
+
variables, labels, and data types.
|
|
10
|
+
- Common cases:
|
|
11
|
+
- Reading data for analysis in Python.
|
|
12
|
+
- Writing processed data back to SPSS format.
|
|
13
|
+
- Rule of thumb:
|
|
14
|
+
- If you need to work with SPSS data files, use this module for reading
|
|
15
|
+
and writing.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
|
|
22
|
+
from ..types import JSONData
|
|
23
|
+
from ..types import JSONList
|
|
24
|
+
from . import stub
|
|
25
|
+
|
|
26
|
+
# SECTION: EXPORTS ========================================================== #
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
'read',
|
|
31
|
+
'write',
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# SECTION: FUNCTIONS ======================================================== #
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def read(
|
|
39
|
+
path: Path,
|
|
40
|
+
) -> JSONList:
|
|
41
|
+
"""
|
|
42
|
+
Read SAV content from ``path``.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
path : Path
|
|
47
|
+
Path to the SAV file on disk.
|
|
48
|
+
|
|
49
|
+
Returns
|
|
50
|
+
-------
|
|
51
|
+
JSONList
|
|
52
|
+
The list of dictionaries read from the SAV file.
|
|
53
|
+
"""
|
|
54
|
+
return stub.read(path, format_name='SAV')
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def write(
|
|
58
|
+
path: Path,
|
|
59
|
+
data: JSONData,
|
|
60
|
+
) -> int:
|
|
61
|
+
"""
|
|
62
|
+
Write ``data`` to SAV file at ``path`` and return record count.
|
|
63
|
+
|
|
64
|
+
Parameters
|
|
65
|
+
----------
|
|
66
|
+
path : Path
|
|
67
|
+
Path to the SAV file on disk.
|
|
68
|
+
data : JSONData
|
|
69
|
+
Data to write as SAV file. Should be a list of dictionaries or a
|
|
70
|
+
single dictionary.
|
|
71
|
+
|
|
72
|
+
Returns
|
|
73
|
+
-------
|
|
74
|
+
int
|
|
75
|
+
The number of rows written to the SAV file.
|
|
76
|
+
"""
|
|
77
|
+
return stub.write(path, data, format_name='SAV')
|
etlplus/file/sylk.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""
|
|
2
|
+
:mod:`etlplus.file.sylk` module.
|
|
3
|
+
|
|
4
|
+
Helpers for reading/writing Symbolic Link (SYLK) data files.
|
|
5
|
+
|
|
6
|
+
Notes
|
|
7
|
+
-----
|
|
8
|
+
- A SYLK file is a text-based file format used to represent spreadsheet
|
|
9
|
+
data, including cell values, formulas, and formatting.
|
|
10
|
+
- Common cases:
|
|
11
|
+
- Storing spreadsheet data in a human-readable format.
|
|
12
|
+
- Exchanging data between different spreadsheet applications.
|
|
13
|
+
- Rule of thumb:
|
|
14
|
+
- If you need to work with SYLK files, use this module for reading
|
|
15
|
+
and writing.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
|
|
22
|
+
from ..types import JSONData
|
|
23
|
+
from ..types import JSONList
|
|
24
|
+
from . import stub
|
|
25
|
+
|
|
26
|
+
# SECTION: EXPORTS ========================================================== #
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
'read',
|
|
31
|
+
'write',
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# SECTION: FUNCTIONS ======================================================== #
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def read(
|
|
39
|
+
path: Path,
|
|
40
|
+
) -> JSONList:
|
|
41
|
+
"""
|
|
42
|
+
Read SYLK content from ``path``.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
path : Path
|
|
47
|
+
Path to the SYLK file on disk.
|
|
48
|
+
|
|
49
|
+
Returns
|
|
50
|
+
-------
|
|
51
|
+
JSONList
|
|
52
|
+
The list of dictionaries read from the SYLK file.
|
|
53
|
+
"""
|
|
54
|
+
return stub.read(path, format_name='SYLK')
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def write(
|
|
58
|
+
path: Path,
|
|
59
|
+
data: JSONData,
|
|
60
|
+
) -> int:
|
|
61
|
+
"""
|
|
62
|
+
Write ``data`` to SYLK file at ``path`` and return record count.
|
|
63
|
+
|
|
64
|
+
Parameters
|
|
65
|
+
----------
|
|
66
|
+
path : Path
|
|
67
|
+
Path to the SYLK file on disk.
|
|
68
|
+
data : JSONData
|
|
69
|
+
Data to write as SYLK file. Should be a list of dictionaries or a
|
|
70
|
+
single dictionary.
|
|
71
|
+
|
|
72
|
+
Returns
|
|
73
|
+
-------
|
|
74
|
+
int
|
|
75
|
+
The number of rows written to the SYLK file.
|
|
76
|
+
"""
|
|
77
|
+
return stub.write(path, data, format_name='SYLK')
|
etlplus/file/toml.py
CHANGED
|
@@ -5,7 +5,7 @@ Helpers for reading/writing Tom's Obvious Minimal Language (TOML) files.
|
|
|
5
5
|
|
|
6
6
|
Notes
|
|
7
7
|
-----
|
|
8
|
-
- A
|
|
8
|
+
- A TOML file is a configuration file that uses the TOML syntax.
|
|
9
9
|
- Common cases:
|
|
10
10
|
- Simple key-value pairs.
|
|
11
11
|
- Nested tables and arrays.
|
etlplus/file/vm.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""
|
|
2
|
+
:mod:`etlplus.file.vm` module.
|
|
3
|
+
|
|
4
|
+
Helpers for reading/writing Apache Velocity (VM) template files.
|
|
5
|
+
|
|
6
|
+
Notes
|
|
7
|
+
-----
|
|
8
|
+
- A VM file is a text file used for generating HTML or other text formats
|
|
9
|
+
by combining templates with data.
|
|
10
|
+
- Common cases:
|
|
11
|
+
- HTML templates.
|
|
12
|
+
- Email templates.
|
|
13
|
+
- Configuration files.
|
|
14
|
+
- Rule of thumb:
|
|
15
|
+
- If you need to work with Apache Velocity template files, use this module
|
|
16
|
+
for reading and writing.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
from ..types import JSONData
|
|
24
|
+
from ..types import JSONList
|
|
25
|
+
from . import stub
|
|
26
|
+
|
|
27
|
+
# SECTION: EXPORTS ========================================================== #
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
'read',
|
|
32
|
+
'write',
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# SECTION: FUNCTIONS ======================================================== #
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def read(
|
|
40
|
+
path: Path,
|
|
41
|
+
) -> JSONList:
|
|
42
|
+
"""
|
|
43
|
+
Read VM content from ``path``.
|
|
44
|
+
|
|
45
|
+
Parameters
|
|
46
|
+
----------
|
|
47
|
+
path : Path
|
|
48
|
+
Path to the VM file on disk.
|
|
49
|
+
|
|
50
|
+
Returns
|
|
51
|
+
-------
|
|
52
|
+
JSONList
|
|
53
|
+
The list of dictionaries read from the VM file.
|
|
54
|
+
"""
|
|
55
|
+
return stub.read(path, format_name='VM')
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def write(
|
|
59
|
+
path: Path,
|
|
60
|
+
data: JSONData,
|
|
61
|
+
) -> int:
|
|
62
|
+
"""
|
|
63
|
+
Write ``data`` to VM file at ``path`` and return record count.
|
|
64
|
+
|
|
65
|
+
Parameters
|
|
66
|
+
----------
|
|
67
|
+
path : Path
|
|
68
|
+
Path to the VM file on disk.
|
|
69
|
+
data : JSONData
|
|
70
|
+
Data to write as VM file. Should be a list of dictionaries or a single
|
|
71
|
+
dictionary.
|
|
72
|
+
|
|
73
|
+
Returns
|
|
74
|
+
-------
|
|
75
|
+
int
|
|
76
|
+
The number of rows written to the VM file.
|
|
77
|
+
"""
|
|
78
|
+
return stub.write(path, data, format_name='VM')
|
etlplus/file/wks.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""
|
|
2
|
+
:mod:`etlplus.file.wks` module.
|
|
3
|
+
|
|
4
|
+
Helpers for reading/writing Lotus 1-2-3 (WKS) spreadsheet files.
|
|
5
|
+
|
|
6
|
+
Notes
|
|
7
|
+
-----
|
|
8
|
+
- A WKS file is a spreadsheet file created using the Lotus 1-2-3 format.
|
|
9
|
+
- Common cases:
|
|
10
|
+
- Reading data from legacy Lotus 1-2-3 spreadsheets.
|
|
11
|
+
- Writing data to Lotus 1-2-3 format for compatibility.
|
|
12
|
+
- Converting WKS files to more modern formats.
|
|
13
|
+
- Rule of thumb:
|
|
14
|
+
- If you need to work with Lotus 1-2-3 spreadsheet files, use this module
|
|
15
|
+
for reading and writing.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
|
|
22
|
+
from ..types import JSONData
|
|
23
|
+
from ..types import JSONList
|
|
24
|
+
from . import stub
|
|
25
|
+
|
|
26
|
+
# SECTION: EXPORTS ========================================================== #
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
'read',
|
|
31
|
+
'write',
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
# SECTION: FUNCTIONS ======================================================== #
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def read(
|
|
39
|
+
path: Path,
|
|
40
|
+
) -> JSONList:
|
|
41
|
+
"""
|
|
42
|
+
Read WKS content from ``path``.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
path : Path
|
|
47
|
+
Path to the WKS file on disk.
|
|
48
|
+
|
|
49
|
+
Returns
|
|
50
|
+
-------
|
|
51
|
+
JSONList
|
|
52
|
+
The list of dictionaries read from the WKS file.
|
|
53
|
+
"""
|
|
54
|
+
return stub.read(path, format_name='WKS')
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def write(
|
|
58
|
+
path: Path,
|
|
59
|
+
data: JSONData,
|
|
60
|
+
) -> int:
|
|
61
|
+
"""
|
|
62
|
+
Write ``data`` to WKS file at ``path`` and return record count.
|
|
63
|
+
|
|
64
|
+
Parameters
|
|
65
|
+
----------
|
|
66
|
+
path : Path
|
|
67
|
+
Path to the WKS file on disk.
|
|
68
|
+
data : JSONData
|
|
69
|
+
Data to write as WKS file. Should be a list of dictionaries or a
|
|
70
|
+
single dictionary.
|
|
71
|
+
|
|
72
|
+
Returns
|
|
73
|
+
-------
|
|
74
|
+
int
|
|
75
|
+
The number of rows written to the WKS file.
|
|
76
|
+
"""
|
|
77
|
+
return stub.write(path, data, format_name='WKS')
|