Every line of 'indentation in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
577 def get_indentation(line): 578 """Return leading whitespace.""" 579 if line.strip(): 580 non_whitespace_index = len(line) - len(line.lstrip()) 581 return line[:non_whitespace_index] 582 else: 583 return ''
318 def _handle_indent_inside_string(self, char, cursor, fullline, post): 319 # break string with a '\' at the end of the original line, always 320 # breaking strings enclosed by parens is done in the 321 # _handle_between_paren method 322 n = self.editor.tab_length 323 pre = '%s \\' % char 324 post += n * ' ' 325 if fullline.endswith(':'): 326 post += n * " " 327 post += char 328 return post, pre
121 def _IndentString(source_string, indentation): 122 """Indent string some number of characters.""" 123 lines = [(indentation * ' ') + line 124 for line in source_string.splitlines(True)] 125 return ''.join(lines)