zlebnik / mongo_filter_evaluator Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
d = {... any data will do ...}
f = {"$and": [{any first filter}, {}]
DataConditionEvaluator(f,d).evaluate()
Leads to stack overrun...recursive calls.
Describe what you were trying to get done.
In the automated building for filter conditions it is common to use a {} empty filter when one part of the generation does not apply vs. simply removing the filter from the $and condition itself. This way one can see that a filter was returned for that part of the and however, it was a empty filter which should pass. Thus the $and logic remains syntactically correct. For example, a user supplied filter on the left and a entitlement filter on the right. If the user is entitled to see everything then syntactically a {} may be used as a replacement.
Tell us what happened, what went wrong, and what you expected to happen.
Exception RuntimeError: maximum recursion depth exceeded
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
def test_filter_stream_and2e(self):
f = {'$and': [{'blah': 0.3}, {}]}
d = {u'blah': 0.3}
DataConditionEvaluator(f, d).evaluate()
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 52, in c_and
for condition in body
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 52, in
for condition in body
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 27, in evaluate
return self.evaluate_logic('$and', condition)
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/evaluator.py", line 98, in evaluate_logic
return getattr(self, 'c_%s' % keyword[1:])(body)
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 47, in c_and
for (condition_keyword, condition_body) in body.items()
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 47, in
for (condition_keyword, condition_body) in body.items()
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 36, in evaluate_condition
for op_keyword, op_body in body.items()
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/base.py", line 36, in
for op_keyword, op_body in body.items()
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/evaluator.py", line 103, in evaluate_function
value=body,
File "/usr/lib/python2.7/site-packages/mongo_filter_evaluator/evaluator.py", line 13, in wrap_method
return (field in self.data) and f(self, field, value)
RuntimeError: maximum recursion depth exceeded
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.