Reference¶
typin_cli¶
types¶
Created on 17 Jul 2017
@author: paulross
-
class
typin.types.
FunctionTypes
(signature=None)[source]¶ Class that accumulate function call data such as call arguments, return values and exceptions raised.
-
add_return
(return_value, line_number)[source]¶ Records a return value at a particular line number. If the return_value is None and we have previously seen an exception at this line then this is a phantom return value and must be ignored. See
TypeInferencer.__enter__
for a description of this.
-
argument_type_strings
¶ A
collections.OrderedDict
of{argument_name : set(types, ...), ...}
where the types are strings.
-
docstring
(include_returns, style='sphinx')[source]¶ Returns a pair (line_number, docstring) for this function. The docstring is the __doc__ for the function and the line_number is the docstring position (function declaration + 1). So to insert into a list of lines called
src
:src[:line_number] + docstring.split('\n') + src[line_number:]
style can be: ‘sphinx’, ‘google’.
Raises: TypesExceptionBase
or derived class.
-
exception_type_strings
¶ A dict of
{line_number : set(types, ...), ...}
for any exceptions raised where the return types are strings. There should only be one type in the set.
-
filtered_arguments
()[source]¶ A
collections.OrderedDict
of{argument_name : set(types, ...), ...}
where the types are strings. This removes the ‘self’ argument if it is the first argument.
-
line_decl
¶ Line number of the function declaration as an integer.
Returns: int
– Function declaration line.Raises: FunctionTypesExceptionNoData
If there is no entry points recorded.
-
line_range
¶ A pair of line numbers of the span of the function as integers. The first is the declaration of the function, the last is the extreme return point or exception.
-
num_entry_points
¶ The number of entry points, 1 for normal functions >1 for generators. 0 Something wrong.
-
return_type_strings
¶ A dict of
{line_number : set(types, ...), ...}
for the return values where the return types are strings. There should only be one type in the set.
-
-
exception
typin.types.
FunctionTypesExceptionNoData
[source]¶ Exception thrown when no call date has been added to a FunctionTypes object.