Skip to content

Commit

Permalink
fix(stubs): utilize absolute names in stub search results.
Browse files Browse the repository at this point in the history
  • Loading branch information
BradenM committed Dec 11, 2022
1 parent 142648d commit 6c81a93
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions micropy/stubs/stubs.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
from __future__ import annotations

import json
import shutil
from pathlib import Path
from typing import TYPE_CHECKING

from micropy import data, utils
from micropy.exceptions import StubError, StubValidationError
from micropy.logger import Log
from micropy.stubs import source

if TYPE_CHECKING:
from micropy.stubs.repo import StubRepository


class StubManager:
"""Manages a collection of Stubs.
Expand All @@ -24,6 +30,8 @@ class StubManager:
"""

repos: list[StubRepository]

_schema = data.SCHEMAS / "stubs.json"
_firm_schema = data.SCHEMAS / "firmware.json"

Expand Down Expand Up @@ -359,8 +367,9 @@ def search_remote(self, query):
installed = [str(s) for s in self._loaded.union(self._firmware)]
for repo in self.repos:
for p in repo.search(query):
results.append((p, p in installed))
return sorted(results)
result = (p.absolute_name, p in installed)
results.append(result)
return results

def resolve_subresource(self, stubs, subresource):
"""Resolve or Create StubManager from list of stubs.
Expand Down

0 comments on commit 6c81a93

Please sign in to comment.