Get the instance to handle a request. If instance_id is provided, resolves via 5-stage matching. Otherwise, returns the default instance. Raises: AmbiguousInstanceError: When instance_id matches multiple instances.
(self, instance_id: str | None = None)
| 452 | return self._fuzzy_match(query) |
| 453 | |
| 454 | def get_instance_for_request(self, instance_id: str | None = None) -> UnityInstance | None: |
| 455 | """Get the instance to handle a request. |
| 456 | |
| 457 | If instance_id is provided, resolves via 5-stage matching. |
| 458 | Otherwise, returns the default instance. |
| 459 | |
| 460 | Raises: |
| 461 | AmbiguousInstanceError: When instance_id matches multiple instances. |
| 462 | """ |
| 463 | if instance_id: |
| 464 | return self._resolve_instance(instance_id) |
| 465 | return self.get_default() |
| 466 | |
| 467 | @property |
| 468 | def count(self) -> int: |