astToolkit 0.7.3__tar.gz → 0.8.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.
Files changed (33) hide show
  1. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/PKG-INFO +1 -1
  2. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_toolBe.py +10 -2
  3. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_toolGrab.py +15 -0
  4. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_toolkitContainers.py +3 -3
  5. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit.egg-info/PKG-INFO +1 -1
  6. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/pyproject.toml +1 -1
  7. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/LICENSE +0 -0
  8. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/README.md +0 -0
  9. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/__init__.py +0 -0
  10. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_astTypes.py +0 -0
  11. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_dumpFunctionDef.py +0 -0
  12. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_dumpHandmade.py +0 -0
  13. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_prototypeFind.py +0 -0
  14. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_theSSOT.py +0 -0
  15. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_toolDOT.py +0 -0
  16. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_toolIfThis.py +0 -0
  17. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_toolMake.py +0 -0
  18. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_toolThen.py +0 -0
  19. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_toolkitAST.py +0 -0
  20. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/_toolkitNodeVisitor.py +0 -0
  21. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/py.typed +0 -0
  22. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit/transformationTools.py +0 -0
  23. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit.egg-info/SOURCES.txt +0 -0
  24. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit.egg-info/dependency_links.txt +0 -0
  25. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit.egg-info/requires.txt +0 -0
  26. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/astToolkit.egg-info/top_level.txt +0 -0
  27. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/setup.cfg +0 -0
  28. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/tests/__init__.py +0 -0
  29. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/tests/conftest.py +0 -0
  30. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/tests/dataSamples/Make.py +0 -0
  31. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/tests/dataSamples/__init__.py +0 -0
  32. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/tests/dataSamples/createTestData.py +0 -0
  33. {asttoolkit-0.7.3 → asttoolkit-0.8.0}/tests/test_Be.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astToolkit
3
- Version: 0.7.3
3
+ Version: 0.8.0
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: CC-BY-NC-4.0
@@ -1,5 +1,6 @@
1
1
  """Automatically generated file, so changes may be overwritten."""
2
- from collections.abc import Callable
2
+ from astToolkit import
3
+ from collections.abc import Callable, Sequence
3
4
  from typing import Any
4
5
  from typing_extensions import TypeIs
5
6
  import ast
@@ -61,6 +62,13 @@ class Be:
61
62
 
62
63
  """
63
64
 
65
+ @staticmethod
66
+ def at(index: int, predicate: Callable[[Any], TypeIs[木]]) -> Callable[[Sequence[ast.AST]], TypeIs[木]]:
67
+
68
+ def workhorse(node: Sequence[ast.AST]) -> TypeIs[木]:
69
+ return predicate(node[index])
70
+ return workhorse
71
+
64
72
  @staticmethod
65
73
  def Add(node: ast.AST) -> TypeIs[ast.Add]:
66
74
  """`Be.Add` matches `class` `ast.Add`.
@@ -270,7 +278,7 @@ class Be:
270
278
 
271
279
  @staticmethod
272
280
  def AST(node: ast.AST) -> TypeIs[ast.AST]:
273
- """`Be.AST`, Abstract Syntax Tree, matches any of `class` `ast.AST` | `ast._NoParent` | `ast.alias` | `ast.arg` | `ast.arguments` | `ast.boolop` | `ast.cmpop` | `ast.comprehension` | `ast.excepthandler` | `ast.Exec` | `ast.expr_context` | `ast.expr` | `ast.keyword` | `ast.match_case` | `ast.mod` | `ast.operator` | `ast.pattern` | `ast.slice` | `ast.stmt` | `ast.type_ignore` | `ast.type_param` | `ast.unaryop` | `ast.withitem`.
281
+ """`Be.AST`, Abstract Syntax Tree, matches any of `class` `ast.AST` | `ast.alias` | `ast.arg` | `ast.arguments` | `ast.boolop` | `ast.cmpop` | `ast.comprehension` | `ast.excepthandler` | `ast.expr_context` | `ast.expr` | `ast.keyword` | `ast.match_case` | `ast.mod` | `ast.operator` | `ast.pattern` | `ast.slice` | `ast.stmt` | `ast.type_ignore` | `ast.type_param` | `ast.unaryop` | `ast.withitem`.
274
282
 
275
283
  It is a subclass of `ast.object`.
276
284
  """
@@ -39,6 +39,21 @@ class Grab:
39
39
  return node
40
40
  return workhorse
41
41
 
42
+ @staticmethod
43
+ def index(at: int, /, action: Callable[[Any], Any]) -> Callable[[Sequence[个]], list[个]]:
44
+
45
+ def workhorse(node: Sequence[个]) -> list[个]:
46
+ node = list(node)
47
+ consequences = action(node[at])
48
+ if consequences is None:
49
+ node.pop(at)
50
+ elif isinstance(consequences, list):
51
+ node = node[0:at] + consequences + node[at + 1:None]
52
+ else:
53
+ node[at] = consequences
54
+ return node
55
+ return workhorse
56
+
42
57
  @staticmethod
43
58
  def annotationAttribute(action: Callable[[工], 工] | Callable[[工 | None], 工 | None]) -> Callable[[hasDOTannotation], hasDOTannotation]:
44
59
 
@@ -305,7 +305,7 @@ class IngredientsFunction:
305
305
 
306
306
  astFunctionDef: ast.FunctionDef
307
307
  imports: LedgerOfImports = dataclasses.field(default_factory=LedgerOfImports)
308
- type_ignores: list[ast.TypeIgnore] = dataclasses.field(default_factory=lambda: list[ast.TypeIgnore]())
308
+ type_ignores: list[ast.TypeIgnore] = dataclasses.field(default_factory=list[ast.TypeIgnore])
309
309
 
310
310
  @dataclasses.dataclass
311
311
  class IngredientsModule:
@@ -372,7 +372,7 @@ class IngredientsModule:
372
372
 
373
373
  Add statements using appendPrologue().
374
374
  """
375
- listIngredientsFunctions: list[IngredientsFunction] = dataclasses.field(default_factory=lambda: list[IngredientsFunction]())
375
+ listIngredientsFunctions: list[IngredientsFunction] = dataclasses.field(default_factory=list[IngredientsFunction])
376
376
  """
377
377
  The function definitions that form the core of this module.
378
378
 
@@ -404,7 +404,7 @@ class IngredientsModule:
404
404
  """
405
405
 
406
406
  # `ast.TypeIgnore` statements to supplement those in other fields; `type_ignores` is a parameter for `ast.Module` constructor
407
- _supplemental_type_ignores: list[ast.TypeIgnore] = dataclasses.field(default_factory=lambda: list[ast.TypeIgnore]())
407
+ _supplemental_type_ignores: list[ast.TypeIgnore] = dataclasses.field(default_factory=list[ast.TypeIgnore])
408
408
  """Internal: Additional type ignore directives."""
409
409
 
410
410
  def __post_init__(self, ingredientsFunction: Sequence[IngredientsFunction] | IngredientsFunction | None) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astToolkit
3
- Version: 0.7.3
3
+ Version: 0.8.0
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: CC-BY-NC-4.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "astToolkit"
3
- version = "0.7.3"
3
+ version = "0.8.0"
4
4
  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."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes