# Path: weasyprint/svg/utils.py
# def normalize(string):
#     """Give a canonical version of a given value string."""
#     string = (string or '').replace('E', 'e')
#     string = re.sub('(?<!e)-', ' -', string)
#     string = re.sub('[ \n\r\t,]+', ' ', string)
#     string = re.sub(r'(\.[0-9-]+)(?=\.)', r'\1 ', string)
#     return string.strip()
# 
# def point(svg, string, font_size):
#     """Pop first two size values from a string."""
#     match = re.match('(.*?) (.*?)(?: |$)', string)
#     if match:
#         x, y = match.group(1, 2)
#         string = string[match.end():]
#         return (*svg.point(x, y, font_size), string)
#     else:
#         raise PointError


from math import atan2, pi, sqrt
from .utils import normalize, point

    if rx > width / 2:
        rx = width / 2
    if ry > height / 2:
        ry = height / 2

    # Inspired by Cairo Cookbook
    # http://cairographics.org/cookbook/roundedrectangles/
    ARC_TO_BEZIER = 4 * (2 ** .5 - 1) / 3
    c1, c2 = ARC_TO_BEZIER * rx, ARC_TO_BEZIER * ry

    svg.stream.move_to(x + rx, y)
    svg.stream.line_to(x + width - rx, y)
    svg.stream.curve_to(
        x + width - rx + c1, y, x + width, y + c2, x + width, y + ry)
    svg.stream.line_to(x + width, y + height - ry)
    svg.stream.curve_to(
        x + width, y + height - ry + c2, x + width + c1 - rx, y + height,
        x + width - rx, y + height)
    svg.stream.line_to(x + rx, y + height)
    svg.stream.curve_to(
        x + rx - c1, y + height, x, y + height - c2, x, y + height - ry)
    svg.stream.line_to(x, y + ry)
    svg.stream.curve_to(x, y + ry - c2, x + rx - c1, y, x + rx, y)
    svg.stream.close()


def line(svg, node, font_size):
    """Draw line tag."""
    x1, y1 = svg.point(node.get('x1'), node.get('y1'), font_size)

# Path: weasyprint/svg/utils.py
# def normalize(string):
#     """Give a canonical version of a given value string."""
#     string = (string or '').replace('E', 'e')
#     string = re.sub('(?<!e)-', ' -', string)
#     string = re.sub('[ \n\r\t,]+', ' ', string)
#     string = re.sub(r'(\.[0-9-]+)(?=\.)', r'\1 ', string)
#     return string.strip()
# 
# def point(svg, string, font_size):
#     """Pop first two size values from a string."""
#     match = re.match('(.*?) (.*?)(?: |$)', string)
#     if match:
#         x, y = match.group(1, 2)
#         string = string[match.end():]
#         return (*svg.point(x, y, font_size), string)
#     else:
#         raise PointError


# Path: weasyprint/svg/shapes.py
from math import atan2, pi, sqrt
from .utils import normalize, point


    if rx > width / 2:
        rx = width / 2
    if ry > height / 2:
        ry = height / 2

    # Inspired by Cairo Cookbook
    # http://cairographics.org/cookbook/roundedrectangles/
    ARC_TO_BEZIER = 4 * (2 ** .5 - 1) / 3
    c1, c2 = ARC_TO_BEZIER * rx, ARC_TO_BEZIER * ry

    svg.stream.move_to(x + rx, y)
    svg.stream.line_to(x + width - rx, y)
    svg.stream.curve_to(
        x + width - rx + c1, y, x + width, y + c2, x + width, y + ry)
    svg.stream.line_to(x + width, y + height - ry)
    svg.stream.curve_to(
        x + width, y + height - ry + c2, x + width + c1 - rx, y + height,
        x + width - rx, y + height)
    svg.stream.line_to(x + rx, y + height)
    svg.stream.curve_to(
        x + rx - c1, y + height, x, y + height - c2, x, y + height - ry)
    svg.stream.line_to(x, y + ry)
    svg.stream.curve_to(x, y + ry - c2, x + rx - c1, y, x + rx, y)
    svg.stream.close()


def line(svg, node, font_size):
    """Draw line tag."""
    x1, y1 = svg.point(node.get('x1'), node.get('y1'), font_size)

    x2, y2 = svg.point(node.get('x2'), node.get('y2'), font_size)