databricks-sdk-py icon indicating copy to clipboard operation
databricks-sdk-py copied to clipboard

[ISSUE] DeprecationWarning: invalid escape sequence '\.'

Open GodNooNoo opened this issue 1 year ago • 2 comments

Description https://github.com/databricks/databricks-sdk-py/blob/a558d97415e8ced4b88c70e03e0a31f4f2006610/databricks/sdk/service/jobs.py#L61C30-L61C30 the backslash before the period in the docstring throws the following warning. DeprecationWarning: invalid escape sequence '.'.

Reproduction Run the following code through pytest or something.

"""The sequence number of this run attempt for a triggered job run. The initial attempt of a run
    has an attempt_number of 0\. If the initial run attempt fails, and the job has a retry policy
    (`max_retries` \> 0), subsequent runs are created with an `original_attempt_run_id` of the
    original attempt’s ID and an incrementing `attempt_number`. Runs are retried only until they
    succeed, and the maximum `attempt_number` is the same as the `max_retries` value for the job."""

Expected behaviour Not receiving a warning.

Is it a regression? Didn't check.

Other Information

  • OS: Linux.
  • Python: 3.10.
  • Version: latest.

GodNooNoo avatar Jan 15 '24 12:01 GodNooNoo

Thanks for raising this, we will take a look.

tanmay-db avatar Jan 15 '24 14:01 tanmay-db

As of python 3.12, this DeprecationWarning is now raised by the language itself, as a SyntaxWarning. https://docs.python.org/3/whatsnew/3.12.html#other-language-changes . So, I can confirm the existence of the issue as well :).

Seems like an easy fix. Either double the backslash or use a raw string, I suppose.

wyattscarpenter avatar May 28 '24 20:05 wyattscarpenter

I think this was probably closed by https://github.com/databricks/databricks-sdk-py/commit/fb30ed98912a4e62a4b535188765f792b7bc6f47#diff-9125abd285f0b94b52f0445f9f85a75a921fae47124d670ab9f8f822de9f33acL61

wyattscarpenter avatar Sep 16 '24 07:09 wyattscarpenter