def coverage( self, vcs: str, user: str, repo: str, api: API, branch: str = None ) -> Optional[float]: api.add(vcs, user, repo) if branch: api.add("branches", branch) return float(get(api.get(), "commit.totals.c"))
def votes(self, package: str, api: API) -> Optional[str]: package_info = api.get(params={ "v": "5", "type": "info", "arg[]": package }) if len(package_info["results"]) == 0: return None return package_info["results"][0].get("NumVotes")
def build(self, user: str, repo: str, api: API, branch: str = None) -> Optional[str]: api.add(user, repo) if branch: api.add("branch", branch) details = api.get() return get(details, "build.status")
def build(self, vcs: str, user: str, repo: str, api: API, branch: str = None) -> Optional[str]: api.add(vcs, user, repo) if branch: api.add("tree", branch) details = api.get(params={"filter": "completed", "limit": 1}) if len(details) == 0: return None return details[0].get("status")
def tests(self, user: str, repo: str, api: API, branch: str = None) -> Optional[TestResults]: total, passed, failed = 0, 0, 0 api.add(user, repo) if branch: api.add("branch", branch) jobs = get(api.get(), "build.jobs") for job in jobs: total += job.get("testsCount") passed += job.get("passedTestsCount") failed += job.get("failedTestsCount") return TestResults(passed=passed, failed=failed, skipped=total - passed - failed)