Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 69f609a4 authored by Charles Paperman's avatar Charles Paperman
Browse files

typing in progress, stuck on mutability of generic

parent 317350eb
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
from typing import (
Callable,
ClassVar,
Generic,
Hashable,
Iterable,
Iterator,
Mapping,
Optional,
Self,
Tuple,
TypeAlias,
TypeVar,
overload,
)
ViewEl = TypeVar("ViewEl", bound=Hashable)
State = TypeVar("State", bound=Hashable)
StateAlt = TypeVar("StateAlt", bound=Hashable)
Symbol = TypeVar("Symbol", bound=Hashable)
SymbolAlt = TypeVar("SymbolAlt", bound=Hashable)
Transition: TypeAlias[State, Symbol] = Tuple[State, Symbol, State]
MarkerVar = TypeVar("MarkerVar", bound=Hashable)
......@@ -4,9 +4,9 @@ from typing import (
Iterator,
Self,
)
from pysemigroup.types import ViewEl, State, Symbol
class View(frozenset):
class View(frozenset[ViewEl]):
def __repr__(self):
return f"{self.__class__.__name__}({self.subrepr()})"
......@@ -25,15 +25,15 @@ class View(frozenset):
yield type(self)(S.union((el,)))
class StateView(View):
class StateView(View[State]):
...
class Configuration(View):
class Configuration(View[State]):
...
class AlphabetView(View):
class AlphabetView(View[Symbol]):
def compute_salt(self, retry=4):
salt = random.randint(0, MAX_INT)
S = set(map(lambda e: hash((e, salt)), self))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment