def show_purchase_form(self, ctx):

        return Result({
            "category": ctx.category,
            "prices": ctx.prices,
            "forms": ctx.forms,
        })
Example #2
0
 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)
     })
Example #3
0
    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)
Example #4
0
    def show_notifications(self, ctx):

        return Result(ctx("notifications"))
Example #5
0
 async def one(self, ctx):
     return Result(ctx.__dict__)
Example #6
0
 async def one(self, ctx):
     return Result(dir(ctx))
Example #7
0
 def return_results(self, ctx):
     """Return results in api format."""
     return Result(self.format_result(ctx.limitted, ctx.expand, ctx.count))
Example #8
0
    def show_notifications(self, ctx):

        return Result({"notifications": ctx.notifications})
Example #9
0
 async def after(self, ctx):
     return Result(ctx.spam * 2)
Example #10
0
 async def three(self, ctx):
     return Result(ctx.bar - ctx.baz)
Example #11
0
 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)
Example #13
0
 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"))
Example #15
0
 def done(self, ctx):
     return Result(ctx.entity)
Example #16
0
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})
Example #18
0
    def show_categories(self, ctx):

        return Result({"categories": ctx.subscribed})
Example #19
0
 async def load_content(self, ctx):
     if ctx.access_allowed:
         return Result("allowed")
     else:
         return Result("denied")
Example #20
0
    def show_profile(self, ctx):

        return Result(ctx("user", "profile"))
Example #21
0
 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"))
Example #24
0
    def show_entries(self, ctx):

        return Result({"category": ctx.category, "entries": ctx.entries})
Example #25
0
def test_result_representation():

    marker = Result(1)
    assert repr(marker) == "Result(1)"
 def done(self, ctx):
     return Result(ctx.result)
Example #27
0
 async def after(self, ctx):
     return Result(dir(ctx))
Example #28
0
    def show_category(self, ctx):

        return Result(ctx.category)
Example #29
0
 def finish(self, ctx):
     return Result(ctx)
Example #30
0
    def show_profile(self, ctx):

        return Result({"user": ctx.user, "profile": ctx.profile})