SDCV engine

SDCV engines for different SDCV deployments

SDCV engines

class app.shared.sdcv_engine.BaseSdcvEngine

Bases: object

Base execution engine for interacting with the sdcv dictionary CLI tool.

__init__(prefix)

Initializes the base engine with a command prefix.

Parameters:

prefix (list[str]) – The base command prefix used to invoke the sdcv process.

list()

Lists all available dictionaries.

Returns:

The completed process containing stdout with dictionary lists.

Return type:

subprocess.CompletedProcess

translate(word, u_filters=None)

Looks up a word translation using optional dictionary filters.

Parameters:
  • word (str) – The target word to translate.

  • u_filters (list, optional) – A list of specific dictionary names to filter the search results.

Returns:

The completed process containing stdout with JSON translation data.

Return type:

subprocess.CompletedProcess

app.shared.sdcv_engine.DOCKER_TYPE = 'docker'

Constant string representing a Docker environment selection identifier.

class app.shared.sdcv_engine.DockerSdcvEngine

Bases: BaseSdcvEngine

Engine implementation for executing sdcv containerized inside a Docker environment.

__init__(container_name)

Initializes the Docker engine linked to a specific container instance.

Parameters:

container_name (str) – The name of the target running Docker container.

app.shared.sdcv_engine.LINUX_TYPE = 'linux'

Constant string representing a local Linux environment selection identifier.

class app.shared.sdcv_engine.LinuxSdcvEngine

Bases: BaseSdcvEngine

Engine implementation for executing sdcv directly on a host Linux environment.

__init__()

Initializes the Linux engine with the default standard local execution prefix.

app.shared.sdcv_engine.create_engine(sdcv_type, container_name=None)

Factory function that instantiates the appropriate sdcv engine based on the environment type.

Parameters:
  • sdcv_type (str) – The type of deployment environment (‘docker’ or ‘linux’).

  • container_name (str, optional) – The name of the target Docker container. Required if type is ‘docker’.

Raises:

ValueError – If the environment type requires a container name, but none was provided or valid.

Returns:

An initialized instance of a subclassed sdcv engine ready for queries.

Return type:

BaseSdcvEngine