oracle/oci-python-sdk

DeprecationWarning: invalid escape sequence

pabs3 opened this issue · 4 comments

pabs3 commented

When running the tests I get a few DeprecationWarning messages:

oci/base_client.py:43: DeprecationWarning: invalid escape sequence \(
    DICT_VALUE_TYPE_REGEX = re.compile('dict\(str, (.+?)\)$')  # noqa: W605

oci/base_client.py:44: DeprecationWarning: invalid escape sequence \[
    LIST_ITEM_TYPE_REGEX = re.compile('list\[(.+?)\]$')  # noqa: W605

base_client.py:825: DeprecationWarning: invalid escape sequence \[
    sub_kls = re.match('list\[(.*)\]', cls).group(1)  # noqa: W605

oci/base_client.py:830: DeprecationWarning: invalid escape sequence \(
    sub_kls = re.match('dict\(([^,]*), (.*)\)', cls).group(2)  # noqa: W605

Since these are regexes the right thing to do use to use raw strings like this:

    DICT_VALUE_TYPE_REGEX = re.compile(r'dict\(str, (.+?)\)$')  # noqa: W605

Hi @pabs3, what python version and what command did you run to test the oci-python-sdk? I tried to reproduce it on my end but I was not able to see the warning.

pabs3 commented

Thank you, I will look more into this issue.

@pabs3, the latest SDK should now have this issue fixed. Please feel free to re-open the issue if another problem comes up. Thank you for contributing to OCI Python SDK.