Releases: AlexandreDecan/portion
Releases · AlexandreDecan/portion
2.6.0 - pass_interval in combine
Added
- The
how
function ofcombine
can access the current interval ifpass_interval
is set (see #97).
2.5.0 - Combine IntervalDicts
Hotfix 2.4.2
Fixes import error in create_api
for Python 3.10+ (see #87)
Hotfix 2.4.1
Fix import error when using create_api
outside a REPL (see #85).
Specialized and customized intervals
Added
- An
AbstractDiscreteInterval
class to ease the creation of specialized discrete intervals (experimental). - A
create_api
function to generate an API similar to the one ofportion
but configured to use a given subclass ofInterval
(experimental, see Specialize & customize intervals).
Changed
- Speed up
repr
andto_string
forInterval
instances (see #76, adm271828). - Some internal changes to ease subclassing:
from_string
andfrom_data
accepts aklass
parameter to specify which class should be used to createInterval
instances (default isInterval
).- Add a
klass
parameter foropen
,closed
,openclosed
,closedopen
,singleton
andempty
(default isInterval
). - Add a
_klass
class attribute inIntervalDict
to specify how to createInterval
instances (default isInterval
). IntervalDict
usesself.__class__
to preserve subclasses when creating new instances.
2.3.1 - Hotfix for #75
Changed
- Speed up lookups in
IntervalDict
for non-interval keys. - Speed up
iterate
by no longer creating singleton instances under the hood. - Drop official support for Python 3.6.
Fixed
- Infinite recursion when a subclass of an
Interval
is compared using>
with anInterval
instance (see #75).
2.3.0
Added
- Support Python 3.10.
IntervalDict.as_dict
has an optionalatomic=False
parameter that, if set toTrue
, returns intervals that are atomic.- Experimental support for structural pattern matching (on
left
,lower
,upper
andright
).
Fixed
- (breaking) Set
list(P.empty()) == []
, i.e., the empty interval is a disjunction of no interval (see #72). - (breaking) For consistency, the empty interval is never
<
,>
,<=
, nor>=
when compared to another interval. - Comparing an interval and a value is deprecated since it is ill-defined when the value is on the left of
<=
or>=
. Convert values to singletons first.
2.2.0 - Subclassing & speed-ups
Added
- Support PEP 517.
Changed
- Some internal changes to ease subclassing
Interval
(see #58):- Use
self.__class__
instead ofInterval
to create new instances; - Deprecate and move
mergeable
function toInterval._mergeable
class method; Interval.from_atomic
is now a class method instead of a static method.
- Use
- Speed up lookups in
IntervalDict
(#65, Jeff Trull). - Speed up removals in
IntervalDict
. - Speed up intersection for non-overlapping intervals (#66, Jeff Trull).
- Speed up
.overlaps
and.contains
for non-overlapping intervals/items.
Hot fix for `from_string`
Fixed
from_string
raises aValueError
if given string cannot be parsed to an interval (#57).
Changed
- Drop official support for Python 3.5.
- Use
black
as official code formatting.
Intervals in pandas & consistent slices
Fixes:
- Getting items from an
Interval
using a slice does no longer return alist
but anInterval
instance. - Intervals are properly pretty-printed by
pandas
(#54).