Skip to content

andrew-c-esp/Flow123d-python-utils

 
 

Repository files navigation

Flow123d-python-utils

Takes file in json profiler format created in project Flow123d and converts it to different format.

Usage

Usage: profiler_formatter_script.py [options]

Options:
  -h, --help            show this help message and exit
  -i FILENAME, --input=FILENAME
                        Absolute or relative path to JSON file which will be
                        processed
  -o FILENAME, --output=FILENAME
                        Absolute or relative path output file which will be
                        generated/overwritten
  -f CLASSNAME, --formatter=CLASSNAME
                        Classname of formatter which will be used, to list
                        available formatters use option -l (--list)
  -l, --list            Prints all formatters available in folder formatters
                        (using duck-typing)
  -s STYLES, --style=STYLES
                        Additional styling options in name:value format (for
                        example separator:  default is os separator)

Examples

List all avaiable formatters:

> python profiler_formatter_script.py -l
Formatter available: 
	CSVFormatter
	SimpleTableFormatter

Transform json file foo.json to csv format file bar.csv:

> python profiler_formatter_script.py -i 'foo.json' -f 'CSVFormatter' -o 'bar.csv'

bar.csv file generated

Print json file foo.json in simple table format with extra paddings around cells:

> python profiler_formatter_script.py -i 'foo.json' -f 'SimpleTableFormatter' -s 'padding:5'

Module support

by importing profiler_formatter_module you can use formatter in python code

> python

>>> import profiler_formatter_module
>>> profiler_formatter_module.ProfilerFormatter.list_formatters ()
['CSVFormatter', 'SimpleTableFormatter']
>>> profiler_formatter_module.ProfilerFormatter().convert ('foo.json', 'bar.txt')
bar.txt file generated
True

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 92.4%
  • TeX 6.6%
  • Other 1.0%