summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildstream/node.pyi33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/buildstream/node.pyi b/src/buildstream/node.pyi
index 854f4bde6..059bec2b8 100644
--- a/src/buildstream/node.pyi
+++ b/src/buildstream/node.pyi
@@ -1,4 +1,4 @@
-from typing import Generic, List, Mapping, Optional, Sequence, TypeVar
+from typing import overload, Generic, List, Mapping, Optional, Sequence, TypeVar, Dict, Any
from ._project import Project
@@ -10,11 +10,36 @@ class ProvenanceInformation: ...
class Node:
def clone(self) -> "Node": ...
def get_provenance(self) -> ProvenanceInformation: ...
+ def strip_node_info(self) -> Dict[str, Any]: ...
class MappingNode(Node, Generic[TNode]):
def __init__(self, file_index: int, line: int, column: int, value: Mapping[str, TValidNodeValue]) -> None: ...
def clone(self) -> MappingNode[TNode]: ...
- def get_str_list(self, key: str, default: List[str] = None) -> List[str]: ...
+ def validate_keys(self, valid_keys: List[str]): ...
+ @overload
+ def get_str_list(self, key: str) -> List[str]: ...
+ @overload
+ def get_str_list(self, key: str, default: List[str]) -> List[str]: ...
+ @overload
+ def get_str_list(self, key: str, default: Optional[List[str]]) -> Optional[List[str]]: ...
+ @overload
+ def get_str(self, key: str) -> str: ...
+ @overload
+ def get_str(self, key: str, default: str) -> str: ...
+ @overload
+ def get_str(self, key: str, default: Optional[str]) -> Optional[str]: ...
+ @overload
+ def get_int(self, key: str) -> int: ...
+ @overload
+ def get_int(self, key: str, default: int) -> int: ...
+ @overload
+ def get_int(self, key: str, default: Optional[int]) -> Optional[int]: ...
+ @overload
+ def get_mapping(self, key: str) -> "MappingNode": ...
+ @overload
+ def get_mapping(self, key: str, default: "MappingNode") -> "MappingNode": ...
+ @overload
+ def get_mapping(self, key: str, default: Optional["MappingNode"]) -> Optional["MappingNode"]: ...
class ScalarNode(Node):
def as_str(self) -> str: ...
@@ -25,6 +50,6 @@ class SequenceNode(Node, Generic[TNode]):
def clone(self) -> "SequenceNode[TNode]": ...
def _assert_symbol_name(
- symbol_name: str, purpose: str, *, ref_node: Optional[Node] = None, allow_dashes: bool = True
+ symbol_name: str, purpose: str, *, ref_node: Optional[Node], allow_dashes: bool = True
) -> None: ...
-def _new_synthetic_file(filename: str, project: Optional[Project] = None) -> MappingNode[TNode]: ...
+def _new_synthetic_file(filename: str, project: Optional[Project]) -> MappingNode[TNode]: ...