autoqasm.reserved_keywords module
- autoqasm.reserved_keywords.sanitize_parameter_name(name: str, existing_names: set[str] | None = None) str[source]
Method to modify the variable name if it is a reserved keyword
- Parameters:
name (str) – Name of the variable to be checked
existing_names (set[str] | None) – Optional set of existing parameter names in the same subroutine signature. When provided, the function will keep appending underscores until the result is unique among existing_names and not a reserved keyword. When None, preserves the original single-underscore behavior for backward compatibility.
- Returns:
str – Returns a modified ‘name’ that has underscores appended to avoid collisions with reserved keywords and existing names; otherwise, it returns the original ‘name’ unchanged