Factor Groups¶
Factors to be used together in a comparison.
The inputs, outputs, and despite
Factor
s of aProcedure
should be FactorGroups.Find whether two sets of
Factor
s can be consistent.Works by first determining whether one
Factor
potentiallycontradicts()
another, and then determining whether it’s possible to make context assignments match between the contradictoryFactor
s.- Parameters
other (
Optional
[Comparable
]) –context (
Optional
[ContextRegister
]) – correspondences between :class:`Factor`s in self and other that can’t be changed in seeking a way to interpret the groups as consistent
- Return type
- Returns
whether unassigned context factors can be assigned in such a way that there’s no contradiction between any factor in
self_factors
andother_factors
, given that someFactor
s have already been assigned as described bymatches
.
Find whether two sets of
Factor
s can be contradictory.- Parameters
other (
ComparableGroup
) – a second set ofFactor
s with context factors that are internally consistent, but may not be consistent withself_factors
.context (
Optional
[ContextRegister
]) – correspondences between :class:`Factor`s in self and other that can’t be changed in seeking a contradiction
- Return type
- Returns
whether any
Factor
assignment can be found that makes aFactor
in the output ofother
contradict aFactor
in the output ofself
.
Find ways for two unordered sets of
Factor
s to satisfy a comparison.All of the elements of other need to fit the comparison. The elements of self don’t all need to be used.
- Parameters
context – a mapping of
Factor
s that have already been matched to each other in the recursive search for a complete group of matches. Usually starts empty when the method is first called.still_need_matches (
Sequence
[Factor
]) –Factor
s that need to satisfy the comparisoncomparison
with someFactor
ofavailable
for the relation to hold, and have not yet been matched.matches (
Optional
[ContextRegister
]) – aContextRegister
matching genericFactor
s
- Yields
context registers showing how each
Factor
inneed_matches
can have the relationcomparison
with someFactor
inavailable_for_matching
, with matching context.- Return type
Iterator
[ContextRegister
]
Search of
self
andself
’s attributes forFactor
with specifiedname
.- Return type
- Returns
a
Factor
with the specifiedname
attribute if it exists, otherwiseNone
.
Search of
self
andself
’s attributes forFactor
with specified string.
Find ways for two unordered sets of
Factor
s to satisfy a comparison.All of the elements of other need to fit the comparison. The elements of self don’t all need to be used.
- Parameters
context – a mapping of
Factor
s that have already been matched to each other in the recursive search for a complete group of matches. Usually starts empty when the method is first called.still_need_matches (
Sequence
[Factor
]) –Factor
s that need to satisfy the comparisoncomparison
with someFactor
ofavailable
for the relation to hold, and have not yet been matched.explanation (
Optional
[Explanation
]) – anExplanation
showing whichFactor
s listed in the FactorGroups were matched to each other, and also including aContextRegister
.
- Yields
context registers showing how each
Factor
inneed_matches
can have the relationcomparison
with someFactor
inavailable_for_matching
, with matching context.- Return type
Generate
ContextRegister
s that cause self to imply other.If self is absent, then generate a ContextRegister from other’s point of view and then swap the keys and values.
- Return type
Factor
s that can be replaced without changingself
s meaning.- Return type
Dict[str, Comparable]
- Returns
a
list
made from adict
withself
’s genericFactor
s as keys andNone
as values, so that the keys can be matched to another object’sgeneric_factors
to perform an equality test.
Reduce group by removing redundant members implied by other members.
- Return type
- Returns
new group with any redundant items remomved
Check for contradictions among the Factors in self.
- Return type
- Returns
bool indicating whether self is internally consistent
Create new
Comparable
, replacing keys ofchanges
with values.- Parameters
changes (
ContextRegister
) – hasComparable
s to replace as keys, and has their replacements as the corresponding values.- Return type
- Returns
a new
Comparable
object with the replacements made.