Skip to content

Commit 06cfc4c

Browse files
committed
Force single line imports.
1 parent a7974cf commit 06cfc4c

20 files changed

Lines changed: 288 additions & 244 deletions

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ coverage.xml
4545
*,cover
4646
.hypothesis/
4747
.pytest_cache/
48+
cov.xml
4849

4950
# Translations
5051
*.mo

‎compliance.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
import operator
1212
import unittest
1313
from dataclasses import dataclass
14-
from typing import Any, List, Mapping, Optional, Sequence, Union
14+
from typing import Any
15+
from typing import List
16+
from typing import Mapping
17+
from typing import Optional
18+
from typing import Sequence
19+
from typing import Union
1520

1621
import pytest
1722

‎consensus.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
import operator
1111
import unittest
1212
from dataclasses import dataclass
13-
from typing import Any, Dict, List, Mapping, Optional, Sequence, Union
13+
from typing import Any
14+
from typing import Dict
15+
from typing import List
16+
from typing import Mapping
17+
from typing import Optional
18+
from typing import Sequence
19+
from typing import Union
1420

1521
import pytest
1622
from yaml import safe_load

‎jsonpath/__init__.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from .lex import Lexer
77
from .match import JSONPathMatch
88
from .parse import Parser
9-
from .path import CompoundJSONPath, JSONPath
9+
from .path import CompoundJSONPath
10+
from .path import JSONPath
1011

1112
__all__ = (
1213
"compile",

‎jsonpath/env.py‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,30 @@
44
import re
55
from collections.abc import Collection
66
from operator import getitem
7-
from typing import (
8-
TYPE_CHECKING,
9-
Any,
10-
AsyncIterable,
11-
Iterable,
12-
List,
13-
Mapping,
14-
Optional,
15-
Sequence,
16-
Union,
17-
)
7+
from typing import TYPE_CHECKING
8+
from typing import Any
9+
from typing import AsyncIterable
10+
from typing import Iterable
11+
from typing import List
12+
from typing import Mapping
13+
from typing import Optional
14+
from typing import Sequence
15+
from typing import Union
1816

1917
from .exceptions import JSONPathSyntaxError
2018
from .filter import UNDEFINED
2119
from .lex import Lexer
2220
from .parse import Parser
23-
from .path import CompoundJSONPath, JSONPath
21+
from .path import CompoundJSONPath
22+
from .path import JSONPath
2423
from .stream import TokenStream
25-
from .token import TOKEN_EOF, TOKEN_INTERSECTION, TOKEN_UNION
24+
from .token import TOKEN_EOF
25+
from .token import TOKEN_INTERSECTION
26+
from .token import TOKEN_UNION
2627

2728
if TYPE_CHECKING:
28-
from .match import FilterContextVars, JSONPathMatch
29+
from .match import FilterContextVars
30+
from .match import JSONPathMatch
2931

3032

3133
class JSONPathEnvironment:
@@ -74,7 +76,7 @@ def compile(self, path: str) -> Union[JSONPath, CompoundJSONPath]: # noqa: A003
7476
)
7577
)
7678
else:
77-
raise JSONPathSyntaxError(
79+
raise JSONPathSyntaxError( # noqa: TRY003
7880
f"unexpected token {stream.current.value!r}",
7981
token=stream.current,
8082
)

‎jsonpath/exceptions.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""JSONPath exceptions."""
22
from __future__ import annotations
33

4-
from typing import TYPE_CHECKING, Optional
4+
from typing import TYPE_CHECKING
5+
from typing import Optional
56

67
if TYPE_CHECKING:
78
from .token import Token

‎jsonpath/filter.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
from __future__ import annotations
22

33
import re
4-
from abc import ABC, abstractmethod
5-
from typing import TYPE_CHECKING, Generic, List, Mapping, Pattern, Sequence, TypeVar
4+
from abc import ABC
5+
from abc import abstractmethod
6+
from typing import TYPE_CHECKING
7+
from typing import Generic
8+
from typing import List
9+
from typing import Mapping
10+
from typing import Pattern
11+
from typing import Sequence
12+
from typing import TypeVar
613

714
from .exceptions import JSONPathTypeError
815

‎jsonpath/lex.py‎

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,66 @@
33

44
import re
55
from functools import partial
6-
from typing import TYPE_CHECKING, Iterator, Pattern
6+
from typing import TYPE_CHECKING
7+
from typing import Iterator
8+
from typing import Pattern
79

810
from .exceptions import JSONPathSyntaxError
9-
from .token import (
10-
TOKEN_AND,
11-
TOKEN_BARE_PROPERTY,
12-
TOKEN_BRACKET_PROPERTY,
13-
TOKEN_COMMA,
14-
TOKEN_CONTAINS,
15-
TOKEN_DDOT,
16-
TOKEN_DOT_INDEX,
17-
TOKEN_DOT_PROPERTY,
18-
TOKEN_DOUBLE_QUOTE_STRING,
19-
TOKEN_EQ,
20-
TOKEN_FALSE,
21-
TOKEN_FILTER_CONTEXT,
22-
TOKEN_FILTER_END,
23-
TOKEN_FILTER_START,
24-
TOKEN_FLOAT,
25-
TOKEN_GE,
26-
TOKEN_GT,
27-
TOKEN_ILLEGAL,
28-
TOKEN_IN,
29-
TOKEN_INDEX,
30-
TOKEN_INT,
31-
TOKEN_INTERSECTION,
32-
TOKEN_LE,
33-
TOKEN_LG,
34-
TOKEN_LIST_END,
35-
TOKEN_LIST_SLICE,
36-
TOKEN_LIST_START,
37-
TOKEN_LPAREN,
38-
TOKEN_LT,
39-
TOKEN_MISSING,
40-
TOKEN_NE,
41-
TOKEN_NIL,
42-
TOKEN_NONE,
43-
TOKEN_NOT,
44-
TOKEN_NULL,
45-
TOKEN_OR,
46-
TOKEN_PROPERTY,
47-
TOKEN_RE,
48-
TOKEN_RE_FLAGS,
49-
TOKEN_RE_PATTERN,
50-
TOKEN_ROOT,
51-
TOKEN_RPAREN,
52-
TOKEN_SELF,
53-
TOKEN_SINGLE_QUOTE_STRING,
54-
TOKEN_SKIP,
55-
TOKEN_SLICE,
56-
TOKEN_SLICE_START,
57-
TOKEN_SLICE_STEP,
58-
TOKEN_SLICE_STOP,
59-
TOKEN_STRING,
60-
TOKEN_TRUE,
61-
TOKEN_UNDEFINED,
62-
TOKEN_UNION,
63-
TOKEN_WILD,
64-
Token,
65-
)
11+
from .token import TOKEN_AND
12+
from .token import TOKEN_BARE_PROPERTY
13+
from .token import TOKEN_BRACKET_PROPERTY
14+
from .token import TOKEN_COMMA
15+
from .token import TOKEN_CONTAINS
16+
from .token import TOKEN_DDOT
17+
from .token import TOKEN_DOT_INDEX
18+
from .token import TOKEN_DOT_PROPERTY
19+
from .token import TOKEN_DOUBLE_QUOTE_STRING
20+
from .token import TOKEN_EQ
21+
from .token import TOKEN_FALSE
22+
from .token import TOKEN_FILTER_CONTEXT
23+
from .token import TOKEN_FILTER_END
24+
from .token import TOKEN_FILTER_START
25+
from .token import TOKEN_FLOAT
26+
from .token import TOKEN_GE
27+
from .token import TOKEN_GT
28+
from .token import TOKEN_ILLEGAL
29+
from .token import TOKEN_IN
30+
from .token import TOKEN_INDEX
31+
from .token import TOKEN_INT
32+
from .token import TOKEN_INTERSECTION
33+
from .token import TOKEN_LE
34+
from .token import TOKEN_LG
35+
from .token import TOKEN_LIST_END
36+
from .token import TOKEN_LIST_SLICE
37+
from .token import TOKEN_LIST_START
38+
from .token import TOKEN_LPAREN
39+
from .token import TOKEN_LT
40+
from .token import TOKEN_MISSING
41+
from .token import TOKEN_NE
42+
from .token import TOKEN_NIL
43+
from .token import TOKEN_NONE
44+
from .token import TOKEN_NOT
45+
from .token import TOKEN_NULL
46+
from .token import TOKEN_OR
47+
from .token import TOKEN_PROPERTY
48+
from .token import TOKEN_RE
49+
from .token import TOKEN_RE_FLAGS
50+
from .token import TOKEN_RE_PATTERN
51+
from .token import TOKEN_ROOT
52+
from .token import TOKEN_RPAREN
53+
from .token import TOKEN_SELF
54+
from .token import TOKEN_SINGLE_QUOTE_STRING
55+
from .token import TOKEN_SKIP
56+
from .token import TOKEN_SLICE
57+
from .token import TOKEN_SLICE_START
58+
from .token import TOKEN_SLICE_STEP
59+
from .token import TOKEN_SLICE_STOP
60+
from .token import TOKEN_STRING
61+
from .token import TOKEN_TRUE
62+
from .token import TOKEN_UNDEFINED
63+
from .token import TOKEN_UNION
64+
from .token import TOKEN_WILD
65+
from .token import Token
6666

6767
if TYPE_CHECKING:
6868
from . import JSONPathEnvironment

‎jsonpath/match.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
"""The JSONPath match object, as returned from :meth:`JSONPath.finditer`."""
22

3-
from typing import Any, Mapping, Sequence, Union
3+
from typing import Any
4+
from typing import Mapping
5+
from typing import Sequence
6+
from typing import Union
47

58
FilterContextVars = Mapping[str, Any]
69

0 commit comments

Comments
 (0)