@@ -153,50 +153,50 @@ def _generate_members(self) -> None:
153
153
setattr (self , _func_name , _out_func )
154
154
155
155
@pydantic .validate_call
156
- def author (self , username : str = "self" ) -> "RunsFilter" :
156
+ def author (self , username : str = "self" ) -> Self :
157
157
self ._filters .append (f"user == { username } " )
158
158
return self
159
159
160
160
@pydantic .validate_call
161
- def exclude_author (self , username : str = "self" ) -> "RunsFilter" :
161
+ def exclude_author (self , username : str = "self" ) -> Self :
162
162
self ._filters .append (f"user != { username } " )
163
163
return self
164
164
165
- def starred (self ) -> "RunsFilter" :
165
+ def starred (self ) -> Self :
166
166
self ._filters .append ("starred" )
167
167
return self
168
168
169
169
@pydantic .validate_call
170
- def has_name (self , name : str ) -> "RunsFilter" :
170
+ def has_name (self , name : str ) -> Self :
171
171
self ._filters .append (f"name == { name } " )
172
172
return self
173
173
174
174
@pydantic .validate_call
175
- def has_name_containing (self , name : str ) -> "RunsFilter" :
175
+ def has_name_containing (self , name : str ) -> Self :
176
176
self ._filters .append (f"name contains { name } " )
177
177
return self
178
178
179
179
@pydantic .validate_call
180
- def has_status (self , status : Status ) -> "RunsFilter" :
180
+ def has_status (self , status : Status ) -> Self :
181
181
self ._filters .append (f"status == { status .value } " )
182
182
return self
183
183
184
- def is_running (self ) -> "RunsFilter" :
184
+ def is_running (self ) -> Self :
185
185
return self .has_status (Status .Running )
186
186
187
- def is_lost (self ) -> "RunsFilter" :
187
+ def is_lost (self ) -> Self :
188
188
return self .has_status (Status .Lost )
189
189
190
- def has_completed (self ) -> "RunsFilter" :
190
+ def has_completed (self ) -> Self :
191
191
return self .has_status (Status .Completed )
192
192
193
- def has_failed (self ) -> "RunsFilter" :
193
+ def has_failed (self ) -> Self :
194
194
return self .has_status (Status .Failed )
195
195
196
196
@pydantic .validate_call
197
197
def has_alert (
198
198
self , alert_name : str , is_critical : typing .Optional [bool ] = None
199
- ) -> "RunsFilter" :
199
+ ) -> Self :
200
200
self ._filters .append (f"alert.name == { alert_name } " )
201
201
if is_critical is True :
202
202
self ._filters .append ("alert.status == critical" )
@@ -211,7 +211,7 @@ def started_within(
211
211
hours : pydantic .PositiveInt = 0 ,
212
212
days : pydantic .PositiveInt = 0 ,
213
213
years : pydantic .PositiveInt = 0 ,
214
- ) -> "RunsFilter" :
214
+ ) -> Self :
215
215
return self ._time_within (Time .Started , hours = hours , days = days , years = years )
216
216
217
217
@pydantic .validate_call
@@ -221,7 +221,7 @@ def modified_within(
221
221
hours : pydantic .PositiveInt = 0 ,
222
222
days : pydantic .PositiveInt = 0 ,
223
223
years : pydantic .PositiveInt = 0 ,
224
- ) -> "RunsFilter" :
224
+ ) -> Self :
225
225
return self ._time_within (Time .Modified , hours = hours , days = days , years = years )
226
226
227
227
@pydantic .validate_call
@@ -231,63 +231,63 @@ def ended_within(
231
231
hours : pydantic .PositiveInt = 0 ,
232
232
days : pydantic .PositiveInt = 0 ,
233
233
years : pydantic .PositiveInt = 0 ,
234
- ) -> "RunsFilter" :
234
+ ) -> Self :
235
235
return self ._time_within (Time .Ended , hours = hours , days = days , years = years )
236
236
237
237
@pydantic .validate_call
238
- def in_folder (self , folder_name : str ) -> "RunsFilter" :
238
+ def in_folder (self , folder_name : str ) -> Self :
239
239
self ._filters .append (f"folder.path == { folder_name } " )
240
240
return self
241
241
242
242
@pydantic .validate_call
243
- def has_metadata_attribute (self , attribute : str ) -> "RunsFilter" :
243
+ def has_metadata_attribute (self , attribute : str ) -> Self :
244
244
self ._filters .append (f"metadata.{ attribute } exists" )
245
245
return self
246
246
247
247
@pydantic .validate_call
248
- def exclude_metadata_attribute (self , attribute : str ) -> "RunsFilter" :
248
+ def exclude_metadata_attribute (self , attribute : str ) -> Self :
249
249
self ._filters .append (f"metadata.{ attribute } not exists" )
250
250
return self
251
251
252
252
def _value_eq (
253
253
self , category : str , attribute : str , value : typing .Union [str , int , float ]
254
- ) -> "RunsFilter" :
254
+ ) -> Self :
255
255
self ._filters .append (f"{ category } .{ attribute } == { value } " )
256
256
return self
257
257
258
258
def _value_neq (
259
259
self , category : str , attribute : str , value : typing .Union [str , int , float ]
260
- ) -> "RunsFilter" :
260
+ ) -> Self :
261
261
self ._filters .append (f"{ category } .{ attribute } != { value } " )
262
262
return self
263
263
264
264
def _value_contains (
265
265
self , category : str , attribute : str , value : typing .Union [str , int , float ]
266
- ) -> "RunsFilter" :
266
+ ) -> Self :
267
267
self ._filters .append (f"{ category } .{ attribute } contains { value } " )
268
268
return self
269
269
270
270
def _value_leq (
271
271
self , category : str , attribute : str , value : typing .Union [int , float ]
272
- ) -> "RunsFilter" :
272
+ ) -> Self :
273
273
self ._filters .append (f"{ category } .{ attribute } <= { value } " )
274
274
return self
275
275
276
276
def _value_geq (
277
277
self , category : str , attribute : str , value : typing .Union [int , float ]
278
- ) -> "RunsFilter" :
278
+ ) -> Self :
279
279
self ._filters .append (f"{ category } .{ attribute } >= { value } " )
280
280
return self
281
281
282
282
def _value_lt (
283
283
self , category : str , attribute : str , value : typing .Union [int , float ]
284
- ) -> "RunsFilter" :
284
+ ) -> Self :
285
285
self ._filters .append (f"{ category } .{ attribute } < { value } " )
286
286
return self
287
287
288
288
def _value_gt (
289
289
self , category : str , attribute : str , value : typing .Union [int , float ]
290
- ) -> "RunsFilter" :
290
+ ) -> Self :
291
291
self ._filters .append (f"{ category } .{ attribute } > { value } " )
292
292
return self
293
293
0 commit comments