string-to-code 0.2.2__tar.gz → 0.2.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 (23) hide show
  1. {string_to_code-0.2.2 → string_to_code-0.2.4}/PKG-INFO +2 -5
  2. {string_to_code-0.2.2 → string_to_code-0.2.4}/pyproject.toml +3 -3
  3. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/core.py +8 -5
  4. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/utils.py +3 -2
  5. {string_to_code-0.2.2 → string_to_code-0.2.4}/LICENSE +0 -0
  6. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/README.md +0 -0
  7. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/__init__.py +0 -0
  8. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/c_like_utils.py +0 -0
  9. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/string_to_code.py +0 -0
  10. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_ada.py +0 -0
  11. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_algol68.py +0 -0
  12. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_ballerina.py +0 -0
  13. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_bash.py +0 -0
  14. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_c.py +0 -0
  15. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_cobol.py +0 -0
  16. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_cpp.py +0 -0
  17. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_haskell.py +0 -0
  18. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_java.py +0 -0
  19. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_lisp.py +0 -0
  20. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_nim.py +0 -0
  21. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_pascal.py +0 -0
  22. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_python3.py +0 -0
  23. {string_to_code-0.2.2 → string_to_code-0.2.4}/string_to_code/to_rust.py +0 -0
@@ -1,18 +1,15 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: string-to-code
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Generates a piece of messy code in a given language displaying a given string
5
5
  Home-page: https://github.com/vil02/string_to_code_proj
6
6
  License: MIT
7
7
  Keywords: code-generation
8
8
  Author: piotr.idzik
9
9
  Author-email: vil02@o2.pl
10
- Requires-Python: >=3.7
10
+ Requires-Python: >=3.10
11
11
  Classifier: License :: OSI Approved :: MIT License
12
12
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.7
14
- Classifier: Programming Language :: Python :: 3.8
15
- Classifier: Programming Language :: Python :: 3.9
16
13
  Classifier: Programming Language :: Python :: 3.10
17
14
  Classifier: Programming Language :: Python :: 3.11
18
15
  Project-URL: Repository, https://github.com/vil02/string_to_code_proj
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "string-to-code"
3
- version = "0.2.2"
3
+ version = "0.2.4"
4
4
  description = "Generates a piece of messy code in a given language displaying a given string "
5
5
  authors = ["piotr.idzik <vil02@o2.pl>"]
6
6
  readme = "./string_to_code/README.md"
@@ -10,7 +10,7 @@ repository = "https://github.com/vil02/string_to_code_proj"
10
10
  keywords = ["code-generation"]
11
11
 
12
12
  [tool.poetry.dependencies]
13
- python = ">=3.7"
13
+ python = ">=3.10"
14
14
 
15
15
  [tool.poetry.group.dev]
16
16
  optional = true
@@ -22,7 +22,7 @@ pylint = ">=2.0"
22
22
  flake8 = ">=5.0"
23
23
  coverage = ">=6.0"
24
24
  black = ">=21.0"
25
- mypy = ">=1.4"
25
+ mypy = ">=1.7"
26
26
 
27
27
  [build-system]
28
28
  requires = ["poetry-core"]
@@ -2,7 +2,6 @@
2
2
  core functions of the string_to_code module
3
3
  """
4
4
  import typing
5
- import collections
6
5
  import random
7
6
  import functools
8
7
 
@@ -13,12 +12,14 @@ class Atom(typing.NamedTuple):
13
12
  atom_char: str
14
13
 
15
14
 
16
- class SimpleFunction(collections.namedtuple("SimpleFunction", ["called_list"])):
15
+ class SimpleFunction(typing.NamedTuple):
17
16
  """
18
17
  represents a function with no arguments and no return value calling
19
18
  other functions of such type or displaying single characters
20
19
  """
21
20
 
21
+ called_list: typing.List[int | Atom]
22
+
22
23
 
23
24
  def str_pieces(in_str, in_pieces_len):
24
25
  """returns in_str splited into pieces of lengths as in in_pieces_len"""
@@ -68,11 +69,13 @@ def get_function_namer(in_name_prefix="f_"):
68
69
  return _inner
69
70
 
70
71
 
71
- def _prepare_printer_program(in_str):
72
- needed_functions = []
72
+ def _prepare_printer_program(
73
+ in_str: str,
74
+ ) -> typing.Tuple[int | Atom | None, typing.List[SimpleFunction]]:
75
+ needed_functions: typing.List[SimpleFunction] = []
73
76
 
74
77
  @functools.lru_cache(maxsize=None)
75
- def _generate_code(in_str):
78
+ def _generate_code(in_str: str) -> Atom | int:
76
79
  if len(in_str) == 1:
77
80
  return Atom(in_str)
78
81
 
@@ -96,8 +96,9 @@ def get_function_to_code(
96
96
  ):
97
97
  """return function_to_code-like function"""
98
98
 
99
- def _function_to_code(in_function_id, in_function, **kwargs):
100
- assert isinstance(in_function, core.SimpleFunction)
99
+ def _function_to_code(
100
+ in_function_id: int, in_function: core.SimpleFunction, **kwargs
101
+ ) -> str:
101
102
  function_name = in_get_function_name(in_function_id, **kwargs)
102
103
  function_body = in_body_to_str(in_function)
103
104
  res = in_merge_to_full_function(function_name, function_body)
File without changes