Bug Description
_sanitize_id replaces non-word characters using \W, which is Unicode aware, so letters and digits outside ASCII pass through untouched. Variable then checks the id against [A-Za-z_][A-Za-z0-9_]* and rejects it, so get_parameter raises InvalidVariableIdError instead of handing back a variable. The out[0].isdigit() guard has the same gap; it is true for ², and prefixing an underscore still leaves an id the pattern refuses. Switching the class to [^A-Za-z0-9_], or passing re.ASCII, fixes both.
Minimal Reproducible Example
import qprogram as qp
from qprogram.qprogram import _sanitize_id
print(_sanitize_id("drive_Ω")) # 'drive_Ω', unchanged
qp.QProgram().get_parameter("drive", "Ω")
Expected Behavior
A sanitized id always matches [A-Za-z_][A-Za-z0-9_]*, so get_parameter returns a variable whatever the bus and parameter names look like.
Actual Behavior
File "src/qprogram/variable.py", line 273, in __init__
raise InvalidVariableIdError(id)
qprogram.errors.InvalidVariableIdError: Variable id 'drive_Ω' is invalid: must match [A-Za-z_][A-Za-z0-9_]* (letters, digits, underscores only; cannot start with a digit, no spaces or special characters).
System Information
qprogram 0.1.0
python 3.14.3 | Linux-7.0.0-30-generic-x86_64-with-glibc2.43
vendors none
Bug Description
_sanitize_idreplaces non-word characters using\W, which is Unicode aware, so letters and digits outside ASCII pass through untouched.Variablethen checks the id against[A-Za-z_][A-Za-z0-9_]*and rejects it, soget_parameterraisesInvalidVariableIdErrorinstead of handing back a variable. Theout[0].isdigit()guard has the same gap; it is true for², and prefixing an underscore still leaves an id the pattern refuses. Switching the class to[^A-Za-z0-9_], or passingre.ASCII, fixes both.Minimal Reproducible Example
Expected Behavior
A sanitized id always matches
[A-Za-z_][A-Za-z0-9_]*, soget_parameterreturns a variable whatever the bus and parameter names look like.Actual Behavior
System Information
qprogram 0.1.0 python 3.14.3 | Linux-7.0.0-30-generic-x86_64-with-glibc2.43 vendors none