Skip to content

Commit

Permalink
chore: tidy up wip field_into
Browse files Browse the repository at this point in the history
  • Loading branch information
dangotbanned committed Aug 1, 2024
1 parent d4cf757 commit e449796
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions altair/vegalite/v5/_api_rfc.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,32 @@ def range(
return _wrap_composition(p)


# NOTE: Ignore everything below
# NOTE: Ignore everything below #
# ----------------------------- #


class field_into:
"""
Return wrapper for `agg`, `field` shorthand dicts.
Idea
----
Rather than something like::
op_1 = alt.X(alt.agg.min("Cost", "Q")).scale(None)
You could chain entirely from the agg::
# the internal unpacking will avoid double-checking the shorthand
op_2 = alt.agg.min("Cost", "Q").x().scale(None)
Optionally, use the chained constructor::
op_2_1 = alt.agg.min("Cost", "Q").x(scale=None)
"""

def __init__(self, arg: Map, /) -> None:
self._arg: Map = arg

Expand Down Expand Up @@ -433,13 +455,8 @@ def y_error2(self, *args: Any, **kwds: Any) -> channels.YError2: ...
def y_offset(self, *args: Any, **kwds: Any) -> channels.YOffset: ...


# field_out = agg.q1()
# wrapped = field_into(field_out).value.x()
## efg = field2.angle()
## some_field = field2.min("Cost", "Q")
# some_field = field_into(field("Cost:Q"))
# beeeee = some_field.x()
# cee = some_field.value.x()
#
#
# ffff = field_into(field("Cost:Q")).x2().bandPosition(4.7)
def example_field():
field_out = agg.q1()
wrapped = field_into(field_out).x() # noqa: F841
some_field = field_into(agg.min("Cost", "Q"))
beeeee = some_field.x().scale(None).impute(None).axis(None) # noqa: F841

0 comments on commit e449796

Please sign in to comment.