pathex.expressions.expression module
Expressions abstract base class
- Module
pathex.expressions.expression
- class Expression[source]
Bases:
abc.ABCExpressions abstract base class.
In PathEx objects of any other kind different from
Expressionare interpreted as an identity terminal expression.Expressionis meant to grouping those kind of expressions that has a special meaning and to provide general methods and Python operator overloading.- get_eager_generator(self, machine: pathex.generation.machines.machine.Machine | None = None, word_type: type[T] = ListWrapper, complete_words: bool = True) Generator[T, None, None][source]
Gives a generator of
CollectionWrapperobject that represent the words generated by the expression.This method is meant as a handy shortcut for
words_generator(self, machine, word_type, complete_words).machineis The machine to be used to interpret the expression. If it isNonethen an instance ofExtendedMachineCompalphabetwill be used. Defaults toNone.word_typeis aCollectionWrappersubtype that will be the type of collection to be used to represent words. Defaults toListWrapper.complete_wordsis a flag indicating if only complete words are to be given. Defaults toTrue.
- get_generator(machine: pathex.generation.machines.machine.Machine | None = None) WordsGenerator[source]
Gives a
WordsGeneratorwith default values for the actual expression.This method is meant as a handy shortcut for
WordsGenerator(expression, machine).machineis the machine to be used to interpret the expression. If it isNonethen an instance ofExtendedMachineCompalphabetwill be used. Defaults toNone.
- get_language(language_type: type[T] = SetWrapper, machine: pathex.generation.machines.machine.Machine | None = None, word_type: type[CollectionWrapper] = ListWrapper, complete_words: bool = True) T[source]
Gives a
CollectionWrapperobject that containsCollectionWrapperobjects that represent the words generated by the expression.language_typeis a subtype ofCollectionWrapperthat will be used as the type of the object to be returned. Defaults toSetWrapper.machineis the machine to be used to interpret the expression. If it isNonethen an instance ofExtendedMachineCompalphabetwill be used. Defaults toNone.word_typeis aCollectionWrappersubtype that will be the type of collection to be used to represent words. Defaults toListWrapper.complete_wordsis a flag indicating if only complete words are to be given. Defaults toTrue.