src/schoology-extractor/data_generation/sections.py
def generate_and_load_sections(
    request_client: RequestClient,
    record_count: int,
    courses: List[Dict],
    grading_periods: List[Dict],
) -> List[Dict]:
    """
    Generate and load a number of sections into the Schoology API.

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    record_count : int
        The number of sections to generate per course.

    Returns
    -------
    List[Dict]
        A list of JSON-like section objects incorporating the response values from the
        Schoology API, e.g. resource ids and status from individual POSTing
    """
    assert (
        record_count > 0
    ), "Number of sections to generate per course must be greater than zero"
    assert (
        record_count < 51
    ), "Number of sections to generate per course must be less then 51"

    course_ids: List[str] = list(map(lambda course: str(course["id"]), courses))
    grading_period_ids: List[int] = list(map(lambda gp: int(gp["id"]), grading_periods))

    result: List[Dict] = []
    for course_id in course_ids:
        try:
            course_sections: List[Dict] = generate_sections(
                record_count, grading_period_ids
            )
            section_result = load_sections(request_client, course_id, course_sections)
            result.extend(section_result)
        except Exception as ex:
            logger.exception(ex)

    return result

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

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    record_count : int
        The number of sections to generate per course.

    Returns
    -------
    List[Dict]
        A list of JSON-like section objects incorporating the response values from the
        Schoology API, e.g. resource ids and status from individual POSTing
    
Generate and load a number of sections into the Schoology API.
Parameters

request_client : RequestClient
A RequestClient initialized for access to the Schoology API
record_count : int
The number of sections to generate per course.

Returns

List[Dict]
A list of JSON-like section objects incorporating the response values from the
Schoology API, e.g. resource ids and status from individual POSTing
Generate and load a number of sections into the Schoology API . Parameters request_client : RequestClient A RequestClient initialized for access to the Schoology API record_count : int The number of sections to generate per course . Returns List [ Dict ] A list of JSON - like section objects incorporating the response values from the Schoology API e . g . resource ids and status from individual POSTing
def generate_and_load_sections(
    request_client: RequestClient,
    record_count: int,
    courses: List[Dict],
    grading_periods: List[Dict],
) -> List[Dict]:
    assert (
        record_count > 0
    ), "Number of sections to generate per course must be greater than zero"
    assert (
        record_count < 51
    ), "Number of sections to generate per course must be less then 51"
    course_ids: List[str] = list(map(lambda course: str(course["id"]), courses))
    grading_period_ids: List[int] = list(map(lambda gp: int(gp["id"]), grading_periods))
    result: List[Dict] = []
    for course_id in course_ids:
        try:
            course_sections: List[Dict] = generate_sections(
                record_count, grading_period_ids
            )
            section_result = load_sections(request_client, course_id, course_sections)
            result.extend(section_result)
        except Exception as ex:
            logger.exception(ex)
    return result
def generate_and_load_sections ( request_client : RequestClient , record_count : int , courses : List [ Dict ] , grading_periods : List [ Dict ] , ) -> List [ Dict ] : assert ( record_count > 0 ) , "Number of sections to generate per course must be greater than zero" assert ( record_count < 51 ) , "Number of sections to generate per course must be less then 51" course_ids : List [ str ] = list ( map ( lambda course : str ( course [ "id" ] ) , courses ) ) grading_period_ids : List [ int ] = list ( map ( lambda gp : int ( gp [ "id" ] ) , grading_periods ) ) result : List [ Dict ] = [ ] for course_id in course_ids : try : course_sections : List [ Dict ] = generate_sections ( record_count , grading_period_ids ) section_result = load_sections ( request_client , course_id , course_sections ) result . extend ( section_result ) except Exception as ex : logger . exception ( ex ) return result
Generate and load a number of sections into the Schoology API.
Generate and load a number of sections into the Schoology API .
"""
    Generate and load a number of sections into the Schoology API.

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    record_count : int
        The number of sections to generate per course.

    Returns
    -------
    List[Dict]
        A list of JSON-like section objects incorporating the response values from the
        Schoology API, e.g. resource ids and status from individual POSTing
    """
request_client
RequestClient
record_count
int
courses
List[Dict]
grading_periods
List[Dict]