Python symbol.and_test() Examples

The following are 30 code examples of symbol.and_test(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module symbol , or try the search function .
Example #1
Source File: __init__.py    From Flask-P2P with MIT License 6 votes vote down vote up
def get_op(cls, op):
        ops = {
            symbol.test: cls.test,
            symbol.and_test: cls.and_test,
            symbol.atom: cls.atom,
            symbol.comparison: cls.comparison,
            'not in': lambda x, y: x not in y,
            'in': lambda x, y: x in y,
            '==': operator.eq,
            '!=': operator.ne,
            '<':  operator.lt,
            '>':  operator.gt,
            '<=': operator.le,
            '>=': operator.ge,
        }
        if hasattr(symbol, 'or_test'):
            ops[symbol.or_test] = cls.test
        return ops[op] 
Example #2
Source File: __init__.py    From Splunking-Crime with GNU Affero General Public License v3.0 6 votes vote down vote up
def get_op(cls, op):
        ops = {
            symbol.test: cls.test,
            symbol.and_test: cls.and_test,
            symbol.atom: cls.atom,
            symbol.comparison: cls.comparison,
            'not in': lambda x, y: x not in y,
            'in': lambda x, y: x in y,
            '==': operator.eq,
            '!=': operator.ne,
            '<':  operator.lt,
            '>':  operator.gt,
            '<=': operator.le,
            '>=': operator.ge,
        }
        if hasattr(symbol, 'or_test'):
            ops[symbol.or_test] = cls.test
        return ops[op] 
Example #3
Source File: __init__.py    From ImageFusion with MIT License 6 votes vote down vote up
def get_op(cls, op):
        ops = {
            symbol.test: cls.test,
            symbol.and_test: cls.and_test,
            symbol.atom: cls.atom,
            symbol.comparison: cls.comparison,
            'not in': lambda x, y: x not in y,
            'in': lambda x, y: x in y,
            '==': operator.eq,
            '!=': operator.ne,
            '<':  operator.lt,
            '>':  operator.gt,
            '<=': operator.le,
            '>=': operator.ge,
        }
        if hasattr(symbol, 'or_test'):
            ops[symbol.or_test] = cls.test
        return ops[op] 
Example #4
Source File: __init__.py    From ImageFusion with MIT License 6 votes vote down vote up
def get_op(cls, op):
        ops = {
            symbol.test: cls.test,
            symbol.and_test: cls.and_test,
            symbol.atom: cls.atom,
            symbol.comparison: cls.comparison,
            'not in': lambda x, y: x not in y,
            'in': lambda x, y: x in y,
            '==': operator.eq,
            '!=': operator.ne,
            '<':  operator.lt,
            '>':  operator.gt,
            '<=': operator.le,
            '>=': operator.ge,
        }
        if hasattr(symbol, 'or_test'):
            ops[symbol.or_test] = cls.test
        return ops[op] 
Example #5
Source File: __init__.py    From ImageFusion with MIT License 6 votes vote down vote up
def get_op(cls, op):
        ops = {
            symbol.test: cls.test,
            symbol.and_test: cls.and_test,
            symbol.atom: cls.atom,
            symbol.comparison: cls.comparison,
            'not in': lambda x, y: x not in y,
            'in': lambda x, y: x in y,
            '==': operator.eq,
            '!=': operator.ne,
            '<':  operator.lt,
            '>':  operator.gt,
            '<=': operator.le,
            '>=': operator.ge,
        }
        if hasattr(symbol, 'or_test'):
            ops[symbol.or_test] = cls.test
        return ops[op] 
Example #6
Source File: __init__.py    From Flask-P2P with MIT License 6 votes vote down vote up
def get_op(cls, op):
        ops = {
            symbol.test: cls.test,
            symbol.and_test: cls.and_test,
            symbol.atom: cls.atom,
            symbol.comparison: cls.comparison,
            'not in': lambda x, y: x not in y,
            'in': lambda x, y: x in y,
            '==': operator.eq,
            '!=': operator.ne,
            '<':  operator.lt,
            '>':  operator.gt,
            '<=': operator.le,
            '>=': operator.ge,
        }
        if hasattr(symbol, 'or_test'):
            ops[symbol.or_test] = cls.test
        return ops[op] 
Example #7
Source File: __init__.py    From lambda-chef-node-cleanup with Apache License 2.0 6 votes vote down vote up
def get_op(cls, op):
        ops = {
            symbol.test: cls.test,
            symbol.and_test: cls.and_test,
            symbol.atom: cls.atom,
            symbol.comparison: cls.comparison,
            'not in': lambda x, y: x not in y,
            'in': lambda x, y: x in y,
            '==': operator.eq,
            '!=': operator.ne,
            '<':  operator.lt,
            '>':  operator.gt,
            '<=': operator.le,
            '>=': operator.ge,
        }
        if hasattr(symbol, 'or_test'):
            ops[symbol.or_test] = cls.test
        return ops[op] 
Example #8
Source File: __init__.py    From jbox with MIT License 6 votes vote down vote up
def get_op(cls, op):
        ops = {
            symbol.test: cls.test,
            symbol.and_test: cls.and_test,
            symbol.atom: cls.atom,
            symbol.comparison: cls.comparison,
            'not in': lambda x, y: x not in y,
            'in': lambda x, y: x in y,
            '==': operator.eq,
            '!=': operator.ne,
            '<':  operator.lt,
            '>':  operator.gt,
            '<=': operator.le,
            '>=': operator.ge,
        }
        if hasattr(symbol, 'or_test'):
            ops[symbol.or_test] = cls.test
        return ops[op] 
Example #9
Source File: pkg_resources.py    From bazarr with GNU General Public License v3.0 5 votes vote down vote up
def and_test(cls, nodelist):
        # MUST NOT short-circuit evaluation, or invalid syntax can be skipped!
        items = [
            cls.interpret(nodelist[i])
            for i in range(1, len(nodelist), 2)
        ]
        return functools.reduce(operator.and_, items) 
Example #10
Source File: transformer.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def or_test(self, nodelist):
        # and_test ('or' and_test)* | lambdef
        if len(nodelist) == 1 and nodelist[0][0] == symbol.lambdef:
            return self.lambdef(nodelist[0])
        return self.com_binary(Or, nodelist) 
Example #11
Source File: transformer.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def and_test(self, nodelist):
        # not_test ('and' not_test)*
        return self.com_binary(And, nodelist) 
Example #12
Source File: transformer.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def or_test(self, nodelist):
        # and_test ('or' and_test)* | lambdef
        if len(nodelist) == 1 and nodelist[0][0] == symbol.lambdef:
            return self.lambdef(nodelist[0])
        return self.com_binary(Or, nodelist) 
Example #13
Source File: transformer.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def and_test(self, nodelist):
        # not_test ('and' not_test)*
        return self.com_binary(And, nodelist) 
Example #14
Source File: transformer.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def or_test(self, nodelist):
        # and_test ('or' and_test)* | lambdef
        if len(nodelist) == 1 and nodelist[0][0] == symbol.lambdef:
            return self.lambdef(nodelist[0])
        return self.com_binary(Or, nodelist) 
Example #15
Source File: __init__.py    From jbox with MIT License 5 votes vote down vote up
def and_test(cls, nodelist):
        # MUST NOT short-circuit evaluation, or invalid syntax can be skipped!
        items = [
            cls.interpret(nodelist[i])
            for i in range(1, len(nodelist), 2)
        ]
        return functools.reduce(operator.and_, items) 
Example #16
Source File: transformer.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def and_test(self, nodelist):
        # not_test ('and' not_test)*
        return self.com_binary(And, nodelist) 
Example #17
Source File: transformer.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def or_test(self, nodelist):
        # and_test ('or' and_test)* | lambdef
        if len(nodelist) == 1 and nodelist[0][0] == symbol.lambdef:
            return self.lambdef(nodelist[0])
        return self.com_binary(Or, nodelist) 
Example #18
Source File: pkg_resources.py    From Flask with Apache License 2.0 5 votes vote down vote up
def and_test(cls, nodelist):
        # MUST NOT short-circuit evaluation, or invalid syntax can be skipped!
        return functools.reduce(operator.and_, [cls.interpret(nodelist[i]) for i in range(1,len(nodelist),2)]) 
Example #19
Source File: transformer.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def and_test(self, nodelist):
        # not_test ('and' not_test)*
        return self.com_binary(And, nodelist) 
Example #20
Source File: pkg_resources.py    From Flask with Apache License 2.0 5 votes vote down vote up
def and_test(cls, nodelist):
        # MUST NOT short-circuit evaluation, or invalid syntax can be skipped!
        return functools.reduce(operator.and_, [cls.interpret(nodelist[i]) for i in range(1,len(nodelist),2)]) 
Example #21
Source File: pkg_resources.py    From Flask with Apache License 2.0 5 votes vote down vote up
def and_test(cls, nodelist):
        # MUST NOT short-circuit evaluation, or invalid syntax can be skipped!
        return functools.reduce(operator.and_, [cls.interpret(nodelist[i]) for i in range(1,len(nodelist),2)]) 
Example #22
Source File: pkg_resources.py    From Flask with Apache License 2.0 5 votes vote down vote up
def get_op(cls, op):
        ops = {
            symbol.test: cls.test,
            symbol.and_test: cls.and_test,
            symbol.atom: cls.atom,
            symbol.comparison: cls.comparison,
            'not in': lambda x, y: x not in y,
            'in': lambda x, y: x in y,
            '==': operator.eq,
            '!=': operator.ne,
        }
        if hasattr(symbol, 'or_test'):
            ops[symbol.or_test] = cls.test
        return ops[op] 
Example #23
Source File: pkg_resources.py    From bazarr with GNU General Public License v3.0 5 votes vote down vote up
def get_op(cls, op):
        ops = {
            symbol.test: cls.test,
            symbol.and_test: cls.and_test,
            symbol.atom: cls.atom,
            symbol.comparison: cls.comparison,
            'not in': lambda x, y: x not in y,
            'in': lambda x, y: x in y,
            '==': operator.eq,
            '!=': operator.ne,
        }
        if hasattr(symbol, 'or_test'):
            ops[symbol.or_test] = cls.test
        return ops[op] 
Example #24
Source File: pkg_resources.py    From Flask with Apache License 2.0 5 votes vote down vote up
def get_op(cls, op):
        ops = {
            symbol.test: cls.test,
            symbol.and_test: cls.and_test,
            symbol.atom: cls.atom,
            symbol.comparison: cls.comparison,
            'not in': lambda x, y: x not in y,
            'in': lambda x, y: x in y,
            '==': operator.eq,
            '!=': operator.ne,
        }
        if hasattr(symbol, 'or_test'):
            ops[symbol.or_test] = cls.test
        return ops[op] 
Example #25
Source File: transformer.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def or_test(self, nodelist):
        # and_test ('or' and_test)* | lambdef
        if len(nodelist) == 1 and nodelist[0][0] == symbol.lambdef:
            return self.lambdef(nodelist[0])
        return self.com_binary(Or, nodelist) 
Example #26
Source File: transformer.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def and_test(self, nodelist):
        # not_test ('and' not_test)*
        return self.com_binary(And, nodelist) 
Example #27
Source File: transformer.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def or_test(self, nodelist):
        # and_test ('or' and_test)* | lambdef
        if len(nodelist) == 1 and nodelist[0][0] == symbol.lambdef:
            return self.lambdef(nodelist[0])
        return self.com_binary(Or, nodelist) 
Example #28
Source File: transformer.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def and_test(self, nodelist):
        # not_test ('and' not_test)*
        return self.com_binary(And, nodelist) 
Example #29
Source File: transformer.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def or_test(self, nodelist):
        # and_test ('or' and_test)* | lambdef
        if len(nodelist) == 1 and nodelist[0][0] == symbol.lambdef:
            return self.lambdef(nodelist[0])
        return self.com_binary(Or, nodelist) 
Example #30
Source File: transformer.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def and_test(self, nodelist):
        # not_test ('and' not_test)*
        return self.com_binary(And, nodelist)