You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
This checks if dfa is truthy. Since the DFA class defines a __len__ method (and no __bool__), is is truthy iff len(dfa) != 0. Unfortunately, the length checks the dfa's cardinality, i.e., the size if the input language. For infinite-language DFAs, an exception is then raised. As a result, infinite DFAs cannot be visualized.
This could be fixed by testing if dfa is None. VisualNFA is not affected since NFA does not define a __len__ method at the moment, but would fail if a similar method would be added to NFA.
Traceback (most recent call last):
File "/path/to/scratch_1.py", line 6, in <module>
VisualDFA(dfa).show_diagram(view=True)
File "/path/to/site-packages/visual_automata/fa/dfa.py", line 34, in __init__
if dfa:
File "/path/to/site-packages/automata/fa/dfa.py", line 160, in __len__
return self.cardinality()
File "/path/to/site-packages/automata/fa/dfa.py", line 792, in cardinality
raise exceptions.InfiniteLanguageException("The language represented by the DFA is infinite.")
automata.base.exceptions.InfiniteLanguageException: The language represented by the DFA is infinite.
The
VisualDFA
constructor checks thedfa
parameter usingvisual-automata/visual_automata/fa/dfa.py
Line 34 in 3ea0cdc
This checks if
dfa
is truthy. Since theDFA
class defines a__len__
method (and no__bool__
), is is truthy ifflen(dfa) != 0
. Unfortunately, the length checks thedfa
's cardinality, i.e., the size if the input language. For infinite-language DFAs, an exception is then raised. As a result, infinite DFAs cannot be visualized.This could be fixed by testing
if dfa is None
.VisualNFA
is not affected sinceNFA
does not define a__len__
method at the moment, but would fail if a similar method would be added toNFA
.MRE
Using most recent versions:
Expected Behavior
The automaton is shown.
Actual Behavior
Workaround
Manually copying the automaton works:
The text was updated successfully, but these errors were encountered: