Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 1.59 KB

README.md

File metadata and controls

43 lines (32 loc) · 1.59 KB

Typilus + Graph generation

On top of Typilus, this repository can be used to generate augmented ASTs that were used in Typilus.

Graph generation

Graph structure

The graphs contain the following edges:

  • CHILD – AST edges
  • NEXT – edges connecting subsequent tokens in code
  • NEXT_USE – next usage of a variable
  • LAST_LEXICAL_USE – previous usage of a variable
  • OCCURRENCES_OF – edges between occurrences of the same variable
  • SUBTOKEN_OF – edges from subtokens to their origin
  • COMPUTED_FROM – edges that point to the origins of a variable
  • RETURNS_TO – edges from return/yield statements to the function definition

Currently, there are no CFG edges.

Graph extraction

  • Go to src/data_preparation/scripts
  • Install dependencies with pip install -r requirements.txt
  • Run python -m graph_generator.run -i {input_dir} -o {output_dir}
  • You can select output format with -f {format}. Currently, dot and jsonl_gz are supported
  • To explore graphs you can use prettyprint_graph in src/data_preparation/scripts/graph_generator/graphgenutils.py

A deep learning algorithm for predicting types in Python. Please find a preprint here.

This repository contains its implementation (src/) and experiments (exp/).

Please cite as:

@inproceedings{allamanis2020typilus,
  title={Typilus: Neural Type Hints},
  author={Allamanis, Miltiadis and Barr, Earl T and Ducousso, Soline and Gao, Zheng},
  booktitle={PLDI},
  year={2020}
}