# Инструменты, связанные с функциями

```python
jishaku.functools.executor_function(sync_function: Callable[[P], T]) → Callable[[P], Awaitable[T]]
```

Декоратор, который оборачивает функцию синхронизации в исполнителя, превращая ее в асинхронную функцию.

Это позволяет обернуть функции обработки и немедленно использовать их как асинхронную функцию.

Примеры

Передача обработки с помощью библиотеки изображений Python в исполнитель:

```python
from io import BytesIO
from PIL import Image

from jishaku.functools import executor_function

@executor_function
def color_processing(color: discord.Color):
    with Image.new('RGB', (64, 64), color.to_rgb()) as im:
        buff = BytesIO()
        im.save(buff, 'png')

    buff.seek(0)
    return buff

@bot.command()
async def color(ctx: commands.Context, color: discord.Color=None):
    color = color or ctx.author.color
    buff = await color_processing(color=color)

    await ctx.send(file=discord.File(fp=buff, filename='color.png'))
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mayaais-organization.gitbook.io/dobro-pozhalovat/instrumenty-svyazannye-s-funkciyami.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
