autograder.cli.common

 1import sys
 2import typing
 3
 4def print_no_match(label: str, query: typing.Union[typing.Any, None] = None) -> None:
 5    """ Print a "no matching X found" error message to stdout. """
 6
 7    if (query is not None):
 8        query = str(query)
 9
10        if (len(query) == 0):
11            query = None
12
13    message = f"No matching {label} found."
14    if (query is not None):
15        message = f"No matching {label} found: '{query}'."
16
17    print(message, file = sys.stderr)