(repo, path, ref=None)
| 75 | |
| 76 | |
| 77 | def upstream_file(repo, path, ref=None): |
| 78 | url = f"repos/{repo}/contents/{path}" |
| 79 | if ref: |
| 80 | url += f"?ref={ref}" |
| 81 | out = gh_api(url) |
| 82 | if not out: |
| 83 | return None |
| 84 | try: |
| 85 | d = json.loads(out) |
| 86 | if isinstance(d, dict) and d.get("content"): |
| 87 | return base64.b64decode(d["content"]).decode("utf-8", "replace") |
| 88 | except Exception: |
| 89 | pass |
| 90 | return None |
| 91 | |
| 92 | |
| 93 | def local_license(dirpath): |
no test coverage detected