aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2020-01-06 15:27:38 +0100
committerDaniel Mensinger <daniel@mensinger-ka.de>2020-01-08 15:28:17 +0100
commit09b53c534f74806ebc49bb2fcdfbae0e3b26fb84 (patch)
tree4466a6005333d6d1ae7d67cbaf24fb63e104df6a /tools
parentf3199edaf8802e2a59fed2f83e825e09b9d4bd0d (diff)
downloadmeson-09b53c534f74806ebc49bb2fcdfbae0e3b26fb84.zip
meson-09b53c534f74806ebc49bb2fcdfbae0e3b26fb84.tar.gz
meson-09b53c534f74806ebc49bb2fcdfbae0e3b26fb84.tar.bz2
types: import typing as T (fixes #6333)
Diffstat (limited to 'tools')
-rwxr-xr-xtools/cmake2meson.py12
-rwxr-xr-xtools/dircondenser.py6
2 files changed, 9 insertions, 9 deletions
diff --git a/tools/cmake2meson.py b/tools/cmake2meson.py
index 07ff3c9..5a27a51 100755
--- a/tools/cmake2meson.py
+++ b/tools/cmake2meson.py
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import typing
+import typing as T
from pathlib import Path
import sys
import re
@@ -47,7 +47,7 @@ class Lexer:
('rparen', re.compile(r'\)')),
]
- def lex(self, code: str) -> typing.Iterator[Token]:
+ def lex(self, code: str) -> T.Iterator[Token]:
lineno = 1
line_start = 0
loc = 0
@@ -135,7 +135,7 @@ class Parser:
args += rest
return args
- def parse(self) -> typing.Iterator[Statement]:
+ def parse(self) -> T.Iterator[Statement]:
while not self.accept('eof'):
yield(self.statement())
@@ -148,9 +148,9 @@ class Converter:
self.cmake_root = Path(cmake_root).expanduser()
self.indent_unit = ' '
self.indent_level = 0
- self.options = [] # type: typing.List[tuple]
+ self.options = [] # type: T.List[tuple]
- def convert_args(self, args: typing.List[Token], as_array: bool = True) -> str:
+ def convert_args(self, args: T.List[Token], as_array: bool = True) -> str:
res = []
if as_array:
start = '['
@@ -173,7 +173,7 @@ class Converter:
return res[0]
return ''
- def write_entry(self, outfile: typing.TextIO, t: Statement):
+ def write_entry(self, outfile: T.TextIO, t: Statement):
if t.name in Converter.ignored_funcs:
return
preincrement = 0
diff --git a/tools/dircondenser.py b/tools/dircondenser.py
index a3cdfdc..023c14e 100755
--- a/tools/dircondenser.py
+++ b/tools/dircondenser.py
@@ -32,14 +32,14 @@ to this:
This directory must be run from source root as it touches run_unittests.py.
'''
-import typing
+import typing as T
import os
import sys
import subprocess
from glob import glob
-def get_entries() -> typing.List[typing.Tuple[int, str]]:
+def get_entries() -> T.List[T.Tuple[int, str]]:
entries = []
for e in glob('*'):
if not os.path.isdir(e):
@@ -53,7 +53,7 @@ def get_entries() -> typing.List[typing.Tuple[int, str]]:
entries.sort()
return entries
-def replace_source(sourcefile: str, replacements: typing.List[typing.Tuple[str, str]]):
+def replace_source(sourcefile: str, replacements: T.List[T.Tuple[str, str]]):
with open(sourcefile, 'r') as f:
contents = f.read()
for old_name, new_name in replacements: