Sven-Bo / TIdy

Easily format TM1 TurboIntegrator processes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TIdy

An easy python formatter TM1 TurboIntegrator processes

Binder

Features

  • Keyword Highlighting

  • Indentation

  • Deploy Jupyter Notebook quickly using Binder: Binder

  • Automatically copy results to clipboard using pyperclip (Available only when running locally)

Example

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;

Known Issues/Improvements

  • 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

Fixed Issues

  • 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 become STRingToNumber (pEndYear)

  • Single line if statments, E.g. IF(nCondition = 1, ProcessBreak, 0); should handle indentation correctly

About

Easily format TM1 TurboIntegrator processes


Languages

Language:Python 65.4%Language:Prolog 25.2%Language:Jupyter Notebook 9.5%