Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use 'UndefinedLike = Any' as the type hint #2681

Merged
merged 4 commits into from
Oct 13, 2022
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
10 changes: 9 additions & 1 deletion altair/utils/schemapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import contextlib
import inspect
import json
from typing import Any

import jsonschema
import numpy as np
Expand Down Expand Up @@ -137,7 +138,14 @@ def __repr__(self):
return "Undefined"


Undefined = UndefinedType()
# In the future Altair may implement a more complete set of type hints.
# But for now, we'll add an annotation to indicate that the type checker
# should permit any value passed to a function argument whose default
# value is Undefined.
UndefinedLike = Any


Undefined: UndefinedLike = UndefinedType()


class SchemaBase(object):
Expand Down
11 changes: 5 additions & 6 deletions doc/user_guide/API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Top-Level Objects

.. autosummary::
:toctree: generated/toplevel/
:caption: Top-Level Objects
:nosignatures:

Chart
Expand All @@ -33,7 +32,6 @@ Encoding Channels

.. autosummary::
:toctree: generated/channels/
:caption: Encoding Channels
:nosignatures:

Angle
Expand Down Expand Up @@ -142,24 +140,25 @@ API Functions

.. autosummary::
:toctree: generated/api/
:caption: API Functions
:nosignatures:

binding
binding_checkbox
binding_radio
binding_range
binding_select
check_fields_and_encodings
concat
condition
graticule
hconcat
layer
parameter
param
repeat
selection
selection_interval
selection_multi
selection_point
selection_single
sequence
sphere
Expand All @@ -173,7 +172,6 @@ Low-Level Schema Wrappers

.. autosummary::
:toctree: generated/core/
:caption: Low-Level Schema Wrappers
:nosignatures:

Aggregate
Expand Down Expand Up @@ -286,6 +284,7 @@ Low-Level Schema Wrappers
Day
DensityTransform
DerivedStream
Dict
DictInlineDataset
DictSelectionInit
DictSelectionInitInterval
Expand Down Expand Up @@ -332,6 +331,7 @@ Low-Level Schema Wrappers
FieldOrDatumDefWithConditionStringDatumDefText
FieldOrDatumDefWithConditionStringFieldDefText
FieldOrDatumDefWithConditionStringFieldDefstring
FieldRange
FieldRangePredicate
FieldValidPredicate
FilterTransform
Expand Down Expand Up @@ -414,7 +414,6 @@ Low-Level Schema Wrappers
Orientation
OverlayMarkDef
Padding
Parameter
ParameterExtent
ParameterName
ParameterPredicate
Expand Down
10 changes: 9 additions & 1 deletion tools/schemapi/schemapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import contextlib
import inspect
import json
from typing import Any

import jsonschema
import numpy as np
Expand Down Expand Up @@ -135,7 +136,14 @@ def __repr__(self):
return "Undefined"


Undefined = UndefinedType()
# In the future Altair may implement a more complete set of type hints.
# But for now, we'll add an annotation to indicate that the type checker
# should permit any value passed to a function argument whose default
# value is Undefined.
UndefinedLike = Any


Undefined: UndefinedLike = UndefinedType()


class SchemaBase(object):
Expand Down