(reproduction_information: dict[str, Any])
| 193 | |
| 194 | |
| 195 | def check_environment(reproduction_information: dict[str, Any]) -> bool: |
| 196 | mismatch_severity: MismatchSeverity | None = None |
| 197 | |
| 198 | system_mismatches = [] |
| 199 | package_mismatches = [] |
| 200 | |
| 201 | def verify( |
| 202 | mismatch_list: list[tuple[str, Any, Any, MismatchSeverity]], |
| 203 | name: str, |
| 204 | this: Any, |
| 205 | original: Any, |
| 206 | severity: MismatchSeverity, |
| 207 | ): |
| 208 | nonlocal mismatch_severity |
| 209 | if this != original: |
| 210 | mismatch_list.append((name, this, original, severity)) |
| 211 | if mismatch_severity is None: |
| 212 | mismatch_severity = severity |
| 213 | else: |
| 214 | mismatch_severity = max(severity, mismatch_severity) |
| 215 | |
| 216 | if "system" in reproduction_information: |
| 217 | system = reproduction_information["system"] |
| 218 | |
| 219 | verify( |
| 220 | system_mismatches, |
| 221 | "Python version", |
| 222 | platform.python_version(), |
| 223 | system["python"]["version"], |
| 224 | MismatchSeverity.LOW, |
| 225 | ) |
| 226 | |
| 227 | verify( |
| 228 | system_mismatches, |
| 229 | "Operating system", |
| 230 | platform.platform(), |
| 231 | system["os"]["platform"], |
| 232 | MismatchSeverity.LOW, |
| 233 | ) |
| 234 | |
| 235 | verify( |
| 236 | system_mismatches, |
| 237 | "CPU", |
| 238 | cpuinfo.get_cpu_info().get("brand_raw"), |
| 239 | system["cpu"]["brand"], |
| 240 | MismatchSeverity.LOW, |
| 241 | ) |
| 242 | |
| 243 | accelerators = get_accelerator_info_dict() |
| 244 | |
| 245 | verify( |
| 246 | system_mismatches, |
| 247 | "Accelerator type", |
| 248 | accelerators["type"], |
| 249 | system["accelerators"]["type"], |
| 250 | MismatchSeverity.HIGH, |
| 251 | ) |
| 252 |
no test coverage detected