qbraid.programs.register_program_type

register_program_type(program_type, alias=None, overwrite=False)[source]

Registers a user-defined program type under the specified alias.

Parameters:
  • program_type (Type[Any]) – The actual Python type or a callable that returns a type. This can be a built-in type like str, a class, or any callable.

  • alias (optional, str) – The alias to register the program type under.

  • overwrite (optional, bool) – Whether to overwrite an existing alias with the new type.

Raises:

ValueError – If the alias is already registered with a different type, if the program type is already registered under a different alias, or if trying to register more than one additional ‘str’ type beyond ‘qasm2’ and ‘qasm3’.

Return type:

None