spec.py: early return in __str__
This commit is contained in:
parent
b362362291
commit
2bc2902fed
1 changed files with 5 additions and 0 deletions
|
@ -911,6 +911,9 @@ def flags():
|
||||||
yield flags
|
yield flags
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
if not self:
|
||||||
|
return ""
|
||||||
|
|
||||||
sorted_items = sorted((k, v) for k, v in self.items() if v)
|
sorted_items = sorted((k, v) for k, v in self.items() if v)
|
||||||
|
|
||||||
result = ""
|
result = ""
|
||||||
|
@ -4563,6 +4566,8 @@ def format_path(
|
||||||
return str(path_ctor(*output_path_components))
|
return str(path_ctor(*output_path_components))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
if not self._dependencies:
|
||||||
|
return self.format()
|
||||||
root_str = [self.format()]
|
root_str = [self.format()]
|
||||||
sorted_dependencies = sorted(
|
sorted_dependencies = sorted(
|
||||||
self.traverse(root=False), key=lambda x: (x.name, x.abstract_hash)
|
self.traverse(root=False), key=lambda x: (x.name, x.abstract_hash)
|
||||||
|
|
Loading…
Reference in a new issue