csonpath 0.10.0__tar.gz → 0.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. csonpath-0.12.0/MANIFEST.in +4 -0
  2. csonpath-0.12.0/Makefile +46 -0
  3. {csonpath-0.10.0/csonpath.egg-info → csonpath-0.12.0}/PKG-INFO +3 -1
  4. {csonpath-0.10.0 → csonpath-0.12.0}/README.md +2 -0
  5. csonpath-0.12.0/configure +35 -0
  6. {csonpath-0.10.0 → csonpath-0.12.0/csonpath.egg-info}/PKG-INFO +3 -1
  7. csonpath-0.12.0/csonpath.egg-info/SOURCES.txt +38 -0
  8. {csonpath-0.10.0 → csonpath-0.12.0}/csonpath.h +494 -275
  9. {csonpath-0.10.0 → csonpath-0.12.0}/csonpath_do.h +131 -84
  10. csonpath-0.12.0/csonpath_json-c.h +175 -0
  11. {csonpath-0.10.0 → csonpath-0.12.0}/csonpath_python.c +55 -31
  12. csonpath-0.12.0/csonpath_yyjson.h +173 -0
  13. {csonpath-0.10.0 → csonpath-0.12.0}/pyproject.toml +10 -5
  14. csonpath-0.12.0/setup.py +35 -0
  15. csonpath-0.12.0/tiny-regex-c/.git +1 -0
  16. csonpath-0.12.0/tiny-regex-c/.github/workflows/c-cpp.yml +24 -0
  17. csonpath-0.12.0/tiny-regex-c/.gitignore +4 -0
  18. csonpath-0.12.0/tiny-regex-c/LICENSE +24 -0
  19. csonpath-0.12.0/tiny-regex-c/Makefile +106 -0
  20. csonpath-0.12.0/tiny-regex-c/README.md +128 -0
  21. csonpath-0.12.0/tiny-regex-c/clib.json +12 -0
  22. csonpath-0.12.0/tiny-regex-c/formal_verification.md +142 -0
  23. csonpath-0.12.0/tiny-regex-c/re.c +540 -0
  24. csonpath-0.12.0/tiny-regex-c/re.h +86 -0
  25. csonpath-0.12.0/tiny-regex-c/scripts/exrex.py +551 -0
  26. csonpath-0.12.0/tiny-regex-c/scripts/regex_test.py +76 -0
  27. csonpath-0.12.0/tiny-regex-c/scripts/regex_test_neg.py +82 -0
  28. csonpath-0.12.0/tiny-regex-c/tests/test1.c +166 -0
  29. csonpath-0.12.0/tiny-regex-c/tests/test2.c +2098 -0
  30. csonpath-0.12.0/tiny-regex-c/tests/test3.c +32 -0
  31. csonpath-0.12.0/tiny-regex-c/tests/test_compile.c +22 -0
  32. csonpath-0.12.0/tiny-regex-c/tests/test_print.c +21 -0
  33. csonpath-0.12.0/tiny-regex-c/tests/test_rand.c +29 -0
  34. csonpath-0.12.0/tiny-regex-c/tests/test_rand_neg.c +30 -0
  35. csonpath-0.12.0/tiny-regex-c/tests/test_thread.c +447 -0
  36. csonpath-0.10.0/MANIFEST.in +0 -2
  37. csonpath-0.10.0/csonpath.egg-info/SOURCES.txt +0 -12
  38. {csonpath-0.10.0 → csonpath-0.12.0}/LICENSE +0 -0
  39. {csonpath-0.10.0 → csonpath-0.12.0}/csonpath.egg-info/dependency_links.txt +0 -0
  40. {csonpath-0.10.0 → csonpath-0.12.0}/csonpath.egg-info/requires.txt +0 -0
  41. {csonpath-0.10.0 → csonpath-0.12.0}/csonpath.egg-info/top_level.txt +0 -0
  42. {csonpath-0.10.0 → csonpath-0.12.0}/setup.cfg +0 -0
@@ -0,0 +1,4 @@
1
+ include Makefile
2
+ include configure
3
+ include *.h
4
+ recursive-include tiny-regex-c *
@@ -0,0 +1,46 @@
1
+ JSON_C_CFLAGS=$(shell pkg-config --cflags json-c)
2
+ JSON_C_LDFLAGS=$(shell pkg-config --libs json-c)
3
+
4
+ include config.mk
5
+
6
+ all: test-json-c-get-a test-json-update test-json-filter test-json-subpath
7
+
8
+ bench:
9
+ make -C bench
10
+
11
+ bench-clean:
12
+ make -C bench clean
13
+
14
+ .PHONY: all clean tests pip-dev pip-dev bench bench-clean
15
+
16
+ CFLAGS+= -Wall -Wextra -Wno-unused-function -Wno-unused-parameter -O0 -g
17
+
18
+ test-json-c-get-a: tests/json-c/get-a.c $(EXTRA_FILES) csonpath_json-c.h csonpath.h csonpath_do.h
19
+ $(CC) tests/json-c/get-a.c $(EXTRA_FILES) $(JSON_C_CFLAGS) $(CFLAGS) -Wno-format -I./ -o test-json-c-get-a $(JSON_C_LDFLAGS) $(LDFLAGS)
20
+
21
+ test-json-update: tests/json-c/set-a.c csonpath_json-c.h csonpath.h csonpath_do.h
22
+ $(CC) tests/json-c/set-a.c $(EXTRA_FILES) $(JSON_C_CFLAGS) $(CFLAGS) -Wno-format -I./ -o test-json-update $(JSON_C_LDFLAGS) $(LDFLAGS)
23
+
24
+ test-json-filter: tests/json-c/filter.c csonpath_json-c.h csonpath.h csonpath_do.h
25
+ $(CC) tests/json-c/filter.c $(EXTRA_FILES) $(JSON_C_CFLAGS) $(CFLAGS) -Wno-format -I./ -o test-json-filter $(JSON_C_LDFLAGS) $(LDFLAGS)
26
+
27
+ test-json-subpath: tests/json-c/subpath.c csonpath_json-c.h csonpath.h csonpath_do.h
28
+ $(CC) tests/json-c/subpath.c $(EXTRA_FILES) $(JSON_C_CFLAGS) $(CFLAGS) -Wno-format -I./ -o test-json-subpath $(JSON_C_LDFLAGS) $(LDFLAGS)
29
+
30
+ tests-c: test-json-c-get-a test-json-update test-json-filter test-json-subpath
31
+ ./test-json-c-get-a
32
+ ./test-json-update
33
+ ./test-json-filter
34
+ ./test-json-subpath
35
+
36
+ pip-dev:
37
+ pip install -e .[dev] --force-reinstall
38
+
39
+ tests-py: pip-dev
40
+ python -m pytest
41
+
42
+ tests: tests-py tests-c
43
+
44
+ clean:
45
+ rm -rvf test-json-c-get-a test-json-update test-json-filter test-json-subpath
46
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csonpath
3
- Version: 0.10.0
3
+ Version: 0.12.0
4
4
  Description-Content-Type: text/markdown
5
5
  License-File: LICENSE
6
6
  Provides-Extra: dev
@@ -45,6 +45,7 @@ Dynamic: license-file
45
45
  - with regex, using POSIX regcom: `"$.obj[?.field ~= "123"]"`
46
46
  - with `&`: `"$.obj[?field != "123" & second = 1]"`
47
47
  - support `|`: `"$.obj | $.otherobj"`
48
+ - support subpath: `$.obj[$.key]`, even in filter `$.obj[?field > $.value]`
48
49
  ### Functions
49
50
  - **Find First**: Retrieve the first value matching a path.
50
51
  - **Find All**: Retrieve all values matching a path.
@@ -144,6 +145,7 @@ print(o.find_first(d)) # Output: "value"
144
145
 
145
146
  #### Avaible methodes:
146
147
  - `CsonPath(path)`: create a new csonpath object.
148
+ - `CsonPath(path, return_empty_array)`: Create a new csonpath object and return an empty list instead of None (like jsonpath-ng).
147
149
  - `OBJ.find_first(self, json)`: take a json, return first found occurrence.
148
150
  - `OBJ.find_all(self, json)`: take a json, return all found occurrence in a list.
149
151
  - `OBJ.remove(self, json)`: take a json, remove all found occurrence from it.
@@ -36,6 +36,7 @@
36
36
  - with regex, using POSIX regcom: `"$.obj[?.field ~= "123"]"`
37
37
  - with `&`: `"$.obj[?field != "123" & second = 1]"`
38
38
  - support `|`: `"$.obj | $.otherobj"`
39
+ - support subpath: `$.obj[$.key]`, even in filter `$.obj[?field > $.value]`
39
40
  ### Functions
40
41
  - **Find First**: Retrieve the first value matching a path.
41
42
  - **Find All**: Retrieve all values matching a path.
@@ -135,6 +136,7 @@ print(o.find_first(d)) # Output: "value"
135
136
 
136
137
  #### Avaible methodes:
137
138
  - `CsonPath(path)`: create a new csonpath object.
139
+ - `CsonPath(path, return_empty_array)`: Create a new csonpath object and return an empty list instead of None (like jsonpath-ng).
138
140
  - `OBJ.find_first(self, json)`: take a json, return first found occurrence.
139
141
  - `OBJ.find_all(self, json)`: take a json, return all found occurrence in a list.
140
142
  - `OBJ.remove(self, json)`: take a json, remove all found occurrence from it.
@@ -0,0 +1,35 @@
1
+ #!/bin/bash
2
+
3
+ CFLAGS=""
4
+ LDFLAGS=""
5
+ EXTRA_FILES=""
6
+
7
+ for arg in $@; do
8
+ echo $( echo "$arg" | cut -d '=' -f 1)
9
+ if [ "--no-regex" = $arg ]; then
10
+ CFLAGS="${CFLAGS} -DCSONPATH_NO_REGEX"
11
+ fi
12
+ if [ "--tiny-regex" = $arg ]; then
13
+ CFLAGS="${CFLAGS} -DCSONPATH_TINY_REGEX"
14
+ EXTRA_FILES="${EXTRA_FILES} tiny-regex-c/re.c"
15
+ fi
16
+ if [ "--pcre2-regex" = $arg ]; then
17
+ CFLAGS="${CFLAGS} -DCSONPATH_PCRE2 $(pkg-config --cflags libpcre2-8)"
18
+ LDFLAGS="${LDFLAGS} $(pkg-config --libs libpcre2-8)"
19
+ fi
20
+ if [ "--pcre2-posix" = $arg ]; then
21
+ CFLAGS="${CFLAGS} -DCSONPATH_PCRE2_POSIX $(pkg-config --cflags libpcre2-posix)"
22
+ LDFLAGS="${LDFLAGS} $(pkg-config --libs libpcre2-posix)"
23
+ fi
24
+ if [ "--help" = $arg ]; then
25
+ echo "help"
26
+ echo " --tiny-regex"
27
+ echo " --pcre2-regex"
28
+ echo " --pcre2-posix"
29
+ echo " --no-regex"
30
+ fi
31
+ done
32
+
33
+ echo CFLAGS=$CFLAGS > config.mk
34
+ echo LDFLAGS=$LDFLAGS >> config.mk
35
+ echo EXTRA_FILES=$EXTRA_FILES >> config.mk
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csonpath
3
- Version: 0.10.0
3
+ Version: 0.12.0
4
4
  Description-Content-Type: text/markdown
5
5
  License-File: LICENSE
6
6
  Provides-Extra: dev
@@ -45,6 +45,7 @@ Dynamic: license-file
45
45
  - with regex, using POSIX regcom: `"$.obj[?.field ~= "123"]"`
46
46
  - with `&`: `"$.obj[?field != "123" & second = 1]"`
47
47
  - support `|`: `"$.obj | $.otherobj"`
48
+ - support subpath: `$.obj[$.key]`, even in filter `$.obj[?field > $.value]`
48
49
  ### Functions
49
50
  - **Find First**: Retrieve the first value matching a path.
50
51
  - **Find All**: Retrieve all values matching a path.
@@ -144,6 +145,7 @@ print(o.find_first(d)) # Output: "value"
144
145
 
145
146
  #### Avaible methodes:
146
147
  - `CsonPath(path)`: create a new csonpath object.
148
+ - `CsonPath(path, return_empty_array)`: Create a new csonpath object and return an empty list instead of None (like jsonpath-ng).
147
149
  - `OBJ.find_first(self, json)`: take a json, return first found occurrence.
148
150
  - `OBJ.find_all(self, json)`: take a json, return all found occurrence in a list.
149
151
  - `OBJ.remove(self, json)`: take a json, remove all found occurrence from it.
@@ -0,0 +1,38 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ Makefile
4
+ README.md
5
+ configure
6
+ csonpath.h
7
+ csonpath_do.h
8
+ csonpath_json-c.h
9
+ csonpath_python.c
10
+ csonpath_yyjson.h
11
+ pyproject.toml
12
+ setup.py
13
+ csonpath.egg-info/PKG-INFO
14
+ csonpath.egg-info/SOURCES.txt
15
+ csonpath.egg-info/dependency_links.txt
16
+ csonpath.egg-info/requires.txt
17
+ csonpath.egg-info/top_level.txt
18
+ tiny-regex-c/.git
19
+ tiny-regex-c/.gitignore
20
+ tiny-regex-c/LICENSE
21
+ tiny-regex-c/Makefile
22
+ tiny-regex-c/README.md
23
+ tiny-regex-c/clib.json
24
+ tiny-regex-c/formal_verification.md
25
+ tiny-regex-c/re.c
26
+ tiny-regex-c/re.h
27
+ tiny-regex-c/.github/workflows/c-cpp.yml
28
+ tiny-regex-c/scripts/exrex.py
29
+ tiny-regex-c/scripts/regex_test.py
30
+ tiny-regex-c/scripts/regex_test_neg.py
31
+ tiny-regex-c/tests/test1.c
32
+ tiny-regex-c/tests/test2.c
33
+ tiny-regex-c/tests/test3.c
34
+ tiny-regex-c/tests/test_compile.c
35
+ tiny-regex-c/tests/test_print.c
36
+ tiny-regex-c/tests/test_rand.c
37
+ tiny-regex-c/tests/test_rand_neg.c
38
+ tiny-regex-c/tests/test_thread.c