pythonwrench 0.5.2__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.2/src/pythonwrench.egg-info → pythonwrench-0.6.0}/PKG-INFO +14 -2
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/pyproject.toml +23 -24
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/__init__.py +65 -55
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/__main__.py +2 -2
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/_core.py +0 -54
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/argparse.py +161 -27
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/collections/collections.py +7 -7
- pythonwrench-0.6.0/src/pythonwrench/csv.py +12 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/dataclasses.py +1 -1
- {pythonwrench-0.5.2 → 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.2 → pythonwrench-0.6.0}/src/pythonwrench/functools.py +27 -7
- 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.2/src/pythonwrench → pythonwrench-0.6.0/src/pythonwrench/serialization}/csv.py +1 -1
- {pythonwrench-0.5.2/src/pythonwrench → pythonwrench-0.6.0/src/pythonwrench/serialization}/json.py +1 -1
- {pythonwrench-0.5.2/src/pythonwrench → pythonwrench-0.6.0/src/pythonwrench/serialization}/jsonl.py +3 -3
- {pythonwrench-0.5.2/src/pythonwrench → pythonwrench-0.6.0/src/pythonwrench/serialization}/pickle.py +1 -1
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/time.py +3 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/typing/__init__.py +2 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/typing/checks.py +9 -2
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/typing/classes.py +4 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0/src/pythonwrench.egg-info}/PKG-INFO +14 -2
- {pythonwrench-0.5.2 → 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.2 → pythonwrench-0.6.0}/tests/test_disk_cache.py +18 -0
- pythonwrench-0.5.2/tests/test_entries.py → pythonwrench-0.6.0/tests/test_entrypoints.py +2 -1
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_functools.py +6 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_typing.py +3 -0
- pythonwrench-0.5.2/docs/requirements.txt +0 -4
- pythonwrench-0.5.2/src/pythonwrench/entries.py +0 -223
- pythonwrench-0.5.2/src/pythonwrench.egg-info/entry_points.txt +0 -7
- pythonwrench-0.5.2/src/pythonwrench.egg-info/requires.txt +0 -6
- pythonwrench-0.5.2/tests/test_argparse.py +0 -67
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/LICENSE +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/README.md +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/setup.cfg +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/setup.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/abc.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/cast.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/checksum.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/collections/__init__.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/collections/prop.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/collections/reducers.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/concurrent.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/datetime.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/difflib.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/enum.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/hashlib.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/importlib.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/inspect.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/logging.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/math.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/os.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/random.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/re.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/semver.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench/warnings.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench.egg-info/dependency_links.txt +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/src/pythonwrench.egg-info/top_level.txt +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_abc.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_cast.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_checksum.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_collections.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_csv.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_dataclasses.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_difflib.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_enum.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_hashlib.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_importlib.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_inspect.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_json.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_jsonl.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_logging.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_math.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_os.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_random.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_readme.py +0 -0
- {pythonwrench-0.5.2 → pythonwrench-0.6.0}/tests/test_semver.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
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>
|
|
@@ -52,8 +52,20 @@ Description-Content-Type: text/markdown
|
|
|
52
52
|
License-File: LICENSE
|
|
53
53
|
Requires-Dist: typing-extensions>=4.10.0
|
|
54
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"
|
|
55
67
|
Provides-Extra: lazy
|
|
56
|
-
Requires-Dist: lazy-loader
|
|
68
|
+
Requires-Dist: lazy-loader<0.5,>=0.4; extra == "lazy"
|
|
57
69
|
Dynamic: license-file
|
|
58
70
|
|
|
59
71
|
# pythonwrench
|
|
@@ -42,17 +42,30 @@ Changelog = "https://github.com/Labbeti/pythonwrench/blob/main/CHANGELOG.md"
|
|
|
42
42
|
Tracker = "https://github.com/Labbeti/pythonwrench/issues"
|
|
43
43
|
|
|
44
44
|
[project.scripts]
|
|
45
|
-
pythonwrench-info = "pythonwrench.
|
|
46
|
-
pythonwrench-tree = "pythonwrench.
|
|
47
|
-
pythonwrench-safe-rmdir = "pythonwrench.
|
|
48
|
-
pyw-info = "pythonwrench.
|
|
49
|
-
pyw-tree = "pythonwrench.
|
|
50
|
-
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"
|
|
51
51
|
|
|
52
52
|
[project.optional-dependencies]
|
|
53
|
-
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
|
+
]
|
|
54
67
|
lazy = [
|
|
55
|
-
"lazy-loader>=0.4",
|
|
68
|
+
"lazy-loader>=0.4,<0.5",
|
|
56
69
|
]
|
|
57
70
|
|
|
58
71
|
[build-system]
|
|
@@ -80,23 +93,9 @@ testpaths = ["tests"]
|
|
|
80
93
|
source = ["src"]
|
|
81
94
|
|
|
82
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
|
|
83
98
|
"__init__.py" = ["F401", "F403"]
|
|
84
99
|
|
|
85
100
|
[tool.uv.sources]
|
|
86
101
|
pythonwrench = { workspace = true }
|
|
87
|
-
|
|
88
|
-
[dependency-groups]
|
|
89
|
-
dev = [
|
|
90
|
-
"coverage[toml]>=7.6.1",
|
|
91
|
-
"flake8",
|
|
92
|
-
"ipykernel",
|
|
93
|
-
"ipython",
|
|
94
|
-
"pre-commit",
|
|
95
|
-
"pytest",
|
|
96
|
-
"pythonwrench",
|
|
97
|
-
"ruff>=0.12.0",
|
|
98
|
-
"setuptools",
|
|
99
|
-
"sphinx<9.0.0",
|
|
100
|
-
"sphinx-immaterial>=0.11.14",
|
|
101
|
-
"twine",
|
|
102
|
-
]
|
|
@@ -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
|
|
@@ -123,15 +124,6 @@ if TYPE_CHECKING or lazy is None:
|
|
|
123
124
|
search_submodules,
|
|
124
125
|
)
|
|
125
126
|
from .inspect import get_argnames, get_current_fn_name, get_fullname
|
|
126
|
-
from .json import dump_json, dumps_json, load_json, loads_json, read_json, save_json
|
|
127
|
-
from .jsonl import (
|
|
128
|
-
dump_jsonl,
|
|
129
|
-
dumps_jsonl,
|
|
130
|
-
load_jsonl,
|
|
131
|
-
loads_jsonl,
|
|
132
|
-
read_jsonl,
|
|
133
|
-
save_jsonl,
|
|
134
|
-
)
|
|
135
127
|
from .logging import (
|
|
136
128
|
VERBOSE_DEBUG,
|
|
137
129
|
VERBOSE_ERROR,
|
|
@@ -150,14 +142,6 @@ if TYPE_CHECKING or lazy is None:
|
|
|
150
142
|
)
|
|
151
143
|
from .math import argmax, argmin, argsort, clamp, clip
|
|
152
144
|
from .os import get_num_cpus_available, safe_rmdir, tree_iter
|
|
153
|
-
from .pickle import (
|
|
154
|
-
dump_pickle,
|
|
155
|
-
dumps_pickle,
|
|
156
|
-
load_pickle,
|
|
157
|
-
loads_pickle,
|
|
158
|
-
read_pickle,
|
|
159
|
-
save_pickle,
|
|
160
|
-
)
|
|
161
145
|
from .random import randstr
|
|
162
146
|
from .re import (
|
|
163
147
|
PatternLike,
|
|
@@ -170,10 +154,38 @@ if TYPE_CHECKING or lazy is None:
|
|
|
170
154
|
sort_with_patterns,
|
|
171
155
|
)
|
|
172
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
|
|
173
184
|
from .typing import (
|
|
174
185
|
BuiltinCollection,
|
|
175
186
|
BuiltinNumber,
|
|
176
187
|
BuiltinScalar,
|
|
188
|
+
Dataclass,
|
|
177
189
|
DataclassInstance,
|
|
178
190
|
EllipsisType,
|
|
179
191
|
ListOrTuple,
|
|
@@ -229,31 +241,31 @@ else:
|
|
|
229
241
|
"checksum",
|
|
230
242
|
"collections",
|
|
231
243
|
"concurrent",
|
|
232
|
-
"csv",
|
|
233
244
|
"dataclasses",
|
|
234
245
|
"datetime",
|
|
235
246
|
"difflib",
|
|
236
247
|
"disk_cache",
|
|
237
|
-
"
|
|
248
|
+
"entrypoints",
|
|
238
249
|
"enum",
|
|
239
250
|
"functools",
|
|
240
251
|
"hashlib",
|
|
241
252
|
"importlib",
|
|
242
253
|
"inspect",
|
|
243
|
-
"json",
|
|
244
|
-
"jsonl",
|
|
245
254
|
"logging",
|
|
246
255
|
"math",
|
|
247
256
|
"os",
|
|
248
|
-
"pickle",
|
|
249
257
|
"random",
|
|
250
258
|
"re",
|
|
251
259
|
"semver",
|
|
260
|
+
"serialization",
|
|
261
|
+
"time",
|
|
252
262
|
"typing",
|
|
253
263
|
"warnings",
|
|
254
264
|
],
|
|
255
265
|
submod_attrs={
|
|
256
266
|
"argparse": [
|
|
267
|
+
"new_parser_from_dataclass",
|
|
268
|
+
"parse_args_using_dataclass",
|
|
257
269
|
"parse_to",
|
|
258
270
|
"str_to_bool",
|
|
259
271
|
"str_to_none",
|
|
@@ -267,6 +279,7 @@ else:
|
|
|
267
279
|
"cast": ["as_builtin", "register_as_builtin_fn"],
|
|
268
280
|
"checksum": ["checksum_any", "checksum_object", "register_checksum_fn"],
|
|
269
281
|
"collections": [
|
|
282
|
+
"SizedGenerator",
|
|
270
283
|
"all_eq",
|
|
271
284
|
"all_ne",
|
|
272
285
|
"contained",
|
|
@@ -288,6 +301,7 @@ else:
|
|
|
288
301
|
"recursive_generator",
|
|
289
302
|
"reduce_add",
|
|
290
303
|
"reduce_and",
|
|
304
|
+
"reduce_matmul",
|
|
291
305
|
"reduce_mul",
|
|
292
306
|
"reduce_or",
|
|
293
307
|
"shuffled",
|
|
@@ -300,13 +314,31 @@ else:
|
|
|
300
314
|
"union_lists",
|
|
301
315
|
"unzip",
|
|
302
316
|
],
|
|
303
|
-
"
|
|
317
|
+
"serialization": [
|
|
304
318
|
"dump_csv",
|
|
319
|
+
"dump_json",
|
|
320
|
+
"dump_jsonl",
|
|
321
|
+
"dump_pickle",
|
|
305
322
|
"dumps_csv",
|
|
323
|
+
"dumps_json",
|
|
324
|
+
"dumps_jsonl",
|
|
325
|
+
"dumps_pickle",
|
|
306
326
|
"load_csv",
|
|
327
|
+
"load_json",
|
|
328
|
+
"load_jsonl",
|
|
329
|
+
"load_pickle",
|
|
307
330
|
"loads_csv",
|
|
331
|
+
"loads_json",
|
|
332
|
+
"loads_jsonl",
|
|
333
|
+
"loads_pickle",
|
|
308
334
|
"read_csv",
|
|
335
|
+
"read_json",
|
|
336
|
+
"read_jsonl",
|
|
337
|
+
"read_pickle",
|
|
309
338
|
"save_csv",
|
|
339
|
+
"save_json",
|
|
340
|
+
"save_jsonl",
|
|
341
|
+
"save_pickle",
|
|
310
342
|
],
|
|
311
343
|
"dataclasses": ["get_defaults_values"],
|
|
312
344
|
"datetime": ["get_now", "get_now_iso8601"],
|
|
@@ -332,22 +364,6 @@ else:
|
|
|
332
364
|
"Placeholder",
|
|
333
365
|
],
|
|
334
366
|
"inspect": ["get_argnames", "get_current_fn_name", "get_fullname"],
|
|
335
|
-
"json": [
|
|
336
|
-
"dump_json",
|
|
337
|
-
"dumps_json",
|
|
338
|
-
"load_json",
|
|
339
|
-
"loads_json",
|
|
340
|
-
"read_json",
|
|
341
|
-
"save_json",
|
|
342
|
-
],
|
|
343
|
-
"jsonl": [
|
|
344
|
-
"dump_jsonl",
|
|
345
|
-
"dumps_jsonl",
|
|
346
|
-
"load_jsonl",
|
|
347
|
-
"loads_jsonl",
|
|
348
|
-
"read_jsonl",
|
|
349
|
-
"save_jsonl",
|
|
350
|
-
],
|
|
351
367
|
"logging": [
|
|
352
368
|
"VERBOSE_DEBUG",
|
|
353
369
|
"VERBOSE_ERROR",
|
|
@@ -366,14 +382,6 @@ else:
|
|
|
366
382
|
],
|
|
367
383
|
"math": ["argmax", "argmin", "argsort", "clamp", "clip"],
|
|
368
384
|
"os": ["get_num_cpus_available", "safe_rmdir", "tree_iter"],
|
|
369
|
-
"pickle": [
|
|
370
|
-
"dump_pickle",
|
|
371
|
-
"dumps_pickle",
|
|
372
|
-
"load_pickle",
|
|
373
|
-
"loads_pickle",
|
|
374
|
-
"read_pickle",
|
|
375
|
-
"save_pickle",
|
|
376
|
-
],
|
|
377
385
|
"random": ["randstr"],
|
|
378
386
|
"re": [
|
|
379
387
|
"PatternLike",
|
|
@@ -386,10 +394,12 @@ else:
|
|
|
386
394
|
"sort_with_patterns",
|
|
387
395
|
],
|
|
388
396
|
"semver": ["Version"],
|
|
397
|
+
"time": ["Ticker"],
|
|
389
398
|
"typing": [
|
|
390
399
|
"BuiltinCollection",
|
|
391
400
|
"BuiltinNumber",
|
|
392
401
|
"BuiltinScalar",
|
|
402
|
+
"Dataclass",
|
|
393
403
|
"DataclassInstance",
|
|
394
404
|
"EllipsisType",
|
|
395
405
|
"ListOrTuple",
|
|
@@ -443,4 +453,4 @@ else:
|
|
|
443
453
|
version = __version__
|
|
444
454
|
version_info = Version(__version__)
|
|
445
455
|
|
|
446
|
-
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
|