MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / _resolve_instance

Method _resolve_instance

relay/instance_registry.py:438–452  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 1

Calls 3

_resolve_by_ref_idMethod · 0.95
_fuzzy_matchMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected