Skip to content

dpebert7/TIdy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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