How to use the pynq.enums.Actions.SelectMany 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_parses_query_and_returns_list(self):
        col = ["a", "b"]
        query = From(col).where("item == 'a'")
        provider = query.provider
        assert isinstance(provider.parse(query, Actions.SelectMany), list)
github heynemann / pynq / tests / unit / test_collection_provider.py View on Github external
def test_collection_provider_parses_query_using_lesser_than(self):
        col = range(5)
        query = From(col).where("item <= 3")
        provider = query.provider
        result = provider.parse(query, Actions.SelectMany)
        assert result == range(4), "The collection was not filtered properly and now is: %s" % result
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)
github heynemann / pynq / pynq / __init__.py View on Github external
def select_many(self):
        return self.provider.parse(self, action=Actions.SelectMany)