[VPNaaS]: DeprecationWarning: invalid escape sequence

Bug #1871621 reported by Dongcan Ye
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Dongcan Ye

Bug Description

Warning:
  Comments left for invalid file neutron_vpnaas/services/vpn/device_drivers/strongswan_ipsec.py

/root/neutron-vpnaas/neutron_vpnaas/services/vpn/device_drivers/ipsec.py:185: DeprecationWarning: invalid escape sequence \d
  STATUS_RE = '\d\d\d "([a-f0-9\-]+).* (unrouted|erouted);'
/root/neutron-vpnaas/neutron_vpnaas/services/vpn/device_drivers/ipsec.py:188: DeprecationWarning: invalid escape sequence \d
  '\d{3} #\d+: "([a-f0-9\-]+).*established.*newest IPSEC')
/root/neutron-vpnaas/neutron_vpnaas/services/vpn/device_drivers/ipsec.py:190: DeprecationWarning: invalid escape sequence \d
  '\d{3} #\d+: "([a-f0-9\-\/x]+).*established.*newest IPSEC')
<unknown>:185: DeprecationWarning: invalid escape sequence \d
<unknown>:188: DeprecationWarning: invalid escape sequence \d
<unknown>:190: DeprecationWarning: invalid escape sequence \d
/root/neutron-vpnaas/neutron_vpnaas/services/vpn/device_drivers/strongswan_ipsec.py:75: DeprecationWarning: invalid escape sequence \-
  STATUS_RE = '([a-f0-9\-]+).* (ROUTED|CONNECTING|INSTALLED)'
<unknown>:75: DeprecationWarning: invalid escape sequence \-

Tags: vpnaas
Dongcan Ye (hellochosen)
tags: added: vpnaas
Changed in neutron:
assignee: nobody → Dongcan Ye (hellochosen)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron-vpnaas (master)

Fix proposed to branch: master
Review: https://review.opendev.org/718442

Changed in neutron:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron-vpnaas (master)

Reviewed: https://review.opendev.org/718442
Committed: https://git.openstack.org/cgit/openstack/neutron-vpnaas/commit/?id=be935a2256d5426e9617c8d119e58b00df9fc3d9
Submitter: Zuul
Branch: master

commit be935a2256d5426e9617c8d119e58b00df9fc3d9
Author: Dongcan Ye <email address hidden>
Date: Wed Apr 8 13:00:35 2020 +0000

    Fix invalid escape sequence warning

    Python 3 interprets string literals as Unicode strings,
    and therefore '\d' is treated as an escaped Unicode character.

    If you’re not using a raw string to express the pattern,
    remember that Python also uses the backslash as an escape sequence in
    string literals; if the escape sequence isn’t recognized by Python’s parser,
    the backslash and subsequent character are included in the resulting string.
    However, if Python would recognize the resulting sequence, the backslash
    should be repeated twice. This is complicated and hard to understand,
    so it’s highly recommended that you use raw strings for all but the
    simplest expressions. [1]

    This patch use raw string for the regular expression.

    [1] https://docs.python.org/3.6/library/re.html#regular-expression-syntax

    Change-Id: Ibee059af3b24896749b66d87a6691fdf40a5767a
    Closes-Bug: #1871621

Changed in neutron:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.