]> git.ipfire.org Git - thirdparty/asterisk.git/commit
swagger_model.py: Fix invalid escape sequence in get_list_parameter_type().
authorGeorge Joseph <gjoseph@sangoma.com>
Tue, 4 Mar 2025 14:29:22 +0000 (07:29 -0700)
committerGeorge Joseph <gjoseph@sangoma.com>
Wed, 5 Mar 2025 21:42:52 +0000 (21:42 +0000)
commitf80e2405e64c32898380230c5f5bf38c168814e5
tree6a9451248c134d72ea24836331909d4585037de6
parenta47fe8f84f89a3e2fdf125002c090034dccb5d59
swagger_model.py: Fix invalid escape sequence in get_list_parameter_type().

Recent python versions complain when backslashes in strings create invalid
escape sequences.  This causes issues for strings used as regex patterns like
`'^List\[(.*)\]$'` where you want the regex parser to treat `[` and `]`
as literals.  Double-backslashing is one way to fix it but simply converting
the string to a raw string `re.match(r'^List\[(.*)\]$', text)` is easier
and less error prone.
rest-api-templates/swagger_model.py