src/canvas-extractor/tests/data_generation/sections.py
def generate_and_load_sections(
    courses: List[Course], record_count: int
) -> Dict[Course, List[Section]]:
    """
    Generate and load a number of sections into the Canvas API.

    Parameters
    ----------
    courses: List[Course]
        A list of Course SDK object already initialized
    record_count : int
        The number of sections to generate per course.

    Returns
    -------
    Dict[Course, List[Section]]
        A list of Canvas SDK Section objects representing the created sections,
        grouped by Course SDK object
    """
    assert (
        record_count > 0
    ), "Number of sections to generate per course must be greater than zero"

    result: Dict[Course, List[Section]] = {}
    for course in courses:
        try:
            sections_dict: List[Dict] = generate_sections(record_count)
            section_list: List[Section] = load_sections(course, sections_dict)
            result[course] = section_list
        except Exception as ex:
            logger.exception(ex)

    return result

    Generate and load a number of sections into the Canvas API.

    Parameters
    ----------
    courses: List[Course]
        A list of Course SDK object already initialized
    record_count : int
        The number of sections to generate per course.

    Returns
    -------
    Dict[Course, List[Section]]
        A list of Canvas SDK Section objects representing the created sections,
        grouped by Course SDK object
    
Generate and load a number of sections into the Canvas API.
Parameters

List[Course]
A list of Course SDK object already initialized
record_count : int
The number of sections to generate per course.

Returns

Dict[Course, List[Section]]
A list of Canvas SDK Section objects representing the created sections,
grouped by Course SDK object
Generate and load a number of sections into the Canvas API . Parameters List [ Course ] A list of Course SDK object already initialized record_count : int The number of sections to generate per course . Returns Dict [ Course List [ Section ]] A list of Canvas SDK Section objects representing the created sections grouped by Course SDK object
def generate_and_load_sections(
    courses: List[Course], record_count: int
) -> Dict[Course, List[Section]]:
    assert (
        record_count > 0
    ), "Number of sections to generate per course must be greater than zero"
    result: Dict[Course, List[Section]] = {}
    for course in courses:
        try:
            sections_dict: List[Dict] = generate_sections(record_count)
            section_list: List[Section] = load_sections(course, sections_dict)
            result[course] = section_list
        except Exception as ex:
            logger.exception(ex)
    return result
def generate_and_load_sections ( courses : List [ Course ] , record_count : int ) -> Dict [ Course , List [ Section ] ] : assert ( record_count > 0 ) , "Number of sections to generate per course must be greater than zero" result : Dict [ Course , List [ Section ] ] = { } for course in courses : try : sections_dict : List [ Dict ] = generate_sections ( record_count ) section_list : List [ Section ] = load_sections ( course , sections_dict ) result [ course ] = section_list except Exception as ex : logger . exception ( ex ) return result
Generate and load a number of sections into the Canvas API.
Generate and load a number of sections into the Canvas API .
"""
    Generate and load a number of sections into the Canvas API.

    Parameters
    ----------
    courses: List[Course]
        A list of Course SDK object already initialized
    record_count : int
        The number of sections to generate per course.

    Returns
    -------
    Dict[Course, List[Section]]
        A list of Canvas SDK Section objects representing the created sections,
        grouped by Course SDK object
    """
courses
List[Course]
record_count
int