def show_purchase_form(self, ctx): return Result({ "category": ctx.category, "prices": ctx.prices, "forms": ctx.forms, })
def send_validation_response(self, ctx): formated_response = json.dumps(ctx.validation_response, indent=2) message_data = { "type": ctx.message["type"], "content": f"```\n{formated_response}\n```", "subject": ctx.message["subject"], "to": [ctx.message["display_recipient"]], } return Result({ "validated": True, "response": self._client.send_message(message_data) })
def update_words(self, ctx) -> Result: """Обновление слов""" actual_word_entities = [ word for actual_level_entity in ctx.actual_level_entities for word in actual_level_entity.words ] diff = WordSelector.match(ctx.fresh_word_entities, actual_word_entities) self.actual_repo.update_words(diff) return Result(ctx)
def show_notifications(self, ctx): return Result(ctx("notifications"))
async def one(self, ctx): return Result(ctx.__dict__)
async def one(self, ctx): return Result(dir(ctx))
def return_results(self, ctx): """Return results in api format.""" return Result(self.format_result(ctx.limitted, ctx.expand, ctx.count))
def show_notifications(self, ctx): return Result({"notifications": ctx.notifications})
async def after(self, ctx): return Result(ctx.spam * 2)
async def three(self, ctx): return Result(ctx.bar - ctx.baz)
def return_result(self, ctx): """Return result in api format.""" return Result(self.format_result(ctx.pet, ctx.expand))
def show_task(self, ctx): return Result(ctx.result)
def apply(self, ctx): # noqa discount = (ctx.product.price_in_cents / 100) * sum(ctx.discounts) return Result(int(ctx.product.price_in_cents - discount))
def show_purchase_form(self, ctx): return Result(ctx("category", "prices", "forms"))
def done(self, ctx): return Result(ctx.entity)
def test_result_representation(): result = Result(1) assert repr(result) == "Result(1)"
def show_categories(self, ctx): return Result({"prices": ctx.prices, "categories": ctx.with_prices})
def show_categories(self, ctx): return Result({"categories": ctx.subscribed})
async def load_content(self, ctx): if ctx.access_allowed: return Result("allowed") else: return Result("denied")
def show_profile(self, ctx): return Result(ctx("user", "profile"))
async def one(self, ctx): return Result(self.f(ctx.foo))
def show_categories(self, ctx): return Result(ctx("prices", categories="with_prices"))
def show_entries(self, ctx): return Result(ctx("category", "entries"))
def show_entries(self, ctx): return Result({"category": ctx.category, "entries": ctx.entries})
def test_result_representation(): marker = Result(1) assert repr(marker) == "Result(1)"
def done(self, ctx): return Result(ctx.result)
async def after(self, ctx): return Result(dir(ctx))
def show_category(self, ctx): return Result(ctx.category)
def finish(self, ctx): return Result(ctx)
def show_profile(self, ctx): return Result({"user": ctx.user, "profile": ctx.profile})