promql-parser 0.3.2__tar.gz → 0.4.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.
@@ -0,0 +1,149 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - 'v*'
9
+ pull_request:
10
+ workflow_dispatch:
11
+
12
+ concurrency:
13
+ group: ${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ linux:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v3
21
+ - uses: PyO3/maturin-action@v1
22
+ with:
23
+ manylinux: auto
24
+ args: --release --sdist -o dist --find-interpreter
25
+ - name: Upload wheels
26
+ uses: actions/upload-artifact@v3
27
+ with:
28
+ name: wheels
29
+ path: dist
30
+
31
+ musllinux:
32
+ runs-on: ubuntu-latest
33
+ strategy:
34
+ matrix:
35
+ target:
36
+ - x86_64-unknown-linux-musl
37
+ - i686-unknown-linux-musl
38
+ steps:
39
+ - uses: actions/checkout@v3
40
+ - uses: actions/setup-python@v4
41
+ with:
42
+ python-version: 3.9
43
+ architecture: x64
44
+ - name: Build wheels
45
+ uses: messense/maturin-action@v1
46
+ with:
47
+ target: ${{ matrix.target }}
48
+ manylinux: musllinux_1_2
49
+ args: --release --out dist -i 3.7 3.8 3.9 3.10 3.11 3.12
50
+ sccache: true
51
+ - name: Install built wheel
52
+ if: matrix.target == 'x86_64-unknown-linux-musl'
53
+ uses: addnab/docker-run-action@v3
54
+ with:
55
+ image: alpine:latest
56
+ options: -v ${{ github.workspace }}:/io -w /io
57
+ run: |
58
+ apk add py3-virtualenv
59
+ python3 -m virtualenv .venv
60
+ source .venv/bin/activate
61
+ pip install promql_parser --no-index --find-links /io/dist/ --force-reinstall
62
+ - name: Upload wheels
63
+ uses: actions/upload-artifact@v3
64
+ with:
65
+ name: wheels
66
+ path: dist
67
+
68
+ musllinux-cross:
69
+ runs-on: ubuntu-latest
70
+ strategy:
71
+ matrix:
72
+ platform:
73
+ - target: aarch64-unknown-linux-musl
74
+ arch: aarch64
75
+ - target: armv7-unknown-linux-musleabihf
76
+ arch: armv7
77
+ steps:
78
+ - uses: actions/checkout@v3
79
+ - uses: actions/setup-python@v4
80
+ with:
81
+ python-version: 3.9
82
+ - name: Build wheels
83
+ uses: messense/maturin-action@v1
84
+ with:
85
+ target: ${{ matrix.platform.target }}
86
+ manylinux: musllinux_1_2
87
+ args: --release --out dist --find-interpreter
88
+ sccache: true
89
+ - uses: uraimo/run-on-arch-action@v2.3.0
90
+ name: Install built wheel
91
+ with:
92
+ arch: ${{ matrix.platform.arch }}
93
+ distro: alpine_latest
94
+ githubToken: ${{ github.token }}
95
+ install: |
96
+ apk add py3-virtualenv
97
+ run: |
98
+ python3 -m virtualenv .venv
99
+ source .venv/bin/activate
100
+ pip install promql_parser --no-index --find-links dist/ --force-reinstall
101
+ - name: Upload wheels
102
+ uses: actions/upload-artifact@v3
103
+ with:
104
+ name: wheels
105
+ path: dist
106
+
107
+ windows:
108
+ runs-on: windows-latest
109
+ steps:
110
+ - uses: actions/checkout@v3
111
+ - uses: PyO3/maturin-action@v1
112
+ with:
113
+ args: --release -o dist --find-interpreter
114
+ - name: Upload wheels
115
+ uses: actions/upload-artifact@v3
116
+ with:
117
+ name: wheels
118
+ path: dist
119
+
120
+ macos:
121
+ runs-on: macos-latest
122
+ steps:
123
+ - uses: actions/checkout@v3
124
+ - uses: PyO3/maturin-action@v1
125
+ with:
126
+ target: universal2-apple-darwin
127
+ args: --release -o dist --find-interpreter
128
+ - name: Upload wheels
129
+ uses: actions/upload-artifact@v3
130
+ with:
131
+ name: wheels
132
+ path: dist
133
+
134
+ release:
135
+ name: Release
136
+ runs-on: ubuntu-latest
137
+ if: "startsWith(github.ref, 'refs/tags/')"
138
+ needs: [macos, windows, linux, musllinux-cross, musllinux]
139
+ steps:
140
+ - uses: actions/download-artifact@v3
141
+ with:
142
+ name: wheels
143
+ - name: Publish to PyPI
144
+ uses: PyO3/maturin-action@v1
145
+ env:
146
+ MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
147
+ with:
148
+ command: upload
149
+ args: --skip-existing *
@@ -4,24 +4,24 @@ version = 3
4
4
 
5
5
  [[package]]
6
6
  name = "aho-corasick"
7
- version = "1.1.2"
7
+ version = "1.1.3"
8
8
  source = "registry+https://github.com/rust-lang/crates.io-index"
9
- checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
9
+ checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
10
10
  dependencies = [
11
11
  "memchr",
12
12
  ]
13
13
 
14
14
  [[package]]
15
15
  name = "anyhow"
16
- version = "1.0.75"
16
+ version = "1.0.86"
17
17
  source = "registry+https://github.com/rust-lang/crates.io-index"
18
- checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
18
+ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
19
19
 
20
20
  [[package]]
21
21
  name = "autocfg"
22
- version = "1.1.0"
22
+ version = "1.3.0"
23
23
  source = "registry+https://github.com/rust-lang/crates.io-index"
24
- checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
24
+ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
25
25
 
26
26
  [[package]]
27
27
  name = "bincode"
@@ -39,16 +39,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
39
39
  checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
40
40
 
41
41
  [[package]]
42
- name = "cactus"
43
- version = "1.0.6"
42
+ name = "bitflags"
43
+ version = "2.5.0"
44
44
  source = "registry+https://github.com/rust-lang/crates.io-index"
45
- checksum = "cf034765b7d19a011c6d619e880582bf95e8186b580e6fab56589872dd87dcf5"
45
+ checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
46
46
 
47
47
  [[package]]
48
- name = "cfg-if"
49
- version = "0.1.10"
48
+ name = "cactus"
49
+ version = "1.0.7"
50
50
  source = "registry+https://github.com/rust-lang/crates.io-index"
51
- checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
51
+ checksum = "acbc26382d871df4b7442e3df10a9402bf3cf5e55cbd66f12be38861425f0564"
52
52
 
53
53
  [[package]]
54
54
  name = "cfg-if"
@@ -58,9 +58,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
58
58
 
59
59
  [[package]]
60
60
  name = "cfgrammar"
61
- version = "0.12.0"
61
+ version = "0.13.5"
62
62
  source = "registry+https://github.com/rust-lang/crates.io-index"
63
- checksum = "bf74ea341ae8905eac9a234b6a5a845e118c25bbbdecf85ec77431a8b3bfa0be"
63
+ checksum = "163348850b1cd34fa99ef1592b5d598ea7e6752f18aff2125b67537e887edb36"
64
64
  dependencies = [
65
65
  "indexmap",
66
66
  "lazy_static",
@@ -72,51 +72,37 @@ dependencies = [
72
72
 
73
73
  [[package]]
74
74
  name = "chrono"
75
- version = "0.4.31"
75
+ version = "0.4.38"
76
76
  source = "registry+https://github.com/rust-lang/crates.io-index"
77
- checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
77
+ checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
78
78
  dependencies = [
79
79
  "num-traits",
80
80
  ]
81
81
 
82
82
  [[package]]
83
83
  name = "deranged"
84
- version = "0.3.9"
84
+ version = "0.3.11"
85
85
  source = "registry+https://github.com/rust-lang/crates.io-index"
86
- checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3"
86
+ checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
87
87
  dependencies = [
88
88
  "powerfmt",
89
89
  ]
90
90
 
91
91
  [[package]]
92
- name = "enum-iterator"
93
- version = "1.4.1"
92
+ name = "equivalent"
93
+ version = "1.0.1"
94
94
  source = "registry+https://github.com/rust-lang/crates.io-index"
95
- checksum = "7add3873b5dd076766ee79c8e406ad1a472c385476b9e38849f8eec24f1be689"
96
- dependencies = [
97
- "enum-iterator-derive",
98
- ]
99
-
100
- [[package]]
101
- name = "enum-iterator-derive"
102
- version = "1.2.1"
103
- source = "registry+https://github.com/rust-lang/crates.io-index"
104
- checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb"
105
- dependencies = [
106
- "proc-macro2",
107
- "quote",
108
- "syn 2.0.38",
109
- ]
95
+ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
110
96
 
111
97
  [[package]]
112
98
  name = "filetime"
113
- version = "0.2.22"
99
+ version = "0.2.23"
114
100
  source = "registry+https://github.com/rust-lang/crates.io-index"
115
- checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0"
101
+ checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd"
116
102
  dependencies = [
117
- "cfg-if 1.0.0",
103
+ "cfg-if",
118
104
  "libc",
119
- "redox_syscall 0.3.5",
105
+ "redox_syscall 0.4.1",
120
106
  "windows-sys",
121
107
  ]
122
108
 
@@ -135,23 +121,11 @@ dependencies = [
135
121
  "unicode-width",
136
122
  ]
137
123
 
138
- [[package]]
139
- name = "getset"
140
- version = "0.1.2"
141
- source = "registry+https://github.com/rust-lang/crates.io-index"
142
- checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9"
143
- dependencies = [
144
- "proc-macro-error",
145
- "proc-macro2",
146
- "quote",
147
- "syn 1.0.109",
148
- ]
149
-
150
124
  [[package]]
151
125
  name = "hashbrown"
152
- version = "0.12.3"
126
+ version = "0.14.5"
153
127
  source = "registry+https://github.com/rust-lang/crates.io-index"
154
- checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
128
+ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
155
129
 
156
130
  [[package]]
157
131
  name = "heck"
@@ -161,25 +135,25 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
161
135
 
162
136
  [[package]]
163
137
  name = "indexmap"
164
- version = "1.9.3"
138
+ version = "2.2.6"
165
139
  source = "registry+https://github.com/rust-lang/crates.io-index"
166
- checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
140
+ checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
167
141
  dependencies = [
168
- "autocfg",
142
+ "equivalent",
169
143
  "hashbrown",
170
144
  ]
171
145
 
172
146
  [[package]]
173
147
  name = "indoc"
174
- version = "2.0.4"
148
+ version = "2.0.5"
175
149
  source = "registry+https://github.com/rust-lang/crates.io-index"
176
- checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8"
150
+ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
177
151
 
178
152
  [[package]]
179
153
  name = "itoa"
180
- version = "1.0.9"
154
+ version = "1.0.11"
181
155
  source = "registry+https://github.com/rust-lang/crates.io-index"
182
- checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
156
+ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
183
157
 
184
158
  [[package]]
185
159
  name = "lazy_static"
@@ -189,15 +163,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
189
163
 
190
164
  [[package]]
191
165
  name = "libc"
192
- version = "0.2.149"
166
+ version = "0.2.155"
193
167
  source = "registry+https://github.com/rust-lang/crates.io-index"
194
- checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
168
+ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
195
169
 
196
170
  [[package]]
197
171
  name = "lock_api"
198
- version = "0.4.11"
172
+ version = "0.4.12"
199
173
  source = "registry+https://github.com/rust-lang/crates.io-index"
200
- checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
174
+ checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
201
175
  dependencies = [
202
176
  "autocfg",
203
177
  "scopeguard",
@@ -205,25 +179,27 @@ dependencies = [
205
179
 
206
180
  [[package]]
207
181
  name = "lrlex"
208
- version = "0.12.0"
182
+ version = "0.13.5"
209
183
  source = "registry+https://github.com/rust-lang/crates.io-index"
210
- checksum = "22b832738fbfa58ad036580929e973b3b6bd31c6d6c7f18f6b5ea7b626675c85"
184
+ checksum = "77ff18e1bd3ed77d7bc2800a0f8b0e922a3c7ba525505be8bab9cf45dfc4984b"
211
185
  dependencies = [
186
+ "cfgrammar",
212
187
  "getopts",
213
188
  "lazy_static",
214
189
  "lrpar",
215
190
  "num-traits",
191
+ "quote",
216
192
  "regex",
193
+ "regex-syntax",
217
194
  "serde",
218
- "try_from",
219
195
  "vergen",
220
196
  ]
221
197
 
222
198
  [[package]]
223
199
  name = "lrpar"
224
- version = "0.12.0"
200
+ version = "0.13.5"
225
201
  source = "registry+https://github.com/rust-lang/crates.io-index"
226
- checksum = "2f270b952b07995fe874b10a5ed7dd28c80aa2130e37a7de7ed667d034e0a521"
202
+ checksum = "efea5a41b9988b5ae41ea9b2375a52cfa0e483f0210357209caa8d361a24a368"
227
203
  dependencies = [
228
204
  "bincode",
229
205
  "cactus",
@@ -243,48 +219,62 @@ dependencies = [
243
219
 
244
220
  [[package]]
245
221
  name = "lrtable"
246
- version = "0.12.0"
222
+ version = "0.13.5"
247
223
  source = "registry+https://github.com/rust-lang/crates.io-index"
248
- checksum = "a854115c6a10772ac154261592b082436abc869c812575cadcf9d7ceda8eff0b"
224
+ checksum = "ff5668c3bfd279ed24d5b0d24568c48dc993f9beabd51f74d1865a78c1d206ab"
249
225
  dependencies = [
250
226
  "cfgrammar",
251
227
  "fnv",
252
228
  "num-traits",
253
229
  "serde",
254
230
  "sparsevec",
255
- "static_assertions",
256
231
  "vob",
257
232
  ]
258
233
 
259
234
  [[package]]
260
235
  name = "memchr"
261
- version = "2.6.4"
236
+ version = "2.7.2"
262
237
  source = "registry+https://github.com/rust-lang/crates.io-index"
263
- checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
238
+ checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
264
239
 
265
240
  [[package]]
266
241
  name = "memoffset"
267
- version = "0.9.0"
242
+ version = "0.9.1"
268
243
  source = "registry+https://github.com/rust-lang/crates.io-index"
269
- checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
244
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
270
245
  dependencies = [
271
246
  "autocfg",
272
247
  ]
273
248
 
249
+ [[package]]
250
+ name = "num-conv"
251
+ version = "0.1.0"
252
+ source = "registry+https://github.com/rust-lang/crates.io-index"
253
+ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
254
+
274
255
  [[package]]
275
256
  name = "num-traits"
276
- version = "0.2.17"
257
+ version = "0.2.19"
277
258
  source = "registry+https://github.com/rust-lang/crates.io-index"
278
- checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
259
+ checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
279
260
  dependencies = [
280
261
  "autocfg",
281
262
  ]
282
263
 
264
+ [[package]]
265
+ name = "num_threads"
266
+ version = "0.1.7"
267
+ source = "registry+https://github.com/rust-lang/crates.io-index"
268
+ checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
269
+ dependencies = [
270
+ "libc",
271
+ ]
272
+
283
273
  [[package]]
284
274
  name = "once_cell"
285
- version = "1.18.0"
275
+ version = "1.19.0"
286
276
  source = "registry+https://github.com/rust-lang/crates.io-index"
287
- checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
277
+ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
288
278
 
289
279
  [[package]]
290
280
  name = "packedvec"
@@ -298,9 +288,9 @@ dependencies = [
298
288
 
299
289
  [[package]]
300
290
  name = "parking_lot"
301
- version = "0.12.1"
291
+ version = "0.12.2"
302
292
  source = "registry+https://github.com/rust-lang/crates.io-index"
303
- checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
293
+ checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb"
304
294
  dependencies = [
305
295
  "lock_api",
306
296
  "parking_lot_core",
@@ -308,61 +298,43 @@ dependencies = [
308
298
 
309
299
  [[package]]
310
300
  name = "parking_lot_core"
311
- version = "0.9.9"
301
+ version = "0.9.10"
312
302
  source = "registry+https://github.com/rust-lang/crates.io-index"
313
- checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
303
+ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
314
304
  dependencies = [
315
- "cfg-if 1.0.0",
305
+ "cfg-if",
316
306
  "libc",
317
- "redox_syscall 0.4.1",
307
+ "redox_syscall 0.5.1",
318
308
  "smallvec",
319
309
  "windows-targets",
320
310
  ]
321
311
 
322
312
  [[package]]
323
- name = "powerfmt"
324
- version = "0.2.0"
325
- source = "registry+https://github.com/rust-lang/crates.io-index"
326
- checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
327
-
328
- [[package]]
329
- name = "proc-macro-error"
330
- version = "1.0.4"
313
+ name = "portable-atomic"
314
+ version = "1.6.0"
331
315
  source = "registry+https://github.com/rust-lang/crates.io-index"
332
- checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
333
- dependencies = [
334
- "proc-macro-error-attr",
335
- "proc-macro2",
336
- "quote",
337
- "syn 1.0.109",
338
- "version_check",
339
- ]
316
+ checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0"
340
317
 
341
318
  [[package]]
342
- name = "proc-macro-error-attr"
343
- version = "1.0.4"
319
+ name = "powerfmt"
320
+ version = "0.2.0"
344
321
  source = "registry+https://github.com/rust-lang/crates.io-index"
345
- checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
346
- dependencies = [
347
- "proc-macro2",
348
- "quote",
349
- "version_check",
350
- ]
322
+ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
351
323
 
352
324
  [[package]]
353
325
  name = "proc-macro2"
354
- version = "1.0.69"
326
+ version = "1.0.83"
355
327
  source = "registry+https://github.com/rust-lang/crates.io-index"
356
- checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
328
+ checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43"
357
329
  dependencies = [
358
330
  "unicode-ident",
359
331
  ]
360
332
 
361
333
  [[package]]
362
334
  name = "promql-parser"
363
- version = "0.3.0"
335
+ version = "0.4.0"
364
336
  source = "registry+https://github.com/rust-lang/crates.io-index"
365
- checksum = "f690d49d92ae6961d96887b56112d98a5667e70a8b9e247a7e0a74e28637eb10"
337
+ checksum = "007a331efb31f6ddb644590ef22359c9469784931162aad92599e34bcfa66583"
366
338
  dependencies = [
367
339
  "cfgrammar",
368
340
  "lazy_static",
@@ -373,7 +345,7 @@ dependencies = [
373
345
 
374
346
  [[package]]
375
347
  name = "py-promql-parser"
376
- version = "0.3.2"
348
+ version = "0.4.0"
377
349
  dependencies = [
378
350
  "chrono",
379
351
  "promql-parser",
@@ -382,16 +354,17 @@ dependencies = [
382
354
 
383
355
  [[package]]
384
356
  name = "pyo3"
385
- version = "0.20.0"
357
+ version = "0.21.2"
386
358
  source = "registry+https://github.com/rust-lang/crates.io-index"
387
- checksum = "04e8453b658fe480c3e70c8ed4e3d3ec33eb74988bd186561b0cc66b85c3bc4b"
359
+ checksum = "a5e00b96a521718e08e03b1a622f01c8a8deb50719335de3f60b3b3950f069d8"
388
360
  dependencies = [
389
- "cfg-if 1.0.0",
361
+ "cfg-if",
390
362
  "chrono",
391
363
  "indoc",
392
364
  "libc",
393
365
  "memoffset",
394
366
  "parking_lot",
367
+ "portable-atomic",
395
368
  "pyo3-build-config",
396
369
  "pyo3-ffi",
397
370
  "pyo3-macros",
@@ -400,9 +373,9 @@ dependencies = [
400
373
 
401
374
  [[package]]
402
375
  name = "pyo3-build-config"
403
- version = "0.20.0"
376
+ version = "0.21.2"
404
377
  source = "registry+https://github.com/rust-lang/crates.io-index"
405
- checksum = "a96fe70b176a89cff78f2fa7b3c930081e163d5379b4dcdf993e3ae29ca662e5"
378
+ checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50"
406
379
  dependencies = [
407
380
  "once_cell",
408
381
  "target-lexicon",
@@ -410,9 +383,9 @@ dependencies = [
410
383
 
411
384
  [[package]]
412
385
  name = "pyo3-ffi"
413
- version = "0.20.0"
386
+ version = "0.21.2"
414
387
  source = "registry+https://github.com/rust-lang/crates.io-index"
415
- checksum = "214929900fd25e6604661ed9cf349727c8920d47deff196c4e28165a6ef2a96b"
388
+ checksum = "01be5843dc60b916ab4dad1dca6d20b9b4e6ddc8e15f50c47fe6d85f1fb97403"
416
389
  dependencies = [
417
390
  "libc",
418
391
  "pyo3-build-config",
@@ -420,60 +393,61 @@ dependencies = [
420
393
 
421
394
  [[package]]
422
395
  name = "pyo3-macros"
423
- version = "0.20.0"
396
+ version = "0.21.2"
424
397
  source = "registry+https://github.com/rust-lang/crates.io-index"
425
- checksum = "dac53072f717aa1bfa4db832b39de8c875b7c7af4f4a6fe93cdbf9264cf8383b"
398
+ checksum = "77b34069fc0682e11b31dbd10321cbf94808394c56fd996796ce45217dfac53c"
426
399
  dependencies = [
427
400
  "proc-macro2",
428
401
  "pyo3-macros-backend",
429
402
  "quote",
430
- "syn 2.0.38",
403
+ "syn",
431
404
  ]
432
405
 
433
406
  [[package]]
434
407
  name = "pyo3-macros-backend"
435
- version = "0.20.0"
408
+ version = "0.21.2"
436
409
  source = "registry+https://github.com/rust-lang/crates.io-index"
437
- checksum = "7774b5a8282bd4f25f803b1f0d945120be959a36c72e08e7cd031c792fdfd424"
410
+ checksum = "08260721f32db5e1a5beae69a55553f56b99bd0e1c3e6e0a5e8851a9d0f5a85c"
438
411
  dependencies = [
439
412
  "heck",
440
413
  "proc-macro2",
414
+ "pyo3-build-config",
441
415
  "quote",
442
- "syn 2.0.38",
416
+ "syn",
443
417
  ]
444
418
 
445
419
  [[package]]
446
420
  name = "quote"
447
- version = "1.0.33"
421
+ version = "1.0.36"
448
422
  source = "registry+https://github.com/rust-lang/crates.io-index"
449
- checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
423
+ checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
450
424
  dependencies = [
451
425
  "proc-macro2",
452
426
  ]
453
427
 
454
428
  [[package]]
455
429
  name = "redox_syscall"
456
- version = "0.3.5"
430
+ version = "0.4.1"
457
431
  source = "registry+https://github.com/rust-lang/crates.io-index"
458
- checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
432
+ checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
459
433
  dependencies = [
460
- "bitflags",
434
+ "bitflags 1.3.2",
461
435
  ]
462
436
 
463
437
  [[package]]
464
438
  name = "redox_syscall"
465
- version = "0.4.1"
439
+ version = "0.5.1"
466
440
  source = "registry+https://github.com/rust-lang/crates.io-index"
467
- checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
441
+ checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e"
468
442
  dependencies = [
469
- "bitflags",
443
+ "bitflags 2.5.0",
470
444
  ]
471
445
 
472
446
  [[package]]
473
447
  name = "regex"
474
- version = "1.10.2"
448
+ version = "1.10.4"
475
449
  source = "registry+https://github.com/rust-lang/crates.io-index"
476
- checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
450
+ checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
477
451
  dependencies = [
478
452
  "aho-corasick",
479
453
  "memchr",
@@ -483,9 +457,9 @@ dependencies = [
483
457
 
484
458
  [[package]]
485
459
  name = "regex-automata"
486
- version = "0.4.3"
460
+ version = "0.4.6"
487
461
  source = "registry+https://github.com/rust-lang/crates.io-index"
488
- checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
462
+ checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
489
463
  dependencies = [
490
464
  "aho-corasick",
491
465
  "memchr",
@@ -494,9 +468,9 @@ dependencies = [
494
468
 
495
469
  [[package]]
496
470
  name = "regex-syntax"
497
- version = "0.8.2"
471
+ version = "0.8.3"
498
472
  source = "registry+https://github.com/rust-lang/crates.io-index"
499
- checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
473
+ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
500
474
 
501
475
  [[package]]
502
476
  name = "rustc_version"
@@ -509,9 +483,9 @@ dependencies = [
509
483
 
510
484
  [[package]]
511
485
  name = "rustversion"
512
- version = "1.0.14"
486
+ version = "1.0.17"
513
487
  source = "registry+https://github.com/rust-lang/crates.io-index"
514
- checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4"
488
+ checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6"
515
489
 
516
490
  [[package]]
517
491
  name = "scopeguard"
@@ -521,41 +495,41 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
521
495
 
522
496
  [[package]]
523
497
  name = "semver"
524
- version = "1.0.20"
498
+ version = "1.0.23"
525
499
  source = "registry+https://github.com/rust-lang/crates.io-index"
526
- checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090"
500
+ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
527
501
 
528
502
  [[package]]
529
503
  name = "serde"
530
- version = "1.0.190"
504
+ version = "1.0.202"
531
505
  source = "registry+https://github.com/rust-lang/crates.io-index"
532
- checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7"
506
+ checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395"
533
507
  dependencies = [
534
508
  "serde_derive",
535
509
  ]
536
510
 
537
511
  [[package]]
538
512
  name = "serde_derive"
539
- version = "1.0.190"
513
+ version = "1.0.202"
540
514
  source = "registry+https://github.com/rust-lang/crates.io-index"
541
- checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3"
515
+ checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838"
542
516
  dependencies = [
543
517
  "proc-macro2",
544
518
  "quote",
545
- "syn 2.0.38",
519
+ "syn",
546
520
  ]
547
521
 
548
522
  [[package]]
549
523
  name = "smallvec"
550
- version = "1.11.1"
524
+ version = "1.13.2"
551
525
  source = "registry+https://github.com/rust-lang/crates.io-index"
552
- checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
526
+ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
553
527
 
554
528
  [[package]]
555
529
  name = "sparsevec"
556
- version = "0.1.4"
530
+ version = "0.2.0"
557
531
  source = "registry+https://github.com/rust-lang/crates.io-index"
558
- checksum = "928d1ef5df00aec8c5643c2ac37db4dd282763013c0fcc81efbb8e13db8dd8ec"
532
+ checksum = "35df5d2e580b29f3f7ec5b4ed49b0ab3acf7f3624122b3e823cafb9630f293b8"
559
533
  dependencies = [
560
534
  "num-traits",
561
535
  "packedvec",
@@ -571,20 +545,9 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
571
545
 
572
546
  [[package]]
573
547
  name = "syn"
574
- version = "1.0.109"
575
- source = "registry+https://github.com/rust-lang/crates.io-index"
576
- checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
577
- dependencies = [
578
- "proc-macro2",
579
- "quote",
580
- "unicode-ident",
581
- ]
582
-
583
- [[package]]
584
- name = "syn"
585
- version = "2.0.38"
548
+ version = "2.0.65"
586
549
  source = "registry+https://github.com/rust-lang/crates.io-index"
587
- checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
550
+ checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106"
588
551
  dependencies = [
589
552
  "proc-macro2",
590
553
  "quote",
@@ -593,38 +556,21 @@ dependencies = [
593
556
 
594
557
  [[package]]
595
558
  name = "target-lexicon"
596
- version = "0.12.12"
559
+ version = "0.12.14"
597
560
  source = "registry+https://github.com/rust-lang/crates.io-index"
598
- checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a"
599
-
600
- [[package]]
601
- name = "thiserror"
602
- version = "1.0.50"
603
- source = "registry+https://github.com/rust-lang/crates.io-index"
604
- checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
605
- dependencies = [
606
- "thiserror-impl",
607
- ]
608
-
609
- [[package]]
610
- name = "thiserror-impl"
611
- version = "1.0.50"
612
- source = "registry+https://github.com/rust-lang/crates.io-index"
613
- checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
614
- dependencies = [
615
- "proc-macro2",
616
- "quote",
617
- "syn 2.0.38",
618
- ]
561
+ checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
619
562
 
620
563
  [[package]]
621
564
  name = "time"
622
- version = "0.3.30"
565
+ version = "0.3.36"
623
566
  source = "registry+https://github.com/rust-lang/crates.io-index"
624
- checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5"
567
+ checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
625
568
  dependencies = [
626
569
  "deranged",
627
570
  "itoa",
571
+ "libc",
572
+ "num-conv",
573
+ "num_threads",
628
574
  "powerfmt",
629
575
  "serde",
630
576
  "time-core",
@@ -639,22 +585,14 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
639
585
 
640
586
  [[package]]
641
587
  name = "time-macros"
642
- version = "0.2.15"
588
+ version = "0.2.18"
643
589
  source = "registry+https://github.com/rust-lang/crates.io-index"
644
- checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20"
590
+ checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
645
591
  dependencies = [
592
+ "num-conv",
646
593
  "time-core",
647
594
  ]
648
595
 
649
- [[package]]
650
- name = "try_from"
651
- version = "0.3.2"
652
- source = "registry+https://github.com/rust-lang/crates.io-index"
653
- checksum = "283d3b89e1368717881a9d51dad843cc435380d8109c9e47d38780a324698d8b"
654
- dependencies = [
655
- "cfg-if 0.1.10",
656
- ]
657
-
658
596
  [[package]]
659
597
  name = "unicode-ident"
660
598
  version = "1.0.12"
@@ -663,9 +601,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
663
601
 
664
602
  [[package]]
665
603
  name = "unicode-width"
666
- version = "0.1.11"
604
+ version = "0.1.12"
667
605
  source = "registry+https://github.com/rust-lang/crates.io-index"
668
- checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
606
+ checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6"
669
607
 
670
608
  [[package]]
671
609
  name = "unindent"
@@ -675,25 +613,15 @@ checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
675
613
 
676
614
  [[package]]
677
615
  name = "vergen"
678
- version = "7.5.1"
616
+ version = "8.3.1"
679
617
  source = "registry+https://github.com/rust-lang/crates.io-index"
680
- checksum = "f21b881cd6636ece9735721cf03c1fe1e774fe258683d084bb2812ab67435749"
618
+ checksum = "e27d6bdd219887a9eadd19e1c34f32e47fa332301184935c6d9bca26f3cca525"
681
619
  dependencies = [
682
620
  "anyhow",
683
- "cfg-if 1.0.0",
684
- "enum-iterator",
685
- "getset",
686
621
  "rustversion",
687
- "thiserror",
688
622
  "time",
689
623
  ]
690
624
 
691
- [[package]]
692
- name = "version_check"
693
- version = "0.9.4"
694
- source = "registry+https://github.com/rust-lang/crates.io-index"
695
- checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
696
-
697
625
  [[package]]
698
626
  name = "vob"
699
627
  version = "3.0.3"
@@ -707,22 +635,23 @@ dependencies = [
707
635
 
708
636
  [[package]]
709
637
  name = "windows-sys"
710
- version = "0.48.0"
638
+ version = "0.52.0"
711
639
  source = "registry+https://github.com/rust-lang/crates.io-index"
712
- checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
640
+ checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
713
641
  dependencies = [
714
642
  "windows-targets",
715
643
  ]
716
644
 
717
645
  [[package]]
718
646
  name = "windows-targets"
719
- version = "0.48.5"
647
+ version = "0.52.5"
720
648
  source = "registry+https://github.com/rust-lang/crates.io-index"
721
- checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
649
+ checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
722
650
  dependencies = [
723
651
  "windows_aarch64_gnullvm",
724
652
  "windows_aarch64_msvc",
725
653
  "windows_i686_gnu",
654
+ "windows_i686_gnullvm",
726
655
  "windows_i686_msvc",
727
656
  "windows_x86_64_gnu",
728
657
  "windows_x86_64_gnullvm",
@@ -731,42 +660,48 @@ dependencies = [
731
660
 
732
661
  [[package]]
733
662
  name = "windows_aarch64_gnullvm"
734
- version = "0.48.5"
663
+ version = "0.52.5"
735
664
  source = "registry+https://github.com/rust-lang/crates.io-index"
736
- checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
665
+ checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
737
666
 
738
667
  [[package]]
739
668
  name = "windows_aarch64_msvc"
740
- version = "0.48.5"
669
+ version = "0.52.5"
741
670
  source = "registry+https://github.com/rust-lang/crates.io-index"
742
- checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
671
+ checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
743
672
 
744
673
  [[package]]
745
674
  name = "windows_i686_gnu"
746
- version = "0.48.5"
675
+ version = "0.52.5"
676
+ source = "registry+https://github.com/rust-lang/crates.io-index"
677
+ checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
678
+
679
+ [[package]]
680
+ name = "windows_i686_gnullvm"
681
+ version = "0.52.5"
747
682
  source = "registry+https://github.com/rust-lang/crates.io-index"
748
- checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
683
+ checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
749
684
 
750
685
  [[package]]
751
686
  name = "windows_i686_msvc"
752
- version = "0.48.5"
687
+ version = "0.52.5"
753
688
  source = "registry+https://github.com/rust-lang/crates.io-index"
754
- checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
689
+ checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
755
690
 
756
691
  [[package]]
757
692
  name = "windows_x86_64_gnu"
758
- version = "0.48.5"
693
+ version = "0.52.5"
759
694
  source = "registry+https://github.com/rust-lang/crates.io-index"
760
- checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
695
+ checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
761
696
 
762
697
  [[package]]
763
698
  name = "windows_x86_64_gnullvm"
764
- version = "0.48.5"
699
+ version = "0.52.5"
765
700
  source = "registry+https://github.com/rust-lang/crates.io-index"
766
- checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
701
+ checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
767
702
 
768
703
  [[package]]
769
704
  name = "windows_x86_64_msvc"
770
- version = "0.48.5"
705
+ version = "0.52.5"
771
706
  source = "registry+https://github.com/rust-lang/crates.io-index"
772
- checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
707
+ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "py-promql-parser"
3
- version = "0.3.2"
3
+ version = "0.4.0"
4
4
  edition = "2021"
5
5
  description = "PromQL Parser for Python"
6
6
  license = "MIT"
@@ -14,5 +14,5 @@ crate-type = ["cdylib"]
14
14
 
15
15
  [dependencies]
16
16
  chrono = { version = "0.4.23", default-features = false, features = ["std"] }
17
- promql-parser = "0.3.0"
18
- pyo3 = { version = "0.20.0", features = ["chrono", "extension-module"] }
17
+ promql-parser = "0.4.0"
18
+ pyo3 = { version = "0.21.2", features = ["chrono", "extension-module"] }
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: promql-parser
3
- Version: 0.3.2
3
+ Version: 0.4.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -1,4 +1,4 @@
1
- use std::collections::HashSet;
1
+ use std::time::SystemTime;
2
2
 
3
3
  use chrono::Duration;
4
4
  use promql_parser::label::Label;
@@ -307,17 +307,7 @@ impl PySubqueryExpr {
307
307
  ),
308
308
  None => None,
309
309
  },
310
- at: match at {
311
- Some(at) => {
312
- let typ = match at {
313
- AtModifier::Start => PyAtModifierType::Start,
314
- AtModifier::End => PyAtModifierType::End,
315
- AtModifier::At(_) => PyAtModifierType::At,
316
- };
317
- Some(PyAtModifier { r#type: typ })
318
- }
319
- None => None,
320
- },
310
+ at: at.map(|at| at.into()),
321
311
  range: Duration::from_std(range)
322
312
  .map_err(|e| PyOverflowError::new_err(e.to_string()))?,
323
313
  step: match step {
@@ -337,7 +327,19 @@ impl PySubqueryExpr {
337
327
  pub struct PyAtModifier {
338
328
  #[pyo3(get)]
339
329
  r#type: PyAtModifierType,
340
- // at: Option<SystemTime>,
330
+ #[pyo3(get)]
331
+ at: Option<SystemTime>,
332
+ }
333
+
334
+ impl From<AtModifier> for PyAtModifier {
335
+ fn from(at: AtModifier) -> Self {
336
+ let (typ, at) = match at {
337
+ AtModifier::Start => (PyAtModifierType::Start, None),
338
+ AtModifier::End => (PyAtModifierType::End, None),
339
+ AtModifier::At(at) => (PyAtModifierType::At, Some(at)),
340
+ };
341
+ PyAtModifier { r#type: typ, at }
342
+ }
341
343
  }
342
344
 
343
345
  #[pyclass(name = "AtModifierType", module = "promql_parser")]
@@ -426,12 +428,36 @@ impl PyMatcher {
426
428
  }
427
429
  }
428
430
 
431
+ impl From<promql_parser::label::Matcher> for PyMatcher {
432
+ fn from(matcher: promql_parser::label::Matcher) -> Self {
433
+ PyMatcher {
434
+ name: matcher.name,
435
+ value: matcher.value,
436
+ op: match matcher.op {
437
+ promql_parser::label::MatchOp::Equal => PyMatchOp::Equal,
438
+ promql_parser::label::MatchOp::NotEqual => PyMatchOp::NotEqual,
439
+ promql_parser::label::MatchOp::Re(_) => PyMatchOp::Re,
440
+ promql_parser::label::MatchOp::NotRe(_) => PyMatchOp::NotRe,
441
+ },
442
+ }
443
+ }
444
+ }
445
+
446
+ #[pyclass(name = "Matchers", module = "promql_parser")]
447
+ #[derive(Debug, Clone, Eq, PartialEq)]
448
+ pub struct PyMatchers {
449
+ #[pyo3(get)]
450
+ matchers: Vec<PyMatcher>,
451
+ #[pyo3(get)]
452
+ or_matchers: Vec<Vec<PyMatcher>>,
453
+ }
454
+
429
455
  #[pyclass(extends = PyExpr, name = "VectorSelector", module = "promql_parser")]
430
456
  pub struct PyVectorSelector {
431
457
  #[pyo3(get)]
432
458
  name: Option<String>,
433
459
  #[pyo3(get)]
434
- label_matchers: HashSet<PyMatcher>,
460
+ matchers: PyMatchers,
435
461
  #[pyo3(get)]
436
462
  offset: Option<Duration>,
437
463
  #[pyo3(get)]
@@ -449,24 +475,27 @@ impl PyVectorSelector {
449
475
  offset,
450
476
  at,
451
477
  } = expr;
478
+ let or_matchers = &matchers.or_matchers;
452
479
  let matchers = &matchers.matchers;
453
- let mut py_matchers = HashSet::with_capacity(matchers.len());
480
+ let mut py_matchers = PyMatchers {
481
+ matchers: Vec::with_capacity(matchers.len()),
482
+ or_matchers: Vec::with_capacity(or_matchers.len()),
483
+ };
454
484
  for matcher in matchers {
455
- py_matchers.insert(PyMatcher {
456
- name: matcher.name.clone(),
457
- value: matcher.value.clone(),
458
- op: match matcher.op {
459
- promql_parser::label::MatchOp::Equal => PyMatchOp::Equal,
460
- promql_parser::label::MatchOp::NotEqual => PyMatchOp::NotEqual,
461
- promql_parser::label::MatchOp::Re(_) => PyMatchOp::Re,
462
- promql_parser::label::MatchOp::NotRe(_) => PyMatchOp::NotRe,
463
- },
464
- });
485
+ py_matchers.matchers.push(matcher.clone().into());
486
+ }
487
+ for matchers in or_matchers {
488
+ py_matchers.or_matchers.push(
489
+ matchers
490
+ .iter()
491
+ .map(|matcher| matcher.clone().into())
492
+ .collect(),
493
+ );
465
494
  }
466
495
 
467
496
  let initializer = PyClassInitializer::from(parent).add_subclass(PyVectorSelector {
468
497
  name,
469
- label_matchers: py_matchers,
498
+ matchers: py_matchers,
470
499
  offset: match offset {
471
500
  Some(Offset::Pos(off)) => Some(
472
501
  Duration::from_std(off).map_err(|e| PyOverflowError::new_err(e.to_string()))?,
@@ -477,17 +506,7 @@ impl PyVectorSelector {
477
506
  ),
478
507
  None => None,
479
508
  },
480
- at: match at {
481
- Some(at) => {
482
- let typ = match at {
483
- AtModifier::Start => PyAtModifierType::Start,
484
- AtModifier::End => PyAtModifierType::End,
485
- AtModifier::At(_) => PyAtModifierType::At,
486
- };
487
- Some(PyAtModifier { r#type: typ })
488
- }
489
- None => None,
490
- },
509
+ at: at.map(|at| at.into()),
491
510
  });
492
511
  Ok(Py::new(py, initializer)?.into_py(py))
493
512
  }
@@ -56,6 +56,7 @@ fn promql_parser(_py: Python, m: &PyModule) -> PyResult<()> {
56
56
  m.add_class::<expr::PyStringLiteral>()?;
57
57
  m.add_class::<expr::PyMatchOp>()?;
58
58
  m.add_class::<expr::PyMatcher>()?;
59
+ m.add_class::<expr::PyMatchers>()?;
59
60
  m.add_class::<expr::PyVectorSelector>()?;
60
61
  m.add_class::<expr::PyMatrixSelector>()?;
61
62
  m.add_class::<expr::PyCall>()?;
@@ -1,3 +1,4 @@
1
+ import promql_parser
1
2
  from promql_parser import parse
2
3
 
3
4
  l = 'prometheus_http_requests_total{code="200", job="prometheus"}'
@@ -1,69 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- tags:
8
- - 'v*'
9
- pull_request:
10
- workflow_dispatch:
11
-
12
- jobs:
13
- linux:
14
- runs-on: ubuntu-latest
15
- steps:
16
- - uses: actions/checkout@v3
17
- - uses: PyO3/maturin-action@v1
18
- with:
19
- manylinux: auto
20
- args: --release --sdist -o dist --find-interpreter
21
- - name: Upload wheels
22
- uses: actions/upload-artifact@v3
23
- with:
24
- name: wheels
25
- path: dist
26
-
27
- windows:
28
- runs-on: windows-latest
29
- steps:
30
- - uses: actions/checkout@v3
31
- - uses: PyO3/maturin-action@v1
32
- with:
33
- args: --release -o dist --find-interpreter
34
- - name: Upload wheels
35
- uses: actions/upload-artifact@v3
36
- with:
37
- name: wheels
38
- path: dist
39
-
40
- macos:
41
- runs-on: macos-latest
42
- steps:
43
- - uses: actions/checkout@v3
44
- - uses: PyO3/maturin-action@v1
45
- with:
46
- target: universal2-apple-darwin
47
- args: --release -o dist --find-interpreter
48
- - name: Upload wheels
49
- uses: actions/upload-artifact@v3
50
- with:
51
- name: wheels
52
- path: dist
53
-
54
- release:
55
- name: Release
56
- runs-on: ubuntu-latest
57
- if: "startsWith(github.ref, 'refs/tags/')"
58
- needs: [ macos, windows, linux ]
59
- steps:
60
- - uses: actions/download-artifact@v3
61
- with:
62
- name: wheels
63
- - name: Publish to PyPI
64
- uses: PyO3/maturin-action@v1
65
- env:
66
- MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
67
- with:
68
- command: upload
69
- args: --skip-existing *
File without changes
File without changes
File without changes