diff options
Diffstat (limited to 'thcolor/angles.py')
-rw-r--r-- | thcolor/angles.py | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/thcolor/angles.py b/thcolor/angles.py index 3f0ca06..23a0c2e 100644 --- a/thcolor/angles.py +++ b/thcolor/angles.py @@ -3,7 +3,7 @@ # Copyright (C) 2019-2022 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr> # This file is part of the thcolor project, which is MIT-licensed. # ***************************************************************************** -""" Angle representation and conversions. """ +"""Angle representation and conversions.""" from math import pi as _pi from typing import Any as _Any, Optional as _Optional @@ -16,9 +16,9 @@ __all__ = [ class Angle: - """ Abstract class representing an angle within thcolor. + """Abstract class representing an angle within thcolor. - Used for some color representations (most notably hue). + Used for some color representations (most notably hue). """ __slots__ = () @@ -50,7 +50,7 @@ class Angle: ) def asdegrees(self) -> 'DegreesAngle': - """ Get the current angle as a degrees angle. """ + """Get the current angle as a degrees angle.""" try: value = self._value @@ -65,7 +65,7 @@ class Angle: return DegreesAngle((value - ob) / (ot - ob) * (nt - nb) + nb) def asgradians(self) -> 'GradiansAngle': - """ Get the current angle as a gradians angle. """ + """Get the current angle as a gradians angle.""" try: value = self._value @@ -80,7 +80,7 @@ class Angle: return GradiansAngle((value - ob) / (ot - ob) * (nt - nb) + nb) def asradians(self) -> 'RadiansAngle': - """ Get the current angle as a radians angle. """ + """Get the current angle as a radians angle.""" try: value = self._value @@ -95,7 +95,7 @@ class Angle: return RadiansAngle((value - ob) / (ot - ob) * (nt - nb) + nb) def asturns(self) -> 'TurnsAngle': - """ Get the current angle as a turns angle. """ + """Get the current angle as a turns angle.""" try: value = self._value @@ -110,7 +110,7 @@ class Angle: return TurnsAngle((value - ob) / (ot - ob) * (nt - nb) + nb) def asprincipal(self): - """ Get the principal angle. """ + """Get the principal angle.""" cls = self.__class__ value = self._value @@ -124,9 +124,9 @@ class Angle: expr: str, decoder: _Optional[_Any] = None, ) -> 'Angle': - """ Create a color from a string. + """Create a color from a string. - :param expr: The expression to decode. + :param expr: The expression to decode. """ if decoder is None: @@ -146,16 +146,16 @@ class Angle: class DegreesAngle(Angle): - """ An angle expressed in degrees. + """An angle expressed in degrees. - A 270° angle can be created the following way: + A 270° angle can be created the following way: - .. code-block:: python + .. code-block:: python - angle = DegreesAngle(270) + angle = DegreesAngle(270) - :param degrees: Degrees; canonical values are between 0 and 360 - excluded. + :param degrees: Degrees, as canonical values are between 0 and 360 + excluded. """ __slots__ = ('_value') @@ -172,22 +172,22 @@ class DegreesAngle(Angle): @property def degrees(self) -> float: - """ Degrees. """ + """Get the degrees.""" return self._value class GradiansAngle(Angle): - """ An angle expressed in gradians. + """An angle expressed in gradians. - A 565.5 gradians angle can be created the following way: + A 565.5 gradians angle can be created the following way: - .. code-block:: python + .. code-block:: python - angle = GradiansAngle(565.5) + angle = GradiansAngle(565.5) - :param gradians: Gradians; canonical values are between - 0 and 400.0 excluded. + :param gradians: Gradians, as canonical values are between + 0 and 400.0 excluded. """ __slots__ = ('_value') @@ -204,23 +204,23 @@ class GradiansAngle(Angle): @property def gradians(self) -> float: - """ Gradians. """ + """Get the gradians.""" return self._value class RadiansAngle(Angle): - """ An angle expressed in radians. + """An angle expressed in radians. - A π radians angle can be created the following way: + A π radians angle can be created the following way: - .. code-block:: python + .. code-block:: python - from math import pi - angle = RadiansAngle(pi) + from math import pi + angle = RadiansAngle(pi) - :param radians: Radians; canonical are between 0 and 2π - excluded. + :param radians: Radians, as canonical are between 0 and 2π + excluded. """ __slots__ = ('_value') @@ -241,22 +241,22 @@ class RadiansAngle(Angle): @property def radians(self) -> float: - """ Radians. """ + """Get the radians.""" return self._value class TurnsAngle(Angle): - """ An angle expressed in turns. + """An angle expressed in turns. - A 3.5 turns angle can be created the following way: + A 3.5 turns angle can be created the following way: - .. code-block:: python + .. code-block:: python - angle = TurnsAngle(3.5) + angle = TurnsAngle(3.5) - :param turns: Turns; canonical values are between 0 and 1 - excluded. + :param turns: Turns, as canonical values are between 0 and 1 + excluded. """ __slots__ = ('_value') @@ -273,7 +273,7 @@ class TurnsAngle(Angle): @property def turns(self) -> float: - """ Turns. """ + """Get the turns.""" return self._value |