Skip to content

Commit 4db5c8e

Browse files
committed
refactor(name): use proper import names
1 parent 634f968 commit 4db5c8e

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

jsonpath_ng/bin/jsonpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import argparse
1616

1717
# JsonPath-RW imports
18-
from jsonpath_rw import parse
18+
from jsonpath_ng import parse
1919

2020
def find_matches_for_file(expr, f):
2121
return expr.find(json.load(f))

jsonpath_ng/parser.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import ply.yacc
77

8-
from jsonpath_rw.jsonpath import *
9-
from jsonpath_rw.lexer import JsonPathLexer
8+
from jsonpath_ng.jsonpath import *
9+
from jsonpath_ng.lexer import JsonPathLexer
1010

1111
logger = logging.getLogger(__name__)
1212

@@ -17,7 +17,7 @@ class JsonPathParser(object):
1717
'''
1818
An LALR-parser for JsonPath
1919
'''
20-
20+
2121
tokens = JsonPathLexer.tokens
2222

2323
def __init__(self, debug=False, lexer_class=None):
@@ -40,7 +40,7 @@ def parse_token_stream(self, token_iterator, start_symbol='jsonpath'):
4040
module_name = os.path.splitext(os.path.split(__file__)[1])[0]
4141
except:
4242
module_name = __name__
43-
43+
4444
parsing_table_module = '_'.join([module_name, start_symbol, 'parsetab'])
4545

4646
# And we regenerate the parse table every time; it doesn't actually take that long!
@@ -55,7 +55,7 @@ def parse_token_stream(self, token_iterator, start_symbol='jsonpath'):
5555
return new_parser.parse(lexer = IteratorToTokenStream(token_iterator))
5656

5757
# ===================== PLY Parser specification =====================
58-
58+
5959
precedence = [
6060
('left', ','),
6161
('left', 'DOUBLEDOT'),
@@ -66,10 +66,10 @@ def parse_token_stream(self, token_iterator, start_symbol='jsonpath'):
6666
]
6767

6868
def p_error(self, t):
69-
raise Exception('Parse error at %s:%s near token %s (%s)' % (t.lineno, t.col, t.value, t.type))
69+
raise Exception('Parse error at %s:%s near token %s (%s)' % (t.lineno, t.col, t.value, t.type))
7070

7171
def p_jsonpath_binop(self, p):
72-
"""jsonpath : jsonpath '.' jsonpath
72+
"""jsonpath : jsonpath '.' jsonpath
7373
| jsonpath DOUBLEDOT jsonpath
7474
| jsonpath WHERE jsonpath
7575
| jsonpath '|' jsonpath
@@ -134,7 +134,7 @@ def p_jsonpath_parens(self, p):
134134

135135
# Because fields in brackets cannot be '*' - that is reserved for array indices
136136
def p_fields_or_any(self, p):
137-
"""fields_or_any : fields
137+
"""fields_or_any : fields
138138
| '*' """
139139
if p[1] == '*':
140140
p[0] = ['*']
@@ -165,7 +165,7 @@ def p_maybe_int(self, p):
165165
"""maybe_int : NUMBER
166166
| empty"""
167167
p[0] = p[1]
168-
168+
169169
def p_empty(self, p):
170170
'empty :'
171171
p[0] = None

tests/bin/test_jsonpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import os
1010
import json
1111

12-
from jsonpath_rw.bin.jsonpath import main
12+
from jsonpath_ng.bin.jsonpath import main
1313

1414
class TestJsonPathScript(unittest.TestCase):
1515
"""

tests/test_jsonpath.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from __future__ import unicode_literals, print_function, absolute_import, division, generators, nested_scopes
22
import unittest
33

4-
from jsonpath_rw import jsonpath # For setting the global auto_id_field flag
4+
from jsonpath_ng import jsonpath # For setting the global auto_id_field flag
55

6-
from jsonpath_rw.parser import parse
7-
from jsonpath_rw.jsonpath import *
8-
from jsonpath_rw.lexer import JsonPathLexerError
6+
from jsonpath_ng.parser import parse
7+
from jsonpath_ng.jsonpath import *
8+
from jsonpath_ng.lexer import JsonPathLexerError
99

1010
class TestDatumInContext(unittest.TestCase):
1111
"""

tests/test_jsonpath_rw_ext.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@
1313
# under the License.
1414

1515
"""
16-
test_jsonpath_rw_ext
16+
test_jsonpath_ng_ext
1717
----------------------------------
1818
19-
Tests for `jsonpath_rw_ext` module.
19+
Tests for `jsonpath_ng_ext` module.
2020
"""
2121

22-
from jsonpath_rw import jsonpath # For setting the global auto_id_field flag
22+
from jsonpath_ng import jsonpath # For setting the global auto_id_field flag
2323
from oslotest import base
2424
from six import moves
2525
import testscenarios
2626

27-
from jsonpath_rw_ext import parser
27+
from jsonpath_ng_ext import parser
2828

2929

30-
class TestJsonpath_rw_ext(testscenarios.WithScenarios,
30+
class Testjsonpath_ng_ext(testscenarios.WithScenarios,
3131
base.BaseTestCase):
3232
scenarios = [
3333
('sorted_list', dict(string='objects.`sorted`',
@@ -343,7 +343,7 @@ def test_fields_value(self):
343343
self.assertEqual(self.target, result[0].value)
344344

345345
# NOTE(sileht): copy of tests/test_jsonpath.py
346-
# to ensure we didn't break jsonpath_rw
346+
# to ensure we didn't break jsonpath_ng
347347

348348

349349
class TestJsonPath(base.BaseTestCase):

tests/test_lexer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from ply.lex import LexToken
66

7-
from jsonpath_rw.lexer import JsonPathLexer, JsonPathLexerError
7+
from jsonpath_ng.lexer import JsonPathLexer, JsonPathLexerError
88

99
class TestLexer(unittest.TestCase):
1010

tests/test_parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from __future__ import unicode_literals, print_function, absolute_import, division, generators, nested_scopes
22
import unittest
33

4-
from jsonpath_rw.lexer import JsonPathLexer
5-
from jsonpath_rw.parser import JsonPathParser
6-
from jsonpath_rw.jsonpath import *
4+
from jsonpath_ng.lexer import JsonPathLexer
5+
from jsonpath_ng.parser import JsonPathParser
6+
from jsonpath_ng.jsonpath import *
77

88
class TestParser(unittest.TestCase):
99
# TODO: This will be much more effective with a few regression tests and `arbitrary` parse . pretty testing

0 commit comments

Comments
 (0)