AutoDoc Examples¶
This page demonstrates .. badge-filter:: used directly with standard
sphinx.ext.autodoc directives (.. autoclass:: and
.. automodule::), without a separate autosummary table.
Unlike toctree or autosummary filtering — where badges are looked up from a per-page index — autodoc filtering works entirely in the DOM: badge IDs are read directly from the rendered badge spans already present on the page.
Each individual member block (method, function, attribute, …) is a
filterable unit. Class containers (dl.py.class) are intentionally kept
visible at all times so their remaining members are always accessible.
Filtering class members (OR mode)¶
The filter below wraps DataProcessor and shows only the two explicitly
listed methods. Clicking a stability or area button hides methods that do
not carry that badge. Because OR mode is active, selecting multiple badges
broadens the visible set.
- class datalib.DataProcessor(config)
- StableCore
Process data records.
Note¶
Just a sample class
Parameters¶
- configdict
Configuration mapping.
- filter_records(data, predicate)
- NewCore
Return records that satisfy a predicate.
Parameters¶
- datalist
Input records.
- predicatecallable
A function that accepts a record and returns
Trueto keep it.
Returns¶
- list
Filtered records.
- merge(left, right, on='id')
- ExperimentalCore
Merge two datasets on a common key.
Parameters¶
- leftlist
Left dataset.
- rightlist
Right dataset.
- onstr, optional
Key field used for joining. Default is
"id".
Returns¶
- list
Merged records.
- preview(data, n=5)
- BetaCore
Return a beta preview of processed output.
Parameters¶
- datalist
Input records.
- nint, optional
Number of preview items. Default is
5.
Returns¶
list
- run(data)
- CoreStable
Execute the processing pipeline.
Parameters¶
- datalist
Input records.
Returns¶
- list
Processed records.
- summarize(data, field)
- MathDeprecated
Compute basic summary statistics for a numeric field.
Parameters¶
- datalist
Input records.
- fieldstr
Name of the numeric field to summarize.
Returns¶
- dict
Dictionary with
min,max,mean, andcountkeys.
Filtering module functions (AND mode)¶
The filter below wraps the mathlib module. In AND mode all active
badges must be present simultaneously, so selecting two badges from
different groups quickly narrows the list to a precise match.
Example library used to demonstrate sphinx-badges autodoc integration.
All public objects carry a numpy-style Badges section using the
group:name syntax. sphinx-badges parses and renders these automatically.
- class datalib.DataProcessor(config)
- StableCore
Process data records.
Note¶
Just a sample class
Parameters¶
- configdict
Configuration mapping.
- filter_records(data, predicate)
- NewCore
Return records that satisfy a predicate.
Parameters¶
- datalist
Input records.
- predicatecallable
A function that accepts a record and returns
Trueto keep it.
Returns¶
- list
Filtered records.
- merge(left, right, on='id')
- ExperimentalCore
Merge two datasets on a common key.
Parameters¶
- leftlist
Left dataset.
- rightlist
Right dataset.
- onstr, optional
Key field used for joining. Default is
"id".
Returns¶
- list
Merged records.
- preview(data, n=5)
- BetaCore
Return a beta preview of processed output.
Parameters¶
- datalist
Input records.
- nint, optional
Number of preview items. Default is
5.
Returns¶
list
- run(data)
- CoreStable
Execute the processing pipeline.
Parameters¶
- datalist
Input records.
Returns¶
- list
Processed records.
- summarize(data, field)
- MathDeprecated
Compute basic summary statistics for a numeric field.
Parameters¶
- datalist
Input records.
- fieldstr
Name of the numeric field to summarize.
Returns¶
- dict
Dictionary with
min,max,mean, andcountkeys.