src/canvas-extractor/tests/data_generation/assignments.py
def generate_and_load_assignments(
    courses: List[Course], record_count: int
) -> Dict[Course, List[Assignment]]:
    """
    Generate and load a number of assignments 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[Assignment]]
        A list of Canvas SDK Assignment objects representing the created assignments,
        grouped by Course SDK object
    """
    assert (
        record_count > 0
    ), "Number of assignments per course to generate must be greater than zero"

    result: Dict[Course, List[Assignment]] = {}

    for course in courses:
        try:
            assignments_dict: List[Dict] = generate_assignments(record_count)
            assignments_list: List[Assignment] = load_assignments(course, assignments_dict)
            result[course] = assignments_list
        except Exception as ex:
            logger.exception(ex)

    return result

    Generate and load a number of assignments 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[Assignment]]
        A list of Canvas SDK Assignment objects representing the created assignments,
        grouped by Course SDK object
    
Generate and load a number of assignments 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[Assignment]]
A list of Canvas SDK Assignment objects representing the created assignments,
grouped by Course SDK object
Generate and load a number of assignments 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 [ Assignment ]] A list of Canvas SDK Assignment objects representing the created assignments grouped by Course SDK object
def generate_and_load_assignments(
    courses: List[Course], record_count: int
) -> Dict[Course, List[Assignment]]:
    assert (
        record_count > 0
    ), "Number of assignments per course to generate must be greater than zero"
    result: Dict[Course, List[Assignment]] = {}
    for course in courses:
        try:
            assignments_dict: List[Dict] = generate_assignments(record_count)
            assignments_list: List[Assignment] = load_assignments(course, assignments_dict)
            result[course] = assignments_list
        except Exception as ex:
            logger.exception(ex)
    return result
def generate_and_load_assignments ( courses : List [ Course ] , record_count : int ) -> Dict [ Course , List [ Assignment ] ] : assert ( record_count > 0 ) , "Number of assignments per course to generate must be greater than zero" result : Dict [ Course , List [ Assignment ] ] = { } for course in courses : try : assignments_dict : List [ Dict ] = generate_assignments ( record_count ) assignments_list : List [ Assignment ] = load_assignments ( course , assignments_dict ) result [ course ] = assignments_list except Exception as ex : logger . exception ( ex ) return result
Generate and load a number of assignments into the Canvas API.
Generate and load a number of assignments into the Canvas API .
"""
    Generate and load a number of assignments 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[Assignment]]
        A list of Canvas SDK Assignment objects representing the created assignments,
        grouped by Course SDK object
    """
courses
List[Course]
record_count
int