Docstrings for spacing utility constructors

This commit is contained in:
Darren Burns
2022-04-27 13:59:35 +01:00
parent 91783b7c1e
commit cd7f0f2713
2 changed files with 27 additions and 1 deletions

View File

@@ -645,14 +645,40 @@ class Spacing(NamedTuple):
@classmethod
def vertical(cls, amount: int) -> Spacing:
"""Construct a Spacing with a given amount of spacing on vertical edges,
and no horizontal spacing.
Args:
amount (int): The magnitude of spacing to apply to vertical edges
Returns:
Spacing: ``Spacing(amount, 0, amount, 0)``
"""
return Spacing(amount, 0, amount, 0)
@classmethod
def horizontal(cls, amount: int) -> Spacing:
"""Construct a Spacing with a given amount of spacing on horizontal edges,
and no vertical spacing.
Args:
amount (int): The magnitude of spacing to apply to horizontal edges
Returns:
Spacing: ``Spacing(0, amount, 0, amount)``
"""
return Spacing(0, amount, 0, amount)
@classmethod
def all(cls, amount: int) -> Spacing:
"""Construct a Spacing with a given amount of spacing on all edges.
Args:
amount (int): The magnitude of spacing to apply to all edges
Returns:
Spacing: ``Spacing(amount, amount, amount, amount)``
"""
return Spacing(amount, amount, amount, amount)
def __add__(self, other: object) -> Spacing: