pytket.wasm#

Handler for wasm files in pytket

class pytket.wasm.WasmFileHandler(filepath: str, check_file: bool = True, int_size: int = 32)[source]#

Add a wasm file to your workflow, stores a copy of the file and checks the function signatures of the file. Offers function to add a wasm op to a circuit

__init__(filepath: str, check_file: bool = True, int_size: int = 32)[source]#

Construct a wasm file handler

Parameters:
  • filepath (str) – Path to the wasm file

  • check_file (bool) – If True checks file for compatibility with wasm standards. If False checks are skipped.

  • int_size (int) – length of the integer that is used in the wasm file

__repr__() str[source]#

str representation of the contents of the wasm file

__str__() str[source]#

str representation of the wasm file

bytecode() bytes[source]#

The WASM content as bytecode

check_function(function_name: str, number_of_parameters: int, number_of_returns: int) bool[source]#

Checks a given function name and signature if it is included

Parameters:
  • function_name (str) – name of the function that is checked

  • number_of_parameters (int) – number of integer parameters of the function

  • number_of_returns (int) – number of integer return values of the function

Returns:

true if the signature and the name of the function is correct