launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07558
[Merge] lp:~wallyworld/launchpad/move-storm-expressions into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/move-storm-expressions into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/move-storm-expressions/+merge/104538
Simply move some storm classes to lp.services.database.stormexpr.py
They were defined in lp.bug.model.structuralsubscription.py but need to be with the rest of their friends so they can be reused.
The classes are: 'ArrayAgg', 'ArrayContains', 'ArrayIntersects'
== Lint ==
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/bugs/model/structuralsubscription.py
lib/lp/services/database/stormexpr.py
./lib/lp/bugs/model/structuralsubscription.py
899: E261 at least two spaces before inline comment
--
https://code.launchpad.net/~wallyworld/launchpad/move-storm-expressions/+merge/104538
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/move-storm-expressions into lp:launchpad.
=== modified file 'lib/lp/bugs/model/structuralsubscription.py'
--- lib/lp/bugs/model/structuralsubscription.py 2012-01-04 17:46:45 +0000
+++ lib/lp/bugs/model/structuralsubscription.py 2012-05-03 12:02:20 +0000
@@ -18,12 +18,10 @@
from storm.base import Storm
from storm.expr import (
And,
- CompoundOper,
Count,
In,
Join,
LeftJoin,
- NamedFunc,
Not,
Or,
Select,
@@ -86,6 +84,11 @@
from lp.services.database.lpstorm import IStore
from lp.services.database.sqlbase import quote
from lp.services.propertycache import cachedproperty
+from lp.services.database.stormexpr import (
+ ArrayAgg,
+ ArrayContains,
+ ArrayIntersects,
+ )
class StructuralSubscription(Storm):
@@ -687,24 +690,6 @@
return subscribers
-class ArrayAgg(NamedFunc):
- "Aggregate values (within a GROUP BY) into an array."
- __slots__ = ()
- name = "ARRAY_AGG"
-
-
-class ArrayContains(CompoundOper):
- "True iff the left side is a superset of the right side."
- __slots__ = ()
- oper = "@>"
-
-
-class ArrayIntersects(CompoundOper):
- "True iff the left side shares at least one element with the right side."
- __slots__ = ()
- oper = "&&"
-
-
def _get_structural_subscription_filter_id_query(
bug, bugtasks, level, direct_subscribers):
"""Helper function.
=== modified file 'lib/lp/services/database/stormexpr.py'
--- lib/lp/services/database/stormexpr.py 2012-04-20 19:38:28 +0000
+++ lib/lp/services/database/stormexpr.py 2012-05-03 12:02:20 +0000
@@ -5,6 +5,9 @@
__all__ = [
'AdvisoryUnlock',
'Array',
+ 'ArrayAgg',
+ 'ArrayContains',
+ 'ArrayIntersects',
'Concatenate',
'CountDistinct',
'Greatest',
@@ -15,6 +18,7 @@
from storm.expr import (
BinaryOper,
ComparableExpr,
+ CompoundOper,
compile,
EXPR,
Expr,
@@ -87,3 +91,21 @@
args = compile(array.args, state)
state.pop()
return "ARRAY[%s]" % args
+
+
+class ArrayAgg(NamedFunc):
+ "Aggregate values (within a GROUP BY) into an array."
+ __slots__ = ()
+ name = "ARRAY_AGG"
+
+
+class ArrayContains(CompoundOper):
+ "True iff the left side is a superset of the right side."
+ __slots__ = ()
+ oper = "@>"
+
+
+class ArrayIntersects(CompoundOper):
+ "True iff the left side shares at least one element with the right side."
+ __slots__ = ()
+ oper = "&&"
Follow ups