src/schoology-extractor/data_generation/discussion_comments.py
def generate_and_load_discussion_comments(
    request_client: RequestClient,
    discussion_comments_per_discussion_count: int,
    discussions: Dict[str, List[Dict]],
    enrollments: Dict[str, List[Dict]],
) -> Dict[str, Dict[str, List[Dict]]]:
    """
    Generate and load a number of discussion_comments into the Schoology API.

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    discussion_comments_per_discussion_count : int
         The number of discussion comments per discussion to generate
    discussions: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like
        discussion objects from a bulk create response
    enrollments: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like
        enrollment objects from a bulk create response

    Returns
    -------
    Dict[str, Dict[str, List[Dict]]]
        A Dict of mappings from Schoology section id to a dict of mappings
        of discussion ids to a list of JSON-like discussion comment
        objects incorporating the response values from the Schoology API,
        e.g. resource ids and status from individual POSTing
    """
    assert (
        discussion_comments_per_discussion_count > 0
    ), "Number of discussion comments per discussion to generate must be greater than zero"

    discussion_comments_per_section_and_discussion: Dict[
        str, Dict[str, List[Dict]]
    ] = generate_discussion_comments(
        discussion_comments_per_discussion_count, discussions, enrollments
    )

    result: Dict[str, Dict[str, List[Dict]]] = {}
    for (
        section_id,
        discussions,
    ) in discussion_comments_per_section_and_discussion.items():
        result[section_id] = {}
        for (
            discussion_id,
            discussion_comments,
        ) in discussions.items():
            try:
                result[section_id][discussion_id] = load_discussion_comments(
                    request_client=request_client,
                    section_id=section_id,
                    discussion_id=discussion_id,
                    discussion_comments=discussion_comments,
                )
            except Exception as ex:
                logger.exception(ex)

    return result

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

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    discussion_comments_per_discussion_count : int
         The number of discussion comments per discussion to generate
    discussions: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like
        discussion objects from a bulk create response
    enrollments: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like
        enrollment objects from a bulk create response

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

request_client : RequestClient
A RequestClient initialized for access to the Schoology API
discussion_comments_per_discussion_count : int
The number of discussion comments per discussion to generate
discussions: Dict[str, List[Dict]]
A Dict of mappings from Schoology section id to a list of JSON-like
discussion objects from a bulk create response
enrollments: Dict[str, List[Dict]]
A Dict of mappings from Schoology section id to a list of JSON-like
enrollment objects from a bulk create response

Returns

Dict[str, Dict[str, List[Dict]]]
A Dict of mappings from Schoology section id to a dict of mappings
of discussion ids to a list of JSON-like discussion comment
objects incorporating the response values from the Schoology API,
e.g. resource ids and status from individual POSTing
Generate and load a number of discussion_comments into the Schoology API . Parameters request_client : RequestClient A RequestClient initialized for access to the Schoology API discussion_comments_per_discussion_count : int The number of discussion comments per discussion to generate discussions : Dict [ str List [ Dict ]] A Dict of mappings from Schoology section id to a list of JSON - like discussion objects from a bulk create response enrollments : Dict [ str List [ Dict ]] A Dict of mappings from Schoology section id to a list of JSON - like enrollment objects from a bulk create response Returns Dict [ str Dict [ str List [ Dict ]]] A Dict of mappings from Schoology section id to a dict of mappings of discussion ids to a list of JSON - like discussion comment objects incorporating the response values from the Schoology API e . g . resource ids and status from individual POSTing
def generate_and_load_discussion_comments(
    request_client: RequestClient,
    discussion_comments_per_discussion_count: int,
    discussions: Dict[str, List[Dict]],
    enrollments: Dict[str, List[Dict]],
) -> Dict[str, Dict[str, List[Dict]]]:
    assert (
        discussion_comments_per_discussion_count > 0
    ), "Number of discussion comments per discussion to generate must be greater than zero"
    discussion_comments_per_section_and_discussion: Dict[
        str, Dict[str, List[Dict]]
    ] = generate_discussion_comments(
        discussion_comments_per_discussion_count, discussions, enrollments
    )
    result: Dict[str, Dict[str, List[Dict]]] = {}
    for (
        section_id,
        discussions,
    ) in discussion_comments_per_section_and_discussion.items():
        result[section_id] = {}
        for (
            discussion_id,
            discussion_comments,
        ) in discussions.items():
            try:
                result[section_id][discussion_id] = load_discussion_comments(
                    request_client=request_client,
                    section_id=section_id,
                    discussion_id=discussion_id,
                    discussion_comments=discussion_comments,
                )
            except Exception as ex:
                logger.exception(ex)
    return result
def generate_and_load_discussion_comments ( request_client : RequestClient , discussion_comments_per_discussion_count : int , discussions : Dict [ str , List [ Dict ] ] , enrollments : Dict [ str , List [ Dict ] ] , ) -> Dict [ str , Dict [ str , List [ Dict ] ] ] : assert ( discussion_comments_per_discussion_count > 0 ) , "Number of discussion comments per discussion to generate must be greater than zero" discussion_comments_per_section_and_discussion : Dict [ str , Dict [ str , List [ Dict ] ] ] = generate_discussion_comments ( discussion_comments_per_discussion_count , discussions , enrollments ) result : Dict [ str , Dict [ str , List [ Dict ] ] ] = { } for ( section_id , discussions , ) in discussion_comments_per_section_and_discussion . items ( ) : result [ section_id ] = { } for ( discussion_id , discussion_comments , ) in discussions . items ( ) : try : result [ section_id ] [ discussion_id ] = load_discussion_comments ( request_client = request_client , section_id = section_id , discussion_id = discussion_id , discussion_comments = discussion_comments , ) except Exception as ex : logger . exception ( ex ) return result
Generate and load a number of discussion_comments into the Schoology API.
Generate and load a number of discussion_comments into the Schoology API .
"""
    Generate and load a number of discussion_comments into the Schoology API.

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    discussion_comments_per_discussion_count : int
         The number of discussion comments per discussion to generate
    discussions: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like
        discussion objects from a bulk create response
    enrollments: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like
        enrollment objects from a bulk create response

    Returns
    -------
    Dict[str, Dict[str, List[Dict]]]
        A Dict of mappings from Schoology section id to a dict of mappings
        of discussion ids to a list of JSON-like discussion comment
        objects incorporating the response values from the Schoology API,
        e.g. resource ids and status from individual POSTing
    """
request_client
RequestClient
discussion_comments_per_discussion_count
int
discussions
Dict[str, List[Dict]]
enrollments
Dict[str, List[Dict]]