crescent-ext-docstrings-0.2.1
توضیحات
A docstring parser for hikari-crescent.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | crescent-ext-docstrings-0.2.1 |
| نام | crescent-ext-docstrings |
| نسخه کتابخانه | 0.2.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Lunarmagpie |
| ایمیل نویسنده | Bambolambo0@gmail.com |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/crescent-ext-docstrings/ |
| مجوز | MPL-2.0 |
# crescent-ext-docstrings
A docstring parser for [hikari-crescent](https://github.com/magpie-dev/hikari-crescent).
## Installation
```
pip install crescent-ext-docstrings
```
## Usage
This extension works for both class commands and function commands.
```python
import crescent
from crescent.ext import docstrings
bot = crescent.Bot("...")
@bot.include
@docstrings.parse_doc
@crescent.command
async def example(ctx: crescent.Context, a: str, b: str) -> None:
"""
This is the command's description.
:param a:
This is the first param's description.
:param b:
This is the first param's description.
"""
await ctx.respond(f"{a=},{b=}")
@bot.include
@docstrings.parse_doc
@crescent.command(name="class_example")
class ClassExample:
"""
Other doc styles are supported. This is google doc style.
Args:
a: This is the first param's description.
b: This is the first param's description.
"""
a = crescent.option(str)
b = crescent.option(str)
async def callback(self, ctx: crescent.Context) -> None:
await ctx.respond(f"{self.a=},{self.b=}")
bot.run()
```
### Doc Styles
Since this library relies on [docstring-parser](https://github.com/rr-/docstring_parser), the styles Rest, Google, Numpy, and Epydoc are supported. If no style is specified, the style will be inferred.
```python
import docstrings
@bot.include
@docstrings.parse_doc(style=docstrings.Style.REST)
@crescent.command
async def example(ctx: crescent.Command, a: str) -> None:
"""
Rest style description.
:param a:
The parameter.
"""
...
```
نیازمندی
| مقدار | نام |
|---|---|
| >=0.14.1,<0.15.0 | docstring-parser |
| >=0.5.0,<0.6.0 | hikari-crescent |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8,<3.12 | Python |
نحوه نصب
نصب پکیج whl crescent-ext-docstrings-0.2.1:
pip install crescent-ext-docstrings-0.2.1.whl
نصب پکیج tar.gz crescent-ext-docstrings-0.2.1:
pip install crescent-ext-docstrings-0.2.1.tar.gz