How to use the pynq.enums.Actions 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_collection_provider.py View on Github external
def test_collection_provider_filters_using_binary_expression_for_numbers(self):
        col = [1, 2, 10, 11, 12]
        query = From(col).where("item > 10")
        provider = query.provider
        result = provider.parse(query, Actions.SelectMany)
        assert result == [11, 12], "The collection was not filtered properly and now is: %s" % result
github heynemann / pynq / pynq / __init__.py View on Github external
def min(self, column="item"):
        return self.provider.parse(self, action=Actions.Min, column=column)
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 / providers / __init__.py View on Github external
def parse(self, query, action, **kwargs):
        if action == Actions.SelectMany:
            return self.parse_select_many(query)
        elif action == Actions.Select:
            return self.parse_select(query, kwargs["cols"])
        elif action == Actions.Count:
            return self.parse_count(query)
        elif action == Actions.Max:
            return self.parse_max(query, kwargs["column"])
        elif action == Actions.Min:
            return self.parse_min(query, kwargs["column"])
        elif action == Actions.Sum:
            return self.parse_sum(query, kwargs["column"])
        elif action == Actions.Avg:
            return self.parse_avg(query, kwargs["column"])
        else:
            raise ValueError("Invalid action exception. %s is unknown." % action)