The complete analysis process

Here is the composite analysis() function that digests a collection of log files:

def analysis(filename: str) -> Dict[str, int]:    """Count book chapters in a given log"""    details = path_filter(        access_detail_iter(            access_iter(                local_gzip(filename))))    books = book_filter(details)    totals = reduce_book_total(books)    return totalsWe've defined a rule, through the book_in_path() function, which we'll apply to each 

The analysis() function uses the local_gzip() function to work with a single filename or file pattern. It applies a standard set of parsing functions, path_filter(), access_detail_iter(), and access_iter(), to create an iterable sequence of AccessDetails objects. It then applies our analytical filter and ...

Get Functional Python Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.