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

from functools import partial
from operator import is_not

class pack:
    def __init__(self, content="pack"):
        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 radius(self, radius=None):
        """
        Source · If radius is specified, sets the pack layout’s radius accessor to the
        specified function and returns this pack layout. If radius is not specified, returns
        the current radius accessor, which defaults to null. If the radius accessor is null,
        the radius of each leaf circle is derived from the leaf node.value (computed by
        node.sum); the radii are then scaled proportionally to fit the layout size. If the
        radius accessor is not null, the radius of each leaf circle is specified exactly by the
        function.

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


    def size(self, size=None):
        """
        Source · If size is specified, sets this pack layout’s size to the specified
        two-element array of numbers [width, height] and returns this pack layout. If size is
        not specified, returns the current size, which defaults to [1, 1].

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


    def padding(self, padding=None):
        """
        Source · If padding is specified, sets this pack layout’s padding accessor to the
        specified number or function and returns this pack layout. If padding is not specified,
        returns the current padding accessor, which defaults to the constant zero. When
        siblings are packed, tangent siblings will be separated by approximately the specified
        padding; the enclosing parent circle will also be separated from its children by
        approximately the specified padding. If an explicit radius is not specified, the
        padding is approximate because a two-pass algorithm is needed to fit within the layout
        size: the circles are first packed without padding; a scaling factor is computed and
        applied to the specified padding; and lastly the circles are re-packed with padding.

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

