How to use the checklist.ChecklistWarning function in checklist

To help you get started, we’ve selected a few checklist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github biocore / scikit-bio / checklist.py View on Github external
invalid_files = []
        for _file in files:
            if not _file.endswith('.py'):
                continue

            pos = 0
            filepath = os.path.join(root, _file)
            f = open(filepath)

            first_line = f.readline().rstrip('\n')
            if first_line == '# checklist.py:CopyrightHeadersValidator IGNORE':
                warnings.warn(
                    "File %s has IGNORE directive. Ignoring scikit-bio "
                    "copyright header validation." % filepath,
                    ChecklistWarning)
                continue

            f.seek(0)
            tokens = list(tokenize.generate_tokens(f.readline))

            # A module docstring is fully described using just two tokens: the
            # main string and a terminating newline. By convention, however, it
            # is always followed by a newline, and thus we advance by three
            # positions to get to the next logical line.
            if tokens[pos][0] == tokenize.STRING:
                pos += 3
            # copyright header consists of 7 lines, and by discussion in
            # preceding comment, spans through 14 tokens.
            cheader = ''.join(map(lambda x: x[1], tokens[pos:pos + 14]))
            # Ensure that there is no blank line at the end of the file
            if (cheader != self.COPYRIGHT_HEADER or