@@ -291,24 +291,12 @@ class AfterTimepoint(TimeCondition):
291
291
292
292
Attributes:
293
293
timepoint: The timepoint.
294
- compare_fields: The fields to compare.
295
- Fields: "year", "month", "day", "hour", "minute", "second"
296
294
"""
297
295
298
296
timepoint : datetime
299
- compare_fields : T .Optional [T .List [str ]] = None
300
297
301
298
def satisfy (self , _ ) -> bool :
302
- if self .compare_fields is None :
303
- return datetime .now () > self .timepoint
304
- else :
305
- for field in self .compare_fields :
306
- if field not in _valid_timepoint_fields :
307
- raise ValueError (f"Invalid field: { field } " )
308
- if getattr (datetime .now (), field ) >= \
309
- getattr (self .timepoint , field ):
310
- return False
311
- return True
299
+ return datetime .now () > self .timepoint
312
300
313
301
314
302
@dataclass
@@ -317,20 +305,8 @@ class BeforeTimepoint(TimeCondition):
317
305
318
306
Attributes:
319
307
timepoint: The timepoint.
320
- compare_fields: The fields to compare.
321
- Fields: "year", "month", "day", "hour", "minute", "second"
322
308
"""
323
309
timepoint : datetime
324
- compare_fields : T .Optional [T .List [str ]] = None
325
310
326
311
def satisfy (self , _ ) -> bool :
327
- if self .compare_fields is None :
328
- return datetime .now () < self .timepoint
329
- else :
330
- for field in self .compare_fields :
331
- if field not in _valid_timepoint_fields :
332
- raise ValueError (f"Invalid field: { field } " )
333
- if getattr (datetime .now (), field ) <= \
334
- getattr (self .timepoint , field ):
335
- return False
336
- return True
312
+ return datetime .now () < self .timepoint
0 commit comments