turing-py 2.1.0__tar.gz → 2.2.0__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 (24) hide show
  1. {turing_py-2.1.0 → turing_py-2.2.0}/PKG-INFO +1 -1
  2. {turing_py-2.1.0 → turing_py-2.2.0}/pyproject.toml +1 -1
  3. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/machine/machine.py +1 -0
  4. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/transition/transition_function.py +10 -12
  5. {turing_py-2.1.0 → turing_py-2.2.0}/LICENSE +0 -0
  6. {turing_py-2.1.0 → turing_py-2.2.0}/README.md +0 -0
  7. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/__init__.py +0 -0
  8. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/alphabet/__init__.py +0 -0
  9. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/alphabet/input_alphabet.py +0 -0
  10. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/alphabet/symbol.py +0 -0
  11. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/alphabet/tape_alphabet.py +0 -0
  12. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/dsl/__init__.py +0 -0
  13. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/dsl/ast.py +0 -0
  14. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/dsl/lexer.py +0 -0
  15. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/dsl/loader.py +0 -0
  16. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/dsl/parser.py +0 -0
  17. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/dsl/token.py +0 -0
  18. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/exception.py +0 -0
  19. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/machine/__init__.py +0 -0
  20. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/machine/states.py +0 -0
  21. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/machine/tape.py +0 -0
  22. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/transition/__init__.py +0 -0
  23. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/transition/direction.py +0 -0
  24. {turing_py-2.1.0 → turing_py-2.2.0}/src/tmpy/transition/transition.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: turing-py
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: Education Turing Machine simulator in Python
5
5
  License-File: LICENSE
6
6
  Author: Eric Santos
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "turing-py"
3
- version = "2.1.0"
3
+ version = "2.2.0"
4
4
  description = "Education Turing Machine simulator in Python"
5
5
  authors = [
6
6
  {name = "Eric Santos",email = "ericshantos13@gmail.com"}
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  """
2
3
  @author: Eric Santos <ericshantos13@gmail.com>
3
4
 
@@ -13,25 +13,23 @@ from .transition import Transition
13
13
 
14
14
 
15
15
  class TransitionFunction:
16
- def __init__(self) -> None:
17
- self._transitions: dict[tuple[str, Symbol], Transition] = {}
16
+ def __init__(self, *args: Transition) -> None:
18
17
 
19
- def add(self, *transitions: Transition) -> None:
18
+ self._tr: dict[tuple[str, Symbol], Transition] = {}
20
19
 
21
- for t in transitions:
20
+ for t in args:
22
21
 
23
22
  if isinstance(t, Iterable) and not isinstance(t, Transition):
24
23
  for tr in t:
25
- self._transitions[(tr.state, tr.symbol)] = tr
24
+ self._tr[(tr.state, tr.symbol)] = tr
26
25
  else:
27
- self._transitions[(t.state, t.symbol)] = t
26
+ self._tr[(t.state, t.symbol)] = t
28
27
 
29
28
  def __call__(self, state: str, symbol: Symbol) -> Transition | None:
30
- return self._transitions.get((state, symbol))
29
+ return self._tr.get((state, symbol))
31
30
 
32
- def __str__(self) -> str:
33
- return "\n".join(str(t) for t in self._transitions.values())
31
+ def __contains__(self, item) -> bool:
32
+ return item in self._tr
34
33
 
35
- @property
36
- def conjugates(self) -> dict[tuple[str, Symbol], Transition]:
37
- return self._transitions
34
+ def __str__(self) -> str:
35
+ return "\n".join(str(t) for t in self._tr.values())
File without changes
File without changes
File without changes