string-to-code 0.2.2__py3-none-any.whl → 0.2.4__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.
string_to_code/core.py CHANGED
@@ -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
 
string_to_code/utils.py CHANGED
@@ -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)
@@ -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,7 +1,7 @@
1
1
  string_to_code/README.md,sha256=A8BkDQpr-Os630YfGnaU-i_kigyVB8bNLhvLfIyzQR8,1225
2
2
  string_to_code/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  string_to_code/c_like_utils.py,sha256=G2HMxU6J9Lczv28yTNJSXLAeTyOHY1RV6gKltvf1h1E,2091
4
- string_to_code/core.py,sha256=Fi_CPHhqZCTZ2L-LK8sSBbHbLAy7nTDywbzfGoKrUZA,3747
4
+ string_to_code/core.py,sha256=nOAmOaHSX4S7_iVjHpZToW-MeZIiaQNaGONA4URS5YM,3854
5
5
  string_to_code/string_to_code.py,sha256=ldAczke3qmY4UnodSP6oaq-Gu89IOubZAXUDflpo61k,1212
6
6
  string_to_code/to_ada.py,sha256=-QUNxghg4KcZzqya0YgBoHJnFA2aYwnjw28Qec-EqJc,2264
7
7
  string_to_code/to_algol68.py,sha256=ENxJbUKIL-iOXz3QrhXdGVUhrv5b_Ogjt_1NLrYbZjY,1641
@@ -17,8 +17,8 @@ string_to_code/to_nim.py,sha256=QolGTXNj764qZOEkYJ0uSBhda1tdQCgnYqgUqyrVTMw,1533
17
17
  string_to_code/to_pascal.py,sha256=EQ1wUQ-jz5frIB0_OQ3h2v8BDitzKFhVsey_xlX3XMg,1921
18
18
  string_to_code/to_python3.py,sha256=ZLU29deSg-rsfR5HmlB5ZCH2pURGmGFdNDfcIZ_DdNU,1588
19
19
  string_to_code/to_rust.py,sha256=xbkKKhvFxbOBtSgh-5_hGJ8zSBDt4vNIqEiJW9JsoXw,1925
20
- string_to_code/utils.py,sha256=SbS_bXtLJd_ROTnxiW41M3_IuoGBiVqDHsxfvEsPyg8,3381
21
- string_to_code-0.2.2.dist-info/LICENSE,sha256=LQrcSkcUyN1FtFYDxWK05puxNN9o2q8PV-_2SwFDTWc,1068
22
- string_to_code-0.2.2.dist-info/METADATA,sha256=jcHFz0HhDQVN62WOiKIHM9jiT8CD96Jgl1I7Uq653Hw,1998
23
- string_to_code-0.2.2.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
24
- string_to_code-0.2.2.dist-info/RECORD,,
20
+ string_to_code/utils.py,sha256=P3qkuOtsZbhejTnouIUuz4qM_tvNrWBkzrX8NOztmok,3368
21
+ string_to_code-0.2.4.dist-info/LICENSE,sha256=LQrcSkcUyN1FtFYDxWK05puxNN9o2q8PV-_2SwFDTWc,1068
22
+ string_to_code-0.2.4.dist-info/METADATA,sha256=oszbBWRvuBm1VsYQeCI5KurDfbsXwxfYfZ9NfISHAKg,1849
23
+ string_to_code-0.2.4.dist-info/WHEEL,sha256=d2fvjOD7sXsVzChCqf0Ty0JbHKBaLYwDbGQDwQTnJ50,88
24
+ string_to_code-0.2.4.dist-info/RECORD,,