Formatting docstrings to match style guide

This commit is contained in:
Darren Burns
2023-02-14 13:57:08 +00:00
parent 467615dabd
commit b6441d0417
2 changed files with 13 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
from typing import TypeVar, Generic from typing import Generic, TypeVar
Key = TypeVar("Key") Key = TypeVar("Key")
Value = TypeVar("Value") Value = TypeVar("Value")
@@ -8,6 +8,8 @@ Value = TypeVar("Value")
class TwoWayDict(Generic[Key, Value]): class TwoWayDict(Generic[Key, Value]):
""" """
A two-way mapping offering O(1) access in both directions.
Wraps two dictionaries and uses them to provide efficient access to Wraps two dictionaries and uses them to provide efficient access to
both values (given keys) and keys (given values). both values (given keys) and keys (given values).
""" """

View File

@@ -41,12 +41,16 @@ CellType = TypeVar("CellType")
class CellDoesNotExist(Exception): class CellDoesNotExist(Exception):
"""Raised when the user supplies coordinates or cell keys which """The cell key/index was invalid.
Raised when the user supplies coordinates or cell keys which
do not exist in the DataTable.""" do not exist in the DataTable."""
class DuplicateKey(Exception): class DuplicateKey(Exception):
"""Raised when the RowKey or ColumnKey provided already refers to """The key supplied already exists.
Raised when the RowKey or ColumnKey provided already refers to
an existing row or column in the DataTable. Keys must be unique.""" an existing row or column in the DataTable. Keys must be unique."""
@@ -120,8 +124,7 @@ class CellKey(NamedTuple):
def default_cell_formatter(obj: object) -> RenderableType: def default_cell_formatter(obj: object) -> RenderableType:
"""Given an object stored in a DataTable cell, return a Rich """Convert a cell into a Rich renderable for display.
renderable type which displays that object.
Args: Args:
obj: Data for a cell. obj: Data for a cell.
@@ -561,8 +564,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
*, *,
update_width: bool = False, update_width: bool = False,
) -> None: ) -> None:
"""Update the content inside the cell with the specified row key """Update the cell identified by the specified row key and column key.
and column key.
Args: Args:
row_key: The key identifying the row. row_key: The key identifying the row.
@@ -736,8 +738,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
) )
def coordinate_to_cell_key(self, coordinate: Coordinate) -> CellKey: def coordinate_to_cell_key(self, coordinate: Coordinate) -> CellKey:
"""Return the key for the cell currently occupying this coordinate in the """Return the key for the cell currently occupying this coordinate.
DataTable
Args: Args:
coordinate: The coordinate to exam the current cell key of. coordinate: The coordinate to exam the current cell key of.
@@ -1140,8 +1141,7 @@ class DataTable(ScrollView, Generic[CellType], can_focus=True):
return 0 <= column_index < len(self.columns) return 0 <= column_index < len(self.columns)
def is_valid_coordinate(self, coordinate: Coordinate) -> bool: def is_valid_coordinate(self, coordinate: Coordinate) -> bool:
"""Return a boolean indicating whether the given coordinate is within table """Return a boolean indicating whether the given coordinate is valid.
bounds.
Args: Args:
coordinate: The coordinate to validate. coordinate: The coordinate to validate.