experimentum.WebGUI package¶
Subpackages¶
Submodules¶
experimentum.WebGUI.helpers module¶
Helper functions for the webinterface.
-
class
experimentum.WebGUI.helpers.
CapturedContent
(escape=True)¶ Bases:
object
Capture prints to stdout and stderr.
Parameters: - streams (dict) – Output streams for stdout and stderr
- escape (bool) – Flag to indicate if streams should be escaped.
-
clear
()¶ Clear the streams.
-
get_lines
()¶ Get merged lines for stdout and stderr.
Returns: list of lines Return type: list
-
get_text
()¶ Get all prints/writes to stdout and stderr.
Returns: text Return type: str
-
has_error
()¶ Check if there is something in the error stream.
Returns: Whether the error stream has content or not. Return type: boolean
-
classmethod
revert
()¶ Revert back to default stdout and stderr streams.
-
experimentum.WebGUI.helpers.
ansi_escape
(text)¶ Remove ansi colors from text.
Parameters: text (str) – Text to escape Returns: escaped text Return type: str
-
experimentum.WebGUI.helpers.
capture_print
(*args, **kwds)¶ Capture prints to stdout and stderr.
- Args
- escape (bool, optional): Defaults to False. Whether to escape ansi sequences or not.
Module contents¶
Provides an easy to use web interface via flask.
Uses the Application Factory Pattern to create a new flask app instance.
-
class
experimentum.WebGUI.
Server
(app, testing=False)¶ Bases:
object
Simple wrapper for the webserver.
-
create_app
()¶ Create a new flask application.
Returns: Flask App Return type: Flask
-
run
(port=5000, debugger=False, reloader=True)¶ Run the server.
Parameters: - port (int, optional) – Defaults to 5000. Port to run on.
- debugger (bool, optional) – Defaults to False. Enable/Disable Debugger.
- reloader (bool, optional) – Defaults to True. Enable/Disable Reloader.
-
-
experimentum.WebGUI.
create_app
(container, test_config=None)¶ Create a new flask app.
Uses the Application Factory Pattern: http://flask.pocoo.org/docs/1.0/patterns/appfactories/
Parameters: - container (App) – Main Service Container
- test_config (dict, optional) – Defaults to None. Test Configuration
Returns: Flask App
Return type: Flask