remove usage of deprecared sre_constants

This commit is contained in:
Alexandru Fikl 2023-04-30 14:12:34 +03:00
parent 4a0caf3213
commit 1be02fc29c
No known key found for this signature in database
GPG Key ID: 32C1509CB6EE436B
2 changed files with 2 additions and 4 deletions

View File

@ -2,7 +2,6 @@
# Copyright (c) 2021 lilydjwg <lilydjwg@gmail.com>, et al.
import re
import sre_constants
from nvchecker.api import session, GetVersionError
@ -19,7 +18,7 @@ async def get_version_impl(info):
try:
regex = re.compile(conf['regex'])
except sre_constants.error as e:
except re.error as e:
raise GetVersionError('bad regex', exc_info=e)
res = await session.request(

View File

@ -2,14 +2,13 @@
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
import re
import sre_constants
from nvchecker.api import session, GetVersionError
async def get_version(name, conf, *, cache, **kwargs):
try:
regex = re.compile(conf['regex'])
except sre_constants.error as e:
except re.error as e:
raise GetVersionError('bad regex', exc_info=e)
if regex.groups > 1:
raise GetVersionError('multi-group regex')