matchIndentation

emlib.textlib.matchIndentation(code, modelcode)[source]

Indent code matching modelcode

Parameters:
  • code (str) – the code to indent

  • modelcode (str) – the code to match

Return type:

str

Returns:

code indented to match modelcode

Example

>>> a = "    # This is some code"
>>> b = "        # This is some other code"
>>> matchIndentation(a, b)
'        # This is some code'