# Generated by detroit
# See https://github.com/bourbonut/detroit/tree/main/api_maker

from functools import partial
from operator import is_not

class symbol:
    def __init__(self, content="symbol"):
        self.content = content

    def __repr__(self):
        return self.content

    def __str__(self):
        return self.content

    def __call__(self, *args):
        arguments = ", ".join(map(repr, args))
        return f"{self}({arguments})"

    def type(self, type=None):
        """
        Source · If type is specified, sets the symbol type to the specified function or symbol
        type and returns this symbol generator.
        .. code:: javascript

            const symbol = d3.symbol().type(d3.symbolCross);

        If type is a function, the symbol generator’s arguments and this are passed through.
        This is convenient for use with selection.attr, say in conjunction with an ordinal
        scale to produce a categorical symbol encoding.
        .. code:: javascript

            const symbolType = d3.scaleOrdinal(d3.symbolsFill);
            const symbol = d3.symbol().type((d) => symbolType(d.category));

        If type is not specified, returns the current symbol type accessor.
        .. code:: javascript

            symbol.type() // () => d3.symbolCross

        The symbol type accessor defaults to:
        .. code:: javascript

            function type() {
              return circle;
            }

        See symbolsFill and symbolsStroke for built-in symbol types. To implement a custom
        symbol type, pass an object that implements symbolType.draw.

        See more informations `here <https://d3js.org/d3-shape/symbol#symbol_type>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (type,))))
        return symbol(content=f"{self.content}.type({arguments})")


    def size(self, size=None):
        """
        Source · If size is specified, sets the size to the specified function or number and
        returns this symbol generator.
        .. code:: javascript

            const symbol = d3.symbol().size(100);

        If size is a function, the symbol generator’s arguments and this are passed through.
        This is convenient for use with selection.attr, say in conjunction with a linear scale
        to produce a quantitative size encoding.
        .. code:: javascript

            const symbolSize = d3.scaleLinear([0, 100]);
            const symbol = d3.symbol().size((d) => symbolSize(d.value));

        If size is not specified, returns the current size accessor.
        .. code:: javascript

            symbol.size() // () => 100

        The size accessor defaults to:
        .. code:: javascript

            function size() {
              return 64;
            }


        See more informations `here <https://d3js.org/d3-shape/symbol#symbol_size>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (size,))))
        return symbol(content=f"{self.content}.size({arguments})")


    def context(self, context=None):
        """
        Source · If context is specified, sets the context and returns this symbol generator.
        .. code:: javascript

            const context = canvas.getContext("2d");
            const symbol = d3.symbol().context(context);

        If context is not specified, returns the current context.
        .. code:: javascript

            symbol.context() // context

        The context defaults to null. If the context is not null, then the generated symbol is
        rendered to this context as a sequence of path method calls. Otherwise, a path data
        string representing the generated symbol is returned.

        See more informations `here <https://d3js.org/d3-shape/symbol#symbol_context>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (context,))))
        return symbol(content=f"{self.content}.context({arguments})")


    def digits(self, digits=None):
        """
        Source · If digits is specified, sets the maximum number of digits after the decimal
        separator and returns this symbol generator.
        .. code:: javascript

            const symbol = d3.symbol().digits(3);

        If digits is not specified, returns the current maximum fraction digits, which defaults
        to 3.
        .. code:: javascript

            symbol.digits() // 3

        This option only applies when the associated context is null, as when this symbol
        generator is used to produce path data.

        See more informations `here <https://d3js.org/d3-shape/symbol#symbol_digits>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (digits,))))
        return symbol(content=f"{self.content}.digits({arguments})")

