package pyre-ast

  1. Overview
  2. Docs

This module provides a type that represents single parameter at each function definition site.

identifier is the name of the parameter. annotation is the (optionally specified) type annotation for the parameter. type_comment can be optionally used in place of annotation for Python2-style type annotation.

Example:

def foo(x: int): ...

Here for parameter x, its annotation will be the int part and type_comment will be unset.

Another example:

def foo(
  x  # type: int
): ...

Here for parameter x, its annotation will be unset and type_comment will be "int".

type ('expr, 'identifier, 'location, 'arg) t = location:'location -> identifier:'identifier -> annotation:'expr option -> type_comment:string option -> 'arg