Skip to Content
Functional Python Programming - Second Edition
book

Functional Python Programming - Second Edition

by Steven F. Lott
April 2018
Intermediate to advanced content levelIntermediate to advanced
408 pages
10h 42m
English
Packt Publishing
Content preview from Functional Python Programming - Second Edition

Filtering the access details

We'll look at several filters for the AccessDetails objects. The first is a collection of filters that reject a lot of overhead files that are rarely interesting. The second filter will be part of the analysis functions, which we'll look at later.

The path_filter() function is a combination of three functions:

  • Exclude empty paths
  • Exclude some specific filenames
  • Exclude files that have a given extension

An optimized version of the path_filter() function looks like this:

def path_filter(        access_details_iter: Iterable[AccessDetails]    ) -> Iterable[AccessDetails]:    name_exclude = {        'favicon.ico', 'robots.txt', 'index.php', 'humans.txt',        'dompdf.php', 'crossdomain.xml',        '_images', 'search.html', 'genindex.html', 'searchindex.js', ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Functional Python Programming - Third Edition

Functional Python Programming - Third Edition

Steven F. Lott

Publisher Resources

ISBN: 9781788627061Supplemental Content