(self, api: str, api_version: str, commit: str | None, spec_file: str)
| 2232 | return any_change |
| 2233 | |
| 2234 | def fetch(self, api: str, api_version: str, commit: str | None, spec_file: str) -> bool: |
| 2235 | ref = "refs/heads/main" if commit is None else commit |
| 2236 | base_url = f"https://github.com/github/rest-api-description/raw/{ref}/descriptions" |
| 2237 | url = f"{base_url}/{api}/{api}.{api_version}.json" |
| 2238 | response = requests.get(url) |
| 2239 | response.raise_for_status() |
| 2240 | written = 0 |
| 2241 | with open(spec_file, "wb") as w: |
| 2242 | print(f"fetching {url}") |
| 2243 | for chunk in response.iter_content(131072): |
| 2244 | w.write(chunk) |
| 2245 | print(".", end="", flush=True) |
| 2246 | written += len(chunk) |
| 2247 | print() |
| 2248 | print(f"written {written // 1024 / 1024:.3f} MBytes") |
| 2249 | return True |
| 2250 | |
| 2251 | def index( |
| 2252 | self, github_path: str, spec_file: str | None, index_filename: str, check_verbs: bool, dry_run: bool |
no test coverage detected