def show_purchase_form(self, ctx):

        return Result({
            "category": ctx.category,
            "prices": ctx.prices,
            "forms": ctx.forms,
        })
Exemplo n.º 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)
     })
Exemplo n.º 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)
Exemplo n.º 4
0
    def show_notifications(self, ctx):

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

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

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

        return Result(ctx("user", "profile"))
Exemplo n.º 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"))
Exemplo n.º 23
0
    def show_entries(self, ctx):

        return Result(ctx("category", "entries"))
Exemplo n.º 24
0
    def show_entries(self, ctx):

        return Result({"category": ctx.category, "entries": ctx.entries})
Exemplo n.º 25
0
def test_result_representation():

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

        return Result(ctx.category)
Exemplo n.º 29
0
 def finish(self, ctx):
     return Result(ctx)
Exemplo n.º 30
0
    def show_profile(self, ctx):

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