コード例 #1
0
def list_writers(writerDirectories: list, problems: list, emails: list, 
        languages: list, writerFirstNames: list, writerNames: list):
    """
    Prints the list of writers and their details to the console. Details are
    retrieved using Writer.__str__()

    Arguments:
    writerDirectories: list - A list of directories to print details for
    problems: list          - Only print writers who have completed this problem
    emails: list            - Only print writers with these emails
    languages: list         - Only print writers who know these languages
    writerFirstNames: list  - Only print writers who have one of these firstname
    writerNames: list       - Only print writers who have one of these fullnames
    """
    # First, we assemble the filter dictionary according to the spec in 
    # util/writer.py
    filterDict = {
                    Writers.FILTER_KEY_DIRS:               writerDirectories,
                    Writers.FILTER_KEY_COMPLETED_PROBLEMS: problems,
                    Writers.FILTER_KEY_EMAILS:             emails,
                    Writers.FILTER_KEY_KNOWS_LANGS:        languages,
                    Writers.FILTER_KEY_FIRST_NAMES:        writerFirstNames,
                    Writers.FILTER_KEY_FULL_NAMES:         writerNames
                 }

    print('\n'.join([str(writer) for writer in 
                     Writers.get_writers_from_filter(filterDict)]))
コード例 #2
0
def todo_writers(writerDirectories: list, problems: list, emails: list,
        languages: list, writerFirstNames: list, writerNames: list):
    """
    Prints the list of what solutions a writer has yet to complete to the 
    console. 

    Arguments:
    writerDirectories: list - A list of directories to print details for
    problems: list          - Only print writers who have todo this problem
    emails: list            - Only print writers with these emails
    languages: list         - Only print writers who have to complete a problem
                              in these languages
    writerFirstNames: list  - Only print writers who have one of these firstname
    writerNames: list       - Only print writers who have one of these fullnames
    """
    # First, we assemble the filter dictionary according to the spec found in
    # util/writer.py
    filterDict = {
                    Writers.FILTER_KEY_DIRS:               writerDirectories,
                    Writers.FILTER_KEY_TODO_PROBLEMS:      problems,
                    Writers.FILTER_KEY_EMAILS:             emails,
                    Writers.FILTER_KEY_TODO_LANGS:        languages,
                    Writers.FILTER_KEY_FIRST_NAMES:        writerFirstNames,
                    Writers.FILTER_KEY_FULL_NAMES:         writerNames
                 }

    print('\n'.join([_get_todo_str_for_writer(writer) for writer in
                     Writers.get_writers_from_filter(filterDict)]))