Skip to content
Prev Previous commit
Next Next commit
added newline and comment
I fixed the sorting of the imports and I added a comment to the plot-function to explain what it does and why it doesn't use a doctest. Thank you to user mrmaxguns for suggesting these changes.
  • Loading branch information
algobytewise authored Feb 20, 2021
commit 62f0d602d4a15d913d9c2762b936fc8208aa80d7
8 changes: 7 additions & 1 deletion other/koch_snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@


from __future__ import annotations

import numpy


Expand Down Expand Up @@ -91,7 +92,12 @@ def rotate(vector: numpy.ndarray, angle_in_degrees: float) -> numpy.ndarray:


def plot(vectors: list[numpy.ndarray]) -> None:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/koch_snowflake.py, please provide doctest for the function plot

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/koch_snowflake.py, please provide doctest for the function plot

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As there is no test file in this pull request nor any test function or class in the file other/koch_snowflake.py, please provide doctest for the function plot

import matplotlib.pyplot as plt # type: ignore
"""
Utility function to plot the vectors using matplotlib.pyplot
No doctest was implemented since this function does not have a return value
"""
import matplotlib.pyplot.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An error occured while parsing the file: other/koch_snowflake.py

Traceback (most recent call last): File "/app/.heroku/python/lib/python3.8/site-packages/libcst/_parser/base_parser.py", line 152, in _add_token plan = stack[-1].dfa.transitions[transition] KeyError: TokenType(NEWLINE) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/algorithms_keeper/parser/python_parser.py", line 145, in parse reports = lint_file( libcst._exceptions.ParserSyntaxError: Syntax Error @ 99:30. Incomplete input. Encountered '\r\n', but expected 'NAME'. import matplotlib.pyplot. ^
as plt # type: ignore

# avoid stretched display of graph
axes = plt.gca()
Expand Down