Elysia Tools

Browse tools, examples, visual explainers, and topic guides from one clear workspace.

Top Categories

Hubs

Language
ZHESPTRUFRDEEN

Elysia Tools

Navigation

Development

Python docstrings: runnable extraction fixtures

Three original Python examples separate documentation from ordinary strings; all five doctests pass.

Samples

Entries inside this sample collection

CodepythonSimple

Module and function documentation

Run the arithmetic fixture and extract docstrings with ast.get_docstring from the module and add function.

python
"""Synthetic arithmetic module."""

def add(left: int, right: int) -> int:
    """Return the sum of two integers.

    >>> add(3, 5)
    8
    """
    return left + right

if __name__ == "__main__":
    import doctest
    doctest.testmod(raise_on_error=True)
CodepythonIntermediate

Class and method documentation

Run the Counter fixture; inspect the class and increment method separately.

python
class Counter:
    """A synthetic counter starting at zero."""

    def __init__(self):
        self.value = 0

    def increment(self):
        """Increase the stored value by one.

        >>> c = Counter()
        >>> c.increment()
        1
        >>> c.increment()
        2
        """
        self.value += 1
        return self.value

if __name__ == "__main__":
    import doctest
    doctest.testmod(raise_on_error=True)
CodepythonIntermediate

Strings that are not docstrings

Run normalize and inspect only its first statement for documentation.

python
LABEL = "This assigned string is data, not a docstring."

def normalize(text: str) -> str:
    """Remove outer whitespace and lowercase text.

    >>> normalize("  HELLO  ")
    'hello'
    """
    result = text.strip().lower()
    """This later expression is not the function docstring."""
    return result

if __name__ == "__main__":
    import doctest
    doctest.testmod(raise_on_error=True)

Tools

Tools frequently paired with this sample

Related

Related sample collections

Related

Related workflows

Tool usage guide

Sample-focused context for search and workflow understanding

Overview

Three original Python examples separate documentation from ordinary strings; all five doctests pass.

Verified exercises

Three original Python examples separate documentation from ordinary strings; all five doctests pass.

How it works

  1. 1Run the arithmetic fixture and extract docstrings with ast.get_docstring from the module and add function.

Edge cases & common failures

  • Scope

    Python 3 only; these examples do not claim to parse other languages.

Examples

1. Module and function documentation

How to use

Run the arithmetic fixture and extract docstrings with ast.get_docstring from the module and add function.

Outcome

Two docstrings; add(3, 5) returns 8.

2. Class and method documentation

How to use

Run the Counter fixture; inspect the class and increment method separately.

Outcome

Two docstrings. Two calls return 1 then 2; the constructor has no docstring.

3. Strings that are not docstrings

How to use

Run normalize and inspect only its first statement for documentation.

Outcome

One docstring. The assigned string and later string expression are not docstrings; normalization returns hello.

Hub

Document OCR Extraction

Extract OCR text from scans and convert document pages or images into Markdown, JSON, tables, captions, and retrieval-ready chunks with quality checks.

Hub

UI Screenshot Structure Review and Development Handoff

Turn one authorized UI screenshot into a manually reviewed component tree, validated JSON and development notes, with source coordinates, uncertainty and revision evidence preserved.

Hub

PDF Extraction and Debugging Workflows

Debug hard PDF extraction cases by checking encryption, safety, page scope, reading order, OCR, tables, review marks, and structured output.

Hub

Structured Signal Extraction from Text, HTML, Markdown, and Logs

Turn mixed text sources into reviewable links, attributes, dates, log fields, and sensitive-match inventories with a deliberate extraction path.

Home
Tools3216
Samples593
Visualizations473
Viewers103
Hubs239
Tags333
Images, Audio & Video657

Image, audio, and video processing, conversion, and optimization tools

Math, Date & Finance647

Calculators, numerics, date logic, statistics, and finance tools

Design & Color298

Color, layout, graphics, visual styling, and design helper tools

Text & Writing209

Writing, cleanup, formatting, extraction, and text analysis tools

Developer & Web194

Developer utilities, networking, web debugging, and automation helpers

Conversion & Encoding175

Format, file, archive, unit, and encoding conversion tools

Lead Generation Quiz Launch and Contact Handoff
Memorial Drafts: Family Review and Print Handoff
Private Habit Records: Backup, Restore and Sharing Review
Article to X and LinkedIn Drafts: Fact Review and Handoff
Markdown Interactive Deck Review and Offline Handoff

© 2026 Elysia Tools. All rights reserved.

DocsPricingAboutTerms of ServicePrivacy PolicyCookiesContact

Development

Python Regex Tester (re module)

Test Python re patterns online: (?P<name>…) named groups, (?P=name) backreferences, VERBOSE patterns, findall behavior, and \g<name> replace templates — plus ready-to-paste Python code.

Development

cURL to Python (requests) Converter

Convert a cURL command into a Python requests code snippet with headers, data, and method

Development

Docstring Extractor

Extract and parse documentation from JavaScript/TypeScript, Python, and Java source code

Data Processing

Array Extractor

Extract elements of specific types from arrays (numbers, strings, booleans, objects, etc.)

Development

Changelog Extractor

Parse and extract structured data from changelogs and release notes in multiple formats

Text Processing

IP Address Extractor

Extract IPv4 and IPv6 addresses from log files, server logs, network traces, or any text content

Development

Multi-Pattern Matcher

Match multiple regex patterns against text in one operation

Document Tools

PDF Text Extractor

Extract text content from PDF documents with support for page selection, formatting options, and multi-language processing

Document

PDF Samples

Generated PDF samples from tools dated 2026-02-01 to 2026-02-10

Development

Python Viewer Samples

Sample Python source files (classes, dataclasses, async/await) for the in-browser Python Viewer

Code Processing

Code Comment Samples

Sample code files with various comment styles for testing comment removal

Blockchain

Hardhat Development Framework Samples

Hardhat Ethereum development environment examples including smart contracts, testing, deployment, scripts, plugins, and development workflows

Media

Copyright-Free MP3 Audio Samples

Collection of royalty-free audio samples for testing and development purposes including nature sounds, meditation music, and ambient audio

Blockchain

Truffle Development Suite Samples

Truffle Ethereum development framework examples including smart contracts, testing, deployment, migrations, debugging, and development workflows