← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1871621] Re: [VPNaaS]: DeprecationWarning: invalid escape sequence

 

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 <hellochosen@xxxxxxxxx>
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

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1871621

Title:
  [VPNaaS]: DeprecationWarning: invalid escape sequence

Status in neutron:
  Fix Released

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 \-

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1871621/+subscriptions


References