mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add some type hints
This commit is contained in:
parent
b6ee649458
commit
0b7dbaf90d
10 changed files with 193 additions and 173 deletions
|
@ -46,7 +46,7 @@ PARSE_GIR = set(
|
|||
|
||||
|
||||
class Element:
|
||||
def __init__(self, tag, attrs: T.Dict[str, str]):
|
||||
def __init__(self, tag: str, attrs: T.Dict[str, str]):
|
||||
self.tag = tag
|
||||
self.attrs = attrs
|
||||
self.children: T.List["Element"] = []
|
||||
|
@ -56,10 +56,10 @@ class Element:
|
|||
def cdata(self):
|
||||
return "".join(self.cdata_chunks)
|
||||
|
||||
def get_elements(self, name) -> T.List["Element"]:
|
||||
def get_elements(self, name: str) -> T.List["Element"]:
|
||||
return [child for child in self.children if child.tag == name]
|
||||
|
||||
def __getitem__(self, key):
|
||||
def __getitem__(self, key: str):
|
||||
return self.attrs.get(key)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue