Another example is related to the feature request #143: skip a number of lines
at the beginning and the end of a file. This use case is easy to implement
through a custom wrapper for the PEP 8 library:

#!pythonimportpycodestyleLINES_SLICE=slice(14,-20)classStyleGuide(pycodestyle.StyleGuide):"""This subclass of pycodestyle.StyleGuide will skip the first and last lines of each file."""definput_file(self,filename,lines=None,expected=None,line_offset=0):iflinesisNone:assertline_offset==0line_offset=LINES_SLICE.startor0lines=pycodestyle.readlines(filename)[LINES_SLICE]returnsuper(StyleGuide,self).input_file(filename,lines=lines,expected=expected,line_offset=line_offset)if__name__=='__main__':style=StyleGuide(parse_argv=True,config_file=True)report=style.check_files()ifreport.total_errors:raiseSystemExit(1)

This module declares a lines’ window which skips 14 lines at the beginning
and 20 lines at the end. If there’s no line to skip at the end, it could be
changed with LINES_SLICE=slice(14,None) for example.

You can save it in a file and use it with the same options as the
original pycodestyle.