Add library
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,6 +1,6 @@
|
|||||||
# ---> Python
|
# ---> Python
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
**/__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
*$py.class
|
*$py.class
|
||||||
|
|
||||||
@@ -174,3 +174,4 @@ cython_debug/
|
|||||||
# PyPI configuration file
|
# PyPI configuration file
|
||||||
.pypirc
|
.pypirc
|
||||||
|
|
||||||
|
.idea
|
||||||
249
README.md
249
README.md
@@ -1,2 +1,251 @@
|
|||||||
# breakshaft
|
# breakshaft
|
||||||
|
|
||||||
|
### Генерация преобразований типов на лету
|
||||||
|
|
||||||
|
#### Зачем это нужно:
|
||||||
|
|
||||||
|
Базовая задача библиотеки - применение методов внедрения зависимостей типа `()->SomeObject` к потребителям
|
||||||
|
`(*,dep_n:SomeObject,*)->*`
|
||||||
|
Однако, кроме прямых применений внедрения зависимостей, библиотека позволяет выстраивать цепочки преобразований
|
||||||
|
`(Any)->A | (A)->B | (B)->C | consumer(A,B,C)`
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
#### Особенности библиотеки:
|
||||||
|
|
||||||
|
- Выстраивает индивидуальный граф всех возможных преобразований для каждого потребителя
|
||||||
|
- Генерирует метод подготовки зависимостей по запросу
|
||||||
|
- Поддерживает асинхронный контекст
|
||||||
|
- Поддерживает внедрение зависимости через синхронные/асинхронные менеджеры контекста
|
||||||
|
- Поддерживает `Union`-типы в зависимостях
|
||||||
|
|
||||||
|
#### Ограничения библиотеки:
|
||||||
|
- Зависимости со стандартными параметрами пока не поддерживаются
|
||||||
|
- Выбор графа преобразований вызывает комбинаторный взрыв
|
||||||
|
- Кэширование графов преобразований не поддерживается
|
||||||
|
- При некоммутативности сгенерированного графа, имеется опасность неконсистентного выбора пути, поскольку порядок обхода методов, а также графа, не гарантирован
|
||||||
|
- Обращение к методам преобразования в сгенерированном методе происходит посредством словаря ссылок - ожидается изменение поведения
|
||||||
|
- Поддерживается только in-time генерация методов
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
#### Базовое применение:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from breakshaft.convertor import ConvRepo
|
||||||
|
|
||||||
|
|
||||||
|
# Объявляем объекты, с которыми будем работать
|
||||||
|
@dataclass
|
||||||
|
class A:
|
||||||
|
a: int
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class B:
|
||||||
|
b: float
|
||||||
|
|
||||||
|
|
||||||
|
repo = ConvRepo()
|
||||||
|
|
||||||
|
|
||||||
|
# Добавляем в репозиторий все преобразования типов, которые можно использовать
|
||||||
|
@repo.mark_injector()
|
||||||
|
def b_to_a(b: B) -> A:
|
||||||
|
return A(int(b.b))
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def a_to_b(a: A) -> B:
|
||||||
|
return B(float(a.a))
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def int_to_a(i: int) -> A:
|
||||||
|
return A(i)
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def int_to_b(i: int) -> B:
|
||||||
|
return B(float(i))
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def a_to_int(a: A) -> int:
|
||||||
|
return a.a
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def b_to_int(b: B) -> int:
|
||||||
|
return int(b.b)
|
||||||
|
|
||||||
|
|
||||||
|
# Целевая функция
|
||||||
|
def consumer(dep: A) -> int:
|
||||||
|
return dep.a
|
||||||
|
|
||||||
|
|
||||||
|
fn = repo.get_conversion(
|
||||||
|
(B,), # Аргументы генерируемого метода
|
||||||
|
consumer, # Целевая функция, которая будет вызвана
|
||||||
|
# Параметры построения графа преобразований
|
||||||
|
force_commutative=True,
|
||||||
|
# Выбрасывать ошибку если невозможно выделить эксклюзивную последовательность преобразований (default=True)
|
||||||
|
allow_async=False, # Запретить использовать асинхронные преобразования (default=True)
|
||||||
|
allow_sync=True, # Разрешить использовать синхронные преобразования (default=True)
|
||||||
|
# Параметры генерации итогового метода
|
||||||
|
force_async=False, # Не требовать генерировать асинхронный метод (default=False)
|
||||||
|
)
|
||||||
|
|
||||||
|
tst = fn(B(1.1))
|
||||||
|
assert tst == 1
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
|
#### Как получить граф преобразований:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from breakshaft.graph_walker import GraphWalker
|
||||||
|
from breakshaft.convertor import ConvRepo
|
||||||
|
from breakshaft import util_mermaid # методы для отрисовки графов в mermaid flowchart
|
||||||
|
|
||||||
|
repo = ConvRepo()
|
||||||
|
# Объявляем A и B, а также методы преобразований - как в прошлом примере
|
||||||
|
walker = GraphWalker()
|
||||||
|
from_types = (int,)
|
||||||
|
g = walker.generate_callgraph(
|
||||||
|
repo.convertor_set, # множество методов преобразований
|
||||||
|
frozenset(from_types), # все "внутренние" механизмы используют frozenset
|
||||||
|
consumer, # "целевой" метод
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Граф с выбором путей
|
||||||
|
|
||||||
|
```python
|
||||||
|
util_mermaid.draw_callgraph_mermaid(
|
||||||
|
g, # граф преобразований
|
||||||
|
split_duplicates=True # не "склеивать" дублирующиеся хвосты ветвей
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
|
||||||
|
flowchart TD
|
||||||
|
|
||||||
|
%%defs:
|
||||||
|
4637413733674907887["3"]
|
||||||
|
_2014196705430320452("\(\< class \'\_\_main\_\_.A\'\> \) \-\> NoneType: consumer \[0\]")
|
||||||
|
0_0_26854043587429446["branch select \[1\] \[2\]"]
|
||||||
|
0_0__7470993180194732607("\(\< class \'\_\_main\_\_.B\'\> \) \-\> A: b\_to\_a \[0\]")
|
||||||
|
0_0_0_0_7892409774476285690["1"]
|
||||||
|
0_0_0_0__2352457504263425844("\(\< class \'int\'\> \) \-\> B: int\_to\_b \[1\]")
|
||||||
|
0_0_0_0_0_0_133146708735736(((0)))
|
||||||
|
0_0_7688981453858411382("\(\< class \'int\'\> \) \-\> A: int\_to\_a \[1\]")
|
||||||
|
1_0_0_0_133146708735736(((0)))
|
||||||
|
%%edges:
|
||||||
|
head(((head))) --> 4637413733674907887
|
||||||
|
0_0__7470993180194732607 ---> 0_0_0_0_7892409774476285690
|
||||||
|
0_0_26854043587429446 -.-> 0_0_7688981453858411382
|
||||||
|
_2014196705430320452 ---> 0_0_26854043587429446
|
||||||
|
0_0_7688981453858411382 ---> 1_0_0_0_133146708735736
|
||||||
|
0_0_0_0_7892409774476285690 -.-> 0_0_0_0__2352457504263425844
|
||||||
|
0_0_0_0__2352457504263425844 ---> 0_0_0_0_0_0_133146708735736
|
||||||
|
4637413733674907887 -.-> _2014196705430320452
|
||||||
|
0_0_26854043587429446 -.-> 0_0__7470993180194732607
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Далее, выделяется множество всех комбинаций выборов путей
|
||||||
|
> **Warning**
|
||||||
|
> В этом месте происходит комбинаторный взрыв
|
||||||
|
|
||||||
|
```python
|
||||||
|
exploded = walker.explode_callgraph_branches(g, frozenset(from_types))
|
||||||
|
print('flowchart TD')
|
||||||
|
for s_i, selected in enumerate(exploded):
|
||||||
|
print(
|
||||||
|
util_mermaid.draw_callgraph_mermaid(
|
||||||
|
# explode возвращает множество вариантов, а отрисовка принимает только целиковый граф
|
||||||
|
Callgraph(frozenset({selected})),
|
||||||
|
split_duplicates=True,
|
||||||
|
# Не печатать `flowchart TD`
|
||||||
|
skip_title=True,
|
||||||
|
# каждому подграфу будет добавляться префикс, необходимо для "разделения" отрисовки по ветвям
|
||||||
|
prefix=f'{s_i}_'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart TD
|
||||||
|
|
||||||
|
%%defs:
|
||||||
|
0_6479277657578663668["3"]
|
||||||
|
0_5230748712811156587("\(\< class \'\_\_main\_\_.A\'\> \) \-\> NoneType: consumer \[1\]")
|
||||||
|
0_0_0_3895278563721661331["2"]
|
||||||
|
0_0_0__7339131078346638087("\(\< class \'\_\_main\_\_.B\'\> \) \-\> A: b\_to\_a \[1\]")
|
||||||
|
0_0_0_0_0__8039019063582738327["1"]
|
||||||
|
0_0_0_0_0__4308564652945379484("\(\< class \'int\'\> \) \-\> B: int\_to\_b \[1\]")
|
||||||
|
%%edges:
|
||||||
|
head(((head))) --> 0_6479277657578663668
|
||||||
|
0_0_0_3895278563721661331 -.-> 0_0_0__7339131078346638087
|
||||||
|
0_0_0_0_0__8039019063582738327 -.-> 0_0_0_0_0__4308564652945379484
|
||||||
|
0_5230748712811156587 ---> 0_0_0_3895278563721661331
|
||||||
|
0_0_0__7339131078346638087 ---> 0_0_0_0_0__8039019063582738327
|
||||||
|
0_6479277657578663668 -.-> 0_5230748712811156587
|
||||||
|
%%defs:
|
||||||
|
1__220022767842101243["2"]
|
||||||
|
1__4215159630864764736("\(\< class \'\_\_main\_\_.A\'\> \) \-\> NoneType: consumer \[1\]")
|
||||||
|
0_0_1_3788926318971690339["1"]
|
||||||
|
0_0_1_5732874305176457742("\(\< class \'int\'\> \) \-\> A: int\_to\_a \[1\]")
|
||||||
|
%%edges:
|
||||||
|
head(((head))) --> 1__220022767842101243
|
||||||
|
1__220022767842101243 -.-> 1__4215159630864764736
|
||||||
|
1__4215159630864764736 ---> 0_0_1_3788926318971690339
|
||||||
|
0_0_1_3788926318971690339 -.-> 0_0_1_5732874305176457742
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Далее, из всех вариантов отбрасываются те, в которых меньше всего на пути преобразования используются исходные объекты,
|
||||||
|
а из них отбрасываются самые длинные пути
|
||||||
|
> **Warning**
|
||||||
|
> На этом этапе можно наткнуться на некоммутативность, а также неконсистентность выбора пути преобразований в случае
|
||||||
|
> если в результате фильтрации получилось больше одного варианта
|
||||||
|
|
||||||
|
```python
|
||||||
|
filtered = walker.filter_exploded_callgraph_branch(exploded)
|
||||||
|
print('flowchart TD')
|
||||||
|
for s_i, selected in enumerate(exploded):
|
||||||
|
print(
|
||||||
|
util_mermaid.draw_callgraph_mermaid(
|
||||||
|
Callgraph(frozenset({selected})),
|
||||||
|
split_duplicates=True,
|
||||||
|
skip_title=True,
|
||||||
|
prefix=f'{s_i}_'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart TD
|
||||||
|
|
||||||
|
%%defs:
|
||||||
|
0_6479277657578663668["3"]
|
||||||
|
0_5230748712811156587("\(\< class \'\_\_main\_\_.A\'\> \) \-\> NoneType: consumer \[1\]")
|
||||||
|
0_0_0_3895278563721661331["2"]
|
||||||
|
0_0_0__7339131078346638087("\(\< class \'\_\_main\_\_.B\'\> \) \-\> A: b\_to\_a \[1\]")
|
||||||
|
0_0_0_0_0__8039019063582738327["1"]
|
||||||
|
0_0_0_0_0__4308564652945379484("\(\< class \'int\'\> \) \-\> B: int\_to\_b \[1\]")
|
||||||
|
%%edges:
|
||||||
|
head(((head))) --> 0_6479277657578663668
|
||||||
|
0_0_0_3895278563721661331 -.-> 0_0_0__7339131078346638087
|
||||||
|
0_0_0_0_0__8039019063582738327 -.-> 0_0_0_0_0__4308564652945379484
|
||||||
|
0_5230748712811156587 ---> 0_0_0_3895278563721661331
|
||||||
|
0_0_0__7339131078346638087 ---> 0_0_0_0_0__8039019063582738327
|
||||||
|
0_6479277657578663668 -.-> 0_5230748712811156587
|
||||||
|
|
||||||
|
```
|
||||||
28
pyproject.toml
Normal file
28
pyproject.toml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
[project]
|
||||||
|
name = "breakshaft"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Library for in-time codegen for type conversion"
|
||||||
|
authors = [
|
||||||
|
{ name = "nikto_b", email = "niktob560@yandex.ru" }
|
||||||
|
]
|
||||||
|
license = "LGPL-3.0-or-later"
|
||||||
|
requires-python = ">=3.13"
|
||||||
|
dependencies = [
|
||||||
|
"hatchling>=1.27.0",
|
||||||
|
"jinja2>=3.1.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["hatchling"]
|
||||||
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
packages = ["src/megasniff"]
|
||||||
|
|
||||||
|
|
||||||
|
[dependency-groups]
|
||||||
|
dev = [
|
||||||
|
"mypy>=1.16.1",
|
||||||
|
"pytest>=8.4.1",
|
||||||
|
"pytest-cov>=6.2.1",
|
||||||
|
]
|
||||||
1
src/breakshaft/__init__.py
Normal file
1
src/breakshaft/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
162
src/breakshaft/__main__.py
Normal file
162
src/breakshaft/__main__.py
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
import typing
|
||||||
|
from contextlib import asynccontextmanager, contextmanager
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
from src.breakshaft import util_mermaid
|
||||||
|
from src.breakshaft.graph_walker import GraphWalker
|
||||||
|
from src.breakshaft.models import Callgraph
|
||||||
|
from .convertor import ConvRepo
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class SomeSchema:
|
||||||
|
a: int
|
||||||
|
|
||||||
|
|
||||||
|
repo = ConvRepo()
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class A:
|
||||||
|
a: int
|
||||||
|
|
||||||
|
|
||||||
|
class B:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class C:
|
||||||
|
a: A
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def zero_schema() -> SomeSchema:
|
||||||
|
return SomeSchema(1)
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def c_from_a(a: A) -> C:
|
||||||
|
return C(a)
|
||||||
|
|
||||||
|
|
||||||
|
# @repo.mark_injector()
|
||||||
|
# def a_from_int(z: int) -> A:
|
||||||
|
# return A(z)
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def zero_a() -> A:
|
||||||
|
return A(34)
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def schema_from_c(c: C) -> SomeSchema:
|
||||||
|
return SomeSchema(c.a.a)
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def a_from_schema(s: SomeSchema) -> A:
|
||||||
|
return A(s.a)
|
||||||
|
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def b_from_a(a: A) -> B:
|
||||||
|
return B()
|
||||||
|
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
@asynccontextmanager
|
||||||
|
async def a_from_b(b: B | int) -> typing.AsyncIterator[A]:
|
||||||
|
if isinstance(b, B):
|
||||||
|
yield A(0)
|
||||||
|
else:
|
||||||
|
yield A(b)
|
||||||
|
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# @repo.mark_injector()
|
||||||
|
# def schema_from_b(b: B) -> SomeSchema:
|
||||||
|
# return SomeSchema(0)
|
||||||
|
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
@contextmanager
|
||||||
|
def schema_from_a_b(a: A, b: B) -> typing.Generator[SomeSchema]:
|
||||||
|
yield SomeSchema(a.a)
|
||||||
|
|
||||||
|
|
||||||
|
# @repo.mark_injector()
|
||||||
|
# def schema_from_a(a: A) -> SomeSchema:
|
||||||
|
# return SomeSchema(a.a)
|
||||||
|
|
||||||
|
# @repo.mark_injector()
|
||||||
|
# def schema_from_int(i: int) -> SomeSchema:
|
||||||
|
# return SomeSchema(i)
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def int_from_float(f: float) -> int:
|
||||||
|
return int(f)
|
||||||
|
|
||||||
|
|
||||||
|
# @repo.mark_injector()
|
||||||
|
# def zero_int() -> int:
|
||||||
|
# return 42
|
||||||
|
|
||||||
|
|
||||||
|
# @repo.consumer
|
||||||
|
|
||||||
|
|
||||||
|
def consumer(dep: SomeSchema) -> int:
|
||||||
|
print(f'consume {dep.a}')
|
||||||
|
return 42
|
||||||
|
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
# fn = repo.get_conversion((int,), consumer, force_commutative=True, force_async=True)
|
||||||
|
# await fn(42)
|
||||||
|
# await fn(B())
|
||||||
|
|
||||||
|
# # g = walker.generate_callgraph_singletype(repo._injector_set, frozenset({int}), SomeSchema)
|
||||||
|
from_types = (B | int,)
|
||||||
|
walker = GraphWalker()
|
||||||
|
g = walker.generate_callgraph(repo.convertor_set, frozenset(from_types), consumer)
|
||||||
|
print('full graph:\n')
|
||||||
|
print(util_mermaid.draw_callgraph_mermaid(g, split_duplicates=True))
|
||||||
|
exploded = walker.explode_callgraph_branches(g, frozenset(from_types))
|
||||||
|
|
||||||
|
print('\nexploded:\n\n')
|
||||||
|
for s_i, selected in enumerate(exploded):
|
||||||
|
# print('\nselected path:\n')
|
||||||
|
print(util_mermaid.draw_callgraph_mermaid(Callgraph(frozenset({selected})), split_duplicates=True,
|
||||||
|
skip_title=True,
|
||||||
|
prefix=f'{s_i}_'))
|
||||||
|
|
||||||
|
print('\nselect variants:\n\n')
|
||||||
|
exploded = walker.filter_exploded_callgraph_branch(exploded)
|
||||||
|
# print(util_mermaid.draw_callgraph_mermaid(Callgraph(frozenset({selected})), split_duplicates=True))
|
||||||
|
|
||||||
|
for s_i, selected in enumerate(exploded):
|
||||||
|
# print('\nselected path:\n')
|
||||||
|
print(util_mermaid.draw_callgraph_mermaid(Callgraph(frozenset({selected})), split_duplicates=True,
|
||||||
|
skip_title=True,
|
||||||
|
prefix=f'{s_i}_'))
|
||||||
|
print(f'\nconsumed {selected.consumed_from_types}')
|
||||||
|
# consumer({})
|
||||||
|
# graph = walker.generate_full_depgraph(consumer)
|
||||||
|
# print(draw_depgraph_mermaid(graph))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
asyncio.run(main())
|
||||||
114
src/breakshaft/convertor.py
Normal file
114
src/breakshaft/convertor.py
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
from typing import Optional, Callable, Unpack, TypeVarTuple, TypeVar, Awaitable, Any
|
||||||
|
|
||||||
|
from .graph_walker import GraphWalker
|
||||||
|
from .models import ConversionPoint, Callgraph
|
||||||
|
from .renderer import ConvertorRenderer, InTimeGenerationConvertorRenderer
|
||||||
|
|
||||||
|
Tin = TypeVarTuple('Tin')
|
||||||
|
Tout = TypeVar('Tout')
|
||||||
|
|
||||||
|
|
||||||
|
class ConvRepo:
|
||||||
|
_convertor_set: set[ConversionPoint]
|
||||||
|
|
||||||
|
walker: GraphWalker
|
||||||
|
renderer: ConvertorRenderer
|
||||||
|
|
||||||
|
def __init__(self,
|
||||||
|
graph_walker: Optional[GraphWalker] = None,
|
||||||
|
renderer: Optional[ConvertorRenderer] = None, ):
|
||||||
|
if graph_walker is None:
|
||||||
|
graph_walker = GraphWalker()
|
||||||
|
if renderer is None:
|
||||||
|
renderer = InTimeGenerationConvertorRenderer()
|
||||||
|
|
||||||
|
self._convertor_set = set()
|
||||||
|
self.walker = graph_walker
|
||||||
|
self.renderer = renderer
|
||||||
|
|
||||||
|
@property
|
||||||
|
def convertor_set(self):
|
||||||
|
return self._convertor_set
|
||||||
|
|
||||||
|
def add_injector(self, func: Callable, rettype: Optional[type] = None):
|
||||||
|
self._convertor_set |= set(ConversionPoint.from_fn(func, rettype=rettype))
|
||||||
|
|
||||||
|
def _callseq_from_callgraph(self, cg: Callgraph) -> list[ConversionPoint]:
|
||||||
|
if len(cg.variants) == 0:
|
||||||
|
return []
|
||||||
|
if len(cg.variants) > 1:
|
||||||
|
raise ValueError('All callgraph subgraphs must be solved for callseq generation')
|
||||||
|
ret = []
|
||||||
|
variant = list(cg.variants)[0]
|
||||||
|
for sg in variant.subgraphs:
|
||||||
|
ret += self._callseq_from_callgraph(sg)
|
||||||
|
ret += [variant.injector]
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def get_conversion(self,
|
||||||
|
from_types: tuple[type[Unpack[Tin]]],
|
||||||
|
fn: Callable[..., Tout],
|
||||||
|
force_commutative: bool = True,
|
||||||
|
allow_async: bool = True,
|
||||||
|
allow_sync: bool = True,
|
||||||
|
force_async: bool = False
|
||||||
|
) -> Callable[[Unpack[Tin]], Tout] | Awaitable[Callable[[Unpack[Tin]], Tout]]:
|
||||||
|
if not allow_async or force_async:
|
||||||
|
filtered_injectors: frozenset[ConversionPoint] = frozenset()
|
||||||
|
for inj in self.convertor_set:
|
||||||
|
if inj.is_async and not allow_async:
|
||||||
|
continue
|
||||||
|
if not inj.is_async and not allow_sync:
|
||||||
|
continue
|
||||||
|
filtered_injectors |= {inj}
|
||||||
|
else:
|
||||||
|
filtered_injectors = frozenset(self.convertor_set)
|
||||||
|
|
||||||
|
cg = self.walker.generate_callgraph(filtered_injectors, frozenset(from_types), fn)
|
||||||
|
if cg is None:
|
||||||
|
raise ValueError(f'Unable to compute conversion graph on {from_types}->{fn.__qualname__}')
|
||||||
|
|
||||||
|
exploded = self.walker.explode_callgraph_branches(cg, frozenset(from_types))
|
||||||
|
|
||||||
|
selected = self.walker.filter_exploded_callgraph_branch(exploded)
|
||||||
|
if len(selected) == 0:
|
||||||
|
raise ValueError('Unable to select conversion path')
|
||||||
|
|
||||||
|
if force_commutative and len(selected) > 1:
|
||||||
|
raise ValueError('Conversion path is not commutative')
|
||||||
|
|
||||||
|
callseq = self._callseq_from_callgraph(Callgraph(frozenset([selected[0]])))
|
||||||
|
return self.renderer.render(from_types, callseq, force_async=force_async)
|
||||||
|
|
||||||
|
def mark_injector(self, *, rettype: Optional[type] = None):
|
||||||
|
def inner(func: Callable):
|
||||||
|
self.add_injector(func)
|
||||||
|
return func
|
||||||
|
|
||||||
|
return inner
|
||||||
|
|
||||||
|
def fork(self, fork_with: Optional[set[ConversionPoint]] = None) -> ConvRepo:
|
||||||
|
return ForkedConvRepo(self, fork_with or None, self.walker, self.renderer)
|
||||||
|
|
||||||
|
|
||||||
|
class ForkedConvRepo(ConvRepo):
|
||||||
|
_base_repo: ConvRepo
|
||||||
|
|
||||||
|
def __init__(self,
|
||||||
|
fork_from: ConvRepo,
|
||||||
|
fork_with: Optional[set[ConversionPoint]] = None,
|
||||||
|
graph_walker: Optional[GraphWalker] = None,
|
||||||
|
renderer: Optional[ConvertorRenderer] = None):
|
||||||
|
super().__init__(graph_walker, renderer)
|
||||||
|
if fork_with is None:
|
||||||
|
fork_with = set()
|
||||||
|
self._convertor_set = fork_with
|
||||||
|
self._base_repo = fork_from
|
||||||
|
|
||||||
|
def add_injector(self, func: Callable, rettype: Optional[type] = None):
|
||||||
|
self._convertor_set |= set(ConversionPoint.from_fn(func, rettype=rettype))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def convertor_set(self):
|
||||||
|
return self._base_repo.convertor_set | self._convertor_set
|
||||||
200
src/breakshaft/graph_walker.py
Normal file
200
src/breakshaft/graph_walker.py
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
import typing
|
||||||
|
from types import NoneType
|
||||||
|
from typing import Callable, Optional
|
||||||
|
|
||||||
|
from .models import ConversionPoint, Callgraph, CallgraphVariant, TransformationPoint, CompositionDirection
|
||||||
|
from .util import extract_func_argtypes, all_combinations
|
||||||
|
|
||||||
|
|
||||||
|
class GraphWalker:
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def generate_callgraph(cls,
|
||||||
|
injectors: frozenset[ConversionPoint],
|
||||||
|
from_types: frozenset[type],
|
||||||
|
consumer_fn: Callable) -> Optional[Callgraph]:
|
||||||
|
|
||||||
|
into_types: frozenset[type] = extract_func_argtypes(consumer_fn)
|
||||||
|
|
||||||
|
branches: frozenset[Callgraph] = frozenset()
|
||||||
|
|
||||||
|
for into_type in into_types:
|
||||||
|
cg = cls.generate_callgraph_singletype(injectors, from_types, into_type)
|
||||||
|
if cg is None:
|
||||||
|
return None
|
||||||
|
branches |= {cg}
|
||||||
|
variant = CallgraphVariant(ConversionPoint(consumer_fn, NoneType, tuple(extract_func_argtypes(consumer_fn))),
|
||||||
|
branches, frozenset())
|
||||||
|
return Callgraph(frozenset({variant}))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def generate_callgraph_singletype(cls,
|
||||||
|
injectors: frozenset[ConversionPoint],
|
||||||
|
from_types: frozenset[type],
|
||||||
|
into_type: type,
|
||||||
|
*,
|
||||||
|
visited_path: Optional[set[ConversionPoint]] = None,
|
||||||
|
visited_types: Optional[set[type]] = None) -> Optional[Callgraph]:
|
||||||
|
if visited_path is None:
|
||||||
|
visited_path = set()
|
||||||
|
if visited_types is None:
|
||||||
|
visited_types = set()
|
||||||
|
|
||||||
|
if into_type in from_types:
|
||||||
|
return Callgraph.new_empty()
|
||||||
|
|
||||||
|
if into_type in visited_types:
|
||||||
|
return None
|
||||||
|
|
||||||
|
head = Callgraph.new_empty()
|
||||||
|
|
||||||
|
visited_types.add(into_type)
|
||||||
|
|
||||||
|
for point in injectors:
|
||||||
|
if point in visited_path:
|
||||||
|
continue
|
||||||
|
if into_type in point.requires:
|
||||||
|
continue
|
||||||
|
if point.injects == into_type:
|
||||||
|
visited_path.add(point)
|
||||||
|
variant_subgraphs = set()
|
||||||
|
dead_end = False
|
||||||
|
for req in point.requires:
|
||||||
|
subg = cls.generate_callgraph_singletype(injectors,
|
||||||
|
from_types,
|
||||||
|
req,
|
||||||
|
visited_path=visited_path.copy(),
|
||||||
|
visited_types=visited_types.copy())
|
||||||
|
if subg is None:
|
||||||
|
dead_end = True
|
||||||
|
break
|
||||||
|
variant_subgraphs.add(subg)
|
||||||
|
|
||||||
|
if not dead_end:
|
||||||
|
consumed = frozenset(point.requires) & from_types
|
||||||
|
variant = CallgraphVariant(point, frozenset(variant_subgraphs), consumed)
|
||||||
|
head = head.add_subgraph_variant(variant)
|
||||||
|
|
||||||
|
if len(head.variants) == 0:
|
||||||
|
return None
|
||||||
|
|
||||||
|
return head
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def explode_callgraph_branches(cls, g: Callgraph, from_types: frozenset[type]) -> list[CallgraphVariant]:
|
||||||
|
variants = []
|
||||||
|
for variant in g.variants:
|
||||||
|
if len(variant.subgraphs) == 0:
|
||||||
|
variants.append(variant)
|
||||||
|
continue
|
||||||
|
subg_combinations: list[list[CallgraphVariant | None]] = []
|
||||||
|
for subg in variant.subgraphs:
|
||||||
|
combinations: list[CallgraphVariant] = cls.explode_callgraph_branches(subg, from_types)
|
||||||
|
if len(combinations) == 0:
|
||||||
|
subg_combinations.append([None])
|
||||||
|
else:
|
||||||
|
subg_combinations.append(typing.cast(list[CallgraphVariant | None], combinations))
|
||||||
|
|
||||||
|
for combination in all_combinations(subg_combinations):
|
||||||
|
if None in combination:
|
||||||
|
combination.remove(None)
|
||||||
|
cons: frozenset[type] = frozenset()
|
||||||
|
cum_cmb: frozenset[Callgraph] = frozenset()
|
||||||
|
for cmb in combination:
|
||||||
|
if cmb is not None:
|
||||||
|
cons |= cmb.consumed_from_types
|
||||||
|
cum_cmb |= {Callgraph(frozenset({cmb}))}
|
||||||
|
variants.append(
|
||||||
|
CallgraphVariant(variant.injector, cum_cmb,
|
||||||
|
variant.consumed_from_types | cons))
|
||||||
|
|
||||||
|
return variants
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def filter_exploded_callgraph_branch(cls,
|
||||||
|
variants: list[CallgraphVariant],
|
||||||
|
priority_injectors: Optional[frozenset[ConversionPoint | Callable]] = None,
|
||||||
|
relevance_metric: Optional[Callable[[CallgraphVariant], int | float]] = None) \
|
||||||
|
-> list[CallgraphVariant]:
|
||||||
|
|
||||||
|
if relevance_metric is None:
|
||||||
|
template_metrics = [
|
||||||
|
lambda x: len(x.consumed_from_types),
|
||||||
|
lambda x: x.consumed_cumsum,
|
||||||
|
lambda x: -x.invokes,
|
||||||
|
]
|
||||||
|
|
||||||
|
for metric in template_metrics:
|
||||||
|
if len(variants) == 1:
|
||||||
|
break
|
||||||
|
new_variants = cls.filter_exploded_callgraph_branch(variants, priority_injectors, metric)
|
||||||
|
if len(new_variants) > 0:
|
||||||
|
variants = new_variants
|
||||||
|
|
||||||
|
if len(variants) > 1:
|
||||||
|
# sorting by first injector func name for creating minimal cosistancy
|
||||||
|
# could lead to heizenbugs due to incosistancy in path selection between calls
|
||||||
|
variants.sort(key=lambda x: x.injector.fn.__qualname__)
|
||||||
|
return variants
|
||||||
|
|
||||||
|
if len(variants) < 2:
|
||||||
|
return variants
|
||||||
|
|
||||||
|
if priority_injectors is None:
|
||||||
|
priority_injectors = frozenset()
|
||||||
|
new_priority_injectors: frozenset[ConversionPoint] = frozenset()
|
||||||
|
for inj in priority_injectors:
|
||||||
|
injs = {inj}
|
||||||
|
if not isinstance(inj, ConversionPoint):
|
||||||
|
injs = ConversionPoint.from_fn(inj)
|
||||||
|
new_priority_injectors |= injs
|
||||||
|
|
||||||
|
priority_injectors = new_priority_injectors
|
||||||
|
|
||||||
|
best_score = max(*list(
|
||||||
|
map(lambda x: relevance_metric(x) * (len(variants) if x.injector in priority_injectors else 1), variants)))
|
||||||
|
|
||||||
|
selected_variants = []
|
||||||
|
for variant in variants:
|
||||||
|
if relevance_metric(variant) >= best_score:
|
||||||
|
selected_variants.append(variant)
|
||||||
|
return selected_variants
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def select_callgraph_branch(cls,
|
||||||
|
variants: list[CallgraphVariant],
|
||||||
|
ignore_noncommutative=False) -> Optional[CallgraphVariant]:
|
||||||
|
filtered = cls.filter_exploded_callgraph_branch(variants)
|
||||||
|
if len(filtered) > 1 and not ignore_noncommutative:
|
||||||
|
raise ValueError('Graph is not commutative')
|
||||||
|
if len(filtered) == 0:
|
||||||
|
return None
|
||||||
|
return filtered[0]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def generate_full_depgraph(cls,
|
||||||
|
injectors: frozenset[ConversionPoint],
|
||||||
|
consumer: Optional[Callable] = None) -> frozenset[TransformationPoint]:
|
||||||
|
out_points: list[TransformationPoint] = []
|
||||||
|
|
||||||
|
for point in injectors:
|
||||||
|
out_points.append(TransformationPoint.new_empty(point))
|
||||||
|
|
||||||
|
if consumer is not None:
|
||||||
|
consumer_requires = extract_func_argtypes(consumer)
|
||||||
|
out_points.append(
|
||||||
|
TransformationPoint.new_empty(ConversionPoint(consumer, NoneType, tuple(consumer_requires))))
|
||||||
|
|
||||||
|
for i in range(len(out_points)):
|
||||||
|
pi = out_points[i]
|
||||||
|
for j in range(len(out_points)):
|
||||||
|
pj = out_points[j]
|
||||||
|
cmp = pi.has_composition(pj)
|
||||||
|
match cmp:
|
||||||
|
case CompositionDirection.FORWARD:
|
||||||
|
pi = pi.with_incoming(pj)
|
||||||
|
out_points[j] = pj
|
||||||
|
case CompositionDirection.BACKWARD:
|
||||||
|
pj = pj.with_incoming(pi)
|
||||||
|
out_points[j] = pj
|
||||||
|
return frozenset(out_points)
|
||||||
175
src/breakshaft/models.py
Normal file
175
src/breakshaft/models.py
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import collections.abc
|
||||||
|
import inspect
|
||||||
|
import types
|
||||||
|
import typing
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from enum import Enum
|
||||||
|
from typing import Callable, Optional, get_type_hints, get_origin, Generator, get_args, Union, AsyncIterator
|
||||||
|
|
||||||
|
from .util import extract_func_argtypes, extract_func_argtypes_seq, is_sync_context_manager_factory, \
|
||||||
|
is_async_context_manager_factory, \
|
||||||
|
all_combinations, is_context_manager_factory
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class ConversionPoint:
|
||||||
|
fn: Callable
|
||||||
|
injects: type
|
||||||
|
requires: tuple[type, ...]
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash((self.fn, self.injects, self.requires))
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f'({",".join(map(str, self.requires))}) -> {self.injects.__qualname__}: {self.fn.__qualname__}'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def fn_args(self) -> list[type]:
|
||||||
|
return extract_func_argtypes_seq(self.fn)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_ctx_manager(self) -> bool:
|
||||||
|
return is_sync_context_manager_factory(self.fn) or is_async_context_manager_factory(self.fn)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_async(self):
|
||||||
|
return inspect.iscoroutinefunction(self.fn) or is_async_context_manager_factory(self.fn)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_fn(cls, func: Callable, rettype: Optional[type] = None):
|
||||||
|
if rettype is None:
|
||||||
|
annot = get_type_hints(func)
|
||||||
|
rettype = annot.get('return')
|
||||||
|
|
||||||
|
if rettype is None:
|
||||||
|
raise ValueError(f'Function {func.__qualname__} provided as injector, but return-type is not specified')
|
||||||
|
|
||||||
|
rettype_origin = get_origin(rettype)
|
||||||
|
cm_out_origins = [
|
||||||
|
typing.Generator,
|
||||||
|
typing.Iterator,
|
||||||
|
collections.abc.Generator,
|
||||||
|
collections.abc.Iterator,
|
||||||
|
typing.AsyncIterator,
|
||||||
|
typing.AsyncGenerator,
|
||||||
|
collections.abc.AsyncIterator,
|
||||||
|
collections.abc.AsyncGenerator,
|
||||||
|
]
|
||||||
|
if any(map(lambda x: rettype_origin is x, cm_out_origins)) and is_context_manager_factory(func):
|
||||||
|
rettype = get_args(rettype)[0]
|
||||||
|
|
||||||
|
argtypes: list[list[type]] = []
|
||||||
|
orig_argtypes = extract_func_argtypes_seq(func)
|
||||||
|
for argtype in orig_argtypes:
|
||||||
|
if isinstance(argtype, types.UnionType) or get_origin(argtype) is Union:
|
||||||
|
u_types = list(get_args(argtype)) + [argtype]
|
||||||
|
else:
|
||||||
|
u_types = [argtype]
|
||||||
|
argtypes.append(u_types)
|
||||||
|
|
||||||
|
argtype_combinations = all_combinations(argtypes)
|
||||||
|
ret = []
|
||||||
|
for argtype_combination in argtype_combinations:
|
||||||
|
ret.append(ConversionPoint(func, rettype, tuple(argtype_combination)))
|
||||||
|
|
||||||
|
# return InjectorPoint(func, rettype, argtypes)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
class CompositionDirection(Enum):
|
||||||
|
FORWARD = 1
|
||||||
|
BACKWARD = -1
|
||||||
|
NONE = 0
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class TransformationPoint:
|
||||||
|
point: ConversionPoint
|
||||||
|
incoming_points: frozenset[TransformationPoint]
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash((self.point, self.incoming_points))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def new_empty(cls, point: ConversionPoint) -> TransformationPoint:
|
||||||
|
return TransformationPoint(point, frozenset())
|
||||||
|
|
||||||
|
def has_composition(self, other: TransformationPoint) -> CompositionDirection:
|
||||||
|
if other.point.injects in self.point.requires:
|
||||||
|
return CompositionDirection.FORWARD
|
||||||
|
if self.point.injects in other.point.requires:
|
||||||
|
return CompositionDirection.BACKWARD
|
||||||
|
return CompositionDirection.NONE
|
||||||
|
|
||||||
|
def copy_with(self, *,
|
||||||
|
incoming_points: Optional[frozenset[TransformationPoint]] = None) -> TransformationPoint:
|
||||||
|
return TransformationPoint(
|
||||||
|
self.point,
|
||||||
|
incoming_points or self.incoming_points,
|
||||||
|
)
|
||||||
|
|
||||||
|
def with_incoming(self, incoming: TransformationPoint) -> TransformationPoint:
|
||||||
|
return self.copy_with(
|
||||||
|
incoming_points=self.incoming_points | frozenset({incoming})
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class CallgraphVariant:
|
||||||
|
injector: ConversionPoint
|
||||||
|
subgraphs: frozenset[Callgraph]
|
||||||
|
consumed_from_types: frozenset[type]
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash((self.injector, self.subgraphs, self.consumed_from_types))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def depth(self) -> int:
|
||||||
|
return 1 + max(0, 0, *list(map(lambda x: x.depth, self.subgraphs)))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def invokes(self) -> int:
|
||||||
|
return 1 + sum(list(map(lambda x: x.invokes, self.subgraphs)))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def consumed_cumsum(self):
|
||||||
|
ret = len(self.consumed_from_types)
|
||||||
|
for g in self.subgraphs:
|
||||||
|
ret += g.consumed_cumsum
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class Callgraph:
|
||||||
|
variants: frozenset[CallgraphVariant]
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(self.variants)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def consumed_cumsum(self):
|
||||||
|
return max(0, 0, *list(map(lambda x: x.consumed_cumsum, self.variants)))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def depth(self) -> int:
|
||||||
|
return 1 + max(0, 0, *list(map(lambda x: x.depth, self.variants)))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def invokes(self) -> int:
|
||||||
|
return max(0, 0, *list(map(lambda x: x.invokes, self.variants)))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def new_empty(cls) -> Callgraph:
|
||||||
|
return cls(frozenset())
|
||||||
|
|
||||||
|
def add_subgraph_variant(self, new_variant: CallgraphVariant) -> Callgraph:
|
||||||
|
return Callgraph(self.variants | {new_variant})
|
||||||
|
|
||||||
|
@property
|
||||||
|
def consumed_from_types_max_cnt(self) -> int:
|
||||||
|
ret = 0
|
||||||
|
for variant in self.variants:
|
||||||
|
ret = max(ret, len(variant.consumed_from_types))
|
||||||
|
return ret
|
||||||
97
src/breakshaft/renderer.py
Normal file
97
src/breakshaft/renderer.py
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
import typing
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Protocol, Sequence, Callable, Optional
|
||||||
|
|
||||||
|
import importlib.resources
|
||||||
|
|
||||||
|
import jinja2
|
||||||
|
|
||||||
|
from .models import ConversionPoint
|
||||||
|
from .util import hashname
|
||||||
|
|
||||||
|
|
||||||
|
class ConvertorRenderer(Protocol):
|
||||||
|
def render(self,
|
||||||
|
from_types: Sequence[type],
|
||||||
|
callseq: Sequence[ConversionPoint],
|
||||||
|
force_async: bool = False) -> Callable:
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class ConversionRenderData:
|
||||||
|
inj_hash: str
|
||||||
|
funchash: str
|
||||||
|
funcname: str
|
||||||
|
funcargs: list[str]
|
||||||
|
is_ctxmanager: bool
|
||||||
|
is_async: bool
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_inj(cls, inj: ConversionPoint):
|
||||||
|
fnargs = []
|
||||||
|
for argtype in inj.requires:
|
||||||
|
fnargs.append(hashname(argtype))
|
||||||
|
return cls(hashname(inj.injects), hashname(inj.fn), repr(inj.fn), fnargs, inj.is_ctx_manager, inj.is_async)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class ConversionArgRenderData:
|
||||||
|
name: str
|
||||||
|
typename: str
|
||||||
|
typehash: str
|
||||||
|
|
||||||
|
|
||||||
|
class InTimeGenerationConvertorRenderer(ConvertorRenderer):
|
||||||
|
templateLoader: jinja2.BaseLoader
|
||||||
|
templateEnv: jinja2.Environment
|
||||||
|
template: jinja2.Template
|
||||||
|
|
||||||
|
def __init__(self,
|
||||||
|
loader: Optional[jinja2.BaseLoader] = None,
|
||||||
|
convertor_template: str = 'convertor.jinja2'):
|
||||||
|
if loader is None:
|
||||||
|
template_path = importlib.resources.files('src.breakshaft.templates')
|
||||||
|
loader = jinja2.FileSystemLoader(str(template_path))
|
||||||
|
self.templateLoader = loader
|
||||||
|
self.templateEnv = jinja2.Environment(loader=self.templateLoader)
|
||||||
|
self.template = self.templateEnv.get_template(convertor_template)
|
||||||
|
|
||||||
|
def render(self,
|
||||||
|
from_types: Sequence[type],
|
||||||
|
callseq: Sequence[ConversionPoint],
|
||||||
|
force_async: bool = False) -> Callable:
|
||||||
|
|
||||||
|
fnmap = {}
|
||||||
|
conversion_models = []
|
||||||
|
ret_hash = 0
|
||||||
|
is_async = force_async
|
||||||
|
|
||||||
|
for call in callseq:
|
||||||
|
fnmap[hash(call.fn)] = call.fn
|
||||||
|
conv = ConversionRenderData.from_inj(call)
|
||||||
|
if conv not in conversion_models:
|
||||||
|
conversion_models.append(conv)
|
||||||
|
if call.is_async:
|
||||||
|
is_async = True
|
||||||
|
|
||||||
|
ret_hash = hash(callseq[-1].injects)
|
||||||
|
|
||||||
|
conv_args = []
|
||||||
|
for i, from_type in enumerate(from_types):
|
||||||
|
conv_args.append(ConversionArgRenderData(f'arg{i}', repr(from_type), hashname(from_type)))
|
||||||
|
|
||||||
|
namespace = {
|
||||||
|
'_conv_funcmap': fnmap,
|
||||||
|
}
|
||||||
|
convertor_functext = self.template.render(
|
||||||
|
ret_hash=ret_hash,
|
||||||
|
conv_args=conv_args,
|
||||||
|
conversions=conversion_models,
|
||||||
|
is_async=is_async,
|
||||||
|
)
|
||||||
|
convertor_functext = '\n'.join(list(filter(lambda x: len(x.strip()), convertor_functext.split('\n'))))
|
||||||
|
exec(convertor_functext, namespace)
|
||||||
|
unwrap_func = namespace['convertor']
|
||||||
|
|
||||||
|
return typing.cast(Callable, unwrap_func)
|
||||||
0
src/breakshaft/templates/__init__.py
Normal file
0
src/breakshaft/templates/__init__.py
Normal file
13
src/breakshaft/templates/convertor.jinja2
Normal file
13
src/breakshaft/templates/convertor.jinja2
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{% set ns = namespace(indent=0) %}
|
||||||
|
{% if is_async %}async {% endif %}def convertor({% for arg in conv_args %}_{{arg.typehash}}: "{{arg.typename}}",{% endfor %}){% if rettype %} -> '{{rettype}}'{% endif %}:
|
||||||
|
{% for conv in conversions %}
|
||||||
|
{% if conv.is_ctxmanager %}
|
||||||
|
{{ ' ' * ns.indent }}# {{conv.funcname}}
|
||||||
|
{{ ' ' * ns.indent }}{% if conv.is_async %}async {% endif %}with _conv_funcmap[{{ conv.funchash }}]({% for conv_arg in conv.funcargs %}_{{conv_arg}}, {% endfor %}) as _{{ conv.inj_hash }}:
|
||||||
|
{% set ns.indent = ns.indent + 1 %}
|
||||||
|
{% else %}
|
||||||
|
{{ ' ' * ns.indent }}# {{conv.funcname}}
|
||||||
|
{{ ' ' * ns.indent }}_{{conv.inj_hash}} = {% if conv.is_async %}await {% endif %}_conv_funcmap[{{conv.funchash}}]({% for conv_arg in conv.funcargs %}_{{conv_arg}}, {% endfor %})
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{{ ' ' * ns.indent }}return _{{ret_hash}}
|
||||||
65
src/breakshaft/util.py
Normal file
65
src/breakshaft/util.py
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import inspect
|
||||||
|
from itertools import product
|
||||||
|
from typing import Callable, get_type_hints, TypeVar, Any
|
||||||
|
|
||||||
|
|
||||||
|
def extract_func_args(func: Callable) -> list[tuple[str, type]]:
|
||||||
|
sig = inspect.signature(func)
|
||||||
|
type_hints = get_type_hints(func)
|
||||||
|
params = sig.parameters
|
||||||
|
|
||||||
|
args_info = []
|
||||||
|
for name, param in params.items():
|
||||||
|
if name not in type_hints:
|
||||||
|
raise TypeError(f"Param {name} must be type-annotated")
|
||||||
|
args_info.append((name, type_hints[name]))
|
||||||
|
return args_info
|
||||||
|
|
||||||
|
|
||||||
|
def extract_func_argtypes(func: Callable) -> frozenset[type]:
|
||||||
|
sig = inspect.signature(func)
|
||||||
|
type_hints = get_type_hints(func)
|
||||||
|
params = sig.parameters
|
||||||
|
|
||||||
|
ret: frozenset[type] = frozenset()
|
||||||
|
for name, param in params.items():
|
||||||
|
if name not in type_hints:
|
||||||
|
raise TypeError(f"Param {name} must be type-annotated")
|
||||||
|
ret |= {type_hints[name]}
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
def extract_func_argtypes_seq(func: Callable) -> list[type]:
|
||||||
|
sig = inspect.signature(func)
|
||||||
|
type_hints = get_type_hints(func)
|
||||||
|
params = sig.parameters
|
||||||
|
|
||||||
|
ret: list[type] = []
|
||||||
|
for name, param in params.items():
|
||||||
|
if name not in type_hints:
|
||||||
|
raise TypeError(f"Param {name} must be type-annotated")
|
||||||
|
ret.append(type_hints[name])
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
def is_context_manager_factory(obj: object) -> bool:
|
||||||
|
return is_sync_context_manager_factory(obj) or is_async_context_manager_factory(obj)
|
||||||
|
|
||||||
|
|
||||||
|
def is_sync_context_manager_factory(obj: object) -> bool:
|
||||||
|
return hasattr(obj, '__wrapped__') and inspect.isgeneratorfunction(obj.__wrapped__)
|
||||||
|
|
||||||
|
|
||||||
|
def is_async_context_manager_factory(obj: object) -> bool:
|
||||||
|
return hasattr(obj, '__wrapped__') and inspect.isasyncgenfunction(obj.__wrapped__)
|
||||||
|
|
||||||
|
|
||||||
|
def hashname(any: Any) -> str:
|
||||||
|
return str(hash(any)).replace('-', '_')
|
||||||
|
|
||||||
|
|
||||||
|
T = TypeVar('T')
|
||||||
|
|
||||||
|
|
||||||
|
def all_combinations(options: list[list[T]]) -> list[list[T]]:
|
||||||
|
return [list(comb) for comb in product(*options)]
|
||||||
70
src/breakshaft/util_mermaid.py
Normal file
70
src/breakshaft/util_mermaid.py
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
from .models import Callgraph, TransformationPoint
|
||||||
|
from .util import hashname
|
||||||
|
|
||||||
|
|
||||||
|
def draw_depgraph_mermaid(depgraph: frozenset[TransformationPoint]):
|
||||||
|
ret = ['flowchart TD']
|
||||||
|
for point in depgraph:
|
||||||
|
n = str(hash(point.point)).replace('-', '_')
|
||||||
|
ret.append(f' {n}["{shield_mermaid_name(str(point.point))}"]')
|
||||||
|
|
||||||
|
for point in depgraph:
|
||||||
|
pn = str(hash(point.point)).replace('-', '_')
|
||||||
|
for incoming in point.incoming_points:
|
||||||
|
n = str(hash(incoming.point)).replace('-', '_')
|
||||||
|
ret.append(f' {n} --> {pn}')
|
||||||
|
|
||||||
|
return '\n'.join(ret)
|
||||||
|
|
||||||
|
|
||||||
|
def shield_mermaid_name(s: str) -> str:
|
||||||
|
syms_for_shielding = {'-', '|', '(', ')', '[', ']', '<', '>', '\'', '"', '_'}
|
||||||
|
syms_for_shielding_after = {'<', '>'}
|
||||||
|
for sym in syms_for_shielding:
|
||||||
|
s = s.replace(sym, '\\' + sym)
|
||||||
|
for sym in syms_for_shielding_after:
|
||||||
|
s = s.replace(sym, sym + ' ')
|
||||||
|
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
def _draw_callgraph_mermaid(g: Callgraph, prefix='', split_duplicates=False):
|
||||||
|
definitions = []
|
||||||
|
edges = []
|
||||||
|
if not split_duplicates:
|
||||||
|
prefix = ''
|
||||||
|
|
||||||
|
if len(g.variants) > 0:
|
||||||
|
if len(g.variants) == 1:
|
||||||
|
definitions.append(f' {prefix}{hashname(g)}["{g.invokes}"]')
|
||||||
|
else:
|
||||||
|
definitions.append(
|
||||||
|
f' {prefix}{hashname(g)}["branch select \\[{g.consumed_from_types_max_cnt}\\] \\[{g.invokes}\\]"]')
|
||||||
|
else:
|
||||||
|
definitions.append(f' {prefix}{hashname(g)}((({g.consumed_from_types_max_cnt})))')
|
||||||
|
|
||||||
|
for v_i, variant in enumerate(g.variants):
|
||||||
|
definitions.append(
|
||||||
|
f' {prefix}{hashname(variant)}("{shield_mermaid_name(str(variant.injector))} \\[{len(variant.consumed_from_types)}\\]")')
|
||||||
|
edges.append(f' {prefix}{hashname(g)} -.-> {prefix}{hashname(variant)}')
|
||||||
|
for s_i, subgraph in enumerate(variant.subgraphs):
|
||||||
|
s_prefix = str(v_i) + '_' + str(s_i) + '_' + prefix
|
||||||
|
if not split_duplicates:
|
||||||
|
s_prefix = ''
|
||||||
|
d, e = _draw_callgraph_mermaid(subgraph, s_prefix, split_duplicates)
|
||||||
|
definitions += d
|
||||||
|
edges += e
|
||||||
|
edges.append(f' {prefix}{hashname(variant)} ---> {s_prefix}{hashname(subgraph)}')
|
||||||
|
|
||||||
|
return definitions, edges
|
||||||
|
|
||||||
|
|
||||||
|
def draw_callgraph_mermaid(g: Callgraph, split_duplicates=False, skip_title=False, prefix=''):
|
||||||
|
d, e = _draw_callgraph_mermaid(g, split_duplicates=split_duplicates, prefix=prefix)
|
||||||
|
e = list(set(e))
|
||||||
|
e = [f' head(((head))) --> {prefix}{hashname(g)}'] + e
|
||||||
|
ret = ''
|
||||||
|
if not skip_title:
|
||||||
|
ret += 'flowchart TD\n\n'
|
||||||
|
ret += ' %%defs:\n' + '\n'.join(d) + '\n\n %%edges:\n' + '\n'.join(e)
|
||||||
|
return ret
|
||||||
40
tests/test_basic.py
Normal file
40
tests/test_basic.py
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
from src.breakshaft.convertor import ConvRepo
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class A:
|
||||||
|
a: int
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class B:
|
||||||
|
b: float
|
||||||
|
|
||||||
|
|
||||||
|
def test_basic():
|
||||||
|
repo = ConvRepo()
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def b_to_a(b: B) -> A:
|
||||||
|
return A(int(b.b))
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def a_to_b(a: A) -> B:
|
||||||
|
return B(float(a.a))
|
||||||
|
|
||||||
|
@repo.mark_injector()
|
||||||
|
def int_to_a(i: int) -> A:
|
||||||
|
return A(i)
|
||||||
|
|
||||||
|
def consumer(dep: A) -> int:
|
||||||
|
return dep.a
|
||||||
|
|
||||||
|
fn1 = repo.get_conversion((B,), consumer, force_commutative=True, force_async=False, allow_async=False)
|
||||||
|
dep = fn1(B(42.1))
|
||||||
|
assert dep == 42
|
||||||
|
|
||||||
|
fn2 = repo.get_conversion((int,), consumer, force_commutative=True, force_async=False, allow_async=False)
|
||||||
|
dep = fn2(123)
|
||||||
|
assert dep == 123
|
||||||
249
uv.lock
generated
Normal file
249
uv.lock
generated
Normal file
@@ -0,0 +1,249 @@
|
|||||||
|
version = 1
|
||||||
|
revision = 2
|
||||||
|
requires-python = ">=3.13"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "breakshaft"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = { editable = "." }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "hatchling" },
|
||||||
|
{ name = "jinja2" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.dev-dependencies]
|
||||||
|
dev = [
|
||||||
|
{ name = "mypy" },
|
||||||
|
{ name = "pytest" },
|
||||||
|
{ name = "pytest-cov" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.metadata]
|
||||||
|
requires-dist = [
|
||||||
|
{ name = "hatchling", specifier = ">=1.27.0" },
|
||||||
|
{ name = "jinja2", specifier = ">=3.1.6" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.metadata.requires-dev]
|
||||||
|
dev = [
|
||||||
|
{ name = "mypy", specifier = ">=1.16.1" },
|
||||||
|
{ name = "pytest", specifier = ">=8.4.1" },
|
||||||
|
{ name = "pytest-cov", specifier = ">=6.2.1" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorama"
|
||||||
|
version = "0.4.6"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "coverage"
|
||||||
|
version = "7.9.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/04/b7/c0465ca253df10a9e8dae0692a4ae6e9726d245390aaef92360e1d6d3832/coverage-7.9.2.tar.gz", hash = "sha256:997024fa51e3290264ffd7492ec97d0690293ccd2b45a6cd7d82d945a4a80c8b", size = 813556, upload-time = "2025-07-03T10:54:15.101Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/94/9d/7a8edf7acbcaa5e5c489a646226bed9591ee1c5e6a84733c0140e9ce1ae1/coverage-7.9.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:985abe7f242e0d7bba228ab01070fde1d6c8fa12f142e43debe9ed1dde686038", size = 212367, upload-time = "2025-07-03T10:53:25.811Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e8/9e/5cd6f130150712301f7e40fb5865c1bc27b97689ec57297e568d972eec3c/coverage-7.9.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:82c3939264a76d44fde7f213924021ed31f55ef28111a19649fec90c0f109e6d", size = 212632, upload-time = "2025-07-03T10:53:27.075Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a8/de/6287a2c2036f9fd991c61cefa8c64e57390e30c894ad3aa52fac4c1e14a8/coverage-7.9.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae5d563e970dbe04382f736ec214ef48103d1b875967c89d83c6e3f21706d5b3", size = 245793, upload-time = "2025-07-03T10:53:28.408Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/06/cc/9b5a9961d8160e3cb0b558c71f8051fe08aa2dd4b502ee937225da564ed1/coverage-7.9.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bdd612e59baed2a93c8843c9a7cb902260f181370f1d772f4842987535071d14", size = 243006, upload-time = "2025-07-03T10:53:29.754Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/49/d9/4616b787d9f597d6443f5588619c1c9f659e1f5fc9eebf63699eb6d34b78/coverage-7.9.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:256ea87cb2a1ed992bcdfc349d8042dcea1b80436f4ddf6e246d6bee4b5d73b6", size = 244990, upload-time = "2025-07-03T10:53:31.098Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/48/83/801cdc10f137b2d02b005a761661649ffa60eb173dcdaeb77f571e4dc192/coverage-7.9.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:f44ae036b63c8ea432f610534a2668b0c3aee810e7037ab9d8ff6883de480f5b", size = 245157, upload-time = "2025-07-03T10:53:32.717Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c8/a4/41911ed7e9d3ceb0ffb019e7635468df7499f5cc3edca5f7dfc078e9c5ec/coverage-7.9.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:82d76ad87c932935417a19b10cfe7abb15fd3f923cfe47dbdaa74ef4e503752d", size = 243128, upload-time = "2025-07-03T10:53:34.009Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/10/41/344543b71d31ac9cb00a664d5d0c9ef134a0fe87cb7d8430003b20fa0b7d/coverage-7.9.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:619317bb86de4193debc712b9e59d5cffd91dc1d178627ab2a77b9870deb2868", size = 244511, upload-time = "2025-07-03T10:53:35.434Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d5/81/3b68c77e4812105e2a060f6946ba9e6f898ddcdc0d2bfc8b4b152a9ae522/coverage-7.9.2-cp313-cp313-win32.whl", hash = "sha256:0a07757de9feb1dfafd16ab651e0f628fd7ce551604d1bf23e47e1ddca93f08a", size = 214765, upload-time = "2025-07-03T10:53:36.787Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/06/a2/7fac400f6a346bb1a4004eb2a76fbff0e242cd48926a2ce37a22a6a1d917/coverage-7.9.2-cp313-cp313-win_amd64.whl", hash = "sha256:115db3d1f4d3f35f5bb021e270edd85011934ff97c8797216b62f461dd69374b", size = 215536, upload-time = "2025-07-03T10:53:38.188Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/08/47/2c6c215452b4f90d87017e61ea0fd9e0486bb734cb515e3de56e2c32075f/coverage-7.9.2-cp313-cp313-win_arm64.whl", hash = "sha256:48f82f889c80af8b2a7bb6e158d95a3fbec6a3453a1004d04e4f3b5945a02694", size = 213943, upload-time = "2025-07-03T10:53:39.492Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a3/46/e211e942b22d6af5e0f323faa8a9bc7c447a1cf1923b64c47523f36ed488/coverage-7.9.2-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:55a28954545f9d2f96870b40f6c3386a59ba8ed50caf2d949676dac3ecab99f5", size = 213088, upload-time = "2025-07-03T10:53:40.874Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d2/2f/762551f97e124442eccd907bf8b0de54348635b8866a73567eb4e6417acf/coverage-7.9.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:cdef6504637731a63c133bb2e6f0f0214e2748495ec15fe42d1e219d1b133f0b", size = 213298, upload-time = "2025-07-03T10:53:42.218Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7a/b7/76d2d132b7baf7360ed69be0bcab968f151fa31abe6d067f0384439d9edb/coverage-7.9.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bcd5ebe66c7a97273d5d2ddd4ad0ed2e706b39630ed4b53e713d360626c3dbb3", size = 256541, upload-time = "2025-07-03T10:53:43.823Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a0/17/392b219837d7ad47d8e5974ce5f8dc3deb9f99a53b3bd4d123602f960c81/coverage-7.9.2-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9303aed20872d7a3c9cb39c5d2b9bdbe44e3a9a1aecb52920f7e7495410dfab8", size = 252761, upload-time = "2025-07-03T10:53:45.19Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d5/77/4256d3577fe1b0daa8d3836a1ebe68eaa07dd2cbaf20cf5ab1115d6949d4/coverage-7.9.2-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc18ea9e417a04d1920a9a76fe9ebd2f43ca505b81994598482f938d5c315f46", size = 254917, upload-time = "2025-07-03T10:53:46.931Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/53/99/fc1a008eef1805e1ddb123cf17af864743354479ea5129a8f838c433cc2c/coverage-7.9.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6406cff19880aaaadc932152242523e892faff224da29e241ce2fca329866584", size = 256147, upload-time = "2025-07-03T10:53:48.289Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/92/c0/f63bf667e18b7f88c2bdb3160870e277c4874ced87e21426128d70aa741f/coverage-7.9.2-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:2d0d4f6ecdf37fcc19c88fec3e2277d5dee740fb51ffdd69b9579b8c31e4232e", size = 254261, upload-time = "2025-07-03T10:53:49.99Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8c/32/37dd1c42ce3016ff8ec9e4b607650d2e34845c0585d3518b2a93b4830c1a/coverage-7.9.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:c33624f50cf8de418ab2b4d6ca9eda96dc45b2c4231336bac91454520e8d1fac", size = 255099, upload-time = "2025-07-03T10:53:51.354Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/da/2e/af6b86f7c95441ce82f035b3affe1cd147f727bbd92f563be35e2d585683/coverage-7.9.2-cp313-cp313t-win32.whl", hash = "sha256:1df6b76e737c6a92210eebcb2390af59a141f9e9430210595251fbaf02d46926", size = 215440, upload-time = "2025-07-03T10:53:52.808Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4d/bb/8a785d91b308867f6b2e36e41c569b367c00b70c17f54b13ac29bcd2d8c8/coverage-7.9.2-cp313-cp313t-win_amd64.whl", hash = "sha256:f5fd54310b92741ebe00d9c0d1d7b2b27463952c022da6d47c175d246a98d1bd", size = 216537, upload-time = "2025-07-03T10:53:54.273Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/1d/a0/a6bffb5e0f41a47279fd45a8f3155bf193f77990ae1c30f9c224b61cacb0/coverage-7.9.2-cp313-cp313t-win_arm64.whl", hash = "sha256:c48c2375287108c887ee87d13b4070a381c6537d30e8487b24ec721bf2a781cb", size = 214398, upload-time = "2025-07-03T10:53:56.715Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/3c/38/bbe2e63902847cf79036ecc75550d0698af31c91c7575352eb25190d0fb3/coverage-7.9.2-py3-none-any.whl", hash = "sha256:e425cd5b00f6fc0ed7cdbd766c70be8baab4b7839e4d4fe5fac48581dd968ea4", size = 204005, upload-time = "2025-07-03T10:54:13.491Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hatchling"
|
||||||
|
version = "1.27.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "packaging" },
|
||||||
|
{ name = "pathspec" },
|
||||||
|
{ name = "pluggy" },
|
||||||
|
{ name = "trove-classifiers" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/8f/8a/cc1debe3514da292094f1c3a700e4ca25442489731ef7c0814358816bb03/hatchling-1.27.0.tar.gz", hash = "sha256:971c296d9819abb3811112fc52c7a9751c8d381898f36533bb16f9791e941fd6", size = 54983, upload-time = "2024-12-15T17:08:11.894Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/08/e7/ae38d7a6dfba0533684e0b2136817d667588ae3ec984c1a4e5df5eb88482/hatchling-1.27.0-py3-none-any.whl", hash = "sha256:d3a2f3567c4f926ea39849cdf924c7e99e6686c9c8e288ae1037c8fa2a5d937b", size = 75794, upload-time = "2024-12-15T17:08:10.364Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iniconfig"
|
||||||
|
version = "2.1.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/f2/97/ebf4da567aa6827c909642694d71c9fcf53e5b504f2d96afea02718862f3/iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7", size = 4793, upload-time = "2025-03-19T20:09:59.721Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/2c/e1/e6716421ea10d38022b952c159d5161ca1193197fb744506875fbb87ea7b/iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760", size = 6050, upload-time = "2025-03-19T20:10:01.071Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "jinja2"
|
||||||
|
version = "3.1.6"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "markupsafe" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d", size = 245115, upload-time = "2025-03-05T20:05:02.478Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67", size = 134899, upload-time = "2025-03-05T20:05:00.369Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "markupsafe"
|
||||||
|
version = "3.0.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/b2/97/5d42485e71dfc078108a86d6de8fa46db44a1a9295e89c5d6d4a06e23a62/markupsafe-3.0.2.tar.gz", hash = "sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0", size = 20537, upload-time = "2024-10-18T15:21:54.129Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/83/0e/67eb10a7ecc77a0c2bbe2b0235765b98d164d81600746914bebada795e97/MarkupSafe-3.0.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd", size = 14274, upload-time = "2024-10-18T15:21:24.577Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/2b/6d/9409f3684d3335375d04e5f05744dfe7e9f120062c9857df4ab490a1031a/MarkupSafe-3.0.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430", size = 12352, upload-time = "2024-10-18T15:21:25.382Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d2/f5/6eadfcd3885ea85fe2a7c128315cc1bb7241e1987443d78c8fe712d03091/MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094", size = 24122, upload-time = "2024-10-18T15:21:26.199Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0c/91/96cf928db8236f1bfab6ce15ad070dfdd02ed88261c2afafd4b43575e9e9/MarkupSafe-3.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396", size = 23085, upload-time = "2024-10-18T15:21:27.029Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c2/cf/c9d56af24d56ea04daae7ac0940232d31d5a8354f2b457c6d856b2057d69/MarkupSafe-3.0.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79", size = 22978, upload-time = "2024-10-18T15:21:27.846Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/2a/9f/8619835cd6a711d6272d62abb78c033bda638fdc54c4e7f4272cf1c0962b/MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a", size = 24208, upload-time = "2024-10-18T15:21:28.744Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f9/bf/176950a1792b2cd2102b8ffeb5133e1ed984547b75db47c25a67d3359f77/MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca", size = 23357, upload-time = "2024-10-18T15:21:29.545Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ce/4f/9a02c1d335caabe5c4efb90e1b6e8ee944aa245c1aaaab8e8a618987d816/MarkupSafe-3.0.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c", size = 23344, upload-time = "2024-10-18T15:21:30.366Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ee/55/c271b57db36f748f0e04a759ace9f8f759ccf22b4960c270c78a394f58be/MarkupSafe-3.0.2-cp313-cp313-win32.whl", hash = "sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1", size = 15101, upload-time = "2024-10-18T15:21:31.207Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/29/88/07df22d2dd4df40aba9f3e402e6dc1b8ee86297dddbad4872bd5e7b0094f/MarkupSafe-3.0.2-cp313-cp313-win_amd64.whl", hash = "sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f", size = 15603, upload-time = "2024-10-18T15:21:32.032Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/62/6a/8b89d24db2d32d433dffcd6a8779159da109842434f1dd2f6e71f32f738c/MarkupSafe-3.0.2-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c", size = 14510, upload-time = "2024-10-18T15:21:33.625Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/7a/06/a10f955f70a2e5a9bf78d11a161029d278eeacbd35ef806c3fd17b13060d/MarkupSafe-3.0.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb", size = 12486, upload-time = "2024-10-18T15:21:34.611Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/34/cf/65d4a571869a1a9078198ca28f39fba5fbb910f952f9dbc5220afff9f5e6/MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c", size = 25480, upload-time = "2024-10-18T15:21:35.398Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0c/e3/90e9651924c430b885468b56b3d597cabf6d72be4b24a0acd1fa0e12af67/MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d", size = 23914, upload-time = "2024-10-18T15:21:36.231Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/66/8c/6c7cf61f95d63bb866db39085150df1f2a5bd3335298f14a66b48e92659c/MarkupSafe-3.0.2-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe", size = 23796, upload-time = "2024-10-18T15:21:37.073Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/bb/35/cbe9238ec3f47ac9a7c8b3df7a808e7cb50fe149dc7039f5f454b3fba218/MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5", size = 25473, upload-time = "2024-10-18T15:21:37.932Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e6/32/7621a4382488aa283cc05e8984a9c219abad3bca087be9ec77e89939ded9/MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a", size = 24114, upload-time = "2024-10-18T15:21:39.799Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0d/80/0985960e4b89922cb5a0bac0ed39c5b96cbc1a536a99f30e8c220a996ed9/MarkupSafe-3.0.2-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9", size = 24098, upload-time = "2024-10-18T15:21:40.813Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/82/78/fedb03c7d5380df2427038ec8d973587e90561b2d90cd472ce9254cf348b/MarkupSafe-3.0.2-cp313-cp313t-win32.whl", hash = "sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6", size = 15208, upload-time = "2024-10-18T15:21:41.814Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4f/65/6079a46068dfceaeabb5dcad6d674f5f5c61a6fa5673746f42a9f4c233b3/MarkupSafe-3.0.2-cp313-cp313t-win_amd64.whl", hash = "sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f", size = 15739, upload-time = "2024-10-18T15:21:42.784Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mypy"
|
||||||
|
version = "1.16.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "mypy-extensions" },
|
||||||
|
{ name = "pathspec" },
|
||||||
|
{ name = "typing-extensions" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/81/69/92c7fa98112e4d9eb075a239caa4ef4649ad7d441545ccffbd5e34607cbb/mypy-1.16.1.tar.gz", hash = "sha256:6bd00a0a2094841c5e47e7374bb42b83d64c527a502e3334e1173a0c24437bab", size = 3324747, upload-time = "2025-06-16T16:51:35.145Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/28/e3/96964af4a75a949e67df4b95318fe2b7427ac8189bbc3ef28f92a1c5bc56/mypy-1.16.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:ddc91eb318c8751c69ddb200a5937f1232ee8efb4e64e9f4bc475a33719de438", size = 11063480, upload-time = "2025-06-16T16:47:56.205Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f5/4d/cd1a42b8e5be278fab7010fb289d9307a63e07153f0ae1510a3d7b703193/mypy-1.16.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:87ff2c13d58bdc4bbe7dc0dedfe622c0f04e2cb2a492269f3b418df2de05c536", size = 10090538, upload-time = "2025-06-16T16:46:43.92Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c9/4f/c3c6b4b66374b5f68bab07c8cabd63a049ff69796b844bc759a0ca99bb2a/mypy-1.16.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0a7cfb0fe29fe5a9841b7c8ee6dffb52382c45acdf68f032145b75620acfbd6f", size = 11836839, upload-time = "2025-06-16T16:36:28.039Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b4/7e/81ca3b074021ad9775e5cb97ebe0089c0f13684b066a750b7dc208438403/mypy-1.16.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:051e1677689c9d9578b9c7f4d206d763f9bbd95723cd1416fad50db49d52f359", size = 12715634, upload-time = "2025-06-16T16:50:34.441Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e9/95/bdd40c8be346fa4c70edb4081d727a54d0a05382d84966869738cfa8a497/mypy-1.16.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:d5d2309511cc56c021b4b4e462907c2b12f669b2dbeb68300110ec27723971be", size = 12895584, upload-time = "2025-06-16T16:34:54.857Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5a/fd/d486a0827a1c597b3b48b1bdef47228a6e9ee8102ab8c28f944cb83b65dc/mypy-1.16.1-cp313-cp313-win_amd64.whl", hash = "sha256:4f58ac32771341e38a853c5d0ec0dfe27e18e27da9cdb8bbc882d2249c71a3ee", size = 9573886, upload-time = "2025-06-16T16:36:43.589Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/cf/d3/53e684e78e07c1a2bf7105715e5edd09ce951fc3f47cf9ed095ec1b7a037/mypy-1.16.1-py3-none-any.whl", hash = "sha256:5fc2ac4027d0ef28d6ba69a0343737a23c4d1b83672bf38d1fe237bdc0643b37", size = 2265923, upload-time = "2025-06-16T16:48:02.366Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mypy-extensions"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/a2/6e/371856a3fb9d31ca8dac321cda606860fa4548858c0cc45d9d1d4ca2628b/mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558", size = 6343, upload-time = "2025-04-22T14:54:24.164Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/79/7b/2c79738432f5c924bef5071f933bcc9efd0473bac3b4aa584a6f7c1c8df8/mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505", size = 4963, upload-time = "2025-04-22T14:54:22.983Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "packaging"
|
||||||
|
version = "25.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/a1/d4/1fc4078c65507b51b96ca8f8c3ba19e6a61c8253c72794544580a7b6c24d/packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f", size = 165727, upload-time = "2025-04-19T11:48:59.673Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469, upload-time = "2025-04-19T11:48:57.875Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pathspec"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/ca/bc/f35b8446f4531a7cb215605d100cd88b7ac6f44ab3fc94870c120ab3adbf/pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712", size = 51043, upload-time = "2023-12-10T22:30:45Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08", size = 31191, upload-time = "2023-12-10T22:30:43.14Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pluggy"
|
||||||
|
version = "1.6.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pygments"
|
||||||
|
version = "2.19.2"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/b0/77/a5b8c569bf593b0140bde72ea885a803b82086995367bf2037de0159d924/pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887", size = 4968631, upload-time = "2025-06-21T13:39:12.283Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217, upload-time = "2025-06-21T13:39:07.939Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pytest"
|
||||||
|
version = "8.4.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||||
|
{ name = "iniconfig" },
|
||||||
|
{ name = "packaging" },
|
||||||
|
{ name = "pluggy" },
|
||||||
|
{ name = "pygments" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/08/ba/45911d754e8eba3d5a841a5ce61a65a685ff1798421ac054f85aa8747dfb/pytest-8.4.1.tar.gz", hash = "sha256:7c67fd69174877359ed9371ec3af8a3d2b04741818c51e5e99cc1742251fa93c", size = 1517714, upload-time = "2025-06-18T05:48:06.109Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/29/16/c8a903f4c4dffe7a12843191437d7cd8e32751d5de349d45d3fe69544e87/pytest-8.4.1-py3-none-any.whl", hash = "sha256:539c70ba6fcead8e78eebbf1115e8b589e7565830d7d006a8723f19ac8a0afb7", size = 365474, upload-time = "2025-06-18T05:48:03.955Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pytest-cov"
|
||||||
|
version = "6.2.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "coverage" },
|
||||||
|
{ name = "pluggy" },
|
||||||
|
{ name = "pytest" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/18/99/668cade231f434aaa59bbfbf49469068d2ddd945000621d3d165d2e7dd7b/pytest_cov-6.2.1.tar.gz", hash = "sha256:25cc6cc0a5358204b8108ecedc51a9b57b34cc6b8c967cc2c01a4e00d8a67da2", size = 69432, upload-time = "2025-06-12T10:47:47.684Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/bc/16/4ea354101abb1287856baa4af2732be351c7bee728065aed451b678153fd/pytest_cov-6.2.1-py3-none-any.whl", hash = "sha256:f5bc4c23f42f1cdd23c70b1dab1bbaef4fc505ba950d53e0081d0730dd7e86d5", size = 24644, upload-time = "2025-06-12T10:47:45.932Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "trove-classifiers"
|
||||||
|
version = "2025.5.9.12"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/38/04/1cd43f72c241fedcf0d9a18d0783953ee301eac9e5d9db1df0f0f089d9af/trove_classifiers-2025.5.9.12.tar.gz", hash = "sha256:7ca7c8a7a76e2cd314468c677c69d12cc2357711fcab4a60f87994c1589e5cb5", size = 16940, upload-time = "2025-05-09T12:04:48.829Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/92/ef/c6deb083748be3bcad6f471b6ae983950c161890bf5ae1b2af80cc56c530/trove_classifiers-2025.5.9.12-py3-none-any.whl", hash = "sha256:e381c05537adac78881c8fa345fd0e9970159f4e4a04fcc42cfd3129cca640ce", size = 14119, upload-time = "2025-05-09T12:04:46.38Z" },
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typing-extensions"
|
||||||
|
version = "4.14.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/98/5a/da40306b885cc8c09109dc2e1abd358d5684b1425678151cdaed4731c822/typing_extensions-4.14.1.tar.gz", hash = "sha256:38b39f4aeeab64884ce9f74c94263ef78f3c22467c8724005483154c26648d36", size = 107673, upload-time = "2025-07-04T13:28:34.16Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b5/00/d631e67a838026495268c2f6884f3711a15a9a2a96cd244fdaea53b823fb/typing_extensions-4.14.1-py3-none-any.whl", hash = "sha256:d1e1e3b58374dc93031d6eda2420a48ea44a36c2b4766a4fdeb3710755731d76", size = 43906, upload-time = "2025-07-04T13:28:32.743Z" },
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user