# Path: tailor/config.py
# def jpath(*args):
# def reload(path):
# 
# Path: tailor/graph.py
# class Node:
#     def __init__(self, kind, data):
#         self.kind = kind
#         self.name = None
#         self.parent = None
#         self.__dict__.update(data)
#         self._children = list()
# 
#     @property
#     def children(self):
#         return list(self._children)
# 
#     def bfs_children(self):
#         visited, stack = list(), [self]
#         while stack:
#             node = stack.pop()
#             if node not in visited:
#                 visited.append(node)
#                 stack.extend(node.children)
#         return reversed(visited[1:])
# 
#     def dfs_children(self):
#         visited, stack = list(), [self]
#         while stack:
#             node = stack.pop(0)
#             if node not in visited:
#                 visited.insert(0, node)
#                 stack.extend(node.children)
#         return reversed(visited[:-1])
# 
#     def add_child(self, node):
#         node.parent = self
#         self._children.append(node)
# 
#     def placeholders_needing_image(self):
#         """ Generator that yields nodes that require an image
#         """
#         for child in self.dfs_children():
#             if child.kind == "placeholder":
#                 if not hasattr(child, "data"):
#                     yield child
# 
#     def needed_captures(self):
#         """Search and return number of images needed
#         """
#         return len(list(self.placeholders_needing_image()))
# 
#     def push_image(self, data):
#         for child in self.dfs_children():
#             if child.kind == "placeholder":
#                 if not hasattr(child, "data"):
#                     child.data = data
#                     return
# 
#     def determine_rect(self):
#         """search through parents until a rect is found and return it
#            if this node contains a rect, then return that
#         """
#         if hasattr(self, "rect"):
#             return self.rect
#         else:
#             return self.parent.determine_rect()
# 
#     def get_root(self):
#         parent = self
#         while parent.parent is not None:
#             parent = parent.parent
#         return parent


import logging
import os.path
        import yaml
from tailor.config import pkConfig
from tailor.graph import Node
    try:
        return [float(i) for i in values]
    except (ValueError, TypeError):
        raise TemplateBuilder.SyntaxError


def create_area_node(raw_config):
    data = raw_config["data"]
    rect = cast_list_float(data["rect"])
    units = data.get("units", None)
    try:
        dpi = float(data["dpi"])
    except KeyError:
        dpi = None
    return Node("area", {"rect": rect, "units": units, "dpi": dpi})


def create_root_node(raw_config):
    if not raw_config["name"] == "root":
        raise YamlTemplateBuilder.SyntaxError

    data = raw_config["data"]
    rect = cast_list_float(data["rect"])
    units = data["units"]
    dpi = float(data["dpi"])
    return Node("area", {"rect": rect, "units": units, "dpi": dpi})


def create_image_node(raw_config):
    filename = raw_config["data"]["filename"]

# Path: tailor/config.py
# def jpath(*args):
# def reload(path):
# 
# Path: tailor/graph.py
# class Node:
#     def __init__(self, kind, data):
#         self.kind = kind
#         self.name = None
#         self.parent = None
#         self.__dict__.update(data)
#         self._children = list()
# 
#     @property
#     def children(self):
#         return list(self._children)
# 
#     def bfs_children(self):
#         visited, stack = list(), [self]
#         while stack:
#             node = stack.pop()
#             if node not in visited:
#                 visited.append(node)
#                 stack.extend(node.children)
#         return reversed(visited[1:])
# 
#     def dfs_children(self):
#         visited, stack = list(), [self]
#         while stack:
#             node = stack.pop(0)
#             if node not in visited:
#                 visited.insert(0, node)
#                 stack.extend(node.children)
#         return reversed(visited[:-1])
# 
#     def add_child(self, node):
#         node.parent = self
#         self._children.append(node)
# 
#     def placeholders_needing_image(self):
#         """ Generator that yields nodes that require an image
#         """
#         for child in self.dfs_children():
#             if child.kind == "placeholder":
#                 if not hasattr(child, "data"):
#                     yield child
# 
#     def needed_captures(self):
#         """Search and return number of images needed
#         """
#         return len(list(self.placeholders_needing_image()))
# 
#     def push_image(self, data):
#         for child in self.dfs_children():
#             if child.kind == "placeholder":
#                 if not hasattr(child, "data"):
#                     child.data = data
#                     return
# 
#     def determine_rect(self):
#         """search through parents until a rect is found and return it
#            if this node contains a rect, then return that
#         """
#         if hasattr(self, "rect"):
#             return self.rect
#         else:
#             return self.parent.determine_rect()
# 
#     def get_root(self):
#         parent = self
#         while parent.parent is not None:
#             parent = parent.parent
#         return parent


# Path: tailor/builder.py
import logging
import os.path
        import yaml
from tailor.config import pkConfig
from tailor.graph import Node

    try:
        return [float(i) for i in values]
    except (ValueError, TypeError):
        raise TemplateBuilder.SyntaxError


def create_area_node(raw_config):
    data = raw_config["data"]
    rect = cast_list_float(data["rect"])
    units = data.get("units", None)
    try:
        dpi = float(data["dpi"])
    except KeyError:
        dpi = None
    return Node("area", {"rect": rect, "units": units, "dpi": dpi})


def create_root_node(raw_config):
    if not raw_config["name"] == "root":
        raise YamlTemplateBuilder.SyntaxError

    data = raw_config["data"]
    rect = cast_list_float(data["rect"])
    units = data["units"]
    dpi = float(data["dpi"])
    return Node("area", {"rect": rect, "units": units, "dpi": dpi})


def create_image_node(raw_config):
    filename = raw_config["data"]["filename"]

    path = os.path.join(pkConfig["paths"]["app_templates"], filename)