check_python_h_first package

Submodules

check_python_h_first.get_submodule_paths module

Find files in submodules.

Those should be fixed in upstream project repos, not here.

Originally implemented in SciPy

check_python_h_first.get_submodule_paths.get_submodule_paths()[source]

Get submodule roots.

Get paths to submodules so that we can exclude them from things like check_test_name.py, check_unicode.py, etc.

check_python_h_first.single_file module

Check that Python.h is included before any stdlib headers.

May be a bit overzealous, but it should get the job done.

Originally implemented in SciPy

check_python_h_first.single_file.check_python_h_included_first(name_to_check: str) int[source]

Check that the passed file includes Python.h first if it does at all.

Perhaps overzealous, but that should work around concerns with recursion.

Parameters:

name_to_check (str) – The name of the file to check.

Returns:

The number of headers before Python.h

Return type:

int

check_python_h_first.wrapper module

Wrapper to check multiple files at once.

The functions in this script try to sort the files for greater effectiveness, then run single_file.check_python_h_included_first() on each file, collating the results.

Originally implemented in SciPy

check_python_h_first.wrapper.diff_files(sha: str) list[str][source]

Find the diff since the given SHA.

Adapted from scipy/tools/lint.py

check_python_h_first.wrapper.find_c_cpp_files(root: str) list[str][source]

Find C and C++ files under root.

Parameters:

root (str)

Return type:

list of str

check_python_h_first.wrapper.process_files(file_list: list[str]) int[source]

Process each of the files in the list.

Parameters:

file_list (list of str)

Returns:

n_out_of_order – The number of headers before Python.h

Return type:

int

check_python_h_first.wrapper.sort_order(path: str) tuple[int, str][source]

Sort key function to get files in reasonable order.

Tries to get headers before files that included them.

Parameters:

path (str)

Returns:

  • priority (int)

  • path (str)

Module contents

Skeleton file to create a package.