mapFolding 0.12.2__py3-none-any.whl → 0.13.0__py3-none-any.whl

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. mapFolding/__init__.py +4 -2
  2. mapFolding/_theSSOT.py +32 -88
  3. mapFolding/{datatypes.py → _theTypes.py} +25 -3
  4. mapFolding/basecamp.py +38 -33
  5. mapFolding/beDRY.py +79 -54
  6. mapFolding/dataBaskets.py +123 -93
  7. mapFolding/filesystemToolkit.py +140 -91
  8. mapFolding/oeis.py +243 -145
  9. mapFolding/reference/flattened.py +1 -1
  10. mapFolding/someAssemblyRequired/RecipeJob.py +116 -100
  11. mapFolding/someAssemblyRequired/__init__.py +40 -15
  12. mapFolding/someAssemblyRequired/_toolIfThis.py +82 -54
  13. mapFolding/someAssemblyRequired/_toolkitContainers.py +19 -16
  14. mapFolding/someAssemblyRequired/getLLVMforNoReason.py +35 -26
  15. mapFolding/someAssemblyRequired/makeAllModules.py +353 -283
  16. mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +83 -84
  17. mapFolding/someAssemblyRequired/makeJobTheorem2codon.py +256 -0
  18. mapFolding/someAssemblyRequired/toolkitNumba.py +80 -50
  19. mapFolding/someAssemblyRequired/transformationTools.py +63 -40
  20. {tests → mapFolding/tests}/__init__.py +2 -2
  21. {tests → mapFolding/tests}/conftest.py +232 -63
  22. {tests → mapFolding/tests}/test_computations.py +58 -18
  23. {tests → mapFolding/tests}/test_filesystem.py +10 -13
  24. {tests → mapFolding/tests}/test_oeis.py +5 -18
  25. {tests → mapFolding/tests}/test_other.py +9 -9
  26. {tests → mapFolding/tests}/test_tasks.py +7 -9
  27. {mapfolding-0.12.2.dist-info → mapfolding-0.13.0.dist-info}/METADATA +24 -37
  28. mapfolding-0.13.0.dist-info/RECORD +54 -0
  29. {mapfolding-0.12.2.dist-info → mapfolding-0.13.0.dist-info}/top_level.txt +0 -1
  30. mapfolding-0.12.2.dist-info/RECORD +0 -53
  31. {mapfolding-0.12.2.dist-info → mapfolding-0.13.0.dist-info}/WHEEL +0 -0
  32. {mapfolding-0.12.2.dist-info → mapfolding-0.13.0.dist-info}/entry_points.txt +0 -0
  33. {mapfolding-0.12.2.dist-info → mapfolding-0.13.0.dist-info}/licenses/LICENSE +0 -0
@@ -26,13 +26,14 @@ system to produce standalone modules optimized for specific map dimensions and c
26
26
  """
27
27
 
28
28
  from astToolkit import identifierDotAttribute, IngredientsFunction, Make
29
- from collections.abc import Callable, Sequence
30
- from numba.core.compiler import CompilerBase as numbaCompilerBase
31
- from typing import Any, cast, Final, NotRequired, TypedDict
29
+ from typing import cast, Final, NotRequired, TYPE_CHECKING, TypedDict
32
30
  import ast
33
31
  import dataclasses
34
32
  import warnings
35
33
 
34
+ if TYPE_CHECKING:
35
+ from collections.abc import Sequence
36
+
36
37
  class ParametersNumba(TypedDict):
37
38
  """
38
39
  Configuration parameters for Numba compilation decorators.
@@ -56,6 +57,7 @@ class ParametersNumba(TypedDict):
56
57
  optional via `NotRequired`, allowing flexible configuration while requiring explicit
57
58
  decisions on critical performance and correctness parameters.
58
59
  """
60
+
59
61
  _dbg_extend_lifetimes: NotRequired[bool]
60
62
  _dbg_optnone: NotRequired[bool]
61
63
  _nrt: NotRequired[bool]
@@ -67,7 +69,7 @@ class ParametersNumba(TypedDict):
67
69
  forceinline: NotRequired[bool]
68
70
  forceobj: NotRequired[bool]
69
71
  inline: NotRequired[str]
70
- locals: NotRequired[dict[str, Any]]
72
+ # locals: NotRequired[dict[str, Any]]
71
73
  looplift: NotRequired[bool]
72
74
  no_cfunc_wrapper: NotRequired[bool]
73
75
  no_cpython_wrapper: NotRequired[bool]
@@ -75,11 +77,11 @@ class ParametersNumba(TypedDict):
75
77
  nogil: NotRequired[bool]
76
78
  nopython: NotRequired[bool]
77
79
  parallel: NotRequired[bool]
78
- pipeline_class: NotRequired[type[numbaCompilerBase]]
79
- signature_or_function: NotRequired[Any | Callable[..., Any] | str | tuple[Any, ...]]
80
+ # pipeline_class: NotRequired[type[numbaCompilerBase]]
81
+ # signature_or_function: NotRequired[Any | Callable[..., Any] | str | tuple[Any, ...]]
80
82
  target: NotRequired[str]
81
83
 
82
- parametersNumbaDefault: Final[ParametersNumba] = { '_nrt': True, 'boundscheck': False, 'cache': True, 'error_model': 'numpy', 'fastmath': True, 'forceinline': True, 'inline': 'always', 'looplift': False, 'no_cfunc_wrapper': False, 'no_cpython_wrapper': False, 'nopython': True, 'parallel': False, }
84
+ parametersNumbaDefault: Final[ParametersNumba] = { '_nrt': True, 'boundscheck': False, 'cache': True, 'error_model': 'numpy', 'fastmath': True, 'forceinline': True, 'inline': 'always', 'looplift': False, 'no_cfunc_wrapper': False, 'no_cpython_wrapper': False, 'nopython': True, 'parallel': False }
83
85
  """
84
86
  Comprehensive Numba configuration for maximum performance optimization.
85
87
 
@@ -132,54 +134,69 @@ While Numba offers multiple decorators (`@jit`, `@njit`, `@vectorize`), this too
132
134
  on the general-purpose `@jit` decorator with configurable parameters for flexibility.
133
135
  """
134
136
 
135
- def decorateCallableWithNumba(ingredientsFunction: IngredientsFunction, parametersNumba: ParametersNumba | None = None) -> IngredientsFunction:
136
- """
137
- Transform a Python function into a Numba-accelerated version with appropriate decorators.
137
+ def decorateCallableWithNumba(ingredientsFunction: IngredientsFunction, parametersNumba: ParametersNumba | None = None) -> IngredientsFunction: # noqa: C901
138
+ """Transform a Python function into a Numba-accelerated version with appropriate decorators.
138
139
 
139
- This function applies Numba's @jit decorator to an existing function definition within
140
- an IngredientsFunction container. It handles the complete transformation pipeline:
140
+ (AI generated docstring)
141
141
 
142
- 1. Removes any existing decorators that might conflict with Numba
143
- 2. Constructs type signatures for Numba compilation when possible
144
- 3. Applies the @jit decorator with specified or default parameters
145
- 4. Updates import requirements to include necessary Numba modules
142
+ This function applies Numba's `@jit` decorator to an existing function definition within
143
+ an `IngredientsFunction` container. It handles the complete transformation assembly line
144
+ including removing any existing decorators that might conflict with Numba, constructing
145
+ type signatures for Numba compilation when possible, applying the `@jit` decorator with
146
+ specified or default parameters, and updating import requirements to include necessary
147
+ Numba modules.
146
148
 
147
149
  The transformation preserves function semantics while enabling significant performance
148
150
  improvements through just-in-time compilation. Type inference is attempted for
149
151
  function parameters and return values to enable optimized compilation paths.
150
- Parameters:
151
- ingredientsFunction: Container holding the function definition and associated metadata
152
- parametersNumba: Optional Numba configuration; uses parametersNumbaDefault if None
153
- Returns:
154
- Modified IngredientsFunction with Numba decorator applied and imports updated
152
+
153
+ Parameters
154
+ ----------
155
+ ingredientsFunction : IngredientsFunction
156
+ Container holding the function definition and associated metadata.
157
+ parametersNumba : ParametersNumba | None = None
158
+ Optional Numba configuration; uses `parametersNumbaDefault` if `None`.
159
+
160
+ Returns
161
+ -------
162
+ ingredientsFunction : IngredientsFunction
163
+ Modified `IngredientsFunction` with Numba decorator applied and imports updated.
164
+
155
165
  """
156
166
  def Z0Z_UnhandledDecorators(astCallable: ast.FunctionDef) -> ast.FunctionDef:
157
- """
158
- Remove existing decorators from function definition to prevent conflicts with Numba.
167
+ """Remove existing decorators from function definition to prevent conflicts with Numba.
168
+
169
+ (AI generated docstring)
159
170
 
160
171
  Numba compilation can be incompatible with certain Python decorators, so this
161
172
  function strips all existing decorators from a function definition before
162
- applying the Numba @jit decorator. Removed decorators are logged as warnings
173
+ applying the Numba `@jit` decorator. Removed decorators are logged as warnings
163
174
  for debugging purposes.
164
175
 
165
176
  TODO: Implement more sophisticated decorator handling that can preserve
166
177
  compatible decorators and intelligently handle decorator composition.
167
178
 
168
- Parameters:
169
- astCallable: Function definition AST node to process
179
+ Parameters
180
+ ----------
181
+ astCallable : ast.FunctionDef
182
+ Function definition AST node to process.
183
+
184
+ Returns
185
+ -------
186
+ astCallable : ast.FunctionDef
187
+ Function definition with decorator list cleared.
170
188
 
171
- Returns:
172
- astCallable: Function definition with decorator list cleared
173
189
  """
174
- # TODO: more explicit handling of decorators. I'm able to ignore this because I know `algorithmSource` doesn't have any decorators.
190
+ # TODO more explicit handling of decorators. I'm able to ignore this because I know `algorithmSource` doesn't have any decorators.
175
191
  for decoratorItem in astCallable.decorator_list.copy():
176
192
  astCallable.decorator_list.remove(decoratorItem)
177
- warnings.warn(f"Removed decorator {ast.unparse(decoratorItem)} from {astCallable.name}")
193
+ warnings.warn(f"Removed decorator {ast.unparse(decoratorItem)} from {astCallable.name}", stacklevel=2)
178
194
  return astCallable
179
195
 
180
196
  def makeSpecialSignatureForNumba(signatureElement: ast.arg) -> ast.Subscript | ast.Name | None: # pyright: ignore[reportUnusedFunction]
181
- """
182
- Generate Numba-compatible type signatures for function parameters.
197
+ """Generate Numba-compatible type signatures for function parameters.
198
+
199
+ (AI generated docstring)
183
200
 
184
201
  This function analyzes function parameter type annotations and converts them into
185
202
  Numba-compatible type signature expressions. It handles various annotation patterns
@@ -189,20 +206,25 @@ def decorateCallableWithNumba(ingredientsFunction: IngredientsFunction, paramete
189
206
  The generated signatures enable Numba to perform more efficient compilation by
190
207
  providing explicit type information rather than relying solely on type inference.
191
208
 
192
- Parameters:
193
- signatureElement: Function parameter with type annotation to convert
209
+ Parameters
210
+ ----------
211
+ signatureElement : ast.arg
212
+ Function parameter with type annotation to convert.
213
+
214
+ Returns
215
+ -------
216
+ ast.Subscript | ast.Name | None
217
+ Numba-compatible type signature AST node, or None if conversion not possible.
194
218
 
195
- Returns:
196
- Numba-compatible type signature AST node, or None if conversion not possible
197
219
  """
198
220
  if isinstance(signatureElement.annotation, ast.Subscript) and isinstance(signatureElement.annotation.slice, ast.Tuple):
199
221
  annotationShape: ast.expr = signatureElement.annotation.slice.elts[0]
200
222
  if isinstance(annotationShape, ast.Subscript) and isinstance(annotationShape.slice, ast.Tuple):
201
223
  shapeAsListSlices: list[ast.Slice] = [ast.Slice() for _axis in range(len(annotationShape.slice.elts))]
202
- shapeAsListSlices[-1] = ast.Slice(step=ast.Constant(value=1))
203
- shapeAST: ast.Slice | ast.Tuple = ast.Tuple(elts=list(shapeAsListSlices), ctx=ast.Load())
224
+ shapeAsListSlices[-1] = Make.Slice(step=Make.Constant(1))
225
+ shapeAST: ast.Slice | ast.Tuple = Make.Tuple(list(shapeAsListSlices))
204
226
  else:
205
- shapeAST = ast.Slice(step=ast.Constant(value=1))
227
+ shapeAST = Make.Slice(step=Make.Constant(1))
206
228
 
207
229
  annotationDtype: ast.expr = signatureElement.annotation.slice.elts[1]
208
230
  if (isinstance(annotationDtype, ast.Subscript) and isinstance(annotationDtype.slice, ast.Attribute)):
@@ -214,9 +236,9 @@ def decorateCallableWithNumba(ingredientsFunction: IngredientsFunction, paramete
214
236
  Z0Z_hacky_dtype: str = ndarrayName
215
237
  datatype_attr = datatypeAST or Z0Z_hacky_dtype
216
238
  ingredientsFunction.imports.addImportFrom_asStr(datatypeModuleDecorator, datatype_attr)
217
- datatypeNumba = ast.Name(id=datatype_attr, ctx=ast.Load())
239
+ datatypeNumba = Make.Name(datatype_attr)
218
240
 
219
- return ast.Subscript(value=datatypeNumba, slice=shapeAST, ctx=ast.Load())
241
+ return Make.Subscript(datatypeNumba, slice=shapeAST)
220
242
 
221
243
  elif isinstance(signatureElement.annotation, ast.Name):
222
244
  return signatureElement.annotation
@@ -235,14 +257,15 @@ def decorateCallableWithNumba(ingredientsFunction: IngredientsFunction, paramete
235
257
 
236
258
  if ingredientsFunction.astFunctionDef.returns and isinstance(ingredientsFunction.astFunctionDef.returns, ast.Name):
237
259
  theReturn: ast.Name = ingredientsFunction.astFunctionDef.returns
238
- list_argsDecorator = [cast(ast.expr, ast.Call(func=ast.Name(id=theReturn.id, ctx=ast.Load())
239
- , args=list_arg4signature_or_function if list_arg4signature_or_function else [], keywords=[] ) )]
260
+ list_argsDecorator = [cast("ast.expr", Make.Call(Make.Name(theReturn.id)
261
+ , list_arg4signature_or_function if list_arg4signature_or_function else [], [] ) )]
240
262
  elif list_arg4signature_or_function:
241
- list_argsDecorator = [cast(ast.expr, ast.Tuple(elts=list_arg4signature_or_function, ctx=ast.Load()))]
263
+ list_argsDecorator = [cast("ast.expr", Make.Tuple(list_arg4signature_or_function))]
242
264
 
243
265
  ingredientsFunction.astFunctionDef = Z0Z_UnhandledDecorators(ingredientsFunction.astFunctionDef)
244
266
  if parametersNumba is None:
245
267
  parametersNumba = parametersNumbaDefault
268
+
246
269
  listDecoratorKeywords: list[ast.keyword] = [Make.keyword(parameterName, Make.Constant(parameterValue)) for parameterName, parameterValue in parametersNumba.items()] # pyright: ignore[reportArgumentType]
247
270
 
248
271
  decoratorModule = Z0Z_numbaDataTypeModule
@@ -257,8 +280,9 @@ def decorateCallableWithNumba(ingredientsFunction: IngredientsFunction, paramete
257
280
 
258
281
  @dataclasses.dataclass
259
282
  class SpicesJobNumba:
260
- """
261
- Configuration container for Numba-specific job processing options.
283
+ """Configuration container for Numba-specific job processing options.
284
+
285
+ (AI generated docstring)
262
286
 
263
287
  This dataclass encapsulates configuration settings that control how Numba
264
288
  compilation and execution is applied to job processing functions. It provides
@@ -269,11 +293,17 @@ class SpicesJobNumba:
269
293
  Numba's specialized requirements, enabling consistent application of
270
294
  optimization settings across different computational contexts.
271
295
 
272
- Attributes:
273
- useNumbaProgressBar: Enable progress bar display for long-running computations
274
- numbaProgressBarIdentifier: Progress bar implementation identifier
275
- parametersNumba: Numba compilation parameters with sensible defaults
296
+ Attributes
297
+ ----------
298
+ useNumbaProgressBar : bool
299
+ Enable progress bar display for long-running computations.
300
+ numbaProgressBarIdentifier : str
301
+ Progress bar implementation identifier.
302
+ parametersNumba : ParametersNumba
303
+ Numba compilation parameters with sensible defaults.
304
+
276
305
  """
306
+
277
307
  useNumbaProgressBar: bool = True
278
308
  """Enable progress bar display for Numba-compiled functions with long execution times."""
279
309
 
@@ -27,18 +27,17 @@ through specialized compilation paths essential for computationally intensive ma
27
27
  """
28
28
 
29
29
  from astToolkit import (
30
- Be, ClassIsAndAttribute, extractClassDef, identifierDotAttribute, IngredientsFunction, Make,
31
- NodeChanger, parseLogicalPath2astModule, Then,
32
- )
30
+ Be, extractClassDef, identifierDotAttribute, IngredientsFunction, Make, NodeChanger, parseLogicalPath2astModule, Then)
33
31
  from astToolkit.transformationTools import unparseFindReplace
32
+ from hunterMakesPy import importLogicalPath2Identifier
34
33
  from mapFolding.someAssemblyRequired import DeReConstructField2ast, IfThis, ShatteredDataclass
35
- from Z0Z_tools import importLogicalPath2Callable
36
34
  import ast
37
35
  import dataclasses
38
36
 
39
37
  def shatter_dataclassesDOTdataclass(logicalPathModule: identifierDotAttribute, dataclassIdentifier: str, instanceIdentifier: str) -> ShatteredDataclass:
40
- """
41
- Decompose a dataclass definition into AST components for manipulation and code generation.
38
+ """Decompose a dataclass definition into AST components for manipulation and code generation.
39
+
40
+ (AI generated docstring)
42
41
 
43
42
  This function breaks down a complete dataclass (like ComputationState) into its constituent
44
43
  parts as AST nodes, enabling fine-grained manipulation of its fields for code generation.
@@ -54,35 +53,44 @@ def shatter_dataclassesDOTdataclass(logicalPathModule: identifierDotAttribute, d
54
53
  where dataclass instances can't be directly used but their fields need to be individually
55
54
  manipulated and passed to computational functions.
56
55
 
57
- Parameters:
58
- logicalPathModule: The fully qualified module path containing the dataclass definition.
59
- dataclassIdentifier: The name of the dataclass to decompose.
60
- instanceIdentifier: The variable name to use for the dataclass instance in generated code.
61
-
62
- Returns:
63
- shatteredDataclass: A ShatteredDataclass containing AST representations of all dataclass components,
64
- with imports, field definitions, annotations, and repackaging code.
56
+ Parameters
57
+ ----------
58
+ logicalPathModule : identifierDotAttribute
59
+ The fully qualified module path containing the dataclass definition.
60
+ dataclassIdentifier : str
61
+ The name of the dataclass to decompose.
62
+ instanceIdentifier : str
63
+ The variable name to use for the dataclass instance in generated code.
64
+
65
+ Returns
66
+ -------
67
+ ShatteredDataclass
68
+ A ShatteredDataclass containing AST representations of all dataclass components,
69
+ with imports, field definitions, annotations, and repackaging code.
70
+
71
+ Raises
72
+ ------
73
+ ValueError
74
+ If the dataclass cannot be found in the specified module or if no counting variable is identified in the dataclass.
65
75
 
66
- Raises:
67
- ValueError: If the dataclass cannot be found in the specified module or if no counting variable is identified in the dataclass.
68
76
  """
69
77
  Official_fieldOrder: list[str] = []
70
78
  dictionaryDeReConstruction: dict[str, DeReConstructField2ast] = {}
71
79
 
72
80
  dataclassClassDef: ast.ClassDef | None = extractClassDef(parseLogicalPath2astModule(logicalPathModule), dataclassIdentifier)
73
- if not isinstance(dataclassClassDef, ast.ClassDef):
74
- raise ValueError(f"I could not find `{dataclassIdentifier = }` in `{logicalPathModule = }`.")
81
+ if not dataclassClassDef:
82
+ message = f"I could not find `{dataclassIdentifier = }` in `{logicalPathModule = }`."
83
+ raise ValueError(message)
75
84
 
76
85
  countingVariable = None
77
- for aField in dataclasses.fields(importLogicalPath2Callable(logicalPathModule, dataclassIdentifier)): # pyright: ignore [reportArgumentType]
86
+ for aField in dataclasses.fields(importLogicalPath2Identifier(logicalPathModule, dataclassIdentifier)): # pyright: ignore [reportArgumentType]
78
87
  Official_fieldOrder.append(aField.name)
79
88
  dictionaryDeReConstruction[aField.name] = DeReConstructField2ast(logicalPathModule, dataclassClassDef, instanceIdentifier, aField)
80
89
  if aField.metadata.get('theCountingIdentifier', False):
81
90
  countingVariable = dictionaryDeReConstruction[aField.name].name
82
91
  if countingVariable is None:
83
- # import warnings
84
- # warnings.warn(message=f"I could not find the counting variable in `{dataclassIdentifier = }` in `{logicalPathModule = }`.", category=UserWarning)
85
- raise ValueError(f"I could not find the counting variable in `{dataclassIdentifier = }` in `{logicalPathModule = }`.")
92
+ message = f"I could not find the counting variable in `{dataclassIdentifier = }` in `{logicalPathModule = }`."
93
+ raise ValueError(message)
86
94
 
87
95
  shatteredDataclass = ShatteredDataclass(
88
96
  countingVariableAnnotation=dictionaryDeReConstruction[countingVariable].astAnnotation,
@@ -106,8 +114,9 @@ def shatter_dataclassesDOTdataclass(logicalPathModule: identifierDotAttribute, d
106
114
  return shatteredDataclass
107
115
 
108
116
  def removeDataclassFromFunction(ingredientsTarget: IngredientsFunction, shatteredDataclass: ShatteredDataclass) -> IngredientsFunction:
109
- """
110
- Transform a function that operates on dataclass instances to work with individual field parameters.
117
+ """Transform a function that operates on dataclass instances to work with individual field parameters.
118
+
119
+ (AI generated docstring)
111
120
 
112
121
  This function performs the core transformation required for Numba compatibility by removing dataclass
113
122
  dependencies from function signatures and implementations. It modifies the target function to:
@@ -121,12 +130,18 @@ def removeDataclassFromFunction(ingredientsTarget: IngredientsFunction, shattere
121
130
  implementations, as Numba cannot handle dataclass instances directly but can efficiently
122
131
  process individual primitive values and tuples.
123
132
 
124
- Parameters:
125
- ingredientsTarget: The function definition and its dependencies to be transformed.
126
- shatteredDataclass: The decomposed dataclass components providing AST mappings and transformations.
133
+ Parameters
134
+ ----------
135
+ ingredientsTarget : IngredientsFunction
136
+ The function definition and its dependencies to be transformed.
137
+ shatteredDataclass : ShatteredDataclass
138
+ The decomposed dataclass components providing AST mappings and transformations.
139
+
140
+ Returns
141
+ -------
142
+ IngredientsFunction
143
+ The modified function ingredients with dataclass dependencies removed.
127
144
 
128
- Returns:
129
- ingredientsTarget: The modified function ingredients with dataclass dependencies removed.
130
145
  """
131
146
  ingredientsTarget.astFunctionDef.args = Make.arguments(list_arg=shatteredDataclass.list_argAnnotated4ArgumentsSpecification)
132
147
  ingredientsTarget.astFunctionDef.returns = shatteredDataclass.signatureReturnAnnotation
@@ -136,8 +151,9 @@ def removeDataclassFromFunction(ingredientsTarget: IngredientsFunction, shattere
136
151
  return ingredientsTarget
137
152
 
138
153
  def unpackDataclassCallFunctionRepackDataclass(ingredientsCaller: IngredientsFunction, targetCallableIdentifier: str, shatteredDataclass: ShatteredDataclass) -> IngredientsFunction:
139
- """
140
- Transform a caller function to interface with a dataclass-free target function.
154
+ """Transform a caller function to interface with a dataclass-free target function.
155
+
156
+ (AI generated docstring)
141
157
 
142
158
  This function complements `removeDataclassFromFunction` by modifying calling code to work with
143
159
  the transformed target function. It implements the unpacking and repacking pattern required
@@ -153,18 +169,25 @@ def unpackDataclassCallFunctionRepackDataclass(ingredientsCaller: IngredientsFun
153
169
  field-based implementations, maintaining the original interface while enabling performance
154
170
  optimizations in the target function.
155
171
 
156
- Parameters:
157
- ingredientsCaller: The calling function definition and its dependencies to be transformed.
158
- targetCallableIdentifier: The name of the target function being called.
159
- shatteredDataclass: The decomposed dataclass components providing unpacking and repacking logic.
172
+ Parameters
173
+ ----------
174
+ ingredientsCaller : IngredientsFunction
175
+ The calling function definition and its dependencies to be transformed.
176
+ targetCallableIdentifier : str
177
+ The name of the target function being called.
178
+ shatteredDataclass : ShatteredDataclass
179
+ The decomposed dataclass components providing unpacking and repacking logic.
180
+
181
+ Returns
182
+ -------
183
+ IngredientsFunction
184
+ The modified caller function with appropriate unpacking and repacking around the target call.
160
185
 
161
- Returns:
162
- ingredientsCaller: The modified caller function with appropriate unpacking and repacking around the target call.
163
186
  """
164
187
  astCallTargetCallable = Make.Call(Make.Name(targetCallableIdentifier), shatteredDataclass.listName4Parameters)
165
- replaceAssignTargetCallable = NodeChanger(ClassIsAndAttribute.valueIs(ast.Assign, IfThis.isCallIdentifier(targetCallableIdentifier)), Then.replaceWith(Make.Assign([shatteredDataclass.fragments4AssignmentOrParameters], value=astCallTargetCallable)))
166
- unpack4targetCallable = NodeChanger(ClassIsAndAttribute.valueIs(ast.Assign, IfThis.isCallIdentifier(targetCallableIdentifier)), Then.insertThisAbove(shatteredDataclass.listUnpack))
167
- repack4targetCallable = NodeChanger(ClassIsAndAttribute.valueIs(ast.Assign, IfThis.isCallIdentifier(targetCallableIdentifier)), Then.insertThisBelow([shatteredDataclass.repack]))
188
+ replaceAssignTargetCallable = NodeChanger(Be.Assign.valueIs(IfThis.isCallIdentifier(targetCallableIdentifier)), Then.replaceWith(Make.Assign([shatteredDataclass.fragments4AssignmentOrParameters], value=astCallTargetCallable)))
189
+ unpack4targetCallable = NodeChanger(Be.Assign.valueIs(IfThis.isCallIdentifier(targetCallableIdentifier)), Then.insertThisAbove(shatteredDataclass.listUnpack))
190
+ repack4targetCallable = NodeChanger(Be.Assign.valueIs(IfThis.isCallIdentifier(targetCallableIdentifier)), Then.insertThisBelow([shatteredDataclass.repack]))
168
191
  replaceAssignTargetCallable.visit(ingredientsCaller.astFunctionDef)
169
192
  unpack4targetCallable.visit(ingredientsCaller.astFunctionDef)
170
193
  repack4targetCallable.visit(ingredientsCaller.astFunctionDef)
@@ -4,7 +4,7 @@ This test suite provides comprehensive validation of map folding computations,
4
4
  file system operations, OEIS integration, task division, and foundational
5
5
  utilities. The tests are designed to support multiple audiences and use cases.
6
6
 
7
- Test Module Organization:
7
+ Test Module Organization (in mapFolding/tests/):
8
8
  - conftest.py: Testing infrastructure and shared fixtures
9
9
  - test_computations.py: Core mathematical validation and algorithm testing
10
10
  - test_filesystem.py: File operations and path management
@@ -25,4 +25,4 @@ ensure consistent error reporting across all tests.
25
25
  For AI Assistants:
26
26
  The testing framework emphasizes readable, predictable patterns that maintain
27
27
  mathematical correctness while supporting code evolution and optimization.
28
- """
28
+ """