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

All Samples(24)  |  Call(18)  |  Derive(0)  |  Import(6)

src/p/y/PyContracts-1.6.0/src/contracts/pyparsing_utils.py   PyContracts(Download)
from .syntax import (Forward, Suppress, FollowedBy, Group, OneOrMore, Optional,
                     opAssoc)
 
 
def myOperatorPrecedence(baseExpr, opList):
        if rightLeftAssoc == opAssoc.LEFT:
            if arity == 1:
                matchExpr = FollowedBy(lastExpr + opExpr) + Group(lastExpr + OneOrMore(opExpr))
            elif arity == 2:
                if opExpr is not None:
#                    matchExpr = Group(lastExpr + FollowedBy(opExpr) + OneOrMore(opExpr - lastExpr))                
                    matchExpr = Group(lastExpr + FollowedBy(opExpr) - OneOrMore(opExpr - lastExpr))
                else:
                    matchExpr = FollowedBy(lastExpr + lastExpr) + Group(lastExpr + OneOrMore(lastExpr))
            elif arity == 3:
                matchExpr = FollowedBy(lastExpr + opExpr1 + lastExpr + opExpr2 + lastExpr) + \
                            Group(lastExpr + opExpr1 + lastExpr + opExpr2 + lastExpr)
            else:
                raise ValueError("operator must be unary (1), binary (2), or ternary (3)")

src/c/o/contracts-HEAD/src/contracts/pyparsing_utils.py   contracts(Download)
from .syntax import (Forward, Suppress, FollowedBy, Group, OneOrMore, Optional,
                     opAssoc)
 
 
def myOperatorPrecedence(baseExpr, opList):
        if rightLeftAssoc == opAssoc.LEFT:
            if arity == 1:
                matchExpr = FollowedBy(lastExpr + opExpr) + Group(lastExpr + OneOrMore(opExpr))
            elif arity == 2:
                if opExpr is not None:
#                    matchExpr = Group(lastExpr + FollowedBy(opExpr) + OneOrMore(opExpr - lastExpr))                
                    matchExpr = Group(lastExpr + FollowedBy(opExpr) - OneOrMore(opExpr - lastExpr))
                else:
                    matchExpr = FollowedBy(lastExpr + lastExpr) + Group(lastExpr + OneOrMore(lastExpr))
            elif arity == 3:
                matchExpr = FollowedBy(lastExpr + opExpr1 + lastExpr + opExpr2 + lastExpr) + \
                            Group(lastExpr + opExpr1 + lastExpr + opExpr2 + lastExpr)
            else:
                raise ValueError("operator must be unary (1), binary (2), or ternary (3)")

src/p/y/PyContracts-1.6.0/src/contracts/library/separate_context.py   PyContracts(Download)
from ..interface import Contract
from ..syntax import add_contract, W, contract_expression, Literal, Group
 
 
class SeparateContext(Contract):
 
 
sepcon = (Group(Literal('$') - Literal('(') -
                contract_expression('child') - Literal(')')))
sepcon.setParseAction(SeparateContext.parse_action)

src/c/o/contracts-HEAD/src/contracts/library/separate_context.py   contracts(Download)
from ..interface import Contract
from ..syntax import add_contract, W, contract_expression, Literal, Group
 
 
class SeparateContext(Contract):
 
 
sepcon = (Group(Literal('$') - Literal('(') -
                contract_expression('child') - Literal(')')))
sepcon.setParseAction(SeparateContext.parse_action)

src/p/y/PyContracts-1.6.0/src/contracts/library/tuple.py   PyContracts(Download)
from ..interface import Contract, ContractNotRespected
from ..syntax import(add_contract, W, contract_expression, O, S, ZeroOrMore,
                      Group, add_keyword, Keyword)
from .compositions import or_contract
 

src/c/o/contracts-HEAD/src/contracts/library/tuple.py   contracts(Download)
from ..interface import Contract, ContractNotRespected
from ..syntax import(add_contract, W, contract_expression, O, S, ZeroOrMore,
                      Group, add_keyword, Keyword)
from .compositions import or_contract