src/dirbs/reports/csv_reports.py
def _retention_window_check(disable_retention_check: bool, year: int, month: int,
                            config: callable, logger: callable) -> None:
    """
    Helper method to perform retention check.

    Arguments:
        disable_retention_check: bool to disable retention check
        year: year of the report
        month: month of the report
        config: DIRBS config object
        logger: DIRBS logger object
    Returns:
        None
    """
    # DIRBS-371: Make sure that we fail if part of the month is outside the retention
    # window
    if not disable_retention_check:
        report_start_date = datetime.date(year, month, 1)
        curr_date = datetime.date.today()
        retention_months = config.retention_config.months_retention
        retention_window_start = datetime.date(curr_date.year, curr_date.month, 1) - \
            relativedelta.relativedelta(months=retention_months)
        if report_start_date < retention_window_start:
            logger.error('Attempting to generate a report for a period outside the retention window...')
            sys.exit(1)

    Helper method to perform retention check.

    Arguments:
        disable_retention_check: bool to disable retention check
        year: year of the report
        month: month of the report
        config: DIRBS config object
        logger: DIRBS logger object
    Returns:
        None
    
Helper method to perform retention check.
Helper method to perform retention check .
def _retention_window_check(disable_retention_check: bool, year: int, month: int,
                            config: callable, logger: callable) -> None:
    if not disable_retention_check:
        report_start_date = datetime.date(year, month, 1)
        curr_date = datetime.date.today()
        retention_months = config.retention_config.months_retention
        retention_window_start = datetime.date(curr_date.year, curr_date.month, 1) - \
            relativedelta.relativedelta(months=retention_months)
        if report_start_date < retention_window_start:
            logger.error('Attempting to generate a report for a period outside the retention window...')
            sys.exit(1)
def _retention_window_check ( disable_retention_check : bool , year : int , month : int , config : callable , logger : callable ) -> None : if not disable_retention_check : report_start_date = datetime . date ( year , month , 1 ) curr_date = datetime . date . today ( ) retention_months = config . retention_config . months_retention retention_window_start = datetime . date ( curr_date . year , curr_date . month , 1 ) - relativedelta . relativedelta ( months = retention_months ) if report_start_date < retention_window_start : logger . error ( 'Attempting to generate a report for a period outside the retention window...' ) sys . exit ( 1 )
Helper method to perform retention check.
Helper method to perform retention check .
"""
    Helper method to perform retention check.

    Arguments:
        disable_retention_check: bool to disable retention check
        year: year of the report
        month: month of the report
        config: DIRBS config object
        logger: DIRBS logger object
    Returns:
        None
    """ # DIRBS-371: Make sure that we fail if part of the month is outside the retention # window
None
disable_retention_check
bool
bool to disable retention check
bool to disable retention check
year
int
year of the report
year of the report
month
int
month of the report
month of the report
config
callable
DIRBS config object
DIRBS config object
logger
callable
DIRBS logger object
DIRBS logger object