src/canvas-extractor/tests/data_generation/enrollments.py
def load_enrollments(course: Course, enrollments: List[Dict]) -> List[Enrollment]:
    """
    Load a list of enrollments for a course via the Canvas API.

    Parameters
    ----------
    course: Course
        A Course SDK object
    enrollments: List[Dict]
        A list of JSON-like enrollment objects in a form suitable for submission to the
        Canvas enrollment creation endpoint.

    Returns
    -------
    List[Enrollment]
        A list of Canvas SDK Enrollment objects representing the created enrollments
    """
    logger.info("Creating %s enrollments via Canvas API", len(enrollments))

    result: List[Enrollment] = []
    for enrollment in enrollments:
        result.append(
            course.enroll_user(
                enrollment["user"],
                enrollment["enrollment_type"],
                **enrollment["enrollment"]
            )
        )

    logger.info("Successfully created %s enrollments", len(enrollments))

    return result

    Load a list of enrollments for a course via the Canvas API.

    Parameters
    ----------
    course: Course
        A Course SDK object
    enrollments: List[Dict]
        A list of JSON-like enrollment objects in a form suitable for submission to the
        Canvas enrollment creation endpoint.

    Returns
    -------
    List[Enrollment]
        A list of Canvas SDK Enrollment objects representing the created enrollments
    
Load a list of enrollments for a course via the Canvas API.
Parameters

Course
A Course SDK object
enrollments: List[Dict]
A list of JSON-like enrollment objects in a form suitable for submission to the
Canvas enrollment creation endpoint.

Returns

List[Enrollment]
A list of Canvas SDK Enrollment objects representing the created enrollments
Load a list of enrollments for a course via the Canvas API . Parameters Course A Course SDK object enrollments : List [ Dict ] A list of JSON - like enrollment objects in a form suitable for submission to the Canvas enrollment creation endpoint . Returns List [ Enrollment ] A list of Canvas SDK Enrollment objects representing the created enrollments
def load_enrollments(course: Course, enrollments: List[Dict]) -> List[Enrollment]:
    logger.info("Creating %s enrollments via Canvas API", len(enrollments))
    result: List[Enrollment] = []
    for enrollment in enrollments:
        result.append(
            course.enroll_user(
                enrollment["user"],
                enrollment["enrollment_type"],
                **enrollment["enrollment"]
            )
        )
    logger.info("Successfully created %s enrollments", len(enrollments))
    return result
def load_enrollments ( course : Course , enrollments : List [ Dict ] ) -> List [ Enrollment ] : logger . info ( "Creating %s enrollments via Canvas API" , len ( enrollments ) ) result : List [ Enrollment ] = [ ] for enrollment in enrollments : result . append ( course . enroll_user ( enrollment [ "user" ] , enrollment [ "enrollment_type" ] , ** enrollment [ "enrollment" ] ) ) logger . info ( "Successfully created %s enrollments" , len ( enrollments ) ) return result
Load a list of enrollments for a course via the Canvas API.
Load a list of enrollments for a course via the Canvas API .
"""
    Load a list of enrollments for a course via the Canvas API.

    Parameters
    ----------
    course: Course
        A Course SDK object
    enrollments: List[Dict]
        A list of JSON-like enrollment objects in a form suitable for submission to the
        Canvas enrollment creation endpoint.

    Returns
    -------
    List[Enrollment]
        A list of Canvas SDK Enrollment objects representing the created enrollments
    """
course
Course
enrollments
List[Dict]