Changes¶
asq v.next¶
- Adds a convenience alias for
asq.initiators.query
asasq.query
.
asq 1.3¶
There are several minor breaking API changes in this release. Please read carefully more details:
- Re-assigns copyright from Robert Smallshire to Sixty North AS.
- Adds
select_with_correspondence()
query method.- Renames the
indexedelement
module tonamedelements
.- Renames the second element of
IndexedElement
fromelement
tovalue
.- Adds the
KeyedElement
namedtuple
to thenamedelements
module.KeyedElement
has two elements calledkey
andvalue
.- Queryable.to_dictionary() no longer raises an exception if the key_selector produces duplicate keys. Instead, the values associated with later keys overwrite those produced by earlier keys. This weakening of the to_dictionary() constract allows us to maintain Liskov subsstitutability in light of the specialised default key and value selectors for the overrides of
to_dictionary()
provided for theLookup
andGrouping
classes. (See the next two changes for more details).- Less surprising behaviour for
Lookup.to_dictionary()
: The default key and value selectors forLookup.to_dictionary()
are overidden, so that the produced dictionary contains a single item for eachGrouping
such that the key of each item is the key of the correspondingGrouping
and the value of the item is a list of the elements from theGrouping
.- Less surprising behaviour for
Grouping.to_dictionary()
: The default key and value selectors forGrouping.to_dictionary()
are overidden, so that the produced dictionary contains a single item, such that the key of the item is the key of theGrouping
and the value of the item is alist
containing the elements from theGrouping
.
asq 1.2.1¶
- Fixes a problem in setup.py that prevented installation on Python 2.
asq 1.2¶
- The default selector for select_with_index() now produces a new IndexedElement object for each type which is a namedtuple. As IndexedElement is a tuple this change is backwards compatibile, but now the more readable item.index and item.element attributes can be used instead of accessing via indexes zero and one.
asq 1.1¶
The selector factories k_(), a_() and m_() have much faster implementations because they are now simply aliases for itemgetter, attrgetter and methodcaller from the Python standard library operator module. As a result, even though they remain backwards API compatible with those in asq 1.0 their capabilities are also extended somewhat:
- k_ can optionally accept more than one argument (key) and if so, the selector it produces will return a tuple of multiple looked-up values rather than a single value.
- a_ can optionally accept more than one argument (key) and if so, the selector it produces will return a tuple of multiple looked-up values rather than a single value. Furthermore, the attribute names supplied in each argument can now contain dots to refer to nested attributes.
Added asq.selectors.make_selector which will create a selector directly from a string or integer using attribute or item lookup respectively.
asq 1.0¶
Huge correctness and completeness changes for 1.0 since 0.9. The API now has feature equivalence with LINQ for objects with 100% test coverage and complete documentation.
The API has been very much reorganised with some renaming of crucial functions. The important asq() function is now called query() to prevent a clash with the package name itself and is found in the asq.initiators package.
For common asq usage you now need to do:
from asq.initiators import query
a = [1, 2, 3]
query(a).select(lambda x: x*x).to_list()
to get started. For more than that, consult the documentation.