Open topher-lo opened 6 hours ago
The changes introduce a variety of new mathematical and time-related functions to the tracecat/expressions/functions.py
file. These include basic arithmetic operations (addition, subtraction, multiplication, division, modulus, power, and summation) and functions for extracting components from datetime
objects (seconds, minutes, hours, days, months, and years). Additionally, new functions for creating timedelta
objects and calculating intervals between datetime
objects are added. The FUNCTION_MAPPING
dictionary is updated to incorporate these new functions for broader accessibility.
File | Change Summary |
---|---|
tracecat/expressions/functions.py | Added functions: add , sub , mul , div , mod , pow , sum_ , round_up , round_down , extract_second , extract_minute , extract_hour , extract_day , extract_month , extract_year , extract_day_of_week , create_seconds , create_hours , create_days , create_weeks , seconds_between , minutes_between , hours_between , days_between , weeks_between , utcnow , change_timezone , drop_timezone . Updated FUNCTION_MAPPING to include new functions. |
In the land of time and math,
New functions hop along the path.
With seconds, minutes, hours to find,
And sums that leave no number behind.
A rabbit's cheer for code so bright,
Making calculations a pure delight! 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Also, any reason why we need individual functions for each of seconds/minutes/hours/days/weeks instead of something like
# Instead of [seconds/minutes/hours/days/weeks]_between
FN.time_between(A, B, ‘seconds’)
# Or
FN.duration_between(A, B, ‘seconds’)
same goes for extract_[seconds/minutes/hours/days/weeks]
Summary by CodeRabbit
datetime
objects, including seconds, minutes, hours, days, months, and years.timedelta
objects based on specified time units.datetime
objects in various units.