Skip to content

Commit

Permalink
Container: add some type hints based on other Value objects
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamc authored and adisbladis committed Mar 27, 2020
1 parent fb82551 commit 8f6ba79
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nixops/nix_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, prefix, children, suffix, inline_variant=None):
self.suffix = suffix
self.inline_variant = inline_variant

def get_min_length(self):
def get_min_length(self) -> Optional[int]:
"""
Return the minimum length of this container and all sub-containers.
"""
Expand All @@ -90,10 +90,10 @@ def get_min_length(self):
+ sum([child.get_min_length() for child in self.children])
)

def is_inlineable(self):
def is_inlineable(self) -> bool:
return all([child.is_inlineable() for child in self.children])

def indent(self, level=0, inline=False, maxwidth=80):
def indent(self, level=0, inline=False, maxwidth=80) -> str:
if not self.is_inlineable():
inline = False
elif level * 2 + self.get_min_length() < maxwidth:
Expand Down

0 comments on commit 8f6ba79

Please sign in to comment.