Skip to content

Commit d227f5c

Browse files
ref: allow explicit relative imports from .json (#35676)
1 parent bd06467 commit d227f5c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

tests/tools/test_flake8_plugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def test_S003():
4242
from simplejson import JSONDecoder, JSONDecodeError, _default_encoder
4343
import sentry.utils.json as good_json
4444
from sentry.utils.json import JSONDecoder, JSONDecodeError
45+
from .json import Validator
4546
4647
4748
def bad_code():

tools/flake8_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self) -> None:
2121
self.errors: list[tuple[int, int, str]] = []
2222

2323
def visit_ImportFrom(self, node: ast.ImportFrom) -> None:
24-
if node.module and node.module.split(".")[0] in S003_modules:
24+
if node.module and not node.level and node.module.split(".")[0] in S003_modules:
2525
self.errors.append((node.lineno, node.col_offset, S003_msg))
2626

2727
self.generic_visit(node)

0 commit comments

Comments
 (0)