Skip to content

Commit dd3490b

Browse files
committed
minor changes and fixes
1 parent 08b46c6 commit dd3490b

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

fastmath.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ def check_fastmath(pkg_dir, pkg_name):
9191

9292
class FunctionCallVisitor(ast.NodeVisitor):
9393
"""
94-
A class to traverse the AST of modules of a package to collect the call stacks
95-
of njit functions.
94+
A class to traverse the AST of the modules of a package to collect
95+
the call stacks of njit functions.
9696
9797
Parameters
9898
----------
@@ -108,51 +108,54 @@ class FunctionCallVisitor(ast.NodeVisitor):
108108
A list of module names to track the modules as the visitor traverses their AST
109109
110110
call_stack : list
111-
A list of function calls made in the current module
111+
A list of njit functions, representing a chain of function calls,
112+
where each element is a string of the form "module_name.func_name".
112113
113114
out : list
114-
A list of unique function call stacks.
115+
A list of unique function `call_stack`s.
115116
116117
njit_funcs : list
117-
A list of njit functions in STUMPY. Each element is a tuple of the form
118-
(module_name, func_name).
118+
A list of all njit functions in `pkg_dir`'s modules. Each element is a tuple
119+
of the form `(module_name, func_name)`.
119120
120121
njit_modules : set
121-
A set of module names, where each contains at least one njit function.
122+
A set that contains the names of all modules, each of which contains at least
123+
one njit function.
122124
123125
njit_nodes : dict
124126
A dictionary mapping njit function names to their corresponding AST nodes.
125-
A key is of the form "module_name.func_name", and its corresponding value
126-
is the AST node- with type ast.FunctionDef- of that njit function
127+
A key is a string, and it is of the form "module_name.func_name", and its
128+
corresponding value is the AST node- with type ast.FunctionDef- of that
129+
function.
127130
128131
ast_modules : dict
129132
A dictionary mapping module names to their corresponding AST objects. A key
130-
is of the form "module_name", and its corresponding value is the content of
131-
the module as an AST object.
133+
is the name of a module, and its corresponding value is the content of that
134+
module as an AST object.
132135
133136
Methods
134137
-------
135138
push_module(module_name)
136-
Push a module name onto the stack of module names.
139+
Push the name of a module onto the stack `module_names`.
137140
138141
pop_module()
139-
Pop the last module name from the stack of module names.
142+
Pop the last module name from the stack `module_names`.
140143
141144
push_call_stack(module_name, func_name)
142-
Push a function call onto the stack of function calls.
145+
Push a function call onto the stack of function calls, `call_stack`.
143146
144147
pop_call_stack()
145-
Pop the last function call from the stack of function calls.
148+
Pop the last function call from the stack of function calls, `call_stack`
146149
147150
goto_deeper_func(node)
148-
Calls the visit method from class `ast.NodeVisitor` on all children of the node.
151+
Calls the visit method from class `ast.NodeVisitor` on all children of the `node`.
149152
150153
goto_next_func(node)
151-
Calls the visit method from class `ast.NodeVisitor` on all children of the node.
154+
Calls the visit method from class `ast.NodeVisitor` on all children of the `node`.
152155
153156
push_out()
154-
Push the current function call stack onto the output list if it is not
155-
included in one of the so-far-collected call stacks.
157+
Push the current function call stack, `call_stack`, onto the output list, `out`,
158+
unless it is already included in one of the so-far-collected call stacks.
156159
157160
visit_Call(node)
158161
Visit an AST node of type `ast.Call`. This method is called when the visitor

0 commit comments

Comments
 (0)