Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(58)  |  Call(54)  |  Derive(0)  |  Import(4)

src/x/o/xotl.ql-0.2.1dev/tests/test_this_queries.py   xotl.ql(Download)
from xoutil.proxy import UNPROXIFING_CONTEXT, unboxed
 
from xotl.ql import this
from xotl.ql.core import these, provides_any
from xotl.ql.interfaces import IQueryObject
                  limit=100)
        # We assume that Person has been thesefied with thesefy('Person')
        who = domain = this('Person')
        q1 = these(w for w in domain
                   if is_instance(w, Person)
            def __iter__(self):
                from xoutil.objects import nameof
                return iter(this(nameof(self)))
 
        @thesefy("Person")
        class Person(object):
            __metaclass__ = Meta
 
        q = these(who for who in Person if who.age > 30)
        q1 = these(who for who in this('Person') if who.age > 30)
def test_most_basic_query():
    query = these(parent for parent in this('parent') if parent.age > 40)
    assert provides_any(query, IQueryObject)
    # Since the query selects a single object, a single object must be
    # placed as the selection (not a tuple!).

src/x/o/xotl.ql-0.2.1dev/tests/test_translation_utils.py   xotl.ql(Download)
from xoutil.proxy import UNPROXIFING_CONTEXT
 
from xotl.ql import this, these, thesefy
from xotl.ql.translation import get_term_path, get_term_signature
from xotl.ql import translation
def test_get_term_signature():
    assert get_term_signature(this.a) == ((), (None, 'a'))
 
    query = these(child
                  for parent in this('parent')

src/x/o/xotl.ql-0.2.1dev/tests/test_design_decision.py   xotl.ql(Download)
from xoutil.proxy import UNPROXIFING_CONTEXT, unboxed
 
from xotl.ql import this
from xotl.ql.core import these, QueryParticlesBubble
from xotl.ql.expressions import EXPRESSION_CONTEXT
 
    # TODO: Document how to obtain the queries
    qs = (a for i in range(3) for b in this('b' + str(i)) for a in b.a)
    for i in range(3):
        expected = this('b' + str(i)).a
        assert IBoundTerm.providedBy(t1)
 
    t1 = next(parent for parent in this('parent'))
    assert 'parent' == unboxed(t1).name
 
def test_basic_queries_building():
    with bubbling() as current:
        expr = next(parent.title + parent.name
                    for parent in this('parent')
                    if (parent.age > 32) & parent.married & parent.spouse.alive)
def test_complex_query_building():
    with bubbling() as current:
        parent, child = next((parent.title + parent.name,
                              child.name + child.nick)
                             for parent in this('parent')

src/x/o/xotl.ql-0.2.1dev/tests/test_ordering.py   xotl.ql(Download)
import sys
 
from xotl.ql import this
from xotl.ql.core import these