parameters: change Color enum members to uppercase

This commit is contained in:
David Lechner
2019-02-27 15:23:16 -06:00
parent f9881d1c20
commit cd57290b78
3 changed files with 23 additions and 21 deletions
+3 -2
View File
@@ -34,12 +34,13 @@ def light(color):
"""Set the color of the brick light.
Arguments:
color (Color): Color of the light. Choose ``Color.black`` or ``None`` to turn the light off.
color (Color): Color of the light. Choose ``Color.BLACK`` or ``None``
to turn the light off.
Example::
# Make the light red
brick.light(Color.red)
brick.light(Color.RED)
# Turn the light off
brick.light(None)
+2 -1
View File
@@ -313,7 +313,8 @@ class ColorSensor():
"""Measure the color of a surface.
:returns:
``Color.black``, ``Color.blue``, ``Color.green``, ``Color.yellow``, ``Color.red``, ``Color.white``, ``Color.brown`` or ``None``.
``Color.BLACK``, ``Color.BLUE``, ``Color.GREEN``, ``Color.YELLOW``,
``Color.RED``, ``Color.WHITE``, ``Color.BROWN`` or ``None``.
:rtype: :class:`Color <parameters.Color>`, or ``None`` if no color is detected.
"""
pass
+18 -18
View File
@@ -6,26 +6,26 @@ from enum import Enum
class Color(Enum):
"""Light or surface color.
.. data:: black
.. data:: blue
.. data:: green
.. data:: yellow
.. data:: red
.. data:: white
.. data:: brown
.. data:: orange
.. data:: purple
.. data:: BLACK
.. data:: BLUE
.. data:: GREEN
.. data:: YELLOW
.. data:: RED
.. data:: WHITE
.. data:: BROWN
.. data:: ORANGE
.. data:: PURPLE
"""
black = 1
blue = 2
green = 3
yellow = 4
red = 5
white = 6
brown = 7
orange = 8
purple = 9
BLACK = 1
BLUE = 2
GREEN = 3
YELLOW = 4
RED = 5
WHITE = 6
BROWN = 7
ORANGE = 8
PURPLE = 9
class Port(Enum):