cmake scripts: more type cleanup

Change-Id: Ic32394548bb997af96756f260b453e830d8b9e9b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Frederik Gladhorn 2019-10-08 15:36:05 +02:00
parent 3a103b3608
commit f959882616
4 changed files with 5 additions and 7 deletions

View File

@ -31,7 +31,7 @@ import json_parser
import posixpath import posixpath
import re import re
import sys import sys
from typing import Set from typing import Optional, Set
from textwrap import dedent from textwrap import dedent
from helper import ( from helper import (
@ -52,7 +52,7 @@ class LibraryMapping:
self.appendFoundSuffix = appendFoundSuffix self.appendFoundSuffix = appendFoundSuffix
def map_tests(test: str) -> str: def map_tests(test: str) -> Optional[str]:
testmap = { testmap = {
"c++11": "$<COMPILE_FEATURES:cxx_std_11>", "c++11": "$<COMPILE_FEATURES:cxx_std_11>",
"c++14": "$<COMPILE_FEATURES:cxx_std_14>", "c++14": "$<COMPILE_FEATURES:cxx_std_14>",

View File

@ -27,7 +27,7 @@
## ##
############################################################################# #############################################################################
import pyparsing as pp import pyparsing as pp # type: ignore
import json import json
import re import re
from helper import _set_up_py_parsing_nicer_debug_output from helper import _set_up_py_parsing_nicer_debug_output

View File

@ -68,7 +68,7 @@ class Blacklist:
try: try:
# If package is available, use Aho-Corasick algorithm, # If package is available, use Aho-Corasick algorithm,
from ahocorapy.keywordtree import KeywordTree from ahocorapy.keywordtree import KeywordTree # type: ignore
self.tree = KeywordTree(case_insensitive=True) self.tree = KeywordTree(case_insensitive=True)
@ -101,8 +101,6 @@ def recursive_scan(path: str, extension: str, result_paths: typing.List[str], bl
""" Find files ending with a certain extension, filtering out blacklisted entries """ """ Find files ending with a certain extension, filtering out blacklisted entries """
try: try:
for entry in os.scandir(path): for entry in os.scandir(path):
entry: os.DirEntry = entry
if entry.is_file() and entry.path.endswith(extension): if entry.is_file() and entry.path.endswith(extension):
result_paths.append(entry.path) result_paths.append(entry.path)
elif entry.is_dir(): elif entry.is_dir():

View File

@ -84,7 +84,7 @@ def find_all_pro_files(base_path: str, args: argparse.Namespace):
return dir_name + "/__" + pro_file return dir_name + "/__" + pro_file
all_files = [] all_files = []
previous_dir_name: str = None previous_dir_name: typing.Optional[str] = None
print("Finding .pro files.") print("Finding .pro files.")
glob_result = glob.glob(os.path.join(base_path, "**/*.pro"), recursive=True) glob_result = glob.glob(os.path.join(base_path, "**/*.pro"), recursive=True)