moobius.quickstart#

Module-level functions#

download_folder#

Downloads from the GroupUltra Public-CCS-demos..

Signature:

  • **download_folder**(local_folder, sub_git_folder)

Parameters:

  • __local_folder:__ Local folder to download to.

  • __sub_git_folder:__ The subfolder within the git repo.

Returns:

  • None.

Raises:

  • (this function does not raise any notable errors)

open_folder_in_explorer#

Lets the user select a folder. This is used for gui-mode only.

Signature:

  • **open_folder_in_explorer**(folder_path)

Parameters:

  • __folder_path:__ Default folder to pick.

Returns:

  • None.

Raises:

  • (this function does not raise any notable errors)

download_text_file_to_string#

A simple download, used to get CCS code from GitHub.

Signature:

  • **download_text_file_to_string**(url)

Parameters:

  • __url:__ URL.

Returns:

  • The text. Raises network exceptions if the request fails.

Raises:

  • (this function does not raise any notable errors)

create_channel#

Creates a channel.

Signature:

  • **create_channel**(email, password, url)

Parameters:

  • __email:__ Email.

  • __password:__ Password.

  • __url:__ Url.

Returns:

  • The service_id, channel_id. Used if no channel is specified.

Raises:

  • (this function does not raise any notable errors)

save#

Saves a file. Makes dirs if need be.

Signature:

  • **save**(fname, x)

Parameters:

  • __fname:__ Filename.

  • __x:__ A string.

Returns:

  • None.

Raises:

  • (this function does not raise any notable errors)

submit#

Saves the CCS files (code and config) to a folder.

Signature:

  • **submit**(out)

Parameters:

  • __out:__ Configuration dict with all the settings.

Returns:

  • The sys.exit().

Calling this function will read the current gui state.

Raises:

  • (this function does not raise any notable errors)

make_box#

Makes a box for GUI usage. None options means fill in.

Signature:

  • **make_box**(root, name, detailed_name, default, options)

Parameters:

  • __root:__ Tk.root.

  • __name:__ The box name.

  • __detailed_name:__ More details.

  • __default:__ The GUI default.

  • __options=None:__ The options to pick, for boxes with options.

Returns:

  • The ttk.Combobox object.

Raises:

  • (this function does not raise any notable errors)

save_starter_ccs#

Reads sys.argv, as well as gui interaction if specified. Uses this information to construct a CCS app and saves to the folder that was specified. This function is called, from the __init__.py in src/moobius, when “python -m moobius” is typed into the command line.

Signature:

  • **save_starter_ccs**()

Parameters:

  • __(this function accepts no arguments):__

Returns:

  • None.

Raises:

  • (this function does not raise any notable errors)

maybe_make_template_files#

Makes template files if there is a need to do so, based on args and sys.argv. Called by wand.run() before initializing the Moobius class if it doesn’t have any templates.

Which files are created:

A service.py file that runs everything. A sample config.py:

Only created if “config_path” is in args (or system args) AND the file does not exist. This requires user information:

email: If no system arg “email my@email.com” or “username my@email.com” is specified, prompts for one with input(). password: If no system arg “password my_sec**t_pword”, prompts for one. channels: If no system arg “channels abc… def…” to specify one or more channels, prompts for one or more.

Note: if the user gives an empty response to input(), a nonfunctional default is used, which can be filled in later.

Unittests to run in a python prompt in an empty folder:
>>> # Prompt the user for credentials and put these in the service.json (NOTE: will generate an error b/c None class):
>>> import sys; from moobius import MoobiusWand; MoobiusWand().run(None, config_path="config/service.json")
>>> # Provide credentials, making a service.json with no user input (NOTE: will generate an error b/c None class):
>>> import sys; sys.argv = '_ email abc@123.com password IAmSecret channels abc-123 def-4561111111111111111111'.split(' '); from moobius import MoobiusWand; MoobiusWand().run(0, config_path="config/service.json")
>>> # Provide agent credentials. There is no need to provide a channel id (NOTE: will generate an error b/c None class).
>>> import sys; sys.argv = '_ email abc@123.com password IAmSecret'.split(' '); from moobius import MoobiusWand; MoobiusWand().run(0, config_path="config/agent.json", is_agent=True).

Signature:

  • **maybe_make_template_files**(args)

Parameters:

  • __args:__ The list of args.

Returns:

  • None.

Raises:

  • (this function does not raise any notable errors)

Internals#