• D
    python: mark regex strings with 'r' prefix · d5c5d8af
    Daniel P. Berrangé 提交于
    When writing regexes special regex matches like "\d" can get
    misinterpreted as normal string escape sequences:
    
    docs/apibuild.py:1359:51: W605 invalid escape sequence '\d'
                            value = value + re.sub("^(\d+)U$", "\\1", token[1])
                                                      ^
    docs/apibuild.py:2134:31: W605 invalid escape sequence '\('
                    m = re.match("\(?1<<(\d+)\)?", info[0])
                                  ^
    docs/apibuild.py:2134:38: W605 invalid escape sequence '\d'
                    m = re.match("\(?1<<(\d+)\)?", info[0])
                                         ^
    docs/apibuild.py:2134:42: W605 invalid escape sequence '\)'
                    m = re.match("\(?1<<(\d+)\)?", info[0])
                                             ^
    
    To avoid this probem all regexes should use the r"...." syntax for their
    strings, which disables normal string escape sequences.
    Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
    d5c5d8af
apibuild.py 96.2 KB