Unwrap injects tuples #7

Merged
nikto_b merged 4 commits from tuple-unwrap into master 2025-08-16 18:47:04 +03:00
5 changed files with 209 additions and 11 deletions
Showing only changes of commit 3150c4b2d0 - Show all commits

View File

@@ -71,6 +71,7 @@ class ConversionPoint:
raise ValueError(f'Function {func.__qualname__} provided as injector, but return-type is not specified')
rettype_origin = get_origin(rettype)
fn_rettype_origin = get_origin(fn_rettype)
cm_out_origins = [
typing.Generator,
typing.Iterator,
@@ -83,6 +84,8 @@ class ConversionPoint:
]
if any(map(lambda x: rettype_origin is x, cm_out_origins)) and is_context_manager_factory(func):
rettype = get_args(rettype)[0]
if any(map(lambda x: fn_rettype_origin is x, cm_out_origins)) and is_context_manager_factory(func):
fn_rettype = get_args(fn_rettype)[0]
if is_basic_type_annot(rettype):
return []

View File

@@ -146,7 +146,7 @@ class InTimeGenerationConvertorRenderer(ConvertorRenderer):
conversion_models = deduplicate_callseq(conversion_models)
ret_hash = hashname(callseq[-1].injects)
ret_hash = hashname(callseq[-1].rettype)
conv_args = []
for i, from_type in enumerate(from_types):