(filepath: str, version: Version, local_path: str)
| 110 | process_attr(data, section, node, version) |
| 111 | |
| 112 | def download_file(filepath: str, version: Version, local_path: str) -> bool: |
| 113 | file_url = f"https://docs.blender.org/api/{version.point_str()}/{filepath}" |
| 114 | |
| 115 | headers_ = {'User-Agent': 'Mozilla/5.0'} |
| 116 | |
| 117 | req = urllib.request.Request(file_url, headers=headers_) |
| 118 | |
| 119 | if not os.path.exists(os.path.dirname(local_path)): |
| 120 | os.makedirs(os.path.dirname(local_path)) |
| 121 | |
| 122 | NUM_TRIES = 10 |
| 123 | for i in range(NUM_TRIES): |
| 124 | try: |
| 125 | with urllib.request.urlopen(req) as response: |
| 126 | with open(local_path, 'wb') as file: |
| 127 | file.write(response.read()) |
| 128 | break |
| 129 | except Exception as e: |
| 130 | if i == NUM_TRIES - 1: |
| 131 | raise e |
| 132 | time.sleep(1.0) |
| 133 | |
| 134 | print(f"Downloaded {file_url} to {local_path}") |
| 135 | return True |
| 136 | |
| 137 | |
| 138 | def get_subclasses(current: str, parent: str, root_path: str, |
no test coverage detected