Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 15, 2023
1 parent 9dbce7e commit f8f4cc9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/debug/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ The `AccumulationTable` is a new PythonTA feature and currently has the followin
3. Loop variable state is stored by creating shallow copies of the objects.
Loops that mutate a nested part of an object will not have their state displayed properly.

5. The `AccumulationTable` context manager can only log the execution of one for loop.
4. The `AccumulationTable` context manager can only log the execution of one for loop.
To log the state of multiple for loops, each must be wrapped in a separate `with` statement and fresh `AccumulationTable` instance.

[tabulate]: https://github.com/astanin/python-tabulate
Expand Down
6 changes: 4 additions & 2 deletions python_ta/debug/accumulation_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import astroid
import tabulate

NO_VALUE = 'N/A'
NO_VALUE = "N/A"


def num_whitespaces(start_of_loop: str) -> int:
Expand Down Expand Up @@ -96,7 +96,9 @@ def _record_iteration(self, frame: types.FrameType) -> None:
for accumulator in self.loop_accumulators:
if accumulator in frame.f_locals:
self.loop_accumulators[accumulator].append(copy.copy(frame.f_locals[accumulator]))
elif (accumulator in frame.f_code.co_varnames) or (accumulator in frame.f_code.co_names):
elif (accumulator in frame.f_code.co_varnames) or (
accumulator in frame.f_code.co_names
):
self.loop_accumulators[accumulator].append(NO_VALUE)
else:
raise NameError
Expand Down

0 comments on commit f8f4cc9

Please sign in to comment.