How to use the pynq.guard.Guard.against_empty function in pynq

To help you get started, we’ve selected a few pynq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heynemann / pynq / tests / unit / test_guard.py View on Github external
def do(self, a):
                Guard.against_empty(a, "Argument a is required")
                pass
github heynemann / pynq / tests / unit / test_guard.py View on Github external
def __init__(self, a):
                Guard.against_empty(a, "Argument a is required")
                pass
github heynemann / pynq / pynq / __init__.py View on Github external
def select(self, *cols):
        empty_message = "Selecting with no fields is not valid. " \
                                  + "When using From(provider).select method, " \
                                  + "please provide a list of expressions or strings as fields."
        Guard.against_empty(cols, empty_message)
        for col in cols:
            Guard.against_empty(col, empty_message)
        Guard.accepts_only(cols, [str, Expression], "Selecting with invalid type. " \
                                                    + "When using From(provider).select method, " \
                                                    + "please provide a list of expressions or strings as fields.")
                                                    
        return self.provider.parse(self, action=Actions.Select, cols=cols)
github heynemann / pynq / pynq / expressions.py View on Github external
def __init__(self, node_type, lhs, rhs):
        '''Initializes the BinaryExpression with the specified arguments.
        Arguments:
            node_type - Specifies the type of operation that this BinaryExpression represents
            lhs - Left-hand side of the operation (as in the first argument)
            rhs - Right-hand site of the operation (as in the second argument)
        '''
        Guard.against_empty(node_type, "The BinaryExpression node type is required")
        Guard.accepts(lhs, (Expression,), "Lhs must be an expression (an instance of a class that inherits from pynq.Expression), but was %s" % lhs.__class__.__name__)
        Guard.accepts(rhs, (Expression,), "Rhs must be an expression (an instance of a class that inherits from pynq.Expression) but was %s" % rhs.__class__.__name__)
        self.node_type = node_type
        self.lhs = lhs
        self.rhs = rhs
github heynemann / pynq / pynq / __init__.py View on Github external
def select(self, *cols):
        empty_message = "Selecting with no fields is not valid. " \
                                  + "When using From(provider).select method, " \
                                  + "please provide a list of expressions or strings as fields."
        Guard.against_empty(cols, empty_message)
        for col in cols:
            Guard.against_empty(col, empty_message)
        Guard.accepts_only(cols, [str, Expression], "Selecting with invalid type. " \
                                                    + "When using From(provider).select method, " \
                                                    + "please provide a list of expressions or strings as fields.")
                                                    
        return self.provider.parse(self, action=Actions.Select, cols=cols)