from nullptr.models.marketplace import Marketplace class Analyzer: def __init__(self, store): self.store = store def find_markets(self, resource, sellbuy, location): for m in self.store.all(Marketplace): resources = m.imports if sellbuy == 'sell' else m.exports if resource in resources: yield m