Skip to content

Commit

Permalink
feat(typing): Temporarily duplicate (vega#3538)
Browse files Browse the repository at this point in the history
Still need the changes here prior to that merging. It solves issues in `_config.py` as well.
vega#3538
  • Loading branch information
dangotbanned committed Aug 15, 2024
1 parent 7d3eac9 commit 4fd7628
Show file tree
Hide file tree
Showing 8 changed files with 988 additions and 751 deletions.
8 changes: 5 additions & 3 deletions altair/vegalite/v5/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@
AggregateOp_T,
AutosizeType_T,
ColorName_T,
CompositeMark_T,
ImputeMethod_T,
LayoutAlign_T,
Mark_T,
MultiTimeUnit_T,
OneOrSeq,
ProjectionType_T,
Expand Down Expand Up @@ -3662,9 +3664,9 @@ def __init__(
self,
data: Optional[ChartDataType] = Undefined,
encoding: Optional[FacetedEncoding] = Undefined,
mark: Optional[str | AnyMark] = Undefined,
width: Optional[int | str | dict | Step] = Undefined,
height: Optional[int | str | dict | Step] = Undefined,
mark: Optional[AnyMark | Mark_T | CompositeMark_T] = Undefined,
width: Optional[int | dict | Step | Literal["container"]] = Undefined,
height: Optional[int | dict | Step | Literal["container"]] = Undefined,
**kwargs: Any,
) -> None:
# Data type hints won't match with what TopLevelUnitSpec expects
Expand Down
135 changes: 69 additions & 66 deletions altair/vegalite/v5/schema/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RectConfigKwds(TypedDict, total=False):
ariaRole: str
ariaRoleDescription: str
aspect: bool
baseline: str | Baseline_T
baseline: TextBaseline_T
binSpacing: float
blend: Blend_T
color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T
Expand Down Expand Up @@ -83,10 +83,10 @@ class RectConfigKwds(TypedDict, total=False):
tooltip: str | bool | None | float | TooltipContent
url: str
width: float
x: str | float
x2: str | float
y: str | float
y2: str | float
x: float | Literal["width"]
x2: float | Literal["width"]
y: float | Literal["height"]
y2: float | Literal["height"]


class AreaConfigKwds(TypedDict, total=False):
Expand All @@ -98,7 +98,7 @@ class AreaConfigKwds(TypedDict, total=False):
ariaRole: str
ariaRoleDescription: str
aspect: bool
baseline: str | Baseline_T
baseline: TextBaseline_T
blend: Blend_T
color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T
cornerRadius: float
Expand Down Expand Up @@ -134,7 +134,7 @@ class AreaConfigKwds(TypedDict, total=False):
orient: Orientation_T
outerRadius: float
padAngle: float
point: str | bool | OverlayMarkDefKwds
point: bool | OverlayMarkDefKwds | Literal["transparent"]
radius: float
radius2: float
shape: str
Expand All @@ -159,10 +159,10 @@ class AreaConfigKwds(TypedDict, total=False):
tooltip: str | bool | None | float | TooltipContent
url: str
width: float
x: str | float
x2: str | float
y: str | float
y2: str | float
x: float | Literal["width"]
x2: float | Literal["width"]
y: float | Literal["height"]
y2: float | Literal["height"]


class AxisConfigKwds(TypedDict, total=False):
Expand Down Expand Up @@ -190,7 +190,7 @@ class AxisConfigKwds(TypedDict, total=False):
gridWidth: float
labelAlign: Align_T
labelAngle: float
labelBaseline: str | Baseline_T
labelBaseline: TextBaseline_T
labelBound: bool | float
labelColor: None | ColorHex | ColorName_T
labelExpr: str
Expand All @@ -204,7 +204,7 @@ class AxisConfigKwds(TypedDict, total=False):
labelLineHeight: float
labelOffset: float
labelOpacity: float
labelOverlap: str | bool
labelOverlap: bool | Literal["greedy", "parity"]
labelPadding: float
labelSeparation: float
labels: bool
Expand Down Expand Up @@ -232,7 +232,7 @@ class AxisConfigKwds(TypedDict, total=False):
titleAlign: Align_T
titleAnchor: TitleAnchor_T
titleAngle: float
titleBaseline: str | Baseline_T
titleBaseline: TextBaseline_T
titleColor: None | ColorHex | ColorName_T
titleFont: str
titleFontSize: float
Expand All @@ -258,7 +258,7 @@ class BarConfigKwds(TypedDict, total=False):
ariaRole: str
ariaRoleDescription: str
aspect: bool
baseline: str | Baseline_T
baseline: TextBaseline_T
binSpacing: float
blend: Blend_T
color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T
Expand Down Expand Up @@ -322,10 +322,10 @@ class BarConfigKwds(TypedDict, total=False):
tooltip: str | bool | None | float | TooltipContent
url: str
width: float
x: str | float
x2: str | float
y: str | float
y2: str | float
x: float | Literal["width"]
x2: float | Literal["width"]
y: float | Literal["height"]
y2: float | Literal["height"]


class BoxPlotConfigKwds(TypedDict, total=False):
Expand All @@ -340,7 +340,7 @@ class BoxPlotConfigKwds(TypedDict, total=False):
| RectConfigKwds
| TickConfigKwds
)
extent: str | float
extent: float | Literal["min-max"]
median: (
bool
| BarConfigKwds
Expand Down Expand Up @@ -389,7 +389,7 @@ class MarkConfigKwds(TypedDict, total=False):
ariaRole: str
ariaRoleDescription: str
aspect: bool
baseline: str | Baseline_T
baseline: TextBaseline_T
blend: Blend_T
color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T
cornerRadius: float
Expand Down Expand Up @@ -448,10 +448,10 @@ class MarkConfigKwds(TypedDict, total=False):
tooltip: str | bool | None | float | TooltipContent
url: str
width: float
x: str | float
x2: str | float
y: str | float
y2: str | float
x: float | Literal["width"]
x2: float | Literal["width"]
y: float | Literal["height"]
y2: float | Literal["height"]


class CompositionConfigKwds(TypedDict, total=False):
Expand Down Expand Up @@ -521,7 +521,7 @@ class HeaderConfigKwds(TypedDict, total=False):
labelAlign: Align_T
labelAnchor: TitleAnchor_T
labelAngle: float
labelBaseline: str | Baseline_T
labelBaseline: TextBaseline_T
labelColor: ColorHex | ColorName_T
labelExpr: str
labelFont: str
Expand All @@ -538,7 +538,7 @@ class HeaderConfigKwds(TypedDict, total=False):
titleAlign: Align_T
titleAnchor: TitleAnchor_T
titleAngle: float
titleBaseline: str | Baseline_T
titleBaseline: TextBaseline_T
titleColor: ColorHex | ColorName_T
titleFont: str
titleFontSize: float
Expand Down Expand Up @@ -576,7 +576,7 @@ class LegendConfigKwds(TypedDict, total=False):
gradientVerticalMinLength: float
gridAlign: LayoutAlign_T
labelAlign: Align_T
labelBaseline: str | Baseline_T
labelBaseline: TextBaseline_T
labelColor: None | ColorHex | ColorName_T
labelFont: str
labelFontSize: float
Expand All @@ -585,7 +585,7 @@ class LegendConfigKwds(TypedDict, total=False):
labelLimit: float
labelOffset: float
labelOpacity: float
labelOverlap: str | bool
labelOverlap: bool | Literal["greedy", "parity"]
labelPadding: float
labelSeparation: float
layout: Map
Expand Down Expand Up @@ -615,7 +615,7 @@ class LegendConfigKwds(TypedDict, total=False):
title: None
titleAlign: Align_T
titleAnchor: TitleAnchor_T
titleBaseline: str | Baseline_T
titleBaseline: TextBaseline_T
titleColor: None | ColorHex | ColorName_T
titleFont: str
titleFontSize: float
Expand All @@ -639,7 +639,7 @@ class LineConfigKwds(TypedDict, total=False):
ariaRole: str
ariaRoleDescription: str
aspect: bool
baseline: str | Baseline_T
baseline: TextBaseline_T
blend: Blend_T
color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T
cornerRadius: float
Expand Down Expand Up @@ -674,7 +674,7 @@ class LineConfigKwds(TypedDict, total=False):
orient: Orientation_T
outerRadius: float
padAngle: float
point: str | bool | OverlayMarkDefKwds
point: bool | OverlayMarkDefKwds | Literal["transparent"]
radius: float
radius2: float
shape: str
Expand All @@ -699,10 +699,10 @@ class LineConfigKwds(TypedDict, total=False):
tooltip: str | bool | None | float | TooltipContent
url: str
width: float
x: str | float
x2: str | float
y: str | float
y2: str | float
x: float | Literal["width"]
x2: float | Literal["width"]
y: float | Literal["height"]
y2: float | Literal["height"]


class ProjectionConfigKwds(TypedDict, total=False):
Expand Down Expand Up @@ -821,7 +821,7 @@ class TickConfigKwds(TypedDict, total=False):
ariaRoleDescription: str
aspect: bool
bandSize: float
baseline: str | Baseline_T
baseline: TextBaseline_T
blend: Blend_T
color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T
cornerRadius: float
Expand Down Expand Up @@ -881,10 +881,10 @@ class TickConfigKwds(TypedDict, total=False):
tooltip: str | bool | None | float | TooltipContent
url: str
width: float
x: str | float
x2: str | float
y: str | float
y2: str | float
x: float | Literal["width"]
x2: float | Literal["width"]
y: float | Literal["height"]
y2: float | Literal["height"]


class TitleConfigKwds(TypedDict, total=False):
Expand All @@ -894,7 +894,7 @@ class TitleConfigKwds(TypedDict, total=False):
anchor: TitleAnchor_T
angle: float
aria: bool
baseline: str | Baseline_T
baseline: TextBaseline_T
color: None | ColorHex | ColorName_T
dx: float
dy: float
Expand Down Expand Up @@ -955,29 +955,32 @@ class ViewConfigKwds(TypedDict, total=False):
class ScaleInvalidDataConfigKwds(TypedDict, total=False):
"""Placeholder doc."""

angle: str | Value[float]
color: str | Value[ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T]
angle: Value[float] | Literal["zero-or-min"]
color: (
Literal["zero-or-min"]
| Value[ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T]
)
fill: (
str
Literal["zero-or-min"]
| Value[None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T]
)
fillOpacity: str | Value[float]
opacity: str | Value[float]
radius: str | Value[float]
shape: str | Value[str]
size: str | Value[float]
fillOpacity: Value[float] | Literal["zero-or-min"]
opacity: Value[float] | Literal["zero-or-min"]
radius: Value[float] | Literal["zero-or-min"]
shape: Value[str] | Literal["zero-or-min"]
size: Value[float] | Literal["zero-or-min"]
stroke: (
str
Literal["zero-or-min"]
| Value[None | ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T]
)
strokeDash: str | Value[Sequence[float]]
strokeOpacity: str | Value[float]
strokeWidth: str | Value[float]
theta: str | Value[float]
x: str | Value[str | float]
xOffset: str | Value[float]
y: str | Value[str | float]
yOffset: str | Value[float]
strokeDash: Literal["zero-or-min"] | Value[Sequence[float]]
strokeOpacity: Value[float] | Literal["zero-or-min"]
strokeWidth: Value[float] | Literal["zero-or-min"]
theta: Value[float] | Literal["zero-or-min"]
x: Literal["zero-or-min"] | Value[float | Literal["width"]]
xOffset: Value[float] | Literal["zero-or-min"]
y: Literal["zero-or-min"] | Value[float | Literal["height"]]
yOffset: Value[float] | Literal["zero-or-min"]


class OverlayMarkDefKwds(TypedDict, total=False):
Expand All @@ -989,7 +992,7 @@ class OverlayMarkDefKwds(TypedDict, total=False):
ariaRole: str
ariaRoleDescription: str
aspect: bool
baseline: str | Baseline_T
baseline: TextBaseline_T
blend: Blend_T
clip: bool
color: ColorHex | LinearGradientKwds | RadialGradientKwds | ColorName_T
Expand Down Expand Up @@ -1054,20 +1057,20 @@ class OverlayMarkDefKwds(TypedDict, total=False):
tooltip: str | bool | None | float | TooltipContent
url: str
width: float
x: str | float
x2: str | float
x: float | Literal["width"]
x2: float | Literal["width"]
x2Offset: float
xOffset: float
y: str | float
y2: str | float
y: float | Literal["height"]
y2: float | Literal["height"]
y2Offset: float
yOffset: float


class LinearGradientKwds(TypedDict, total=False):
"""Placeholder doc."""

gradient: str
gradient: Literal["linear"]
stops: Sequence[GradientStopKwds]
id: str
x1: float
Expand All @@ -1079,7 +1082,7 @@ class LinearGradientKwds(TypedDict, total=False):
class RadialGradientKwds(TypedDict, total=False):
"""Placeholder doc."""

gradient: str
gradient: Literal["radial"]
stops: Sequence[GradientStopKwds]
id: str
r1: float
Expand Down
Loading

0 comments on commit 4fd7628

Please sign in to comment.