src/schoology-extractor/data_generation/discussions.py
def generate_discussions(
    discussions_per_assignment_count: int, assignments: Dict[str, List[Dict]]
) -> Dict[str, List[Dict]]:
    """
    Generate a list of graded Schoology discussions for assignments.

    Parameters
    ----------
    discussions_per_assignment_count : int
         The number of discussions per assignment to generate
    assignments: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like
        assignment objects from a bulk create response

    Returns
    -------
    Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like discussion objects
        in a form suitable for submission to the Schoology discussion create endpoint.
    """
    assert (
        discussions_per_assignment_count > 0
    ), "Number of discussions per section to generate must be greater than zero"

    logging.info(
        f"Generating {discussions_per_assignment_count} discussions per section"
    )
    discussions: Dict[str, List[Dict]] = {}
    for section_id, assignments_for_section in assignments.items():
        for assignment in assignments_for_section:
            discussions_per_assignment: List[Dict] = []
            for _ in range(1, discussions_per_assignment_count + 1):
                discussions_per_assignment.append(
                    {
                        "title": fake.catch_phrase(),
                        "body": fake.sentence(),
                        "graded": "0",
                    }
                )
            discussions[section_id] = discussions_per_assignment
    return discussions

    Generate a list of graded Schoology discussions for assignments.

    Parameters
    ----------
    discussions_per_assignment_count : int
         The number of discussions per assignment to generate
    assignments: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like
        assignment objects from a bulk create response

    Returns
    -------
    Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like discussion objects
        in a form suitable for submission to the Schoology discussion create endpoint.
    
Generate a list of graded Schoology discussions for assignments.
Parameters

discussions_per_assignment_count : int
The number of discussions per assignment to generate
assignments: Dict[str, List[Dict]]
A Dict of mappings from Schoology section id to a list of JSON-like
assignment objects from a bulk create response

Returns

Dict[str, List[Dict]]
A Dict of mappings from Schoology section id to a list of JSON-like discussion objects
in a form suitable for submission to the Schoology discussion create endpoint.
Generate a list of graded Schoology discussions for assignments . Parameters discussions_per_assignment_count : int The number of discussions per assignment to generate assignments : Dict [ str List [ Dict ]] A Dict of mappings from Schoology section id to a list of JSON - like assignment objects from a bulk create response Returns Dict [ str List [ Dict ]] A Dict of mappings from Schoology section id to a list of JSON - like discussion objects in a form suitable for submission to the Schoology discussion create endpoint .
def generate_discussions(
    discussions_per_assignment_count: int, assignments: Dict[str, List[Dict]]
) -> Dict[str, List[Dict]]:
    assert (
        discussions_per_assignment_count > 0
    ), "Number of discussions per section to generate must be greater than zero"
    logging.info(
        f"Generating {discussions_per_assignment_count} discussions per section"
    )
    discussions: Dict[str, List[Dict]] = {}
    for section_id, assignments_for_section in assignments.items():
        for assignment in assignments_for_section:
            discussions_per_assignment: List[Dict] = []
            for _ in range(1, discussions_per_assignment_count + 1):
                discussions_per_assignment.append(
                    {
                        "title": fake.catch_phrase(),
                        "body": fake.sentence(),
                        "graded": "0",
                    }
                )
            discussions[section_id] = discussions_per_assignment
    return discussions
def generate_discussions ( discussions_per_assignment_count : int , assignments : Dict [ str , List [ Dict ] ] ) -> Dict [ str , List [ Dict ] ] : assert ( discussions_per_assignment_count > 0 ) , "Number of discussions per section to generate must be greater than zero" logging . info ( f"Generating {discussions_per_assignment_count} discussions per section" ) discussions : Dict [ str , List [ Dict ] ] = { } for section_id , assignments_for_section in assignments . items ( ) : for assignment in assignments_for_section : discussions_per_assignment : List [ Dict ] = [ ] for _ in range ( 1 , discussions_per_assignment_count + 1 ) : discussions_per_assignment . append ( { "title" : fake . catch_phrase ( ) , "body" : fake . sentence ( ) , "graded" : "0" , } ) discussions [ section_id ] = discussions_per_assignment return discussions
Generate a list of graded Schoology discussions for assignments.
Generate a list of graded Schoology discussions for assignments .
"""
    Generate a list of graded Schoology discussions for assignments.

    Parameters
    ----------
    discussions_per_assignment_count : int
         The number of discussions per assignment to generate
    assignments: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like
        assignment objects from a bulk create response

    Returns
    -------
    Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like discussion objects
        in a form suitable for submission to the Schoology discussion create endpoint.
    """
discussions_per_assignment_count
int
assignments
Dict[str, List[Dict]]