1# example from https://pypi.org/project/pathspec/ 2 3import pathspec 4 5# The gitignore-style patterns for files to select, but we're including 6# instead of ignoring. 7spec_text = """ 8 9# This is a comment because the line begins with a hash: "#" 10 11# Include several project directories (and all descendants) relative to 12# the current directory. To reference a directory you must end with a 13# slash: "/" 14/project-a/ 15/project-b/ 16/project-c/ 17 18# Patterns can be negated by prefixing with exclamation mark: "!" 19 20# Ignore temporary files beginning or ending with "~" and ending with 21# ".swp". 22!~* 23!*~ 24!*.swp 25 26# These are python projects so ignore compiled python files from 27# testing. 28!*.pyc 29 30# Ignore the build directories but only directly under the project 31# directories. 32!/*/build/ 33 34""" 35 36spec = pathspec.PathSpec.from_lines('gitwildmatch', spec_text.splitlines()) 37