def filter_version_tags(cls, *, tags, exclude, expression): """ return list of tags that match expression """ version_tags = [] version_spec = SimpleSpec(expression) for tag in tags: tag_name = tag['name'] tag_sha = tag['commit']['sha'] version = GitHubAPI.get_version(name=tag_name) if version is not None: if version_spec.match(version): version_tags.append((tag_name, tag_sha)) return version_tags
def find(self, name: str, version: Union[Version, str]) -> Optional["BaseLoad"]: """Find a load matching the given name and version""" if isinstance(version, str): version = Version(version) for constraint, load_class in self._loads.get(name, {}).items(): spec = SimpleSpec(constraint) if spec.match(version): _logger.debug("Found load %s for versions %s, matching %s", name, constraint, version) return load_class _logger.error("No load %s found for version %s", name, version) return None