Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions altair/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,11 @@ def decorate(f):

# Supplement the docstring of f with information from Obj
if Obj.__doc__:
# Patch in a reference to the class this docstring is copied from,
# to generate a hyperlink.
doclines = Obj.__doc__.splitlines()
doclines[0] = f"Refer to :class:`{Obj.__name__}`"

if f.__doc__:
doc = f.__doc__ + "\n".join(doclines[1:])
else:
Expand Down
36 changes: 18 additions & 18 deletions altair/vegalite/v5/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ def transform_aggregate(
self: _TTopLevelMixin, aggregate=Undefined, groupby=Undefined, **kwds
) -> _TTopLevelMixin:
"""
Add an AggregateTransform to the schema.
Add an :class:`AggregateTransform` to the schema.

Parameters
----------
Expand Down Expand Up @@ -977,7 +977,7 @@ def transform_bin(
self: _TTopLevelMixin, as_=Undefined, field=Undefined, bin=True, **kwargs
) -> _TTopLevelMixin:
"""
Add a BinTransform to the schema.
Add a :class:`BinTransform` to the schema.

Parameters
----------
Expand Down Expand Up @@ -1035,7 +1035,7 @@ def transform_calculate(
self: _TTopLevelMixin, as_=Undefined, calculate=Undefined, **kwargs
) -> _TTopLevelMixin:
"""
Add a CalculateTransform to the schema.
Add a :class:`CalculateTransform` to the schema.

Parameters
----------
Expand Down Expand Up @@ -1108,7 +1108,7 @@ def transform_density(
minsteps=Undefined,
steps=Undefined,
) -> _TTopLevelMixin:
"""Add a DensityTransform to the spec.
"""Add a :class:`DensityTransform` to the spec.

Parameters
----------
Expand Down Expand Up @@ -1174,7 +1174,7 @@ def transform_impute(
value=Undefined,
) -> _TTopLevelMixin:
"""
Add an ImputeTransform to the schema.
Add an :class:`ImputeTransform` to the schema.

Parameters
----------
Expand Down Expand Up @@ -1237,7 +1237,7 @@ def transform_joinaggregate(
self: _TTopLevelMixin, joinaggregate=Undefined, groupby=Undefined, **kwargs
) -> _TTopLevelMixin:
"""
Add a JoinAggregateTransform to the schema.
Add a :class:`JoinAggregateTransform` to the schema.

Parameters
----------
Expand Down Expand Up @@ -1288,7 +1288,7 @@ def transform_joinaggregate(
# TODO: Update docstring
def transform_filter(self: _TTopLevelMixin, filter, **kwargs) -> _TTopLevelMixin:
"""
Add a FilterTransform to the schema.
Add a :class:`FilterTransform` to the schema.

Parameters
----------
Expand Down Expand Up @@ -1322,7 +1322,7 @@ def transform_filter(self: _TTopLevelMixin, filter, **kwargs) -> _TTopLevelMixin
def transform_flatten(
self: _TTopLevelMixin, flatten, as_=Undefined
) -> _TTopLevelMixin:
"""Add a FlattenTransform to the schema.
"""Add a :class:`FlattenTransform` to the schema.

Parameters
----------
Expand Down Expand Up @@ -1350,7 +1350,7 @@ def transform_flatten(
)

def transform_fold(self: _TTopLevelMixin, fold, as_=Undefined) -> _TTopLevelMixin:
"""Add a FoldTransform to the spec.
"""Add a :class:`FoldTransform` to the spec.

Parameters
----------
Expand Down Expand Up @@ -1380,7 +1380,7 @@ def transform_loess(
bandwidth=Undefined,
groupby=Undefined,
) -> _TTopLevelMixin:
"""Add a LoessTransform to the spec.
"""Add a :class:`LoessTransform` to the spec.

Parameters
----------
Expand Down Expand Up @@ -1422,7 +1422,7 @@ def transform_lookup(
default=Undefined,
**kwargs,
) -> _TTopLevelMixin:
"""Add a DataLookupTransform or SelectionLookupTransform to the chart
"""Add a :class:`DataLookupTransform` or :class:`SelectionLookupTransform` to the chart

Parameters
----------
Expand Down Expand Up @@ -1477,7 +1477,7 @@ def transform_pivot(
limit=Undefined,
op=Undefined,
) -> _TTopLevelMixin:
"""Add a pivot transform to the chart.
"""Add a :class:`PivotTransform` to the chart.

Parameters
----------
Expand Down Expand Up @@ -1523,7 +1523,7 @@ def transform_quantile(
probs=Undefined,
step=Undefined,
) -> _TTopLevelMixin:
"""Add a quantile transform to the chart
"""Add a :class:`QuantileTransform` to the chart

Parameters
----------
Expand Down Expand Up @@ -1572,7 +1572,7 @@ def transform_regression(
order=Undefined,
params=Undefined,
) -> _TTopLevelMixin:
"""Add a RegressionTransform to the chart.
"""Add a :class:`RegressionTransform` to the chart.

Parameters
----------
Expand Down Expand Up @@ -1628,7 +1628,7 @@ def transform_regression(

def transform_sample(self: _TTopLevelMixin, sample=1000) -> _TTopLevelMixin:
"""
Add a SampleTransform to the schema.
Add a :class:`SampleTransform` to the schema.

Parameters
----------
Expand All @@ -1650,7 +1650,7 @@ def transform_stack(
self: _TTopLevelMixin, as_, stack, groupby, offset=Undefined, sort=Undefined
) -> _TTopLevelMixin:
"""
Add a StackTransform to the schema.
Add a :class:`StackTransform` to the schema.

Parameters
----------
Expand Down Expand Up @@ -1691,7 +1691,7 @@ def transform_timeunit(
**kwargs,
) -> _TTopLevelMixin:
"""
Add a TimeUnitTransform to the schema.
Add a :class:`TimeUnitTransform` to the schema.

Parameters
----------
Expand Down Expand Up @@ -1776,7 +1776,7 @@ def transform_window(
sort=Undefined,
**kwargs,
) -> _TTopLevelMixin:
"""Add a WindowTransform to the schema
"""Add a :class:`WindowTransform` to the schema

Parameters
----------
Expand Down
68 changes: 17 additions & 51 deletions altair/vegalite/v5/schema/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ def mark_arc(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=Und
url=Undefined, width=Undefined, x=Undefined, x2=Undefined, x2Offset=Undefined,
xOffset=Undefined, y=Undefined, y2=Undefined, y2Offset=Undefined, yOffset=Undefined,
**kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'arc'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'arc' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -95,9 +93,7 @@ def mark_area(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=Un
tooltip=Undefined, url=Undefined, width=Undefined, x=Undefined, x2=Undefined,
x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined, y2Offset=Undefined,
yOffset=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'area'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'area' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -154,9 +150,7 @@ def mark_bar(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=Und
url=Undefined, width=Undefined, x=Undefined, x2=Undefined, x2Offset=Undefined,
xOffset=Undefined, y=Undefined, y2=Undefined, y2Offset=Undefined, yOffset=Undefined,
**kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'bar'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'bar' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -213,9 +207,7 @@ def mark_image(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=U
timeUnitBandSize=Undefined, tooltip=Undefined, url=Undefined, width=Undefined,
x=Undefined, x2=Undefined, x2Offset=Undefined, xOffset=Undefined, y=Undefined,
y2=Undefined, y2Offset=Undefined, yOffset=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'image'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'image' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -272,9 +264,7 @@ def mark_line(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=Un
tooltip=Undefined, url=Undefined, width=Undefined, x=Undefined, x2=Undefined,
x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined, y2Offset=Undefined,
yOffset=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'line'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'line' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -331,9 +321,7 @@ def mark_point(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=U
timeUnitBandSize=Undefined, tooltip=Undefined, url=Undefined, width=Undefined,
x=Undefined, x2=Undefined, x2Offset=Undefined, xOffset=Undefined, y=Undefined,
y2=Undefined, y2Offset=Undefined, yOffset=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'point'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'point' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -390,9 +378,7 @@ def mark_rect(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=Un
tooltip=Undefined, url=Undefined, width=Undefined, x=Undefined, x2=Undefined,
x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined, y2Offset=Undefined,
yOffset=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'rect'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'rect' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -449,9 +435,7 @@ def mark_rule(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=Un
tooltip=Undefined, url=Undefined, width=Undefined, x=Undefined, x2=Undefined,
x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined, y2Offset=Undefined,
yOffset=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'rule'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'rule' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -508,9 +492,7 @@ def mark_text(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=Un
tooltip=Undefined, url=Undefined, width=Undefined, x=Undefined, x2=Undefined,
x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined, y2Offset=Undefined,
yOffset=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'text'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'text' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -567,9 +549,7 @@ def mark_tick(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=Un
tooltip=Undefined, url=Undefined, width=Undefined, x=Undefined, x2=Undefined,
x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined, y2Offset=Undefined,
yOffset=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'tick'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'tick' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -626,9 +606,7 @@ def mark_trail(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=U
timeUnitBandSize=Undefined, tooltip=Undefined, url=Undefined, width=Undefined,
x=Undefined, x2=Undefined, x2Offset=Undefined, xOffset=Undefined, y=Undefined,
y2=Undefined, y2Offset=Undefined, yOffset=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'trail'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'trail' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -686,9 +664,7 @@ def mark_circle(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=
tooltip=Undefined, url=Undefined, width=Undefined, x=Undefined, x2=Undefined,
x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined,
y2Offset=Undefined, yOffset=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'circle'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'circle' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -746,9 +722,7 @@ def mark_square(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, aria=
tooltip=Undefined, url=Undefined, width=Undefined, x=Undefined, x2=Undefined,
x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined,
y2Offset=Undefined, yOffset=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'square'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'square' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -806,9 +780,7 @@ def mark_geoshape(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, ari
tooltip=Undefined, url=Undefined, width=Undefined, x=Undefined, x2=Undefined,
x2Offset=Undefined, xOffset=Undefined, y=Undefined, y2=Undefined,
y2Offset=Undefined, yOffset=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'geoshape'

For information on additional arguments, see :class:`MarkDef`
"""Set the chart's mark to 'geoshape' (see :class:`MarkDef`)
"""
kwds = dict(align=align, angle=angle, aria=aria, ariaRole=ariaRole,
ariaRoleDescription=ariaRoleDescription, aspect=aspect, bandSize=bandSize,
Expand Down Expand Up @@ -844,9 +816,7 @@ def mark_geoshape(self: _TMarkMethodMixin, align=Undefined, angle=Undefined, ari
def mark_boxplot(self: _TMarkMethodMixin, box=Undefined, clip=Undefined, color=Undefined,
extent=Undefined, median=Undefined, opacity=Undefined, orient=Undefined,
outliers=Undefined, rule=Undefined, size=Undefined, ticks=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'boxplot'

For information on additional arguments, see :class:`BoxPlotDef`
"""Set the chart's mark to 'boxplot' (see :class:`BoxPlotDef`)
"""
kwds = dict(box=box, clip=clip, color=color, extent=extent, median=median, opacity=opacity,
orient=orient, outliers=outliers, rule=rule, size=size, ticks=ticks, **kwds)
Expand All @@ -860,9 +830,7 @@ def mark_boxplot(self: _TMarkMethodMixin, box=Undefined, clip=Undefined, color=U
def mark_errorbar(self: _TMarkMethodMixin, clip=Undefined, color=Undefined, extent=Undefined,
opacity=Undefined, orient=Undefined, rule=Undefined, size=Undefined,
thickness=Undefined, ticks=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'errorbar'

For information on additional arguments, see :class:`ErrorBarDef`
"""Set the chart's mark to 'errorbar' (see :class:`ErrorBarDef`)
"""
kwds = dict(clip=clip, color=color, extent=extent, opacity=opacity, orient=orient, rule=rule,
size=size, thickness=thickness, ticks=ticks, **kwds)
Expand All @@ -876,9 +844,7 @@ def mark_errorbar(self: _TMarkMethodMixin, clip=Undefined, color=Undefined, exte
def mark_errorband(self: _TMarkMethodMixin, band=Undefined, borders=Undefined, clip=Undefined,
color=Undefined, extent=Undefined, interpolate=Undefined, opacity=Undefined,
orient=Undefined, tension=Undefined, **kwds) -> _TMarkMethodMixin:
"""Set the chart's mark to 'errorband'

For information on additional arguments, see :class:`ErrorBandDef`
"""Set the chart's mark to 'errorband' (see :class:`ErrorBandDef`)
"""
kwds = dict(band=band, borders=borders, clip=clip, color=color, extent=extent,
interpolate=interpolate, opacity=opacity, orient=orient, tension=tension, **kwds)
Expand Down
4 changes: 1 addition & 3 deletions tools/generate_schema_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ def to_dict(self, validate=True, ignore=(), context=None):

MARK_METHOD = '''
def mark_{mark}({def_arglist}) -> {self_type}:
"""Set the chart's mark to '{mark}'

For information on additional arguments, see :class:`{mark_def}`
"""Set the chart's mark to '{mark}' (see :class:`{mark_def}`)
"""
kwds = dict({dict_arglist})
copy = self.copy(deep=False)
Expand Down