Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from functools import partial
- from query import run_query
- class QueryResolver(dict):
- def __getitem__(self, key):
- if key.lower().startswith('select_') and key not in self:
- self[key] = partial(run_query, key)
- return super().__getitem__(key)
- class QueryProvider(type):
- @classmethod
- def __prepare__(cls, name, bases):
- return QueryResolver()
Add Comment
Please, Sign In to add comment