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

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

    Returns
    -------
    List[Dict]
        A list of JSON-like user objects incorporating the response values from the
        Schoology API, e.g. resource ids and status from individual POSTing
    """
    assert record_count > 0, "Number of users to generate must be greater than zero"

    total_users: List[Dict] = generate_users(record_count)

    MAX_CHUNK_SIZE = 50
    chunked_users: List[List[Dict]] = [
        total_users[x : x + MAX_CHUNK_SIZE]
        for x in range(0, len(total_users), MAX_CHUNK_SIZE)
    ]

    result: List[Dict] = []
    for user_chunk in chunked_users:
        try:
            chunked_result = load_users(request_client, user_chunk)
            result.extend(chunked_result)
        except Exception as ex:
            logger.exception(ex)

    return result

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

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

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

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

Returns

List[Dict]
A list of JSON-like user objects incorporating the response values from the
Schoology API, e.g. resource ids and status from individual POSTing
Generate and load a number of users into the Schoology API . Parameters request_client : RequestClient A RequestClient initialized for access to the Schoology API record_count : int The number of users to generate . Returns List [ Dict ] A list of JSON - like user objects incorporating the response values from the Schoology API e . g . resource ids and status from individual POSTing
def generate_and_load_users(
    request_client: RequestClient, record_count: int
) -> List[Dict]:
    assert record_count > 0, "Number of users to generate must be greater than zero"
    total_users: List[Dict] = generate_users(record_count)
    MAX_CHUNK_SIZE = 50
    chunked_users: List[List[Dict]] = [
        total_users[x : x + MAX_CHUNK_SIZE]
        for x in range(0, len(total_users), MAX_CHUNK_SIZE)
    ]
    result: List[Dict] = []
    for user_chunk in chunked_users:
        try:
            chunked_result = load_users(request_client, user_chunk)
            result.extend(chunked_result)
        except Exception as ex:
            logger.exception(ex)
    return result
def generate_and_load_users ( request_client : RequestClient , record_count : int ) -> List [ Dict ] : assert record_count > 0 , "Number of users to generate must be greater than zero" total_users : List [ Dict ] = generate_users ( record_count ) MAX_CHUNK_SIZE = 50 chunked_users : List [ List [ Dict ] ] = [ total_users [ x : x + MAX_CHUNK_SIZE ] for x in range ( 0 , len ( total_users ) , MAX_CHUNK_SIZE ) ] result : List [ Dict ] = [ ] for user_chunk in chunked_users : try : chunked_result = load_users ( request_client , user_chunk ) result . extend ( chunked_result ) except Exception as ex : logger . exception ( ex ) return result
Generate and load a number of users into the Schoology API.
Generate and load a number of users into the Schoology API .
"""
    Generate and load a number of users into the Schoology API.

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

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