"""Helper methods for accounting_period_close DAG.""" from lib import constants from lib.abacus_event import AbacusEvent from lib.utils import event def get_event_from_params(dag_run: dict, **kwargs) -> AbacusEvent: """Get and validate event from params passed to task callbacks. Args: dag_run (dict): config of the accounting_period_close DAG instance kwargs (dict): any other optional arguments """ abacus_event = event.get_abacus_event(dag_run, **kwargs) event.validate_event_for_handler( abacus_event, target_type=constants.DAG_ACCOUNTING_PERIOD_CLOSE_TARGET_TYPE, event_name=constants.DAG_ACCOUNTING_PERIOD_CLOSE_EVENT_NAME ) return abacus_event