Skip to content

Placet documentation

Placetpy(name='placet', **kwargs)

Bases: Communicator

A class used to interact with Placet process running in background.

Extends Communicator to run Placet and its commands of the proper format.

Parameters:

Name Type Description Default
name str

The name of the process to start. Should be the command starting Placet interactive shell.

'placet'

Other Parameters:

Name Type Description
show_intro bool

If True (defauls is True), prints the welcome message of Placet at the start.

debug_mode bool

If True (default is False), runs Placetpy in debug mode.

save_logs bool

If True (default is True) , invoking save_debug_info().

send_delay float

The time delay before each data transfer to a child process (sometimes needed for stability). Default is Placetpy._BUFFER_MAXSIZE.

readline(timeout=Communicator._BASE_TIMEOUT)

Read the line from Placet process.

Parameters:

Name Type Description Default
timeout float

Timeout of the reader before raising the exception. No effect anymore. The parameter is kept for compatibility.

Communicator._BASE_TIMEOUT

Returns:

Type Description
str

The line of the data received from the child process.

restart()

Restart the child process.

run_command(command, skipline=True)

Run the given command in Placet.

Does not return any value. The output after the execution is up to the user to read with readline() or readlines().

Parameters:

Name Type Description Default
command PlacetCommand

The command to pass to Placet.

required
skipline bool

If True invokes skipline() to read the command back from the buffer. This option is needed when the process writes the command it 'writes' into the out buffer.

True

PlacetCommand(command, **kwargs)

A class used to classify the Placet commands.

Attributes:

Name Type Description
command str

A line with Placet command, including all the options

timeout float

The typical time margin for the execution time of the command. Is passed further to Placetpy - if execution takes longer than timeout, throws an exception

type str

The type of the command. Corresponds to the command name, without any options

additional_lineskip int

The number of lines that the command produces when executed.

Parameters:

Name Type Description Default
command str

The command including all the options as a string.

required

Other Parameters:

Name Type Description
timeout Optional[float]

A timeout for the command execution in Placet.

type str

A command type. Correspons to the command name without any parameters. If not provided, is evaluated automatically.

additional_lineskip int

The number of lines of the Placet output to skip after writing the command. If not provided, is evaluated automatically based on the type of a command.

expect_before bool

If True (default is True), expect command is invoked before 'writing' the command.

expect_after bool

If True (default is False), expect command is invoked after 'writing' the command.

no_expect bool

If True (default is False), expect command for the command prompt is not invoked neither before or after doing 'writing'. Overwrites expect_before and expect_after parameters.