The abstract base classes previously defined in 'collections' were moved
to 'collections.abc' in 3.3. The aliases will be removed in 3.10.
Preempt this change now with a simple find-replace:
$ ag -l 'collections.($TYPES)' | \
xargs sed -i 's/\(collections\)\.\($TYPES\)/\1.abc.\2/g'
Where $TYPES is the list of moved ABCs from [1].
[1] https://docs.python.org/3/library/collections.abc.html
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Change-Id: Ib07d778a01275d7c985e059156e95abc112e81c8
assertItemsEqual was removed from Python's unittest.TestCase in
Python 3.3 [1][2]. We have been able to use them since then, because
testtools required unittest2, which still included it. With testtools
removing Python 2.7 support [3][4], we will lose support for
assertItemsEqual, so we should switch to use assertCountEqual.
[1] - https://bugs.python.org/issue17866
[2] - https://hg.python.org/cpython/rev/d9921cb6e3cd
[3] - testing-cabal/testtools#286
[4] - testing-cabal/testtools#277
Change-Id: I1591e8603262d377d8e0801af152928787374e79
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.
Fix problems found.
Update local hacking checks for new flake8.
Change-Id: Idffc923ac339978714001be22e3c9ef285e907f5
The behaviour of the groupBy() function was fixed in 1.1.2 by
3fb9178401 to pass only the list of values
to be aggregated to the aggregator function, instead of passing both the
key and the list of values (and expecting both the key and the
aggregated value to be returned). This fix was incompatible with
existing expressions that used the aggregator argument to groupBy().
In the event of an error, fall back trying the previous syntax and see
if something plausible gets returned. If not, re-raise the original error.
This should mean that pre-existing expressions will continue to work,
while most outright bogus expressions should fail in a manner consistent
with the correct definition of the function.
Change-Id: Ic6c54be4ed99003fe56cf1a5329f3f1d84fd43c8
Closes-Bug: #1750032
The change e693e6ecef added slots to the
concrete classes in yaqltypes, however the abstract parent classes
HiddenParameterType and LazyParameterType were omitted, with the result
that their derived types would still contain an __dict__ attribute.
Change-Id: I8e7335ced58b06cfd0de81ceb721dc2f8396f85f
* now it is possible to pass one or more YAQL expressions in command line.
This also disables interactive mode
* input file name can be specified as "-" to read from stdin
* added option to treat input as a string rather than JSON
* added option to treat input as an array (strings or JSONs)
* added option to output result in Python format rather than JSON
* removed redundant code that left from yaql v0.2
* print error messages to stderr rather than stdout
Change-Id: Ieb1037bc2ba59c2d2360edc4ac9b414e62a0cc79
'yaql.convertInputData' and 'yaql.convertOutputData' engine
options were added. By setting them to false one can suppress
input or output data conversion. For the input data this will prevent
yaql from converting mutable data structures (lists, dicts, sets) to
their immutable versions, which will break some of the constructs that
require hashable structures (for example set of lists, or list as a
dictionary key), for the output it will not expand produced iterators
and not convert tuples to lists. However this can greatly improve
performance in some cases
Change-Id: I240ce6646fe7dbc9522624739600b6c364bb9618
- documenter script functionality was merged
into sphinx extension
- heavy refactoring of the documenter code
- grouping of overload methods in documentation
- several minor fixes in doc strings
Change-Id: I9bccd6b1ff1750d966d8c39558d204fcaa4ad185
- Sphinx extension to generate YAQL autodoc was written
- Added option not to generate package header for the
YAQL doc-strings -> RST generator
Change-Id: I63020ea1fc2cb10f18d7d6bbc6ad33a62b846f6c
Collectively, these types are fairly common in the context (about 400 in
the default context). Defining __slots__ for them so that they don't
need a __dict__ object to store attributes results in a fairly
inconsequential saving of memory with the default context, but likely
could result in significant savings depending on the amount of data yaql
is operating on.
Change-Id: Iaae6b48672a3293f3920125347835a100883ea76
These are the two most common types of object in a yaql context (about
800 exist in the default context). Defining __slots__ for them so that
they don't need a __dict__ object to store attributes results in a
modest saving of memory (around 10% of the default context).
Change-Id: I5c7027bcd48a1f2282a369c1469107d2ab9c5083
groupBy method accepts `aggregator`
parameter which is supposed to be
a function to aggregate value withing each group
but instead it was applied to the whole group list
Change-Id: Ic38bbe7bed7c624aa3e17f5f4ed4708fc216c278
Closes-Bug: #1626234
I'd like to use the regex replace interface to do a pattern
substitution, and couldn't find any docs or tests illustrating
how to do it when using backreferences, so adding this test
which proves it works and provides an example for other folks
trying to do this.
Change-Id: Ibbda3cac83955ae6ed6a32a2d51e0fb511220d7a
The thrown error for single() method in case of collection to
have more than one element should be StopIteration unlike ValueError,
for consistency with other code.
Change-Id: Ib55b04c7c0a5b2afcd7db118e0291c9aa4e46858