agronholm / agronholm/typeguard

function compatability check

Aberta
#12 5 comentários 0 reações 0 responsáveis Ver no GitHub
enhancement
Linguagem predominante
Python
Estrelas
1.8k
Forks
146
Merge médio
8d 12h
PRs com merge (30d)
1

Descrição

Awesome project, I think it will be very useful.
One question, is there anything that might be used to check the compatibility between two functions?
I am imagining something like this:

```

from typing import List, Any, Sequence
from typeguard import functions_compatible

def f1(var1: int) -> List[int]:
return [var1]

def f2(var1: List[int]) -> Any:
return var1


functions_compatible(f1, f2) # True
functions_compatible(f2, f1) # True, because Any can be int
functions_compatible(f2, f1, strict=True) # False, because Any is not always int
```
I am working on a configurable data pipeline that is meant to run for a very long time, but the exact function connections are not always known until import time or later.

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.