astToolkit 0.7.2__tar.gz → 0.7.4__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.2 → asttoolkit-0.7.4}/PKG-INFO +1 -1
  2. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/__init__.py +1 -1
  3. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_toolBe.py +1 -1
  4. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_toolGrab.py +16 -13
  5. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_toolMake.py +1 -19
  6. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit.egg-info/PKG-INFO +1 -1
  7. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/pyproject.toml +1 -1
  8. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/LICENSE +0 -0
  9. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/README.md +0 -0
  10. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_astTypes.py +0 -0
  11. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_dumpFunctionDef.py +0 -0
  12. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_dumpHandmade.py +0 -0
  13. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_prototypeFind.py +0 -0
  14. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_theSSOT.py +0 -0
  15. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_toolDOT.py +0 -0
  16. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_toolIfThis.py +0 -0
  17. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_toolThen.py +0 -0
  18. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_toolkitAST.py +0 -0
  19. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_toolkitContainers.py +0 -0
  20. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/_toolkitNodeVisitor.py +0 -0
  21. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/py.typed +0 -0
  22. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit/transformationTools.py +0 -0
  23. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit.egg-info/SOURCES.txt +0 -0
  24. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit.egg-info/dependency_links.txt +0 -0
  25. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit.egg-info/requires.txt +0 -0
  26. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/astToolkit.egg-info/top_level.txt +0 -0
  27. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/setup.cfg +0 -0
  28. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/tests/__init__.py +0 -0
  29. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/tests/conftest.py +0 -0
  30. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/tests/dataSamples/Make.py +0 -0
  31. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/tests/dataSamples/__init__.py +0 -0
  32. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/tests/dataSamples/createTestData.py +0 -0
  33. {asttoolkit-0.7.2 → asttoolkit-0.7.4}/tests/test_Be.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astToolkit
3
- Version: 0.7.2
3
+ Version: 0.7.4
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
@@ -120,7 +120,7 @@ from astToolkit._toolkitNodeVisitor import (
120
120
 
121
121
  from astToolkit._toolBe import Be as Be
122
122
  from astToolkit._toolDOT import DOT as DOT
123
- from astToolkit._toolGrab import Grab as Grab, index as index, indices as indices
123
+ from astToolkit._toolGrab import Grab as Grab
124
124
  from astToolkit._toolMake import Make as Make
125
125
  from astToolkit._prototypeFind import Find as Find
126
126
 
@@ -270,7 +270,7 @@ class Be:
270
270
 
271
271
  @staticmethod
272
272
  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`.
273
+ """`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
274
 
275
275
  It is a subclass of `ast.object`.
276
276
  """
@@ -12,25 +12,13 @@ from astToolkit import (
12
12
  hasDOTsubject, hasDOTtag, hasDOTtarget, hasDOTtargets, hasDOTtest, hasDOTtype, hasDOTtype_comment, hasDOTtype_ignores,
13
13
  hasDOTtype_params, hasDOTupper, hasDOTvalue, hasDOTvalues, hasDOTvararg, 一符, 个, 二符, 俪, 口, 工, 工位, 布尔符, 形, 比符)
14
14
  from collections.abc import Callable, Sequence
15
- from typing import Any, cast
15
+ from typing import Any
16
16
  import ast
17
17
  import sys
18
18
 
19
19
  if sys.version_info >= (3, 13):
20
20
  from astToolkit import hasDOTdefault_value
21
21
 
22
- def index[个, 归个](at: int) -> Callable[[Sequence[个]], 归个]:
23
-
24
- def workhorse(node: Sequence[个]) -> 归个:
25
- return cast('归个', node[at])
26
- return workhorse
27
-
28
- def indices[个, 归个](at: slice) -> Callable[[Sequence[个]], 归个]:
29
-
30
- def workhorse(node: Sequence[个]) -> 归个:
31
- return cast('归个', node[at])
32
- return workhorse
33
-
34
22
  class Grab:
35
23
  """Modify specific attributes of AST nodes while preserving the node structure.
36
24
 
@@ -51,6 +39,21 @@ class Grab:
51
39
  return node
52
40
  return workhorse
53
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
+
54
57
  @staticmethod
55
58
  def annotationAttribute(action: Callable[[工], 工] | Callable[[工 | None], 工 | None]) -> Callable[[hasDOTannotation], hasDOTannotation]:
56
59
 
@@ -2422,25 +2422,7 @@ class Make:
2422
2422
 
2423
2423
  @staticmethod
2424
2424
  def mod() -> ast.mod:
2425
- """Create an appropriate `ast.mod` (***mod***ule) node based on the body content.
2426
-
2427
- (AI generated docstring)
2428
-
2429
- The `mod` method creates the appropriate module type node based on the
2430
- provided body. This is a convenience method that determines whether to
2431
- create a `Module`, `Expression`, or `Interactive` node.
2432
-
2433
- Parameters
2434
- ----------
2435
- body : list[ast.stmt] | ast.expr
2436
- Either a list of statements or a single expression
2437
-
2438
- Returns
2439
- -------
2440
- nodeMod : ast.mod
2441
- The constructed module node of appropriate type
2442
-
2443
- """
2425
+ """Create an abstract `ast.mod` (***mod***ule) `object`."""
2444
2426
  return ast.mod()
2445
2427
 
2446
2428
  class Mod(ast.Mod):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astToolkit
3
- Version: 0.7.2
3
+ Version: 0.7.4
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.2"
3
+ version = "0.7.4"
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