iterativerecursion 1.0__tar.gz → 1.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iterativerecursion
3
- Version: 1.0
3
+ Version: 1.1
4
4
  Summary: A Python module to simulate recursive function calls using iteration, providing explicit control over execution flow and avoiding stack overflow issues.
5
5
  Author-email: "Carlos A. Planchón" <carlosandresplanchonprestes@gmail.com>
6
6
  License-Expression: MIT
@@ -25,6 +25,12 @@ Dynamic: license-file
25
25
 
26
26
  ![iterativerecursion banner](https://raw.githubusercontent.com/carlosplanchon/iterativerecursion/refs/heads/master/assets/banner.jpeg)
27
27
 
28
+ [![CI](https://github.com/carlosplanchon/iterativerecursion/actions/workflows/ci.yml/badge.svg)](https://github.com/carlosplanchon/iterativerecursion/actions/workflows/ci.yml)
29
+ [![PyPI version](https://img.shields.io/pypi/v/iterativerecursion.svg)](https://pypi.org/project/iterativerecursion/)
30
+ [![Python versions](https://img.shields.io/pypi/pyversions/iterativerecursion.svg)](https://pypi.org/project/iterativerecursion/)
31
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
32
+ [![DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/carlosplanchon/iterativerecursion)
33
+
28
34
  *A Python module to simulate recursive function calls using iteration, providing explicit control over execution flow and avoiding stack overflow issues.*
29
35
 
30
36
  ## Overview
@@ -308,7 +314,7 @@ engine.add_environment_variables({"x": 10, "y": 20})
308
314
  Begins executing functions starting from the specified function.
309
315
 
310
316
  - **Parameters**:
311
- - `next_function_to_call` (str): Name of the first function to call
317
+ - `next_function_to_call` (str | None): Name of the first function to call. Pass `None` to terminate immediately after recording `environment_variables`.
312
318
  - `environment_variables` (dict[str, Any]): Initial environment variables
313
319
  - `arg_env_mapping` (dict[str, str]): Parameter mapping for first function
314
320
  - `max_iterations` (int | None): Maximum iterations allowed (default: None/unlimited)
@@ -2,6 +2,12 @@
2
2
 
3
3
  ![iterativerecursion banner](https://raw.githubusercontent.com/carlosplanchon/iterativerecursion/refs/heads/master/assets/banner.jpeg)
4
4
 
5
+ [![CI](https://github.com/carlosplanchon/iterativerecursion/actions/workflows/ci.yml/badge.svg)](https://github.com/carlosplanchon/iterativerecursion/actions/workflows/ci.yml)
6
+ [![PyPI version](https://img.shields.io/pypi/v/iterativerecursion.svg)](https://pypi.org/project/iterativerecursion/)
7
+ [![Python versions](https://img.shields.io/pypi/pyversions/iterativerecursion.svg)](https://pypi.org/project/iterativerecursion/)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+ [![DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/carlosplanchon/iterativerecursion)
10
+
5
11
  *A Python module to simulate recursive function calls using iteration, providing explicit control over execution flow and avoiding stack overflow issues.*
6
12
 
7
13
  ## Overview
@@ -285,7 +291,7 @@ engine.add_environment_variables({"x": 10, "y": 20})
285
291
  Begins executing functions starting from the specified function.
286
292
 
287
293
  - **Parameters**:
288
- - `next_function_to_call` (str): Name of the first function to call
294
+ - `next_function_to_call` (str | None): Name of the first function to call. Pass `None` to terminate immediately after recording `environment_variables`.
289
295
  - `environment_variables` (dict[str, Any]): Initial environment variables
290
296
  - `arg_env_mapping` (dict[str, str]): Parameter mapping for first function
291
297
  - `max_iterations` (int | None): Maximum iterations allowed (default: None/unlimited)
@@ -122,9 +122,9 @@ class IterativeRecursionEngine:
122
122
 
123
123
  def start_function_caller(
124
124
  self,
125
- next_function_to_call: str,
125
+ next_function_to_call: str | None,
126
126
  environment_variables: VarsDict,
127
- arg_env_mapping: VarsDict,
127
+ arg_env_mapping: dict[str, str],
128
128
  max_iterations: int | None = None
129
129
  ) -> VarsDict:
130
130
  """
@@ -143,11 +143,11 @@ class IterativeRecursionEngine:
143
143
  :raises ValueError: If function returns invalid structure
144
144
  :raises TypeError: If function return has wrong types
145
145
  """
146
+ self.environment_variables.update(environment_variables)
147
+
146
148
  if next_function_to_call is None:
147
149
  return self.environment_variables
148
150
 
149
- self.environment_variables.update(environment_variables)
150
-
151
151
  # Resolve initial arguments
152
152
  arg_env_mapping = self._resolve_arguments(arg_env_mapping, next_function_to_call)
153
153
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iterativerecursion
3
- Version: 1.0
3
+ Version: 1.1
4
4
  Summary: A Python module to simulate recursive function calls using iteration, providing explicit control over execution flow and avoiding stack overflow issues.
5
5
  Author-email: "Carlos A. Planchón" <carlosandresplanchonprestes@gmail.com>
6
6
  License-Expression: MIT
@@ -25,6 +25,12 @@ Dynamic: license-file
25
25
 
26
26
  ![iterativerecursion banner](https://raw.githubusercontent.com/carlosplanchon/iterativerecursion/refs/heads/master/assets/banner.jpeg)
27
27
 
28
+ [![CI](https://github.com/carlosplanchon/iterativerecursion/actions/workflows/ci.yml/badge.svg)](https://github.com/carlosplanchon/iterativerecursion/actions/workflows/ci.yml)
29
+ [![PyPI version](https://img.shields.io/pypi/v/iterativerecursion.svg)](https://pypi.org/project/iterativerecursion/)
30
+ [![Python versions](https://img.shields.io/pypi/pyversions/iterativerecursion.svg)](https://pypi.org/project/iterativerecursion/)
31
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
32
+ [![DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/carlosplanchon/iterativerecursion)
33
+
28
34
  *A Python module to simulate recursive function calls using iteration, providing explicit control over execution flow and avoiding stack overflow issues.*
29
35
 
30
36
  ## Overview
@@ -308,7 +314,7 @@ engine.add_environment_variables({"x": 10, "y": 20})
308
314
  Begins executing functions starting from the specified function.
309
315
 
310
316
  - **Parameters**:
311
- - `next_function_to_call` (str): Name of the first function to call
317
+ - `next_function_to_call` (str | None): Name of the first function to call. Pass `None` to terminate immediately after recording `environment_variables`.
312
318
  - `environment_variables` (dict[str, Any]): Initial environment variables
313
319
  - `arg_env_mapping` (dict[str, str]): Parameter mapping for first function
314
320
  - `max_iterations` (int | None): Maximum iterations allowed (default: None/unlimited)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "iterativerecursion"
7
- version = "1.0"
7
+ version = "1.1"
8
8
  description = "A Python module to simulate recursive function calls using iteration, providing explicit control over execution flow and avoiding stack overflow issues."
9
9
  readme = "README.md"
10
10
 
@@ -73,6 +73,19 @@ class TestBasicFunctionality:
73
73
 
74
74
  assert result == {} # Returns empty environment dict
75
75
 
76
+ def test_none_initial_function_applies_environment(self):
77
+ """Test that None initial function still applies the passed environment."""
78
+ executor = IterativeRecursionEngine()
79
+ result = executor.start_function_caller(
80
+ next_function_to_call=None,
81
+ environment_variables={"seed": 42},
82
+ arg_env_mapping={}
83
+ )
84
+
85
+ # Passing None terminates immediately but still records the environment
86
+ assert result == {"seed": 42}
87
+ assert executor.environment_variables["seed"] == 42
88
+
76
89
 
77
90
  class TestEnvironmentVariables:
78
91
  """Test environment variable management."""