docs: add Google-style docstrings and Sphinx autodoc setup

Add concise docstrings to all Python modules, classes, and public
functions. Configure Sphinx with napoleon extension for Google-style
docstring parsing and autodoc pages for each module.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Mathew Sir Guest the best
2026-05-06 23:06:37 -06:00
co-authored by Claude Opus 4.6
parent fd3ff46804
commit 4d681a92ca
16 changed files with 479 additions and 0 deletions
+19
View File
@@ -1,3 +1,5 @@
"""REST API handlers for game operations."""
import json
from datetime import datetime, timezone
@@ -9,6 +11,8 @@ from models.game import Game, Word
class BaseAPIHandler(tornado.web.RequestHandler):
"""Base handler for JSON API endpoints."""
def set_default_headers(self):
self.set_header("Content-Type", "application/json")
@@ -21,6 +25,8 @@ class BaseAPIHandler(tornado.web.RequestHandler):
class CategoriesHandler(BaseAPIHandler):
"""``GET /api/categories`` -- list all word categories."""
def get(self):
session = self.get_session()
try:
@@ -31,6 +37,11 @@ class CategoriesHandler(BaseAPIHandler):
class NewGameHandler(BaseAPIHandler):
"""``POST /api/game/new`` -- create a new game.
Expects JSON body with ``category_id`` and optional ``board_size`` (8-20).
"""
def post(self):
session = self.get_session()
try:
@@ -67,6 +78,8 @@ class NewGameHandler(BaseAPIHandler):
class GameStateHandler(BaseAPIHandler):
"""``GET /api/game/<id>`` -- retrieve current game state."""
def get(self, game_id):
session = self.get_session()
try:
@@ -100,6 +113,12 @@ class GameStateHandler(BaseAPIHandler):
class GuessHandler(BaseAPIHandler):
"""``POST /api/game/<id>/guess`` -- submit a word guess.
Accepts either ``{"word": "..."}`` for text input or
``{"cells": [{"row": N, "col": N}, ...]}`` for click selection.
"""
def post(self, game_id):
session = self.get_session()
try: