Validate hosts and build the AnyUrl object. Split from `validate` so this method can be altered in `MultiHostDsn`.
(cls, m: Match[str], url: str, parts: 'Parts')
| 287 | |
| 288 | @classmethod |
| 289 | def _build_url(cls, m: Match[str], url: str, parts: 'Parts') -> 'AnyUrl': |
| 290 | """ |
| 291 | Validate hosts and build the AnyUrl object. Split from `validate` so this method |
| 292 | can be altered in `MultiHostDsn`. |
| 293 | """ |
| 294 | host, tld, host_type, rebuild = cls.validate_host(parts) |
| 295 | |
| 296 | return cls( |
| 297 | None if rebuild else url, |
| 298 | scheme=parts['scheme'], |
| 299 | user=parts['user'], |
| 300 | password=parts['password'], |
| 301 | host=host, |
| 302 | tld=tld, |
| 303 | host_type=host_type, |
| 304 | port=parts['port'], |
| 305 | path=parts['path'], |
| 306 | query=parts['query'], |
| 307 | fragment=parts['fragment'], |
| 308 | ) |
| 309 | |
| 310 | @staticmethod |
| 311 | def _match_url(url: str) -> Optional[Match[str]]: |