示例#1
0
    def add_elem(self, prev_token: Token, token: Token):
        if add_token_space(prev_token, token) and len(self.value) > 0:
            self.value += " "

        if self.is_empty():
            self.col_nb = col_nb(token)

        self.value += token.string
示例#2
0
 def __init__(self, token: Token):
     self.line_nb = line_nb(token)
     self.col_nb = col_nb(token)
     self.key = ""
     self.value = ""
     self.pre_comments, self.post_comments = list(), list()
     self.len = 0
     self.inline: bool = True
     self.fully_processed: bool = False
     self._has_inline_comment: bool = False
示例#3
0
 def check_exit(self, cur_param: Parameter):
     exit = False
     if not self.found_newline:
         return exit
     if not_empty(self.token):
         # Special condition for comments: they appear before indents/dedents.
         if self.token.type == tokenize.COMMENT:
             if not cur_param.is_empty() and col_nb(
                     self.token) < cur_param.col_nb:
                 exit = True
         else:
             exit = self.cur_indent < self.target_indent
         if exit:
             self.flush_param(cur_param, skip_empty=True)
     return exit