Add `Versions.flattened()`: return full list
`Versions.flattened()` returns a flat list of all the versions in the
Versions object, without any stratification by minor version.
This commit also updates the type hint for Versions.__iter__, which
returns a Generator.
@@ -160,10 +160,14 @@ class Versions:
return None
return self.versions[-1][-1]
- def __iter__(self) -> List[Version]:
+ def __iter__(self) -> Generator[List[Version], None, None]:
for item in self.versions:
yield item
+ def flattened(self) -> List[Version]:
+ """Return a flattened list of all versions"""
+ return [version for row in self for version in row]
+
def get_semantic_version(qt_ver: str, is_preview: bool) -> Optional[Version]:
"""Converts a Qt version string (596, 512, 5132, etc) into a semantic version.
