@@ -29,22 +29,20 @@ def longest_common_prefix_length(items: Sequence[str]) -> int:
2929 return best
3030
3131
32- def generate_enums (template : Path , output : Path , headers : Iterable [Path ]):
32+ def generate_enums (template : Path , output : Path , headers : Iterable [Path ]): # noqa: C901
3333 """Generates the contents of ``enums.py`` in the source tree by parsing
3434 the given include files from igraph's source tree.
3535
3636 Parsing is done with crude string operations and not with a real C parser
3737 so the formatting of the input file matters.
3838 """
3939
40- IGNORED_ENUMS = set (
41- (
42- "igraph_cached_property_t" ,
43- "igraph_attribute_type_t" ,
44- "igraph_attribute_elemtype_t" ,
45- "igraph_lapack_dsyev_which_t" ,
46- )
47- )
40+ IGNORED_ENUMS = {
41+ "igraph_cached_property_t" ,
42+ "igraph_attribute_type_t" ,
43+ "igraph_attribute_elemtype_t" ,
44+ "igraph_lapack_dsyev_which_t" ,
45+ }
4846 ENUM_NAME_REMAPPING = {
4947 "Adjacency" : "AdjacencyMode" ,
5048 "BlissSh" : "BLISSSplittingHeuristics" ,
@@ -70,7 +68,7 @@ def generate_enums(template: Path, output: Path, headers: Iterable[Path]):
7068 "Loops" : [("IGNORE" , 0 )]
7169 }
7270
73- def process_enum (fp : TextIO , spec ) -> Optional [str ]:
71+ def process_enum (fp : TextIO , spec ) -> Optional [str ]: # noqa: C901
7472 spec = re .sub (r"\s*/\*[^/]*\*/\s*" , " " , spec )
7573 spec = spec .replace ("IGRAPH_DEPRECATED_ENUMVAL" , "" )
7674 spec = re .sub (r"\s+" , " " , spec )
0 commit comments