Skip to content

Commit

Permalink
bump version to 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mscarey committed Apr 8, 2021
1 parent beb4d3f commit 0b0ac22
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
14 changes: 14 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
Changelog
=========
0.4.0 (2021-04-08)
------------------
- Fact constructor accepts truth param
- allow alternate methods to specify context for .implies()
- add string expansion to ContextRegister.from_lists
- all Explanation.from_context calls expand strings
- disallow repeated Terms in TermSequence
- fix bug: _context_registers method yielded same ContextRegister repeatedly
- add DuplicateTermError
- fix bug: FactorGroup.union used duplicative TermSequence
- ContextRegister.from_lists works with unequal length lists
- add contradicts_same_context method
- add repr method for subclasses of Comparable to inherit

0.3.0 (2021-03-19)
------------------
- add FactorMatch NamedTuples to be listed in Explanation
Expand Down
2 changes: 1 addition & 1 deletion nettlesome/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
from .quantities import Comparison, DateRange, NumberRange, UnitRange
from .statements import Statement

__version__ = "0.3.0"
__version__ = "0.4.0"
2 changes: 1 addition & 1 deletion nettlesome/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def _add_group(self, other: FactorGroup) -> FactorGroup:
def add(
self,
other: Union[FactorGroup, Sequence[Factor], Factor],
context: Optional[Union[ContextRegister, Explanation]] = None,
) -> Optional[FactorGroup]:
"""Combine all Factors into a single FactorGroup."""
if isinstance(other, self.__class__):
return self._add_group(other)
to_add = self.__class__(other)
Expand Down
5 changes: 5 additions & 0 deletions nettlesome/terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,7 @@ def factor_pairs(self) -> Iterator[Tuple[Term, Term]]:
yield (self.get_reverse_factor(value), value)

def means(self, other: ContextRegister) -> bool:
"""Determine if self and other have the same Factor matches."""
if not isinstance(other, ContextRegister):
return False
for key, value in self.factor_pairs():
Expand Down Expand Up @@ -1407,6 +1408,7 @@ def short_string(self) -> str:

@property
def key(self) -> str:
"""Make a key for storing the FactorMatch in a dict."""
return self.short_string

def __str__(self):
Expand Down Expand Up @@ -1477,6 +1479,7 @@ def from_context(
return Explanation(reasons=[], context=context or ContextRegister())

def means(self, other: Explanation) -> bool:
"""Test if both Explanations have the same context and reasons."""
if not isinstance(other, Explanation):
return False
if not self.context.means(other.context):
Expand Down Expand Up @@ -1627,6 +1630,8 @@ def recursive_terms(self) -> Dict[str, Term]:


class DuplicateTermError(Exception):
"""Error indicating a TermSequence contains the same Term more than once."""

pass


Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]

name = nettlesome
version = 0.3.0
version = 0.4.0
author= Matt Carey
author_email = [email protected]
description = simplified semantic reasoning
Expand Down

0 comments on commit 0b0ac22

Please sign in to comment.