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

from functools import partial
from operator import is_not

class tree:
    def __init__(self, content="tree"):
        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 size(self, size=None):
        """
        Source · If size is specified, sets this tree layout’s size to the specified
        two-element array of numbers [width, height] and returns this tree layout. If size is
        not specified, returns the current layout size, which defaults to [1, 1]. A layout size
        of null indicates that a node size will be used instead. The coordinates x and y
        represent an arbitrary coordinate system; for example, to produce a radial layout, a
        size of [360, radius] corresponds to a breadth of 360° and a depth of radius.

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


    def nodeSize(self, size=None):
        """
        Source · If size is specified, sets this tree layout’s node size to the specified
        two-element array of numbers [width, height] and returns this tree layout. If size is
        not specified, returns the current node size, which defaults to null. A node size of
        null indicates that a layout size will be used instead. When a node size is specified,
        the root node is always positioned at ⟨0, 0⟩.

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


    def separation(self, separation=None):
        """
        Source · If separation is specified, sets the separation accessor to the specified
        function and returns this tree layout. If separation is not specified, returns the
        current separation accessor, which defaults to:
        .. code:: javascript

            function separation(a, b) {
              return a.parent == b.parent ? 1 : 2;
            }

        A variation that is more appropriate for radial layouts reduces the separation gap
        proportionally to the radius:
        .. code:: javascript

            function separation(a, b) {
              return (a.parent == b.parent ? 1 : 2) / a.depth;
            }

        The separation accessor is used to separate neighboring nodes. The separation function
        is passed two nodes a and b, and must return the desired separation. The nodes are
        typically siblings, though the nodes may be more distantly related if the layout
        decides to place such nodes adjacent.

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

