astToolkit 0.14.2__tar.gz → 0.14.3__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.
- {asttoolkit-0.14.2/astToolkit.egg-info → asttoolkit-0.14.3}/PKG-INFO +1 -1
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/_toolIfThis.py +45 -3
- {asttoolkit-0.14.2 → asttoolkit-0.14.3/astToolkit.egg-info}/PKG-INFO +1 -1
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/pyproject.toml +26 -11
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/LICENSE +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/MANIFEST.in +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/README.md +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/__init__.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/_kitNodeTours.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/_theSSOT.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/_toolBe.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/_toolDOT.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/_toolGrab.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/_toolMake.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/_toolThen.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/_tool_dump.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/changeDef.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/filesystem.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/ohWow.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/py.typed +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/theTypes.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit/transformationTools.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit.egg-info/SOURCES.txt +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit.egg-info/dependency_links.txt +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit.egg-info/requires.txt +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/astToolkit.egg-info/top_level.txt +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/setup.cfg +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/__init__.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/conftest.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/conftestAnnex.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/dataSamples/Make.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/dataSamples/__init__.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/dataSamples/sampleModuleForParsing.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/dataSamples/sampleModuleWithRelativeImports.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/dataSamples/synthesizeTestDataCrudely.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/dataSamples/torchRelativeImports.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/test_Be.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/test_Grab.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/test_IfThis.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/test_Then.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/test_changeDef.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/test_filesystem.py +0 -0
- {asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/test_transformationTools.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: astToolkit
|
|
3
|
-
Version: 0.14.
|
|
3
|
+
Version: 0.14.3
|
|
4
4
|
Summary: A powerfully composable, type-safe toolkit for Python abstract syntax tree (AST) manipulation, analysis, transformation, and code generation with a layered architecture designed for building sophisticated code processing assembly-lines.
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License-Expression: CC-BY-NC-4.0
|
|
@@ -90,8 +90,47 @@ class IfThis:
|
|
|
90
90
|
return all(antecedent(node) for antecedent in predicate)
|
|
91
91
|
return workhorse
|
|
92
92
|
|
|
93
|
+
@overload
|
|
94
|
+
@staticmethod
|
|
95
|
+
def isAnyOf[归一: ast.AST, 归二: ast.AST](predicate一: Callable[[ast.AST], TypeIs[归一]], predicate二: Callable[[ast.AST], TypeIs[归二]], /) -> Callable[[ast.AST], TypeIs[归一 | 归二]]: ...
|
|
96
|
+
@overload
|
|
97
|
+
@staticmethod
|
|
98
|
+
def isAnyOf[归一: ast.AST, 归二: ast.AST](predicate一: Callable[[ast.AST], TypeIs[归一]], predicate二: Callable[[ast.AST], TypeGuard[归二]], /) -> Callable[[ast.AST], TypeGuard[归一 | 归二]]: ...
|
|
99
|
+
@overload
|
|
100
|
+
@staticmethod
|
|
101
|
+
def isAnyOf[归一: ast.AST, 归二: ast.AST](predicate一: Callable[[ast.AST], TypeGuard[归一]], predicate二: Callable[[ast.AST], TypeIs[归二]], /) -> Callable[[ast.AST], TypeGuard[归一 | 归二]]: ...
|
|
102
|
+
@overload
|
|
93
103
|
@staticmethod
|
|
94
|
-
def isAnyOf[
|
|
104
|
+
def isAnyOf[归一: ast.AST, 归二: ast.AST](predicate一: Callable[[ast.AST], TypeGuard[归一]], predicate二: Callable[[ast.AST], TypeGuard[归二]], /) -> Callable[[ast.AST], TypeGuard[归一 | 归二]]: ...
|
|
105
|
+
@overload
|
|
106
|
+
@staticmethod
|
|
107
|
+
def isAnyOf[归一: ast.AST, 归二: ast.AST, 归三: ast.AST](predicate一: Callable[[ast.AST], TypeIs[归一]], predicate二: Callable[[ast.AST], TypeIs[归二]], predicate三: Callable[[ast.AST], TypeIs[归三]], /) -> Callable[[ast.AST], TypeIs[归一 | 归二 | 归三]]: ...
|
|
108
|
+
@overload
|
|
109
|
+
@staticmethod
|
|
110
|
+
def isAnyOf[归一: ast.AST, 归二: ast.AST, 归三: ast.AST](predicate一: Callable[[ast.AST], TypeIs[归一]], predicate二: Callable[[ast.AST], TypeIs[归二]], predicate三: Callable[[ast.AST], TypeGuard[归三]], /) -> Callable[[ast.AST], TypeGuard[归一 | 归二 | 归三]]: ...
|
|
111
|
+
@overload
|
|
112
|
+
@staticmethod
|
|
113
|
+
def isAnyOf[归一: ast.AST, 归二: ast.AST, 归三: ast.AST](predicate一: Callable[[ast.AST], TypeIs[归一]], predicate二: Callable[[ast.AST], TypeGuard[归二]], predicate三: Callable[[ast.AST], TypeIs[归三]], /) -> Callable[[ast.AST], TypeGuard[归一 | 归二 | 归三]]: ...
|
|
114
|
+
@overload
|
|
115
|
+
@staticmethod
|
|
116
|
+
def isAnyOf[归一: ast.AST, 归二: ast.AST, 归三: ast.AST](predicate一: Callable[[ast.AST], TypeIs[归一]], predicate二: Callable[[ast.AST], TypeGuard[归二]], predicate三: Callable[[ast.AST], TypeGuard[归三]], /) -> Callable[[ast.AST], TypeGuard[归一 | 归二 | 归三]]: ...
|
|
117
|
+
@overload
|
|
118
|
+
@staticmethod
|
|
119
|
+
def isAnyOf[归一: ast.AST, 归二: ast.AST, 归三: ast.AST](predicate一: Callable[[ast.AST], TypeGuard[归一]], predicate二: Callable[[ast.AST], TypeIs[归二]], predicate三: Callable[[ast.AST], TypeIs[归三]], /) -> Callable[[ast.AST], TypeGuard[归一 | 归二 | 归三]]: ...
|
|
120
|
+
@overload
|
|
121
|
+
@staticmethod
|
|
122
|
+
def isAnyOf[归一: ast.AST, 归二: ast.AST, 归三: ast.AST](predicate一: Callable[[ast.AST], TypeGuard[归一]], predicate二: Callable[[ast.AST], TypeIs[归二]], predicate三: Callable[[ast.AST], TypeGuard[归三]], /) -> Callable[[ast.AST], TypeGuard[归一 | 归二 | 归三]]: ...
|
|
123
|
+
@overload
|
|
124
|
+
@staticmethod
|
|
125
|
+
def isAnyOf[归一: ast.AST, 归二: ast.AST, 归三: ast.AST](predicate一: Callable[[ast.AST], TypeGuard[归一]], predicate二: Callable[[ast.AST], TypeGuard[归二]], predicate三: Callable[[ast.AST], TypeIs[归三]], /) -> Callable[[ast.AST], TypeGuard[归一 | 归二 | 归三]]: ...
|
|
126
|
+
@overload
|
|
127
|
+
@staticmethod
|
|
128
|
+
def isAnyOf[归一: ast.AST, 归二: ast.AST, 归三: ast.AST](predicate一: Callable[[ast.AST], TypeGuard[归一]], predicate二: Callable[[ast.AST], TypeGuard[归二]], predicate三: Callable[[ast.AST], TypeGuard[归三]], /) -> Callable[[ast.AST], TypeGuard[归一 | 归二 | 归三]]: ...
|
|
129
|
+
@overload
|
|
130
|
+
@staticmethod
|
|
131
|
+
def isAnyOf(*predicate: Callable[[ast.AST], bool]) -> Callable[[ast.AST], bool]: ...
|
|
132
|
+
@staticmethod
|
|
133
|
+
def isAnyOf(*predicate: Callable[[ast.AST], bool]) -> Callable[[ast.AST], bool]:
|
|
95
134
|
"""Combine predicates that allow any one match on an AST node.
|
|
96
135
|
|
|
97
136
|
(AI generated docstring)
|
|
@@ -109,7 +148,10 @@ class IfThis:
|
|
|
109
148
|
Returns
|
|
110
149
|
-------
|
|
111
150
|
findThis : Callable[[ast.AST], bool]
|
|
112
|
-
Predicate returning `True` when at least one supplied condition holds.
|
|
151
|
+
Predicate returning `True` when at least one supplied condition holds. For two or three
|
|
152
|
+
conditions, `TypeIs` predicates combine into a `TypeIs` predicate for the union of their
|
|
153
|
+
node types, and a mixture of `TypeIs` and `TypeGuard` predicates combines into a `TypeGuard`
|
|
154
|
+
predicate for that union.
|
|
113
155
|
|
|
114
156
|
See Also
|
|
115
157
|
--------
|
|
@@ -127,7 +169,7 @@ class IfThis:
|
|
|
127
169
|
IfThis.isAnyOf(Be.ImportFrom, Be.Import), Then.removeIt)
|
|
128
170
|
```
|
|
129
171
|
"""
|
|
130
|
-
def workhorse(node: ast.AST) ->
|
|
172
|
+
def workhorse(node: ast.AST) -> bool:
|
|
131
173
|
return any(antecedent(node) for antecedent in predicate)
|
|
132
174
|
return workhorse
|
|
133
175
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: astToolkit
|
|
3
|
-
Version: 0.14.
|
|
3
|
+
Version: 0.14.3
|
|
4
4
|
Summary: A powerfully composable, type-safe toolkit for Python abstract syntax tree (AST) manipulation, analysis, transformation, and code generation with a layered architecture designed for building sophisticated code processing assembly-lines.
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License-Expression: CC-BY-NC-4.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# path-sync copy -n hunterhogan
|
|
2
2
|
[project]
|
|
3
3
|
name = "astToolkit"
|
|
4
|
-
version = "0.14.
|
|
4
|
+
version = "0.14.3"
|
|
5
5
|
description = "A powerfully composable, type-safe toolkit for Python abstract syntax tree (AST) manipulation, analysis, transformation, and code generation with a layered architecture designed for building sophisticated code processing assembly-lines."
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
requires-python = ">=3.14"
|
|
@@ -72,8 +72,10 @@ run = { branch = true, data_file = "tests/coverage/.coverage", omit = ["tests/*"
|
|
|
72
72
|
# === DO_NOT_EDIT: path-sync hunterhogan ===
|
|
73
73
|
[tool.isort]
|
|
74
74
|
add_imports = ["from __future__ import annotations"]
|
|
75
|
+
append_only = true
|
|
76
|
+
atomic = true
|
|
75
77
|
combine_as_imports = true
|
|
76
|
-
extend_skip_glob = ["*.
|
|
78
|
+
extend_skip_glob = ["*.pyi"]
|
|
77
79
|
filter_files = true
|
|
78
80
|
force_alphabetical_sort_within_sections = true
|
|
79
81
|
from_first = true
|
|
@@ -84,26 +86,23 @@ lines_after_imports = 1
|
|
|
84
86
|
lines_between_types = 0
|
|
85
87
|
multi_line_output = 4
|
|
86
88
|
no_sections = true
|
|
87
|
-
|
|
89
|
+
skip_gitignore = true
|
|
88
90
|
use_parentheses = true
|
|
89
91
|
# === OK_EDIT: path-sync hunterhogan ===
|
|
90
92
|
|
|
91
93
|
# === DO_NOT_EDIT: path-sync hunterhogan ===
|
|
92
94
|
[tool.pyrefly]
|
|
93
|
-
preset = "strict"
|
|
94
95
|
enabled-ignores = ["pyrefly"]
|
|
96
|
+
# ignore-errors-in-generated-code = true
|
|
95
97
|
infer-with-first-use = false
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
preset = "strict"
|
|
99
|
+
python-platform = "all"
|
|
98
100
|
# === OK_EDIT: path-sync hunterhogan ===
|
|
99
101
|
|
|
100
102
|
# === DO_NOT_EDIT: path-sync hunterhogan ===
|
|
101
103
|
[tool.pyrefly.errors]
|
|
102
104
|
bad-return = "warn"
|
|
103
|
-
invalid-type-var = "warn"
|
|
104
105
|
invalid-yield = "warn"
|
|
105
|
-
protected-access = "warn"
|
|
106
|
-
redundant-condition = "warn"
|
|
107
106
|
# === OK_EDIT: path-sync hunterhogan ===
|
|
108
107
|
|
|
109
108
|
[tool.pytest]
|
|
@@ -249,7 +248,10 @@ inline-quotes = "single"
|
|
|
249
248
|
|
|
250
249
|
# === DO_NOT_EDIT: path-sync hunterhogan ===
|
|
251
250
|
[tool.ruff.lint.per-file-ignores]
|
|
252
|
-
"
|
|
251
|
+
"**/*_test.py" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
|
|
252
|
+
"**/conftest*.py" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
|
|
253
|
+
"**/test_*.py" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
|
|
254
|
+
"**/tests/**" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
|
|
253
255
|
# === OK_EDIT: path-sync hunterhogan ===
|
|
254
256
|
|
|
255
257
|
# === DO_NOT_EDIT: path-sync hunterhogan ===
|
|
@@ -260,8 +262,10 @@ convention = "numpy"
|
|
|
260
262
|
# === DO_NOT_EDIT: path-sync hunterhogan ===
|
|
261
263
|
[tool.ruff.format]
|
|
262
264
|
docstring-code-format = true
|
|
263
|
-
quote-style = "single"
|
|
264
265
|
indent-style = "tab"
|
|
266
|
+
line-ending = "lf"
|
|
267
|
+
nested-string-quote-style = "preferred"
|
|
268
|
+
quote-style = "single"
|
|
265
269
|
skip-magic-trailing-comma = true
|
|
266
270
|
# === OK_EDIT: path-sync hunterhogan ===
|
|
267
271
|
|
|
@@ -277,6 +281,7 @@ line-ending = "lf"
|
|
|
277
281
|
# === DO_NOT_EDIT: path-sync hunterhogan ===
|
|
278
282
|
[tool.ty.analysis]
|
|
279
283
|
respect-type-ignore-comments = false
|
|
284
|
+
return-type-inference = "always"
|
|
280
285
|
# === OK_EDIT: path-sync hunterhogan ===
|
|
281
286
|
|
|
282
287
|
# === DO_NOT_EDIT: path-sync hunterhogan ===
|
|
@@ -285,6 +290,16 @@ extra-paths = ["./typings"]
|
|
|
285
290
|
python-platform = "all"
|
|
286
291
|
# === OK_EDIT: path-sync hunterhogan ===
|
|
287
292
|
|
|
293
|
+
# === DO_NOT_EDIT: path-sync hunterhogan ===
|
|
294
|
+
[tool.ty.rules]
|
|
295
|
+
blanket-ignore-comment = "error"
|
|
296
|
+
missing-override-decorator = "error"
|
|
297
|
+
missing-type-argument = "error"
|
|
298
|
+
possibly-missing-attribute = "warn" # Might annoy you: ty's docs say this rule produces many false positives.
|
|
299
|
+
possibly-unresolved-reference = "warn" # Might annoy you: ty's docs say this rule produces many false positives.
|
|
300
|
+
truthiness-test-of-none-union = "warn" # Might annoy you: flags `if value:` on `int | None` or `str | None` even when treating 0 or '' like None is deliberate.
|
|
301
|
+
# === OK_EDIT: path-sync hunterhogan ===
|
|
302
|
+
|
|
288
303
|
[tool.updateCitation]
|
|
289
304
|
filenameCitationDOTcff = "CITATION.cff"
|
|
290
305
|
pathFilenameCitationSSOT = "citations/CITATION.cff"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{asttoolkit-0.14.2 → asttoolkit-0.14.3}/tests/dataSamples/sampleModuleWithRelativeImports.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|