Skip to content

Commit

Permalink
Fix undefined name sre_constants in Python 3.11 (#552)
Browse files Browse the repository at this point in the history
#546 (comment)

@gopackgo90 Your review, please.
  • Loading branch information
cclauss authored Dec 5, 2022
1 parent 07cf975 commit 6812b5a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions prospector/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import re
import sre_constants
import sys
from pathlib import Path
from typing import Dict, List, Union
Expand Down Expand Up @@ -253,7 +252,7 @@ def _determine_ignores(self, config, profile, libraries):
continue
try:
ignores.append(re.compile(pattern))
except sre_constants.error:
except re._constants.error:
pass

# Convert ignore paths into patterns
Expand Down
3 changes: 1 addition & 2 deletions prospector/tools/profile_validator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re
import sre_constants
from pathlib import Path

import yaml
Expand Down Expand Up @@ -147,7 +146,7 @@ def add_message(code, message, setting):
for pattern in parsed.get("ignore-patterns", []):
try:
re.compile(pattern)
except sre_constants.error:
except re._constants.error:
add_message(CONFIG_INVALID_REGEXP, "Invalid regular expression", pattern)

for key in ProfileValidationTool.LIST_SETTINGS:
Expand Down

0 comments on commit 6812b5a

Please sign in to comment.