An easy python formatter TM1 TurboIntegrator processes
-
Keyword Highlighting
-
Indentation
-
Deploy Jupyter Notebook quickly using Binder:
-
Automatically copy results to clipboard using pyperclip (Available only when running locally)
from TI import TI
ti = TI(text = "")
ti.set_tab("\t")
string = """
if (1=0) ;
ASCIIOUTPUT('zz.txt', 'Hello world!');
endif;
"""
ti.text = string.split('\n')
ti.tidy()
ti.print_output()
Output:
IF (1 = 0);
ASCIIOutput('zz.txt', 'Hello world!');
ENDIF;
-
Add hanging indentation for long
ExecuteProcess
statements. -
Include and document options for removing extra whitespace, shortening comment headers, etc.
-
Include formatting for rule files
-
Expanded testing
-
Operators within quotes should not be spaced, E.g.
path = '\\main-directory\test.txt';
-
Allow passing of raw
.pro
files. Note: This is working, but is generally dangerous and should only be with proper testing. -
\n
must not be interpreted as new line, especially when passing string rather than file path. E.g.nResult = nNumerator\nDivisor;
should not split into two lines. -
Correct capitalization at start of word. E.g.
stringtonumber (pEndYear)
should not becomeSTRingToNumber (pEndYear)
-
Single line if statments, E.g.
IF(nCondition = 1, ProcessBreak, 0);
should handle indentation correctly