mirror of
https://github.com/koloideal/Argenta.git
synced 2026-06-10 10:05:28 +03:00
feat: impl docs (#4)
The entire public api is covered with documentation in two languages - Russian and English. the library now supports the latest three versions of python - 3.12, 3.13 and 3.14 minor design changes: now, when a Boolean flag is entered, its value is an empty string, not None. tests have been adapted to the supported versions of python, readmi has been redesigned in two languages, German is no longer available.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
from sqlite3 import Connection
|
||||
from argenta import Response, Router
|
||||
from argenta.di import FromDishka
|
||||
|
||||
router = Router()
|
||||
|
||||
@router.command("connect")
|
||||
def connect_handler(response: Response, connection: FromDishka[Connection]):
|
||||
connection.execute("...")
|
||||
@@ -0,0 +1,13 @@
|
||||
import sqlite3
|
||||
from sqlite3 import Connection
|
||||
from typing import Iterable
|
||||
|
||||
from dishka import Provider, Scope, provide
|
||||
|
||||
|
||||
class ConnectionProvider(Provider):
|
||||
@provide(scope=Scope.REQUEST)
|
||||
def new_connection(self) -> Iterable[Connection]:
|
||||
conn = sqlite3.connect(":memory:")
|
||||
yield conn
|
||||
conn.close()
|
||||
@@ -0,0 +1,3 @@
|
||||
from argenta import Orchestrator
|
||||
|
||||
orchestrator = Orchestrator(custom_providers=[ConnectionProvider()])
|
||||
@@ -0,0 +1,9 @@
|
||||
from argenta import Response, Router
|
||||
from argenta.di import FromDishka
|
||||
from argenta.orchestrator.argparser import ArgSpace
|
||||
|
||||
router = Router()
|
||||
|
||||
@router.command("info")
|
||||
def connect_handler(response: Response, argspace: FromDishka[ArgSpace]):
|
||||
print(argspace.get_by_name("type"))
|
||||
Reference in New Issue
Block a user