pythonwrench 0.5.1__tar.gz → 0.6.0__tar.gz
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.
- {pythonwrench-0.5.1/src/pythonwrench.egg-info → pythonwrench-0.6.0}/PKG-INFO +19 -4
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/README.md +3 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/pyproject.toml +23 -25
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/__init__.py +69 -55
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/__main__.py +2 -2
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/_core.py +0 -54
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/argparse.py +161 -29
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/cast.py +4 -2
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/collections/collections.py +7 -7
- pythonwrench-0.6.0/src/pythonwrench/csv.py +12 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/dataclasses.py +1 -1
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/disk_cache.py +5 -3
- pythonwrench-0.6.0/src/pythonwrench/entrypoints/info.py +46 -0
- pythonwrench-0.6.0/src/pythonwrench/entrypoints/safe_rmdir.py +96 -0
- pythonwrench-0.6.0/src/pythonwrench/entrypoints/tree.py +112 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/functools.py +47 -7
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/inspect.py +1 -20
- pythonwrench-0.6.0/src/pythonwrench/json.py +12 -0
- pythonwrench-0.6.0/src/pythonwrench/jsonl.py +12 -0
- pythonwrench-0.6.0/src/pythonwrench/pickle.py +12 -0
- pythonwrench-0.6.0/src/pythonwrench/serialization/__init__.py +70 -0
- pythonwrench-0.6.0/src/pythonwrench/serialization/_core.py +60 -0
- {pythonwrench-0.5.1/src/pythonwrench → pythonwrench-0.6.0/src/pythonwrench/serialization}/csv.py +1 -1
- {pythonwrench-0.5.1/src/pythonwrench → pythonwrench-0.6.0/src/pythonwrench/serialization}/json.py +1 -1
- {pythonwrench-0.5.1/src/pythonwrench → pythonwrench-0.6.0/src/pythonwrench/serialization}/jsonl.py +3 -3
- {pythonwrench-0.5.1/src/pythonwrench → pythonwrench-0.6.0/src/pythonwrench/serialization}/pickle.py +1 -1
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/time.py +3 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/typing/__init__.py +2 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/typing/checks.py +9 -2
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/typing/classes.py +4 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0/src/pythonwrench.egg-info}/PKG-INFO +19 -4
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench.egg-info/SOURCES.txt +10 -3
- pythonwrench-0.6.0/src/pythonwrench.egg-info/entry_points.txt +7 -0
- pythonwrench-0.6.0/src/pythonwrench.egg-info/requires.txt +18 -0
- pythonwrench-0.6.0/tests/test_argparse.py +135 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_cast.py +12 -4
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_disk_cache.py +18 -0
- pythonwrench-0.5.1/tests/test_entries.py → pythonwrench-0.6.0/tests/test_entrypoints.py +2 -1
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_functools.py +6 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_typing.py +3 -0
- pythonwrench-0.5.1/docs/requirements.txt +0 -4
- pythonwrench-0.5.1/src/pythonwrench/entries.py +0 -223
- pythonwrench-0.5.1/src/pythonwrench.egg-info/entry_points.txt +0 -7
- pythonwrench-0.5.1/src/pythonwrench.egg-info/requires.txt +0 -7
- pythonwrench-0.5.1/tests/test_argparse.py +0 -67
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/LICENSE +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/setup.cfg +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/setup.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/abc.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/checksum.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/collections/__init__.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/collections/prop.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/collections/reducers.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/concurrent.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/datetime.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/difflib.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/enum.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/hashlib.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/importlib.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/logging.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/math.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/os.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/random.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/re.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/semver.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench/warnings.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench.egg-info/dependency_links.txt +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/src/pythonwrench.egg-info/top_level.txt +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_abc.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_checksum.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_collections.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_csv.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_dataclasses.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_difflib.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_enum.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_hashlib.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_importlib.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_inspect.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_json.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_jsonl.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_logging.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_math.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_os.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_random.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_readme.py +0 -0
- {pythonwrench-0.5.1 → pythonwrench-0.6.0}/tests/test_semver.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pythonwrench
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Python library with tools for typing, manipulating collections, and more!
|
|
5
5
|
Author-email: "Étienne Labbé (Labbeti)" <labbeti.pub@gmail.com>
|
|
6
6
|
Maintainer-email: "Étienne Labbé (Labbeti)" <labbeti.pub@gmail.com>
|
|
@@ -50,11 +50,23 @@ Classifier: Operating System :: POSIX
|
|
|
50
50
|
Requires-Python: <3.15,>=3.8
|
|
51
51
|
Description-Content-Type: text/markdown
|
|
52
52
|
License-File: LICENSE
|
|
53
|
-
Requires-Dist: lazy-loader>=0.4
|
|
54
53
|
Requires-Dist: typing-extensions>=4.10.0
|
|
55
54
|
Provides-Extra: dev
|
|
55
|
+
Requires-Dist: pandas>=2.0.3; extra == "dev"
|
|
56
|
+
Requires-Dist: coverage[toml]>=7.6.1; extra == "dev"
|
|
57
|
+
Requires-Dist: ruff>=0.12.0; extra == "dev"
|
|
58
|
+
Requires-Dist: sphinx<9.0.0; extra == "dev"
|
|
59
|
+
Requires-Dist: sphinx-immaterial>=0.11.14; extra == "dev"
|
|
60
|
+
Requires-Dist: flake8>=5.0.4; extra == "dev"
|
|
61
|
+
Requires-Dist: ipykernel>=6.29.5; extra == "dev"
|
|
62
|
+
Requires-Dist: ipython>=8.12.3; extra == "dev"
|
|
63
|
+
Requires-Dist: pre-commit>=3.5.0; extra == "dev"
|
|
64
|
+
Requires-Dist: pytest>=8.3.5; extra == "dev"
|
|
65
|
+
Requires-Dist: setuptools>=75.3.2; extra == "dev"
|
|
66
|
+
Requires-Dist: twine>=6.1.0; extra == "dev"
|
|
56
67
|
Provides-Extra: lazy
|
|
57
|
-
Requires-Dist: lazy-loader
|
|
68
|
+
Requires-Dist: lazy-loader<0.5,>=0.4; extra == "lazy"
|
|
69
|
+
Dynamic: license-file
|
|
58
70
|
|
|
59
71
|
# pythonwrench
|
|
60
72
|
|
|
@@ -219,6 +231,9 @@ Easely converts common python structures like list of dicts to dict of lists :
|
|
|
219
231
|
... True
|
|
220
232
|
```
|
|
221
233
|
|
|
234
|
+
## Lazy loading
|
|
235
|
+
To speed up this package loading, you can install it with `uv add pythonwrench[lazy]`, so `import pythonwrench as pw` will be faster.
|
|
236
|
+
|
|
222
237
|
## Contact
|
|
223
238
|
Maintainer:
|
|
224
239
|
- [Étienne Labbé](https://labbeti.github.io/) "Labbeti": labbeti.pub@gmail.com
|
|
@@ -161,6 +161,9 @@ Easely converts common python structures like list of dicts to dict of lists :
|
|
|
161
161
|
... True
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
+
## Lazy loading
|
|
165
|
+
To speed up this package loading, you can install it with `uv add pythonwrench[lazy]`, so `import pythonwrench as pw` will be faster.
|
|
166
|
+
|
|
164
167
|
## Contact
|
|
165
168
|
Maintainer:
|
|
166
169
|
- [Étienne Labbé](https://labbeti.github.io/) "Labbeti": labbeti.pub@gmail.com
|
|
@@ -31,7 +31,6 @@ maintainers = [
|
|
|
31
31
|
]
|
|
32
32
|
dynamic = ["version"]
|
|
33
33
|
dependencies = [
|
|
34
|
-
"lazy-loader>=0.4",
|
|
35
34
|
"typing-extensions>=4.10.0",
|
|
36
35
|
]
|
|
37
36
|
|
|
@@ -43,17 +42,30 @@ Changelog = "https://github.com/Labbeti/pythonwrench/blob/main/CHANGELOG.md"
|
|
|
43
42
|
Tracker = "https://github.com/Labbeti/pythonwrench/issues"
|
|
44
43
|
|
|
45
44
|
[project.scripts]
|
|
46
|
-
pythonwrench-info = "pythonwrench.
|
|
47
|
-
pythonwrench-tree = "pythonwrench.
|
|
48
|
-
pythonwrench-safe-rmdir = "pythonwrench.
|
|
49
|
-
pyw-info = "pythonwrench.
|
|
50
|
-
pyw-tree = "pythonwrench.
|
|
51
|
-
pyw-safe-rmdir = "pythonwrench.
|
|
45
|
+
pythonwrench-info = "pythonwrench.entrypoints.info:main_info"
|
|
46
|
+
pythonwrench-tree = "pythonwrench.entrypoints.tree:main_tree"
|
|
47
|
+
pythonwrench-safe-rmdir = "pythonwrench.entrypoints.safe_rmdir:main_safe_rmdir"
|
|
48
|
+
pyw-info = "pythonwrench.entrypoints.info:main_info"
|
|
49
|
+
pyw-tree = "pythonwrench.entrypoints.tree:main_tree"
|
|
50
|
+
pyw-safe-rmdir = "pythonwrench.entrypoints.safe_rmdir:main_safe_rmdir"
|
|
52
51
|
|
|
53
52
|
[project.optional-dependencies]
|
|
54
|
-
dev = [
|
|
53
|
+
dev = [
|
|
54
|
+
"pandas>=2.0.3",
|
|
55
|
+
"coverage[toml]>=7.6.1",
|
|
56
|
+
"ruff>=0.12.0",
|
|
57
|
+
"sphinx<9.0.0",
|
|
58
|
+
"sphinx-immaterial>=0.11.14",
|
|
59
|
+
"flake8>=5.0.4",
|
|
60
|
+
"ipykernel>=6.29.5",
|
|
61
|
+
"ipython>=8.12.3",
|
|
62
|
+
"pre-commit>=3.5.0",
|
|
63
|
+
"pytest>=8.3.5",
|
|
64
|
+
"setuptools>=75.3.2",
|
|
65
|
+
"twine>=6.1.0",
|
|
66
|
+
]
|
|
55
67
|
lazy = [
|
|
56
|
-
"lazy-loader>=0.4",
|
|
68
|
+
"lazy-loader>=0.4,<0.5",
|
|
57
69
|
]
|
|
58
70
|
|
|
59
71
|
[build-system]
|
|
@@ -81,23 +93,9 @@ testpaths = ["tests"]
|
|
|
81
93
|
source = ["src"]
|
|
82
94
|
|
|
83
95
|
[tool.ruff.lint.extend-per-file-ignores]
|
|
96
|
+
# F401: module imported but unused
|
|
97
|
+
# F403: ‘from module import *’ used; unable to detect undefined names
|
|
84
98
|
"__init__.py" = ["F401", "F403"]
|
|
85
99
|
|
|
86
100
|
[tool.uv.sources]
|
|
87
101
|
pythonwrench = { workspace = true }
|
|
88
|
-
|
|
89
|
-
[dependency-groups]
|
|
90
|
-
dev = [
|
|
91
|
-
"coverage[toml]>=7.6.1",
|
|
92
|
-
"flake8",
|
|
93
|
-
"ipykernel",
|
|
94
|
-
"ipython",
|
|
95
|
-
"pre-commit",
|
|
96
|
-
"pytest",
|
|
97
|
-
"pythonwrench",
|
|
98
|
-
"ruff>=0.12.0",
|
|
99
|
-
"setuptools",
|
|
100
|
-
"sphinx<9.0.0",
|
|
101
|
-
"sphinx-immaterial>=0.11.14",
|
|
102
|
-
"twine",
|
|
103
|
-
]
|
|
@@ -9,7 +9,7 @@ __author_email__ = "labbeti.pub@gmail.com"
|
|
|
9
9
|
__license__ = "MIT"
|
|
10
10
|
__maintainer__ = "Étienne Labbé (Labbeti)"
|
|
11
11
|
__status__ = "Development"
|
|
12
|
-
__version__ = "0.
|
|
12
|
+
__version__ = "0.6.0"
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
from typing import TYPE_CHECKING
|
|
@@ -28,31 +28,31 @@ if TYPE_CHECKING or lazy is None:
|
|
|
28
28
|
from . import checksum as checksum
|
|
29
29
|
from . import collections as collections
|
|
30
30
|
from . import concurrent as concurrent
|
|
31
|
-
from . import csv as csv
|
|
32
31
|
from . import dataclasses as dataclasses
|
|
33
32
|
from . import datetime as datetime
|
|
34
33
|
from . import difflib as difflib
|
|
35
34
|
from . import disk_cache as disk_cache
|
|
36
|
-
from . import
|
|
35
|
+
from . import entrypoints as entrypoints
|
|
37
36
|
from . import enum as enum
|
|
38
37
|
from . import functools as functools
|
|
39
38
|
from . import hashlib as hashlib
|
|
40
39
|
from . import importlib as importlib
|
|
41
40
|
from . import inspect as inspect
|
|
42
|
-
from . import json as json
|
|
43
|
-
from . import jsonl as jsonl
|
|
44
41
|
from . import logging as logging
|
|
45
42
|
from . import math as math
|
|
46
43
|
from . import os as os
|
|
47
|
-
from . import pickle as pickle
|
|
48
44
|
from . import random as random
|
|
49
45
|
from . import re as re
|
|
50
46
|
from . import semver as semver
|
|
47
|
+
from . import serialization as serialization
|
|
48
|
+
from . import time as time
|
|
51
49
|
from . import warnings as warnings
|
|
52
50
|
|
|
53
51
|
# Global library imports
|
|
54
52
|
from .abc import Singleton
|
|
55
53
|
from .argparse import (
|
|
54
|
+
new_parser_from_dataclass,
|
|
55
|
+
parse_args_using_dataclass,
|
|
56
56
|
parse_to,
|
|
57
57
|
str_to_bool,
|
|
58
58
|
str_to_none,
|
|
@@ -65,6 +65,7 @@ if TYPE_CHECKING or lazy is None:
|
|
|
65
65
|
from .cast import as_builtin, register_as_builtin_fn
|
|
66
66
|
from .checksum import checksum_any, checksum_object, register_checksum_fn
|
|
67
67
|
from .collections import (
|
|
68
|
+
SizedGenerator,
|
|
68
69
|
all_eq,
|
|
69
70
|
all_ne,
|
|
70
71
|
contained,
|
|
@@ -86,6 +87,7 @@ if TYPE_CHECKING or lazy is None:
|
|
|
86
87
|
recursive_generator,
|
|
87
88
|
reduce_add,
|
|
88
89
|
reduce_and,
|
|
90
|
+
reduce_matmul,
|
|
89
91
|
reduce_mul,
|
|
90
92
|
reduce_or,
|
|
91
93
|
shuffled,
|
|
@@ -98,7 +100,6 @@ if TYPE_CHECKING or lazy is None:
|
|
|
98
100
|
union_lists,
|
|
99
101
|
unzip,
|
|
100
102
|
)
|
|
101
|
-
from .csv import dump_csv, dumps_csv, load_csv, loads_csv, read_csv, save_csv
|
|
102
103
|
from .dataclasses import get_defaults_values
|
|
103
104
|
from .datetime import get_now, get_now_iso8601
|
|
104
105
|
from .difflib import find_closest_in_list, sequence_matcher_ratio
|
|
@@ -114,22 +115,15 @@ if TYPE_CHECKING or lazy is None:
|
|
|
114
115
|
)
|
|
115
116
|
from .hashlib import hash_file
|
|
116
117
|
from .importlib import (
|
|
118
|
+
Placeholder,
|
|
117
119
|
is_available_package,
|
|
118
120
|
is_editable_package,
|
|
119
121
|
reload_editable_packages,
|
|
120
122
|
reload_submodules,
|
|
123
|
+
requires_packages,
|
|
121
124
|
search_submodules,
|
|
122
125
|
)
|
|
123
126
|
from .inspect import get_argnames, get_current_fn_name, get_fullname
|
|
124
|
-
from .json import dump_json, dumps_json, load_json, loads_json, read_json, save_json
|
|
125
|
-
from .jsonl import (
|
|
126
|
-
dump_jsonl,
|
|
127
|
-
dumps_jsonl,
|
|
128
|
-
load_jsonl,
|
|
129
|
-
loads_jsonl,
|
|
130
|
-
read_jsonl,
|
|
131
|
-
save_jsonl,
|
|
132
|
-
)
|
|
133
127
|
from .logging import (
|
|
134
128
|
VERBOSE_DEBUG,
|
|
135
129
|
VERBOSE_ERROR,
|
|
@@ -148,14 +142,6 @@ if TYPE_CHECKING or lazy is None:
|
|
|
148
142
|
)
|
|
149
143
|
from .math import argmax, argmin, argsort, clamp, clip
|
|
150
144
|
from .os import get_num_cpus_available, safe_rmdir, tree_iter
|
|
151
|
-
from .pickle import (
|
|
152
|
-
dump_pickle,
|
|
153
|
-
dumps_pickle,
|
|
154
|
-
load_pickle,
|
|
155
|
-
loads_pickle,
|
|
156
|
-
read_pickle,
|
|
157
|
-
save_pickle,
|
|
158
|
-
)
|
|
159
145
|
from .random import randstr
|
|
160
146
|
from .re import (
|
|
161
147
|
PatternLike,
|
|
@@ -168,10 +154,38 @@ if TYPE_CHECKING or lazy is None:
|
|
|
168
154
|
sort_with_patterns,
|
|
169
155
|
)
|
|
170
156
|
from .semver import Version
|
|
157
|
+
from .serialization import (
|
|
158
|
+
dump_csv,
|
|
159
|
+
dump_json,
|
|
160
|
+
dump_jsonl,
|
|
161
|
+
dump_pickle,
|
|
162
|
+
dumps_csv,
|
|
163
|
+
dumps_json,
|
|
164
|
+
dumps_jsonl,
|
|
165
|
+
dumps_pickle,
|
|
166
|
+
load_csv,
|
|
167
|
+
load_json,
|
|
168
|
+
load_jsonl,
|
|
169
|
+
load_pickle,
|
|
170
|
+
loads_csv,
|
|
171
|
+
loads_json,
|
|
172
|
+
loads_jsonl,
|
|
173
|
+
loads_pickle,
|
|
174
|
+
read_csv,
|
|
175
|
+
read_json,
|
|
176
|
+
read_jsonl,
|
|
177
|
+
read_pickle,
|
|
178
|
+
save_csv,
|
|
179
|
+
save_json,
|
|
180
|
+
save_jsonl,
|
|
181
|
+
save_pickle,
|
|
182
|
+
)
|
|
183
|
+
from .time import Ticker
|
|
171
184
|
from .typing import (
|
|
172
185
|
BuiltinCollection,
|
|
173
186
|
BuiltinNumber,
|
|
174
187
|
BuiltinScalar,
|
|
188
|
+
Dataclass,
|
|
175
189
|
DataclassInstance,
|
|
176
190
|
EllipsisType,
|
|
177
191
|
ListOrTuple,
|
|
@@ -227,31 +241,31 @@ else:
|
|
|
227
241
|
"checksum",
|
|
228
242
|
"collections",
|
|
229
243
|
"concurrent",
|
|
230
|
-
"csv",
|
|
231
244
|
"dataclasses",
|
|
232
245
|
"datetime",
|
|
233
246
|
"difflib",
|
|
234
247
|
"disk_cache",
|
|
235
|
-
"
|
|
248
|
+
"entrypoints",
|
|
236
249
|
"enum",
|
|
237
250
|
"functools",
|
|
238
251
|
"hashlib",
|
|
239
252
|
"importlib",
|
|
240
253
|
"inspect",
|
|
241
|
-
"json",
|
|
242
|
-
"jsonl",
|
|
243
254
|
"logging",
|
|
244
255
|
"math",
|
|
245
256
|
"os",
|
|
246
|
-
"pickle",
|
|
247
257
|
"random",
|
|
248
258
|
"re",
|
|
249
259
|
"semver",
|
|
260
|
+
"serialization",
|
|
261
|
+
"time",
|
|
250
262
|
"typing",
|
|
251
263
|
"warnings",
|
|
252
264
|
],
|
|
253
265
|
submod_attrs={
|
|
254
266
|
"argparse": [
|
|
267
|
+
"new_parser_from_dataclass",
|
|
268
|
+
"parse_args_using_dataclass",
|
|
255
269
|
"parse_to",
|
|
256
270
|
"str_to_bool",
|
|
257
271
|
"str_to_none",
|
|
@@ -265,6 +279,7 @@ else:
|
|
|
265
279
|
"cast": ["as_builtin", "register_as_builtin_fn"],
|
|
266
280
|
"checksum": ["checksum_any", "checksum_object", "register_checksum_fn"],
|
|
267
281
|
"collections": [
|
|
282
|
+
"SizedGenerator",
|
|
268
283
|
"all_eq",
|
|
269
284
|
"all_ne",
|
|
270
285
|
"contained",
|
|
@@ -286,6 +301,7 @@ else:
|
|
|
286
301
|
"recursive_generator",
|
|
287
302
|
"reduce_add",
|
|
288
303
|
"reduce_and",
|
|
304
|
+
"reduce_matmul",
|
|
289
305
|
"reduce_mul",
|
|
290
306
|
"reduce_or",
|
|
291
307
|
"shuffled",
|
|
@@ -298,13 +314,31 @@ else:
|
|
|
298
314
|
"union_lists",
|
|
299
315
|
"unzip",
|
|
300
316
|
],
|
|
301
|
-
"
|
|
317
|
+
"serialization": [
|
|
302
318
|
"dump_csv",
|
|
319
|
+
"dump_json",
|
|
320
|
+
"dump_jsonl",
|
|
321
|
+
"dump_pickle",
|
|
303
322
|
"dumps_csv",
|
|
323
|
+
"dumps_json",
|
|
324
|
+
"dumps_jsonl",
|
|
325
|
+
"dumps_pickle",
|
|
304
326
|
"load_csv",
|
|
327
|
+
"load_json",
|
|
328
|
+
"load_jsonl",
|
|
329
|
+
"load_pickle",
|
|
305
330
|
"loads_csv",
|
|
331
|
+
"loads_json",
|
|
332
|
+
"loads_jsonl",
|
|
333
|
+
"loads_pickle",
|
|
306
334
|
"read_csv",
|
|
335
|
+
"read_json",
|
|
336
|
+
"read_jsonl",
|
|
337
|
+
"read_pickle",
|
|
307
338
|
"save_csv",
|
|
339
|
+
"save_json",
|
|
340
|
+
"save_jsonl",
|
|
341
|
+
"save_pickle",
|
|
308
342
|
],
|
|
309
343
|
"dataclasses": ["get_defaults_values"],
|
|
310
344
|
"datetime": ["get_now", "get_now_iso8601"],
|
|
@@ -325,25 +359,11 @@ else:
|
|
|
325
359
|
"is_editable_package",
|
|
326
360
|
"reload_editable_packages",
|
|
327
361
|
"reload_submodules",
|
|
362
|
+
"requires_packages",
|
|
328
363
|
"search_submodules",
|
|
364
|
+
"Placeholder",
|
|
329
365
|
],
|
|
330
366
|
"inspect": ["get_argnames", "get_current_fn_name", "get_fullname"],
|
|
331
|
-
"json": [
|
|
332
|
-
"dump_json",
|
|
333
|
-
"dumps_json",
|
|
334
|
-
"load_json",
|
|
335
|
-
"loads_json",
|
|
336
|
-
"read_json",
|
|
337
|
-
"save_json",
|
|
338
|
-
],
|
|
339
|
-
"jsonl": [
|
|
340
|
-
"dump_jsonl",
|
|
341
|
-
"dumps_jsonl",
|
|
342
|
-
"load_jsonl",
|
|
343
|
-
"loads_jsonl",
|
|
344
|
-
"read_jsonl",
|
|
345
|
-
"save_jsonl",
|
|
346
|
-
],
|
|
347
367
|
"logging": [
|
|
348
368
|
"VERBOSE_DEBUG",
|
|
349
369
|
"VERBOSE_ERROR",
|
|
@@ -362,14 +382,6 @@ else:
|
|
|
362
382
|
],
|
|
363
383
|
"math": ["argmax", "argmin", "argsort", "clamp", "clip"],
|
|
364
384
|
"os": ["get_num_cpus_available", "safe_rmdir", "tree_iter"],
|
|
365
|
-
"pickle": [
|
|
366
|
-
"dump_pickle",
|
|
367
|
-
"dumps_pickle",
|
|
368
|
-
"load_pickle",
|
|
369
|
-
"loads_pickle",
|
|
370
|
-
"read_pickle",
|
|
371
|
-
"save_pickle",
|
|
372
|
-
],
|
|
373
385
|
"random": ["randstr"],
|
|
374
386
|
"re": [
|
|
375
387
|
"PatternLike",
|
|
@@ -382,10 +394,12 @@ else:
|
|
|
382
394
|
"sort_with_patterns",
|
|
383
395
|
],
|
|
384
396
|
"semver": ["Version"],
|
|
397
|
+
"time": ["Ticker"],
|
|
385
398
|
"typing": [
|
|
386
399
|
"BuiltinCollection",
|
|
387
400
|
"BuiltinNumber",
|
|
388
401
|
"BuiltinScalar",
|
|
402
|
+
"Dataclass",
|
|
389
403
|
"DataclassInstance",
|
|
390
404
|
"EllipsisType",
|
|
391
405
|
"ListOrTuple",
|
|
@@ -439,4 +453,4 @@ else:
|
|
|
439
453
|
version = __version__
|
|
440
454
|
version_info = Version(__version__)
|
|
441
455
|
|
|
442
|
-
del
|
|
456
|
+
del TYPE_CHECKING, lazy
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
|
|
4
|
-
import os
|
|
5
4
|
from functools import wraps
|
|
6
|
-
from io import TextIOWrapper
|
|
7
|
-
from pathlib import Path
|
|
8
5
|
from typing import (
|
|
9
6
|
Any,
|
|
10
7
|
Callable,
|
|
@@ -16,7 +13,6 @@ from typing import (
|
|
|
16
13
|
Tuple,
|
|
17
14
|
Union,
|
|
18
15
|
get_args,
|
|
19
|
-
overload,
|
|
20
16
|
)
|
|
21
17
|
|
|
22
18
|
from typing_extensions import ParamSpec, TypeVar
|
|
@@ -169,53 +165,3 @@ class _FunctionRegistry(Generic[T_Output]):
|
|
|
169
165
|
else:
|
|
170
166
|
msg = f"Invalid argument {unk_mode=}. (expected one of {get_args(UnkMode)})"
|
|
171
167
|
raise ValueError(msg)
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
@overload
|
|
175
|
-
def _setup_output_fpath(
|
|
176
|
-
fpath: Union[str, Path, os.PathLike],
|
|
177
|
-
overwrite: bool,
|
|
178
|
-
make_parents: bool,
|
|
179
|
-
absolute: bool = True,
|
|
180
|
-
) -> Path: ...
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
@overload
|
|
184
|
-
def _setup_output_fpath(
|
|
185
|
-
fpath: TextIOWrapper,
|
|
186
|
-
overwrite: bool,
|
|
187
|
-
make_parents: bool,
|
|
188
|
-
absolute: bool = True,
|
|
189
|
-
) -> TextIOWrapper: ...
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
@overload
|
|
193
|
-
def _setup_output_fpath(
|
|
194
|
-
fpath: None,
|
|
195
|
-
overwrite: bool,
|
|
196
|
-
make_parents: bool,
|
|
197
|
-
absolute: bool = True,
|
|
198
|
-
) -> None: ...
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
def _setup_output_fpath(
|
|
202
|
-
fpath: Union[str, Path, os.PathLike, TextIOWrapper, None],
|
|
203
|
-
overwrite: bool,
|
|
204
|
-
make_parents: bool,
|
|
205
|
-
absolute: bool = True,
|
|
206
|
-
) -> Union[Path, None, TextIOWrapper]:
|
|
207
|
-
"""Resolve path, expand path and create intermediate parents."""
|
|
208
|
-
if not isinstance(fpath, (str, Path, os.PathLike)):
|
|
209
|
-
return fpath
|
|
210
|
-
|
|
211
|
-
fpath = Path(fpath)
|
|
212
|
-
if absolute:
|
|
213
|
-
fpath = fpath.resolve().expanduser()
|
|
214
|
-
|
|
215
|
-
if not overwrite and fpath.exists():
|
|
216
|
-
msg = f"File {fpath} already exists."
|
|
217
|
-
raise FileExistsError(msg)
|
|
218
|
-
elif make_parents:
|
|
219
|
-
fpath.parent.mkdir(parents=True, exist_ok=True)
|
|
220
|
-
|
|
221
|
-
return fpath
|