diff options
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/ast/interpreter.py | 2 | ||||
-rw-r--r-- | mesonbuild/ast/introspection.py | 4 | ||||
-rw-r--r-- | mesonbuild/ast/postprocess.py | 6 | ||||
-rw-r--r-- | mesonbuild/ast/printer.py | 2 | ||||
-rw-r--r-- | mesonbuild/ast/visitor.py | 2 | ||||
-rw-r--r-- | mesonbuild/interpreterbase.py | 8 | ||||
-rw-r--r-- | mesonbuild/mesonlib.py | 4 | ||||
-rw-r--r-- | mesonbuild/mparser.py | 52 |
8 files changed, 40 insertions, 40 deletions
diff --git a/mesonbuild/ast/interpreter.py b/mesonbuild/ast/interpreter.py index 2839f54..25dfb80 100644 --- a/mesonbuild/ast/interpreter.py +++ b/mesonbuild/ast/interpreter.py @@ -67,7 +67,7 @@ ADD_SOURCE = 0 REMOVE_SOURCE = 1 class AstInterpreter(interpreterbase.InterpreterBase): - def __init__(self, source_root: str, subdir: str, subproject: str, visitors: T.Optional[T.List[AstVisitor]] = None) -> None: + def __init__(self, source_root: str, subdir: str, subproject: str, visitors: T.Optional[T.List[AstVisitor]] = None): super().__init__(source_root, subdir, subproject) self.visitors = visitors if visitors is not None else [] self.visited_subdirs = {} # type: T.Dict[str, bool] diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py index d51b099..c9a51bf 100644 --- a/mesonbuild/ast/introspection.py +++ b/mesonbuild/ast/introspection.py @@ -30,7 +30,7 @@ build_target_functions = ['executable', 'jar', 'library', 'shared_library', 'sha class IntrospectionHelper: # mimic an argparse namespace - def __init__(self, cross_file: str) -> None: + def __init__(self, cross_file: str): self.cross_file = cross_file # type: str self.native_file = None # type: str self.cmd_line_options = {} # type: T.Dict[str, str] @@ -46,7 +46,7 @@ class IntrospectionInterpreter(AstInterpreter): cross_file: T.Optional[str] = None, subproject: str = '', subproject_dir: str = 'subprojects', - env: T.Optional[environment.Environment] = None) -> None: + env: T.Optional[environment.Environment] = None): visitors = visitors if visitors is not None else [] super().__init__(source_root, subdir, subproject, visitors=visitors) diff --git a/mesonbuild/ast/postprocess.py b/mesonbuild/ast/postprocess.py index 6d808be..35fe1d3 100644 --- a/mesonbuild/ast/postprocess.py +++ b/mesonbuild/ast/postprocess.py @@ -20,7 +20,7 @@ from .. import mparser import typing as T class AstIndentationGenerator(AstVisitor): - def __init__(self) -> None: + def __init__(self): self.level = 0 def visit_default_func(self, node: mparser.BaseNode) -> None: @@ -76,7 +76,7 @@ class AstIndentationGenerator(AstVisitor): self.level -= 1 class AstIDGenerator(AstVisitor): - def __init__(self) -> None: + def __init__(self): self.counter = {} # type: T.Dict[str, int] def visit_default_func(self, node: mparser.BaseNode) -> None: @@ -87,7 +87,7 @@ class AstIDGenerator(AstVisitor): self.counter[name] += 1 class AstConditionLevel(AstVisitor): - def __init__(self) -> None: + def __init__(self): self.condition_level = 0 def visit_default_func(self, node: mparser.BaseNode) -> None: diff --git a/mesonbuild/ast/printer.py b/mesonbuild/ast/printer.py index 06f3c62..39e2cca 100644 --- a/mesonbuild/ast/printer.py +++ b/mesonbuild/ast/printer.py @@ -28,7 +28,7 @@ arithmic_map = { } class AstPrinter(AstVisitor): - def __init__(self, indent: int = 2, arg_newline_cutoff: int = 5) -> None: + def __init__(self, indent: int = 2, arg_newline_cutoff: int = 5): self.result = '' self.indent = indent self.arg_newline_cutoff = arg_newline_cutoff diff --git a/mesonbuild/ast/visitor.py b/mesonbuild/ast/visitor.py index ec51014..37be463 100644 --- a/mesonbuild/ast/visitor.py +++ b/mesonbuild/ast/visitor.py @@ -18,7 +18,7 @@ from .. import mparser class AstVisitor: - def __init__(self) -> None: + def __init__(self): pass def visit_default_func(self, node: mparser.BaseNode) -> None: diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py index e3c2c64..8071136 100644 --- a/mesonbuild/interpreterbase.py +++ b/mesonbuild/interpreterbase.py @@ -185,7 +185,7 @@ def disablerIfNotFound(f): class permittedKwargs: - def __init__(self, permitted: T.Set[str]) -> None: + def __init__(self, permitted: T.Set[str]): self.permitted = permitted # type: T.Set[str] def __call__(self, f): @@ -208,7 +208,7 @@ class FeatureCheckBase: # Format: {subproject: {feature_version: set(feature_names)}} feature_registry = {} # type: T.ClassVar[T.Dict[str, T.Dict[str, T.Set[str]]]] - def __init__(self, feature_name: str, version: str) -> None: + def __init__(self, feature_name: str, version: str): self.feature_name = feature_name # type: str self.feature_version = version # type: str @@ -293,7 +293,7 @@ class FeatureDeprecated(FeatureCheckBase): class FeatureCheckKwargsBase: - def __init__(self, feature_name: str, feature_version: str, kwargs: T.List[str]) -> None: + def __init__(self, feature_name: str, feature_version: str, kwargs: T.List[str]): self.feature_name = feature_name self.feature_version = feature_version self.kwargs = kwargs @@ -375,7 +375,7 @@ def is_disabled(args, kwargs) -> bool: class InterpreterBase: elementary_types = (int, float, str, bool, list) - def __init__(self, source_root: str, subdir: str, subproject: str) -> None: + def __init__(self, source_root: str, subdir: str, subproject: str): self.source_root = source_root self.funcs = {} # type: T.Dict[str, T.Callable[[mparser.BaseNode, T.List[TYPE_nvar], T.Dict[str, TYPE_nvar]], TYPE_var]] self.builtin = {} # type: T.Dict[str, InterpreterObject] diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 854c934..2298c86 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -400,7 +400,7 @@ class PerThreeMachine(PerMachine[_T]): class PerMachineDefaultable(PerMachine[T.Optional[_T]]): """Extends `PerMachine` with the ability to default from `None`s. """ - def __init__(self) -> None: + def __init__(self): super().__init__(None, None) def default_missing(self) -> "PerMachine[T.Optional[_T]]": @@ -418,7 +418,7 @@ class PerMachineDefaultable(PerMachine[T.Optional[_T]]): class PerThreeMachineDefaultable(PerMachineDefaultable, PerThreeMachine[T.Optional[_T]]): """Extends `PerThreeMachine` with the ability to default from `None`s. """ - def __init__(self) -> None: + def __init__(self): PerThreeMachine.__init__(self, None, None, None) def default_missing(self) -> "PerThreeMachine[T.Optional[_T]]": diff --git a/mesonbuild/mparser.py b/mesonbuild/mparser.py index d0e7525..8753b40 100644 --- a/mesonbuild/mparser.py +++ b/mesonbuild/mparser.py @@ -79,7 +79,7 @@ class BlockParseException(MesonException): TV_TokenTypes = T.TypeVar('TV_TokenTypes', int, str, bool) class Token(T.Generic[TV_TokenTypes]): - def __init__(self, tid: str, filename: str, line_start: int, lineno: int, colno: int, bytespan: T.Tuple[int, int], value: TV_TokenTypes) -> None: + def __init__(self, tid: str, filename: str, line_start: int, lineno: int, colno: int, bytespan: T.Tuple[int, int], value: TV_TokenTypes): self.tid = tid # type: str self.filename = filename # type: str self.line_start = line_start # type: int @@ -94,7 +94,7 @@ class Token(T.Generic[TV_TokenTypes]): return self.tid == other.tid class Lexer: - def __init__(self, code: str) -> None: + def __init__(self, code: str): self.code = code self.keywords = {'true', 'false', 'if', 'else', 'elif', 'endif', 'and', 'or', 'not', 'foreach', 'endforeach', @@ -226,7 +226,7 @@ class Lexer: raise ParseException('lexer', self.getline(line_start), lineno, col) class BaseNode: - def __init__(self, lineno: int, colno: int, filename: str, end_lineno: T.Optional[int] = None, end_colno: T.Optional[int] = None) -> None: + def __init__(self, lineno: int, colno: int, filename: str, end_lineno: T.Optional[int] = None, end_colno: T.Optional[int] = None): self.lineno = lineno # type: int self.colno = colno # type: int self.filename = filename # type: str @@ -246,18 +246,18 @@ class BaseNode: func(self) class ElementaryNode(T.Generic[TV_TokenTypes], BaseNode): - def __init__(self, token: Token[TV_TokenTypes]) -> None: + def __init__(self, token: Token[TV_TokenTypes]): super().__init__(token.lineno, token.colno, token.filename) self.value = token.value # type: TV_TokenTypes self.bytespan = token.bytespan # type: T.Tuple[int, int] class BooleanNode(ElementaryNode[bool]): - def __init__(self, token: Token[bool]) -> None: + def __init__(self, token: Token[bool]): super().__init__(token) assert isinstance(self.value, bool) class IdNode(ElementaryNode[str]): - def __init__(self, token: Token[str]) -> None: + def __init__(self, token: Token[str]): super().__init__(token) assert isinstance(self.value, str) @@ -265,12 +265,12 @@ class IdNode(ElementaryNode[str]): return "Id node: '%s' (%d, %d)." % (self.value, self.lineno, self.colno) class NumberNode(ElementaryNode[int]): - def __init__(self, token: Token[int]) -> None: + def __init__(self, token: Token[int]): super().__init__(token) assert isinstance(self.value, int) class StringNode(ElementaryNode[str]): - def __init__(self, token: Token[str]) -> None: + def __init__(self, token: Token[str]): super().__init__(token) assert isinstance(self.value, str) @@ -284,7 +284,7 @@ class BreakNode(ElementaryNode): pass class ArgumentNode(BaseNode): - def __init__(self, token: Token[TV_TokenTypes]) -> None: + def __init__(self, token: Token[TV_TokenTypes]): super().__init__(token.lineno, token.colno, token.filename) self.arguments = [] # type: T.List[BaseNode] self.commas = [] # type: T.List[Token[TV_TokenTypes]] @@ -325,64 +325,64 @@ class ArgumentNode(BaseNode): return self.num_args() # Fixme class ArrayNode(BaseNode): - def __init__(self, args: ArgumentNode, lineno: int, colno: int, end_lineno: int, end_colno: int) -> None: + def __init__(self, args: ArgumentNode, lineno: int, colno: int, end_lineno: int, end_colno: int): super().__init__(lineno, colno, args.filename, end_lineno=end_lineno, end_colno=end_colno) self.args = args # type: ArgumentNode class DictNode(BaseNode): - def __init__(self, args: ArgumentNode, lineno: int, colno: int, end_lineno: int, end_colno: int) -> None: + def __init__(self, args: ArgumentNode, lineno: int, colno: int, end_lineno: int, end_colno: int): super().__init__(lineno, colno, args.filename, end_lineno=end_lineno, end_colno=end_colno) self.args = args class EmptyNode(BaseNode): - def __init__(self, lineno: int, colno: int, filename: str) -> None: + def __init__(self, lineno: int, colno: int, filename: str): super().__init__(lineno, colno, filename) self.value = None class OrNode(BaseNode): - def __init__(self, left: BaseNode, right: BaseNode) -> None: + def __init__(self, left: BaseNode, right: BaseNode): super().__init__(left.lineno, left.colno, left.filename) self.left = left # type: BaseNode self.right = right # type: BaseNode class AndNode(BaseNode): - def __init__(self, left: BaseNode, right: BaseNode) -> None: + def __init__(self, left: BaseNode, right: BaseNode): super().__init__(left.lineno, left.colno, left.filename) self.left = left # type: BaseNode self.right = right # type: BaseNode class ComparisonNode(BaseNode): - def __init__(self, ctype: str, left: BaseNode, right: BaseNode) -> None: + def __init__(self, ctype: str, left: BaseNode, right: BaseNode): super().__init__(left.lineno, left.colno, left.filename) self.left = left # type: BaseNode self.right = right # type: BaseNode self.ctype = ctype # type: str class ArithmeticNode(BaseNode): - def __init__(self, operation: str, left: BaseNode, right: BaseNode) -> None: + def __init__(self, operation: str, left: BaseNode, right: BaseNode): super().__init__(left.lineno, left.colno, left.filename) self.left = left # type: BaseNode self.right = right # type: BaseNode self.operation = operation # type: str class NotNode(BaseNode): - def __init__(self, token: Token[TV_TokenTypes], value: BaseNode) -> None: + def __init__(self, token: Token[TV_TokenTypes], value: BaseNode): super().__init__(token.lineno, token.colno, token.filename) self.value = value # type: BaseNode class CodeBlockNode(BaseNode): - def __init__(self, token: Token[TV_TokenTypes]) -> None: + def __init__(self, token: Token[TV_TokenTypes]): super().__init__(token.lineno, token.colno, token.filename) self.lines = [] # type: T.List[BaseNode] class IndexNode(BaseNode): - def __init__(self, iobject: BaseNode, index: BaseNode) -> None: + def __init__(self, iobject: BaseNode, index: BaseNode): super().__init__(iobject.lineno, iobject.colno, iobject.filename) self.iobject = iobject # type: BaseNode self.index = index # type: BaseNode class MethodNode(BaseNode): - def __init__(self, filename: str, lineno: int, colno: int, source_object: BaseNode, name: str, args: ArgumentNode) -> None: + def __init__(self, filename: str, lineno: int, colno: int, source_object: BaseNode, name: str, args: ArgumentNode): super().__init__(lineno, colno, filename) self.source_object = source_object # type: BaseNode self.name = name # type: str @@ -390,28 +390,28 @@ class MethodNode(BaseNode): self.args = args # type: ArgumentNode class FunctionNode(BaseNode): - def __init__(self, filename: str, lineno: int, colno: int, end_lineno: int, end_colno: int, func_name: str, args: ArgumentNode) -> None: + def __init__(self, filename: str, lineno: int, colno: int, end_lineno: int, end_colno: int, func_name: str, args: ArgumentNode): super().__init__(lineno, colno, filename, end_lineno=end_lineno, end_colno=end_colno) self.func_name = func_name # type: str assert(isinstance(func_name, str)) self.args = args # type: ArgumentNode class AssignmentNode(BaseNode): - def __init__(self, filename: str, lineno: int, colno: int, var_name: str, value: BaseNode) -> None: + def __init__(self, filename: str, lineno: int, colno: int, var_name: str, value: BaseNode): super().__init__(lineno, colno, filename) self.var_name = var_name # type: str assert(isinstance(var_name, str)) self.value = value # type: BaseNode class PlusAssignmentNode(BaseNode): - def __init__(self, filename: str, lineno: int, colno: int, var_name: str, value: BaseNode) -> None: + def __init__(self, filename: str, lineno: int, colno: int, var_name: str, value: BaseNode): super().__init__(lineno, colno, filename) self.var_name = var_name # type: str assert(isinstance(var_name, str)) self.value = value # type: BaseNode class ForeachClauseNode(BaseNode): - def __init__(self, token: Token, varnames: T.List[str], items: BaseNode, block: CodeBlockNode) -> None: + def __init__(self, token: Token, varnames: T.List[str], items: BaseNode, block: CodeBlockNode): super().__init__(token.lineno, token.colno, token.filename) self.varnames = varnames # type: T.List[str] self.items = items # type: BaseNode @@ -424,7 +424,7 @@ class IfNode(BaseNode): self.block = block # type: CodeBlockNode class IfClauseNode(BaseNode): - def __init__(self, linenode: BaseNode) -> None: + def __init__(self, linenode: BaseNode): super().__init__(linenode.lineno, linenode.colno, linenode.filename) self.ifs = [] # type: T.List[IfNode] self.elseblock = EmptyNode(linenode.lineno, linenode.colno, linenode.filename) # type: T.Union[EmptyNode, CodeBlockNode] @@ -467,7 +467,7 @@ comparison_map = {'equal': '==', # 9 plain token class Parser: - def __init__(self, code: str, filename: str) -> None: + def __init__(self, code: str, filename: str): self.lexer = Lexer(code) self.stream = self.lexer.lex(filename) self.current = Token('eof', '', 0, 0, 0, (0, 0), None) # type: Token |