nixos/lib/test-driver: correct regex in pythonize_name()
r"[A-z]" is not equivalent to r"[A-Za-z]"; it is equivalent to r"[A-Z[]^_`a-z]". But Python variable names cannot contain, e.g., a backtick. So the current regex is wrong.
This commit is contained in:
parent
5c724ed138
commit
98b97a2011
@ -53,7 +53,7 @@ def get_tmp_dir() -> Path:
|
||||
|
||||
|
||||
def pythonize_name(name: str) -> str:
|
||||
return re.sub(r"^[^A-z_]|[^A-z0-9_]", "_", name)
|
||||
return re.sub(r"^[^A-Za-z_]|[^A-Za-z0-9_]", "_", name)
|
||||
|
||||
|
||||
class Driver:
|
||||
|
Loading…
x
Reference in New Issue
Block a user