Browse Source

Fix deprecation escape sequence errors under 3.6

Python 3.6 is more strict about strings containing escape sequences.
We've cleaned up other regex strings but a few sneaked back in. This
converts a few more instances to raw strings to get rid of the escape
warnings.

Change-Id: I102a3b27a2f8e55de117007b183d5c4ad40284fb
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
changes/80/650080/1
Sean McGinnis 3 years ago
parent
commit
6c9609911d
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
  1. 12
      cinder/tests/functional/api_samples_test_base.py
  2. 8
      cinder/tests/unit/volume/drivers/fusionstorage/test_fs_client.py
  3. 2
      cinder/volume/drivers/huawei/huawei_conf.py
  4. 2
      cinder/volume/drivers/netapp/utils.py

12
cinder/tests/functional/api_samples_test_base.py

@ -417,12 +417,12 @@ class ApiSampleTestBase(functional_helpers._FunctionalTestBase):
def _get_regexes(self):
text = r'(\\"|[^"])*'
isotime_re = '\d{4}-[0,1]\d-[0-3]\dT\d{2}:\d{2}:\d{2}Z'
strtime_re = '\d{4}-[0,1]\d-[0-3]\dT\d{2}:\d{2}:\d{2}\.\d{6}'
isotime_re = r'\d{4}-[0,1]\d-[0-3]\dT\d{2}:\d{2}:\d{2}Z'
strtime_re = r'\d{4}-[0,1]\d-[0-3]\dT\d{2}:\d{2}:\d{2}\.\d{6}'
extension_update = (
'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{2}:\d{2}')
strtime_url_re = ('\d{4}-[0,1]\d-[0-3]\d'
'\+\d{2}\%3A\d{2}\%3A\d{2}\.\d{6}')
r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[+-]\d{2}:\d{2}')
strtime_url_re = (r'\d{4}-[0,1]\d-[0-3]\d'
r'\+\d{2}\%3A\d{2}\%3A\d{2}\.\d{6}')
return {
'isotime': isotime_re,
@ -436,7 +436,7 @@ class ApiSampleTestBase(functional_helpers._FunctionalTestBase):
'-[0-9a-f]{4}-[0-9a-f]{12}',
'request_id': 'req-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}'
'-[0-9a-f]{4}-[0-9a-f]{12}',
'host': 'https?://[0-9]+(?:\.[0-9]+){3}:[0-9]+',
'host': r'https?://[0-9]+(?:\.[0-9]+){3}:[0-9]+',
'host_name': r'\w+',
'glance_host': self._get_glance_host(),
'os-vol-host-attr:host': self.volume.host,

8
cinder/tests/unit/volume/drivers/fusionstorage/test_fs_client.py

@ -30,18 +30,18 @@ class FakeSession(test_utils.FakeBaseSession):
'/storagePool$':
{'storagePools': [{'poolName': 'fake_pool_name',
'poolId': 'fake_pool_id'}]},
'/storagePool\?poolId=0':
r'/storagePool\?poolId=0':
{'storagePools': [{'poolName': 'fake_pool_name1',
'poolId': 0}]},
'/volume/queryByName\?volName=fake_name':
r'/volume/queryByName\?volName=fake_name':
{'errorCode': 0, 'lunDetailInfo':
[{'volume_id': 'fake_id',
'volume_name': 'fake_name'}]},
'/volume/queryById\?volId=fake_id':
r'/volume/queryById\?volId=fake_id':
{'errorCode': 0, 'lunDetailInfo':
[{'volume_id': 'fake_id',
'volume_name': 'fake_name'}]},
'/lun/wwn/list\?wwn=fake_wwn':
r'/lun/wwn/list\?wwn=fake_wwn':
{'errorCode': 0, 'lunDetailInfo':
[{'volume_id': 'fake_id',
'volume_wwn': 'fake_wwn'}]},

2
cinder/volume/drivers/huawei/huawei_conf.py

@ -328,7 +328,7 @@ class HuaweiConf(object):
if ini_type in dev:
# Analyze initiators configure text, convert to:
# [{'Name':'xxx'}, {'Name':'xxx','CHAPinfo':'mm-usr#mm-pwd'}]
ini_list = re.split('\s', dev[ini_type])
ini_list = re.split(r'\s', dev[ini_type])
def _convert_one_iscsi_info(ini_text):
# get initiator configure attr list

2
cinder/volume/drivers/netapp/utils.py

@ -372,7 +372,7 @@ def get_export_host_junction_path(share):
if '[' in share and ']' in share:
try:
# ipv6
host = re.search('\[(.*)\]', share).group(1)
host = re.search(r'\[(.*)\]', share).group(1)
junction_path = share.split(':')[-1]
except AttributeError:
raise exception.NetAppDriverException(_("Share '%s' is "

Loading…
Cancel
Save