Skip to content
/ Tara Public

Write your type hints and return types automatically with Tara. The type and return automaton

Notifications You must be signed in to change notification settings

Donny-GUI/Tara

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tara automata

Automate python type hints for params and return values

Getting Started

Windows

git clone https://github.com/Donny-GUI/Tara.git
cd Tara
python main.py <yourfile>

Linux

git clone https://github.com/Donny-GUI/Tara.git
cd Tara
python3 main.py <yourfile>

BEFORE 📷

before

AFTER 📸

after after

How?

Parameters use a mix of symbolic execution, natural language processing and static analysis. Then finally a large language model to find a reasonable type if none is assigned.

For Return Types

  1. Determine if the function has a return ast
  2. Find those statements that push return
  3. Check if it has a type hint or type annotation
  4. Analyize the literal string of the return value for lexigraphical hints
  5. if no result, use language syntax to infer type.
  6. Reanalyze to make sure the type or types makes sense

To Come

  1. Secondary Types - Genrators/iters, slices, Callable, Array, etc
  2. Standard Library Types - Index the standard library return types and objects. build a map to function -> return object

About

Write your type hints and return types automatically with Tara. The type and return automaton

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages