[Subversion] / PEAK-Rules / peak / rules / indexing.py  

Log of /PEAK-Rules/peak/rules/indexing.py

Parent Directory

No default branch
Bookmark a link to HEAD: (view) (download) (as text)


Revision 2767 - (view) (download) (as text) - [select for diffs]
Modified Thu Apr 9 17:22:19 2015 UTC (9 years, 1 month ago) by pje
File length: 14117 byte(s)
Diff to previous 2747
Fix 3.x frozenset repr for tests

Revision 2747 - (view) (download) (as text) - [select for diffs]
Modified Sat Apr 4 06:10:47 2015 UTC (9 years, 1 month ago) by pje
File length: 13951 byte(s)
Diff to previous 2741
Python 3 compatibility: map and iteritems

Revision 2741 - (view) (download) (as text) - [select for diffs]
Modified Sat Apr 4 03:20:35 2015 UTC (9 years, 1 month ago) by pje
File length: 13945 byte(s)
Diff to previous 2679
Remove unnecessary import

Revision 2679 - (view) (download) (as text) - [select for diffs]
Modified Wed Aug 18 05:05:36 2010 UTC (13 years, 8 months ago) by pje
File length: 13975 byte(s)
Diff to previous 2678
Fix broken indexing for "is not" conditions (especially "and"-ed ones)

Revision 2678 - (view) (download) (as text) - [select for diffs]
Modified Wed Aug 18 03:10:22 2010 UTC (13 years, 8 months ago) by pje
File length: 13575 byte(s)
Diff to previous 2600
Simplified class indexing strategy so that ABCs and other 2.6+ classes 
using __subclasscheck__/__subclasshook__ should work correctly without
any special treatment.  (The tradeoff is worse worst-case performance
when not-yet-indexed classes are added to rules or seen during
dispatching.)

Revision 2600 - (view) (download) (as text) - [select for diffs]
Modified Wed Jul 15 04:30:57 2009 UTC (14 years, 10 months ago) by pje
File length: 15977 byte(s)
Diff to previous 2566
Fix for Python 2.6 DeprecationWarning

Revision 2566 - (view) (download) (as text) - [select for diffs]
Modified Tue Jul 15 16:49:02 2008 UTC (15 years, 9 months ago) by pje
File length: 15991 byte(s)
Diff to previous 2557
Refactor condition negation by adding negate() GF, dropping
truth mode from builders, and adding an OrElse sequential-or
operator.  This also changed how Truth tests are coded, to use
Value(True, T/F) objects in place of bools (to get rid of the
ambiguity that previously existed).  Value(x, False) objects
no longer have disjuncts, since that was another ambiguity.
These ambiguities meant that you couldn't cleanly take the
disjuncts() of a Test(), which meant you also couldn't negate
a test safely.  We also no longer force Signature() objects
to expand Test disjunctions, as this isn't necessary for
DNF handling.  (Because we're going to grab the disjuncts()
at rule-add time anyway -- eager expansion was an unnecessary
holdover from the way RuleDispatch did things.)  See also:

 http://www.eby-sarna.com/pipermail/peak/2008-July/003000.html

for more background on the reasoning behind these changes.

Revision 2557 - (view) (download) (as text) - [select for diffs]
Modified Wed Jun 25 14:47:38 2008 UTC (15 years, 10 months ago) by pje
File length: 15950 byte(s)
Diff to previous 2551
Fix "not isinstance" criteria, broken by last refactoring due to
inadequate test coverage.  :(

Revision 2551 - (view) (download) (as text) - [select for diffs]
Modified Thu Jun 12 02:05:33 2008 UTC (15 years, 11 months ago) by pje
File length: 15657 byte(s)
Diff to previous 2550
Add some tests of mixed istype/class indexing.  (Also,
a slight refactoring of TypeIndex.add_class.)

Revision 2550 - (view) (download) (as text) - [select for diffs]
Modified Thu Jun 12 00:34:29 2008 UTC (15 years, 11 months ago) by pje
File length: 15677 byte(s)
Diff to previous 2547
Massive overhaul of the indexing system, to simplify custom
indexing and fully support istype() criteria in instance/subclass
nodes.

Revision 2547 - (view) (download) (as text) - [select for diffs]
Modified Wed Jun 11 16:51:06 2008 UTC (15 years, 11 months ago) by pje
File length: 14409 byte(s)
Diff to previous 2499
Preliminary istype() support for predicate dispatch.
This is just the necessary compiler support for translating expressions
of the form ``type(x) is y`` and ``x in istype(y)``, some support for
istype() implication/intersection with Class criteria, and a bit of 
cleanup/refactoring of the indexing code.

NOT supported: mixing istype() and Classes...  or actually indexing 
istype() criteria.  The entire BitmapIndex system is going to have to be 
refactored in order to fully fix this.  :(  On the bright side, that 
will let me clean up a bunch of other index-related cruft, too.

Revision 2499 - (view) (download) (as text) - [select for diffs]
Modified Tue Feb 26 15:25:51 2008 UTC (16 years, 2 months ago) by pje
File length: 13842 byte(s)
Diff to previous 2495
Drop unnecessary attributes from BitmapIndex

Revision 2495 - (view) (download) (as text) - [select for diffs]
Modified Sun Feb 10 05:07:47 2008 UTC (16 years, 3 months ago) by pje
File length: 13894 byte(s)
Diff to previous 2494
Oops - during testing I commented out part of the fix for
an indexing bug.

Revision 2494 - (view) (download) (as text) - [select for diffs]
Modified Sun Feb 10 05:04:02 2008 UTC (16 years, 3 months ago) by pje
File length: 13896 byte(s)
Diff to previous 2493
Fix not getting disjuncts of 'not x' rules (bug reported
by R.D. Murray)

Revision 2493 - (view) (download) (as text) - [select for diffs]
Modified Fri Jan 25 14:56:45 2008 UTC (16 years, 3 months ago) by pje
File length: 13898 byte(s)
Diff to previous 2481
Fix range indexes not handling > cases correctly if there
are no other conditions in the index for the same value.
(Reported by Alberto Valverde.)

Revision 2481 - (view) (download) (as text) - [select for diffs]
Modified Sun Jan 13 17:26:02 2008 UTC (16 years, 4 months ago) by pje
File length: 13803 byte(s)
Diff to previous 2467
Fix selectivity problems with Truth and ==
comparisons that were ending up with branches==1,
leading to incorrect dispatch trees.  (The number
of branches should never be 1 in a correct index.)

Revision 2467 - (view) (download) (as text) - [select for diffs]
Modified Mon Dec 31 16:56:05 2007 UTC (16 years, 4 months ago) by pje
File length: 13780 byte(s)
Diff to previous 2463
String parsing and auto-upgrade of existing GFs!
Two major caveats, though: subexpression ordering
is not enforced, and subexpression calculation
caching is temporarily disabled, due to problems
with the stack trickery used in dispatching.  But
the basic engine is now working correctly.

Revision 2463 - (view) (download) (as text) - [select for diffs]
Modified Mon Dec 31 05:21:37 2007 UTC (16 years, 4 months ago) by pje
File length: 13890 byte(s)
Diff to previous 2458
Centralize the 2.3-compatibility code, fixup some missing
__all__ entries.

Revision 2458 - (view) (download) (as text) - [select for diffs]
Modified Sun Dec 30 20:14:46 2007 UTC (16 years, 4 months ago) by pje
File length: 13756 byte(s)
Diff to previous 2456
Separate memoization from builder state, drop build_root
method and go back to using Ordering(builder,expr) directly
for detecting ordering.  This lets us reuse the same builder
for different trees, as long as all the build state is kept
in the memo.

Revision 2456 - (view) (download) (as text) - [select for diffs]
Modified Sun Dec 30 15:32:41 2007 UTC (16 years, 4 months ago) by pje
File length: 13959 byte(s)
Diff to previous 2455
Index reseeding, classic MROs, enhanced "abstract", and 
smart engine recreation (w/unsubscribe).

Revision 2455 - (view) (download) (as text) - [select for diffs]
Modified Sat Dec 29 22:46:24 2007 UTC (16 years, 4 months ago) by pje
File length: 13537 byte(s)
Diff to previous 2452
Index refactoring: allow TreeBuilder subclasses to define how
expression-ordering is done, adjust ``BitmapIndex.seed_bits()``
and ``split_ranges`` to work better together and be a basis
for more complex dispatch node building.

Revision 2452 - (view) (download) (as text) - [select for diffs]
Modified Sat Dec 29 18:49:31 2007 UTC (16 years, 4 months ago) by pje
File length: 13391 byte(s)
Diff to previous 2426
Thread-safety and re-entrant code generation, such that calling a
function that is being regenerated will execute the previous code
for that function.  Simplified Engine protocols for code generation,
etc.

Revision 2426 - (view) (download) (as text) - [select for diffs]
Modified Wed Nov 21 19:59:35 2007 UTC (16 years, 5 months ago) by pje
File length: 13392 byte(s)
Diff to previous 2418
Switch to using peak.util.extremes

Revision 2418 - (view) (download) (as text) - [select for diffs]
Modified Sun Nov 11 22:59:25 2007 UTC (16 years, 6 months ago) by pje
File length: 13362 byte(s)
Diff to previous 2315
Changed to use AddOns instead of Aspects.

Revision 2315 - (view) (download) (as text) - [select for diffs]
Modified Sun Jun 24 18:57:34 2007 UTC (16 years, 10 months ago) by pje
File length: 13338 byte(s)
Diff to previous 2313
Improve the robustness of the core bootstrapping process, and flesh out
the ``Engine`` abstract base class a bit.  RuleSets now generate actions
using ``disjunct()``, so they should work with the predicate system now.
``overrides()`` for methods is now distinct from ``implies()``, as that
lowers the self-referentiality complexity just a bit.  :)  Also, it
paves the way to creating a less error-prone way of haing inter-
methodtype priorities (e.g. Around vs. Before/After, etc.).

Revision 2313 - (view) (download) (as text) - [select for diffs]
Modified Sun Jun 24 02:05:15 2007 UTC (16 years, 10 months ago) by pje
File length: 13242 byte(s)
Diff to previous 2312
PEAK-Rules is now as "smart" as RuleDispatch, in that it now
"knows" as much as RuleDispatch does about logical conditions
regarding Python objects, and how to index them efficiently.
The machinery is also better documented (and probably better
tested) than the equivalent bits of RuleDispatch.

Alas, this does not mean that you can actually use Python
expressions for generic function criteria yet, as the actual
tree builder/interpreter hasn't been written.  So we can
evaluate and index expressions, but not build them from an AST
or build/run a dispatch tree from the indexes.  Still, it's
getting *really* close now!

Revision 2312 - (view) (download) (as text) - [select for diffs]
Modified Thu Jun 21 13:52:46 2007 UTC (16 years, 10 months ago) by pje
File length: 9789 byte(s)
Diff to previous 2311
Move actual criterion types to peak.rules.criteria, which is also where
predicate/signature logic and criteria implication/intersection will
live.

Revision 2311 - (view) (download) (as text) - [select for diffs]
Modified Thu Jun 21 13:20:30 2007 UTC (16 years, 10 months ago) by pje
File length: 11991 byte(s)
Diff to previous 2310
Refactor ``seeds_for()`` to make its methods simpler to implement.

Revision 2310 - (view) (download) (as text) - [select for diffs]
Modified Thu Jun 21 03:16:13 2007 UTC (16 years, 10 months ago) by pje
File length: 11813 byte(s)
Diff to previous 2308
Implement indexing for is/not and </>/==/!= conditions, and general
bitmap-based index facility.  (Still needs class indexing to achieve
parity with the comparable parts of RuleDispatch, but it's getting
close.)

Revision 2308 - (view) (download) (as text) - [select for diffs]
Modified Tue Jun 12 04:51:21 2007 UTC (16 years, 11 months ago) by pje
File length: 4405 byte(s)
Diff to previous 2201
Added Aspects (ala PEP 3124) and refactor to use them in place of special
methods.  Refactor indexes to be aspects of an engine.  Improved handling
for the self-referential bootstrapping of the implies() generic function.

Revision 2201 - (view) (download) (as text) - [select for diffs]
Added Mon Jul 3 23:25:26 2006 UTC (17 years, 10 months ago) by pje
File length: 3110 byte(s)
Added a generic version of the Chambers & Chen algorithm, with tests.  
Unlike the RuleDispatch implementation, this one doesn't care how 
indexes or criteria or expressions actually work, and it has a much 
simpler way of dealing with inter-expression constraints.  The tree 
building algorithm can also be easily revised to produce any kind of 
dispatch tree, either eagerly or lazily, and whether in the form of 
bytecode, source code, or an actual object tree.  (RuleDispatch only 
supports lazy creation of an object tree; it can't do anything else.)

Of course, this core algorithm is useless without some concrete types to 
represent expressions, criteria, and indexes -- not to mention some 
actual tree-generating code to go along with it.  But this algorithm for
generating decision trees will be at the heart of the main rule engine 
for predicate dispatching.

At this point, about 2/3rds of the code in the ``dispatch.functions``
module of RuleDispatch has been mapped to ``peak.rules.core`` and 
``peak.rules.indexing``.  About 1/6th of ``dispatch.strategy`` has also
been translated.  ``dispatch.ast_builder`` will not require any code
changes, but it will probably get some new tests.  The remaining modules,
however, (including ``strategy``, ``combiners``, and  ``predicates``)
will be changed substantially.

The good news is that these changes should mostly be simplifications, 
since most of the ``predicates`` module will become calls to 
BytecodeAssembler APIs.  But the remaining parts of ``strategy`` and 
``functions`` will likely become more complex, because they will need 
to know how to generate decision-making bytecode, deal with rule 
removals, and a few other odds and ends.  Some additional code will also 
be needed to ensure that the core implementation is sufficiently 
extensible to allow new features (like predicate abstractions and 
classifiers) to be implemented.

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

  Diffs between and
  Type of Diff should be a

Sort log by:

cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help