python-bizdays icon indicating copy to clipboard operation
python-bizdays copied to clipboard

Use context manager to change options locally

Open wilsonfreitas opened this issue 1 year ago • 0 comments

A project might set a specific option to bizdays. But in another part, it needs to change this option. This should be done locally with context managers.

from bizdays import set_option, Calendar, option

set_option("mode", "pandas")
cal = Calendar.load("B3")

with bizdays.option("mode", "datetime"):
    cal.bizdays(date1, date2)

wilsonfreitas avatar Jan 24 '24 09:01 wilsonfreitas