Resolve an instance by 5-stage matching. Priority: ref_id → exact id → exact name → path suffix → name prefix. Each stage: 1 match → return, multiple → AmbiguousInstanceError, 0 → next.
(self, query: str)
| 436 | return self._unique_match([i for i in all_inst if i.project_name.startswith(query)], query) |
| 437 | |
| 438 | def _resolve_instance(self, query: str) -> UnityInstance | None: |
| 439 | """Resolve an instance by 5-stage matching. |
| 440 | |
| 441 | Priority: ref_id → exact id → exact name → path suffix → name prefix. |
| 442 | Each stage: 1 match → return, multiple → AmbiguousInstanceError, 0 → next. |
| 443 | """ |
| 444 | ref_match = self._resolve_by_ref_id(query) |
| 445 | if ref_match: |
| 446 | return ref_match |
| 447 | |
| 448 | exact = self._instances.get(query) |
| 449 | if exact: |
| 450 | return exact |
| 451 | |
| 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. |
no test coverage detected