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

from functools import partial
from operator import is_not

class path:
    def __init__(self, content="path"):
        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 moveTo(self, x=None, y=None):
        """
        Source · Move to the specified point ⟨x, y⟩. Equivalent to context.moveTo and SVG’s
        “moveto” command.
        .. code:: javascript

            path.moveTo(100, 100);


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


    def closePath(self):
        """
        Source · Ends the current subpath and causes an automatic straight line to be drawn
        from the current point to the initial point of the current subpath. Equivalent to
        context.closePath and SVG’s “closepath” command.
        .. code:: javascript

            path.closePath();


        See more informations `here <https://d3js.org/d3-path#path_closePath>`_.
        """
        return path(content=f"{self.content}.closePath()")


    def lineTo(self, x=None, y=None):
        """
        Source · Draws a straight line from the current point to the specified point ⟨x, y⟩.
        Equivalent to context.lineTo and SVG’s “lineto” command.
        .. code:: javascript

            path.lineTo(200, 200);


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


    def quadraticCurveTo(self, cpx=None, cpy=None, x=None, y=None):
        """
        Source · Draws a quadratic Bézier segment from the current point to the specified point
        ⟨x, y⟩, with the specified control point ⟨cpx, cpy⟩. Equivalent to
        context.quadraticCurveTo and SVG’s quadratic Bézier curve commands.
        .. code:: javascript

            path.quadraticCurveTo(200, 0, 200, 200);


        See more informations `here <https://d3js.org/d3-path#path_quadraticCurveTo>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (cpx, cpy, x, y))))
        return path(content=f"{self.content}.quadraticCurveTo({arguments})")


    def bezierCurveTo(self, cpx1=None, cpy1=None, cpx2=None, cpy2=None, x=None, y=None):
        """
        Source · Draws a cubic Bézier segment from the current point to the specified point ⟨x,
        y⟩, with the specified control points ⟨cpx1, cpy1⟩ and ⟨cpx2, cpy2⟩. Equivalent to
        context.bezierCurveTo and SVG’s cubic Bézier curve commands.
        .. code:: javascript

            path.bezierCurveTo(200, 0, 0, 200, 200, 200);


        See more informations `here <https://d3js.org/d3-path#path_bezierCurveTo>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (cpx1, cpy1, cpx2, cpy2, x, y))))
        return path(content=f"{self.content}.bezierCurveTo({arguments})")


    def arcTo(self, x1=None, y1=None, x2=None, y2=None, radius=None):
        """
        Source · Draws a circular arc segment with the specified radius that starts tangent to
        the line between the current point and the specified point ⟨x1, y1⟩ and ends tangent to
        the line between the specified points ⟨x1, y1⟩ and ⟨x2, y2⟩. If the first tangent point
        is not equal to the current point, a straight line is drawn between the current point
        and the first tangent point. Equivalent to context.arcTo and uses SVG’s elliptical arc
        curve commands.
        .. code:: javascript

            path.arcTo(150, 150, 300, 10, 40);


        See more informations `here <https://d3js.org/d3-path#path_arcTo>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (x1, y1, x2, y2, radius))))
        return path(content=f"{self.content}.arcTo({arguments})")


    def arc(self, x=None, y=None, radius=None, startAngle=None, endAngle=None, anticlockwise=None):
        """
        Source · Draws a circular arc segment with the specified center ⟨x, y⟩, radius,
        startAngle and endAngle. If anticlockwise is true, the arc is drawn in the
        anticlockwise direction; otherwise, it is drawn in the clockwise direction. If the
        current point is not equal to the starting point of the arc, a straight line is drawn
        from the current point to the start of the arc. Equivalent to context.arc and uses
        SVG’s elliptical arc curve commands.
        .. code:: javascript

            path.arc(80, 80, 70, 0, Math.PI * 2);


        See more informations `here <https://d3js.org/d3-path#path_arc>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (x, y, radius, startAngle, endAngle, anticlockwise))))
        return path(content=f"{self.content}.arc({arguments})")


    def rect(self, x=None, y=None, w=None, h=None):
        """
        Source · Creates a new subpath containing just the four points ⟨x, y⟩, ⟨x + w, y⟩, ⟨x +
        w, y + h⟩, ⟨x, y + h⟩, with those four points connected by straight lines, and then
        marks the subpath as closed. Equivalent to context.rect and uses SVG’s “lineto”
        commands.
        .. code:: javascript

            path.rect(10, 10, 140, 140);


        See more informations `here <https://d3js.org/d3-path#path_rect>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (x, y, w, h))))
        return path(content=f"{self.content}.rect({arguments})")


    def toString(self):
        """
        Source · Returns the string representation of this path according to SVG’s path data
        specification.
        .. code:: javascript

            path.toString() // "M40,0A40,40,0,1,1,-40,0A40,40,0,1,1,40,0"


        See more informations `here <https://d3js.org/d3-path#path_toString>`_.
        """
        return path(content=f"{self.content}.toString()")

