(
ref_id: str,
)
| 245 | |
| 246 | |
| 247 | def parse_ref_id_to_uuid( |
| 248 | ref_id: str, |
| 249 | ): |
| 250 | clean_ref_id = None |
| 251 | |
| 252 | # HEX # 0x31d6cfe04b9011ec800142010a8000b0 |
| 253 | if ref_id.startswith("0x") and len(ref_id) == (2 + 32): |
| 254 | ref_id = ref_id[2:] |
| 255 | |
| 256 | # UUID # 31d6cfe0-4b90-11ec-8001-42010a8000b0 |
| 257 | # HEX # 31d6cfe04b9011ec800142010a8000b0 |
| 258 | try: |
| 259 | clean_ref_id = str(UUID(ref_id)) |
| 260 | except Exception as e: |
| 261 | log.error( |
| 262 | "ref_id must be a UUID, got %s [%s]", |
| 263 | type(ref_id), |
| 264 | ref_id, |
| 265 | ) |
| 266 | raise TypeError() from e |
| 267 | |
| 268 | return clean_ref_id |
| 269 | |
| 270 | |
| 271 | def parse_ref_slug_to_str( |
no test coverage detected