コード例 #1
0
ファイル: rules.py プロジェクト: agustinhenze/dlt
 def _get_context(self, field):
     position = 1
     indicator = green.format("^") + len(field.name) * green.format("~")
     txt = "{field_render}\n{indicator}"
     txt = txt.format(field_render=field_to_text(field),
                      indicator=indicator)
     return (txt, position)
コード例 #2
0
ファイル: rules.py プロジェクト: agustinhenze/dlt
 def _get_context_single_line_values(self, field):
     field_txt = field_to_text(field)
     position = field_txt.find("\n ")
     txt = "{first}\n{indicator}{rest}"
     txt = txt.format(
         first=field_txt[:position],
         indicator=" " * position + green.format("^"),
         rest=field_txt[position:],
     )
     return (txt, position)
コード例 #3
0
ファイル: rules.py プロジェクト: agustinhenze/dlt
 def _get_context(self, paragraphs):
     txt = ""
     mark = False
     for paragraph in self._data:
         if paragraph in paragraphs:
             mark = True
         for i, field in enumerate(paragraph):
             if mark and i == 0:
                 txt += '{0}\n'.format(green.format("_" * 40))
             txt += '{0}\n'.format(field_to_text(field))
         if mark:
             txt += '{0}'.format(green.format("^" * 40))
         txt += '\n'
         mark = False
     return txt[:-1]
コード例 #4
0
ファイル: rules.py プロジェクト: agustinhenze/dlt
 def _get_context(self, paragraph, wrong_field):
     txt = ""
     context = ""
     position = 1
     line_number = 1
     for field in paragraph:
         txt += "{0}\n".format(field_to_text(field))
         if field.name == wrong_field:
             ctx = txt[:]
             txt = ""
             length = int(len(field.name))
             line_number = field.line_number
             indicator = green.format("_") + green.format("~") * length
             context = "{indicator}{ctx}".format(ctx=ctx,
                                                 indicator=indicator)
     return "{0}\n{1}".format(context, txt), line_number, position