Example #1
0
 def _markastrelated(self, node):
     for child in node.values():
         if IDocstring.providedBy(child) \
           or IImport.providedBy(child) \
           or IAttribute.providedBy(child) \
           or IDecorator.providedBy(child):
             self._marklines(*range(child.bufstart, child.bufend))
         else:
             self._marklines(*range(child.bufstart, child.defendlineno))
         self._markastrelated(child)
Example #2
0
 def _markastrelated(self, node):
     for child in node.values():
         if IDocstring.providedBy(child) \
           or IImport.providedBy(child) \
           or IAttribute.providedBy(child) \
           or IDecorator.providedBy(child):
             self._marklines(*range(child.bufstart, child.bufend))
         else:
             self._marklines(*range(child.bufstart, child.defendlineno))
         self._markastrelated(child)
Example #3
0
 def _add(self, import_):
     values = self.context.values()
     for value in values:
         if IBlock.providedBy(value):
             comment = True
             for line in value.lines:
                 if not line.startswith('#'):
                     comment = False
                     break
             if comment:
                 self.context.insertafter(import_, value)
                 return
         if not IImport.providedBy(value) \
           and not IDocstring.providedBy(value):
             self.context.insertbefore(import_, value)
             return
     self.context[import_.uuid] = import_
Example #4
0
 def _add(self, import_):
     values = self.context.values()
     for value in values:
         if IBlock.providedBy(value):
             comment = True
             for line in value.lines:
                 if not line.startswith('#'):
                     comment = False
                     break
             if comment:
                 self.context.insertafter(import_, value)
                 return
         if not IImport.providedBy(value) \
           and not IDocstring.providedBy(value):
             self.context.insertbefore(import_, value)
             return
     self.context[import_.uuid] = import_