FAdo.common
Common definitions for FAdo files
-
class AllWords(alphabet)[source]
Iterator thar generates all words of an alphabet in militar order
-
exception CFGerror[source]
-
exception CFGgrammarError(rule)[source]
-
exception CFGterminalError(size)[source]
-
exception CodesError(msg)[source]
-
exception CodingTheoryError(msg)[source]
-
exception DFAEmptyDFA[source]
-
exception DFAEmptySigma[source]
-
exception DFAFileError[source]
-
exception DFAFound(word)[source]
-
exception DFASyntaticError(line)[source]
-
exception DFAdifferentSigma[source]
-
exception DFAepsilonRedefinition[source]
-
exception DFAequivalent[source]
-
exception DFAerror[source]
-
exception DFAinputError(word)[source]
-
exception DFAmarkedError(sym)[source]
-
exception DFAnoInitial[source]
-
exception DFAnotComplete[source]
-
exception DFAnotMinimal[source]
-
exception DFAnotNFA(msg)[source]
-
exception DFAstateUnknown(stidx)[source]
-
exception DFAstopped[source]
-
exception DFAsymbolUnknown(sym)[source]
-
class Drawable[source]
Any FAdo object that is drawable
-
display(filename=None, size='30,20', strict=False, maxlblsz=6)[source]
Display automata using dot
- Parameters:
size – size of representation
filename – filename to use for the graphic representation (default a os tmpfile)
maxlblsz (int) – max size of labels before getting removed
strict (bool) – use limitations of label sizes
Changed in version 1.2.1.
-
abstract dotFormat(size='20,20', filename=None, direction='LR', strict=False, maxlblsz=6, sep='\n')[source]
Some dot representation
- Parameters:
-
Returns:
str:
-
dotLabel(lbl0)[source]
Label string
-
makePNG(filename=None, size='30,20')[source]
Produce png file to display
- Parameters:
-
- Returns:
name of the file created
-
exception DuplicateName(number)[source]
-
exception FAException[source]
-
exception FASiseMismatch[source]
-
exception FAdoError[source]
-
exception FAdoGeneralError(msg)[source]
-
exception FAdoNotImplemented[source]
-
exception FAdoSyntacticError[source]
-
exception GraphError(message)[source]
-
exception IllegalBias(msg)[source]
-
class Memoized(func)[source]
Decorator that caches a function’s return value each time it is called.
If called later with the same arguments, the cached value is returned, and not re-evaluated.
-
exception NFAEmpty(msg='')[source]
-
exception NFAerror(msg='')[source]
-
exception NImplemented[source]
-
exception NonPlanar[source]
-
exception NotSP[source]
-
exception PDAerror[source]
-
exception PDAsymbolUnknown(symb)[source]
-
exception PEGError(msg)[source]
-
exception ParRangError[source]
-
exception PropertyNotSatisfied(msg)[source]
-
class SPLabel(val=None)[source]
Label class for Serial-Paralel test algorithm
See also
Moreira & Reis, Fundamenta Informatica, ‘Series-Paralel automata and short regular expressions’, n.91 3-4,
pag 611-629
-
exception SSBadTransition[source]
-
exception SSError[source]
-
exception SSMissAlphabet[source]
-
exception TFAAccept[source]
-
exception TFAReject[source]
-
exception TFARejectBlocked[source]
-
exception TFARejectLoop[source]
-
exception TFARejectNonFinal[source]
-
exception TFASignal[source]
-
exception TRError[source]
-
exception TstError(message)[source]
-
class TwDict(fw=None)[source]
A class for dictionaries ‘both ways’
-
exception TypeError[source]
-
exception VersoError(msg)[source]
-
exception VertexNotInGraph[source]
-
class Word(data=None)[source]
Class to implement generic words as iterables with pretty-print
Basically a unified way to deal with words with caracters of sizes different of one with no much fuss
-
binomial(n, k)[source]
Exactly what it seems
- Parameters:
-
- Return type:
int
-
delFromList(l, l1)[source]
Delete every element of l1 from l
- Parameters:
-
-
dememoize(cls, method_name)[source]
Restore method of given class from Memoized state. Stored attributes will be removed.
-
exception fnhException[source]
-
forceIterable(x)[source]
Forces a non-iterable object into a list, otherwise returns itself
- Parameters:
x (list) – the object
- Returns:
object as a list
- Return type:
list
-
fromBase(n: list, b: int) → int[source]
Converts a number n in base b into an integer
- Parameters:
-
Returns: int
.. versionadded: 2.1.3
-
graphvizTranslate(s, strict=False, maxlblsz=6)[source]
Translate epsilons for graphviz
- Parameters:
-
- Return type:
str
-
homogeneousP(l)[source]
Is the list homogeneous?
- Parameters:
l (list) – list to be inspected
- Return type:
bool
-
inBase(n: int, base: int, tail=None) → list[source]
Writes the representation of a non-null natural in a base.
- Parameters:
n – number to conver
base – base to use
Returns: list of integers
-
lSet(s: set)[source]
returns the last element of a set
- Parameters:
s (set) – the set
- Returns:
the last element of the set
-
memoize(cls, method_name)[source]
Memoizes a given method result on instances of given class.
Given method should have no side effects. Results are stored as instance attributes — given parameters are
disregarded.
- Parameters:
-
-
exception notAcyclic[source]
-
overlapFreeP(word)[source]
- Returns True if word is overlap free, i.e, no proper and nonempty
prefix is a suffix
- Parameters:
word – the word
- Return type:
Boolean
-
pad(n: int, nu: list) → list[source]
Pads the given list nu to have the appropriate number of leading 0 up to size n
- Parameters:
n – number of algarisms
nu – list
-
padList(l: list, size: int) → list[source]
Pads the list l, with zeros, up to the size size
- Parameters:
-
- Returns:
the resulting list
- Return type:
list
-
exception regexpInvalid(word)[source]
-
exception regexpInvalidMethod[source]
-
exception regexpInvalidSymbols[source]
-
sConcat(x, y)[source]
CConcat words
- Parameters:
x – first word
y – second word
- Returns:
concatenation word
-
suffixes(word)[source]
Returns the list of proper suffixes of a word
- Parameters:
word (str) – the word
- Return type:
list
-
uSet(s: set)[source]
returns the first element of a set
- Parameters:
s (set) – the set
- Returns:
the first element of s
-
unifSzSubset(max: int) → int[source]
Returns a size uniformly distributed for a variable that behaves like a subset of a max element set.
- Parameters:
max (int) – max size to accept
- Returns:
the size
- Return type:
int
-
unique(l)[source]
Eliminate duplicates
- Parameters:
l (list) – source list
- Returns:
list wthout repetitions
- Return type:
lst
-
zeta(s: int | float, t=100) → float | complex[source]
Implementation of Riemman’s zeta function