"""This is still just a sketch ... """
raise NotImplementedError()

BINDCODE = 'bindcode'
BINDSYM = 'bindsym'


# TODO set after rendering
class Bindings:
    """
    bindsym | bindcode
    [--release] [<Group>+][<Modifiers>+]<keysym> command

    [--release] [--border] [--whole-window] [<Modifiers>+]button<n> command
    """
    def __init__(self, lines):
        self.lines = lines

    def __len__(self):
        return len(self.dict)

    def translate_bindings(self):
        """translate bindcode to bindsym assignments

        this need to be done the moment the information is asked because it
        depends on the currently acitve layout.
        """

    def write_bindings_info(self):
        """Write info in some format that can be nicely displayed"""

    @property
    def dict(self):
        context = {}
        for line in self.lines:
            if not self.is_binding(line):
                continue
            maxsplit = 3 if '--release' in line else 2
            bindType, shortcut, binding = line.split(maxsplit=maxsplit)
            context["%s:%s" % (bindType, shortcut)] = binding
        return context

    @staticmethod
    def is_binding(line):
        return line.startswith(BINDSYM) or line.startswith(BINDCODE)

    @property
    def bindings(self):
        exp = 0
        for line in self.prunedLines:
            if Bindings.is_binding(line):
                exp += 1
        bindings = Bindings(self.prunedLines)
        if len(bindings) != exp:
            raise exc.ParseError("expected %s bindings - got %s for %s",
                                 exp, len(bindings), self.clean)
        return bindings


@@ -8,14 +8,8 @@
  is 
-still 
 just
@@ -26,16 +26,16 @@
 ... %22%22%22%0A
+
 raise No
@@ -104,13 +104,8 @@
 %0A%0A%0A#
- TODO
  set
@@ -115,17 +115,13 @@
 ter 
-rendering
+build
 %0Acla
@@ -369,62 +369,8 @@
 es%0A%0A
-    def __len__(self):%0A        return len(self.dict)%0A%0A
     
@@ -617,32 +617,32 @@
 ngs_info(self):%0A
+
         %22%22%22Write
@@ -698,887 +698,4 @@
 %22%22%22%0A
-%0A    @property%0A    def dict(self):%0A        context = %7B%7D%0A        for line in self.lines:%0A            if not self.is_binding(line):%0A                continue%0A            maxsplit = 3 if '--release' in line else 2%0A            bindType, shortcut, binding = line.split(maxsplit=maxsplit)%0A            context%5B%22%25s:%25s%22 %25 (bindType, shortcut)%5D = binding%0A        return context%0A%0A    @staticmethod%0A    def is_binding(line):%0A        return line.startswith(BINDSYM) or line.startswith(BINDCODE)%0A%0A    @property%0A    def bindings(self):%0A        exp = 0%0A        for line in self.prunedLines:%0A            if Bindings.is_binding(line):%0A                exp += 1%0A        bindings = Bindings(self.prunedLines)%0A        if len(bindings) != exp:%0A            raise exc.ParseError(%22expected %25s bindings - got %25s for %25s%22,%0A                                 exp, len(bindings), self.clean)%0A        return bindings%0A%0A

update sketch