(input_data: bytes, *, name: str, lock: Optional[threading.Lock], generated_input_hashes: Dict[bytes, str])
return None
check_randomness_of_generator() checks the generated inputs. This adds some overheads but is needed for foolproof. Many users forget to initialize their library and use fixed seeds.

    :returns: a previous name of the input when it was already once generated. None if it's a new input.
check_randomness_of_generator() checks the generated inputs. This adds some overheads but is needed for foolproof. Many users forget to initialize their library and use fixed seeds.
check_randomness_of_generator () checks the generated inputs . This adds some overheads but is needed for foolproof . Many users forget to initialize their library and use fixed seeds .
def check_randomness_of_generator(input_data: bytes, *, name: str, lock: Optional[threading.Lock], generated_input_hashes: Dict[bytes, str]) -> Optional[str]:
    """check_randomness_of_generator() checks the generated inputs. This adds some overheads but is needed for foolproof. Many users forget to initialize their library and use fixed seeds.

    :returns: a previous name of the input when it was already once generated. None if it's a new input.
    """

    # To prevent consuming unlimited memories, do nothing if the user's generator is properly implemented.
    limit = 1000
    if len(generated_input_hashes) >= limit:
        return None

    input_digest = hashlib.sha1(input_data).digest()
    nullcontext = contextlib.ExitStack()  # TODO: use contextlib.nullcontext after Python 3.7
    with lock or nullcontext:
        if len(generated_input_hashes) < limit:
            if input_digest in generated_input_hashes:
                return generated_input_hashes[input_digest]
            else:
                generated_input_hashes[input_digest] = name
                if len(generated_input_hashes) == limit:
                    logger.info('Conflict checking of generated inputs is disabled now because it seems the given input generator has enough randomness.')  # This prints a log line but it's safe because here is in a lock.
    return None
def check_randomness_of_generator ( input_data : bytes , * , name : str , lock : Optional [ threading . Lock ] , generated_input_hashes : Dict [ bytes , str ] ) -> Optional [ str ] : # To prevent consuming unlimited memories, do nothing if the user's generator is properly implemented. limit = 1000 if len ( generated_input_hashes ) >= limit : return None input_digest = hashlib . sha1 ( input_data ) . digest ( ) nullcontext = contextlib . ExitStack ( ) # TODO: use contextlib.nullcontext after Python 3.7 with lock or nullcontext : if len ( generated_input_hashes ) < limit : if input_digest in generated_input_hashes : return generated_input_hashes [ input_digest ] else : generated_input_hashes [ input_digest ] = name if len ( generated_input_hashes ) == limit : logger . info ( 'Conflict checking of generated inputs is disabled now because it seems the given input generator has enough randomness.' ) # This prints a log line but it's safe because here is in a lock. return None