Skip to content

Added type annotations to docstrings #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions adafruit_display_shapes/circle.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ class Circle(RoundRect):
# pylint: disable=too-few-public-methods, invalid-name
"""A circle.

:param x0: The x-position of the center.
:param y0: The y-position of the center.
:param r: The radius of the circle.
:param fill: The color to fill the circle. Can be a hex value for a color or
:param int x0: The x-position of the center.
:param int y0: The y-position of the center.
:param int r: The radius of the circle.
:param int|None fill: The color to fill the circle. Can be a hex value for a color or
``None`` for transparent.
:param outline: The outline of the circle. Can be a hex value for a color or
:param int|None outline: The outline of the circle. Can be a hex value for a color or
``None`` for no outline.
:param stroke: Used for the outline. Will not change the radius.
:param int stroke: Used for the outline. Will not change the radius.

"""

Expand Down
10 changes: 5 additions & 5 deletions adafruit_display_shapes/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ class Line(Polygon):
# pylint: disable=too-many-arguments,invalid-name, too-few-public-methods
"""A line.

:param x0: The x-position of the first vertex.
:param y0: The y-position of the first vertex.
:param x1: The x-position of the second vertex.
:param y1: The y-position of the second vertex.
:param color: The color of the line.
:param int x0: The x-position of the first vertex.
:param int y0: The y-position of the first vertex.
:param int x1: The x-position of the second vertex.
:param int y1: The y-position of the second vertex.
:param int color: The color of the line.
"""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions adafruit_display_shapes/polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class Polygon(displayio.TileGrid):
# pylint: disable=too-many-arguments,invalid-name
"""A polygon.

:param points: A list of (x, y) tuples of the points
:param outline: The outline of the polygon. Can be a hex value for a color or
:param list points: A list of (x, y) tuples of the points
:param int|None outline: The outline of the polygon. Can be a hex value for a color or
``None`` for no outline.
"""

Expand Down
18 changes: 9 additions & 9 deletions adafruit_display_shapes/rect.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@
class Rect(displayio.TileGrid):
"""A rectangle.

:param x: The x-position of the top left corner.
:param y: The y-position of the top left corner.
:param width: The width of the rectangle.
:param height: The height of the rectangle.
:param fill: The color to fill the rectangle. Can be a hex value for a color or
``None`` for transparent.
:param outline: The outline of the rectangle. Can be a hex value for a color or
:param int x: The x-position of the top left corner.
:param int y: The y-position of the top left corner.
:param int width: The width of the rectangle.
:param int height: The height of the rectangle.
:param int|None fill: The color to fill the rectangle. Can be a hex value for a color or
``None`` for transparent.
:param int|None outline: The outline of the rectangle. Can be a hex value for a color or
``None`` for no outline.
:param stroke: Used for the outline. Will not change the outer bound size set by ``width`` and
``height``.
:param int stroke: Used for the outline. Will not change the outer bound size set by ``width``
and ``height``.

"""

Expand Down
22 changes: 11 additions & 11 deletions adafruit_display_shapes/roundrect.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ class RoundRect(displayio.TileGrid):
# pylint: disable=too-many-arguments
"""A round-corner rectangle.

:param x: The x-position of the top left corner.
:param y: The y-position of the top left corner.
:param width: The width of the rounded-corner rectangle.
:param height: The height of the rounded-corner rectangle.
:param r: The radius of the rounded corner.
:param fill: The color to fill the rounded-corner rectangle. Can be a hex value for a color or
``None`` for transparent.
:param outline: The outline of the rounded-corner rectangle. Can be a hex value for a color or
``None`` for no outline.
:param stroke: Used for the outline. Will not change the outer bound size set by ``width`` and
``height``.
:param int x: The x-position of the top left corner.
:param int y: The y-position of the top left corner.
:param int width: The width of the rounded-corner rectangle.
:param int height: The height of the rounded-corner rectangle.
:param int r: The radius of the rounded corner.
:param int|None fill: The color to fill the rounded-corner rectangle. Can be a hex value
for a color or ``None`` for transparent.
:param int|None outline: The outline of the rounded-corner rectangle. Can be a hex value
for a color or ``None`` for no outline.
:param int stroke: Used for the outline. Will not change the outer bound size set by ``width``
and ``height``.

"""

Expand Down
22 changes: 11 additions & 11 deletions adafruit_display_shapes/sparkline.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ class Sparkline(displayio.Group):
# pylint: disable=too-many-arguments
"""A sparkline graph.

:param width: Width of the sparkline graph in pixels
:param height: Height of the sparkline graph in pixels
:param max_items: Maximum number of values housed in the sparkline
:param dyn_xpitch: dynamically change xpitch (True)
:param y_min: Lower range for the y-axis. Set to None for autorange.
:param y_max: Upper range for the y-axis. Set to None for autorange.
:param x: X-position on the screen, in pixels
:param y: Y-position on the screen, in pixels
:param color: Line color, the default value is 0xFFFFFF (WHITE)
:param int width: Width of the sparkline graph in pixels
:param int height: Height of the sparkline graph in pixels
:param int max_items: Maximum number of values housed in the sparkline
:param bool dyn_xpitch: (Optional) Dynamically change xpitch (True)
:param int|None y_min: Lower range for the y-axis. Set to None for autorange.
:param int|None y_max: Upper range for the y-axis. Set to None for autorange.
:param int x: X-position on the screen, in pixels
:param int y: Y-position on the screen, in pixels
:param int color: Line color, the default value is 0xFFFFFF (WHITE)

Note: If dyn_xpitch is True (default), the sparkline will allways span
the complete width. Otherwise, the sparkline will grow when you
Expand Down Expand Up @@ -113,8 +113,8 @@ def clear_values(self) -> None:
def add_value(self, value: float, update: bool = True) -> None:
"""Add a value to the sparkline.

:param value: The value to be added to the sparkline
:param update: trigger recreation of primitives
:param float value: The value to be added to the sparkline
:param bool update: trigger recreation of primitives

Note: when adding multiple values it is more efficient to call
this method with parameter 'update=False' and then to manually
Expand Down
18 changes: 9 additions & 9 deletions adafruit_display_shapes/triangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class Triangle(Polygon):
# pylint: disable=too-many-arguments,invalid-name
"""A triangle.

:param x0: The x-position of the first vertex.
:param y0: The y-position of the first vertex.
:param x1: The x-position of the second vertex.
:param y1: The y-position of the second vertex.
:param x2: The x-position of the third vertex.
:param y2: The y-position of the third vertex.
:param fill: The color to fill the triangle. Can be a hex value for a color or
``None`` for transparent.
:param outline: The outline of the triangle. Can be a hex value for a color or
:param int x0: The x-position of the first vertex.
:param int y0: The y-position of the first vertex.
:param int x1: The x-position of the second vertex.
:param int y1: The y-position of the second vertex.
:param int x2: The x-position of the third vertex.
:param int y2: The y-position of the third vertex.
:param int|None fill: The color to fill the triangle. Can be a hex value for a color or
``None`` for transparent.
:param int|None outline: The outline of the triangle. Can be a hex value for a color or
``None`` for no outline.
"""
# pylint: disable=too-many-locals
Expand Down