Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SyntaxWarning: invalid escape sequence #255

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jfcherng
Copy link
Contributor

@jfcherng jfcherng commented Nov 13, 2023

As the title., for Python 3.12.

@jfcherng
Copy link
Contributor Author

If you need more information for reproduction,

test.py

from blackduck.Utils import get_resource_name

get_resource_name({'_meta': { 'href': 'https://a.b' }})

and then

$ python -Walways test.py  # where python is python 3.12

You will get

/home/jfcherng/repos/sdlc/hub-rest-api-python/.venv/lib/python3.12/site-packages/blackduck/Utils.py:104: SyntaxWarning: invalid escape sequence '\w'
  if re.search("^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$", part):
/home/jfcherng/repos/sdlc/hub-rest-api-python/.venv/lib/python3.12/site-packages/blackduck/Utils.py:35: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
  def iso8601_timespan(days_ago, from_date=datetime.utcnow(), delta=timedelta(weeks=1)):
parts = https://a.b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant