Skip to content

Commit

Permalink
feat(main): drop in new StubRepository impl in place of StubRepo.
Browse files Browse the repository at this point in the history
  • Loading branch information
BradenM committed Dec 11, 2022
1 parent c28d988 commit 25f0402
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions micropy/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Main Module."""

from __future__ import annotations

import tempfile
from pathlib import Path

Expand All @@ -9,7 +11,8 @@
from micropy.logger import Log
from micropy.project import Project, modules
from micropy.pyd import DevicePath, MessageHandlers, ProgressStreamConsumer, PyDevice
from micropy.stubs import StubManager, source
from micropy.stubs import RepositoryInfo, StubManager, StubRepository
from pydantic import parse_file_as


class MicroPy:
Expand Down Expand Up @@ -39,9 +42,11 @@ def stubs(self):
StubManager: StubManager Instance
"""
repo_list = data.REPO_SOURCES.read_text()
repos = source.StubRepo.from_json(repo_list)
return StubManager(resource=data.STUB_DIR, repos=repos)
repo_list = parse_file_as(list[RepositoryInfo], data.REPO_SOURCES)
repo = StubRepository()
for repo_info in repo_list:
repo.add_repository(repo_info)
return StubManager(resource=data.STUB_DIR, repos=[repo])

@utils.lazy_property
def project(self):
Expand Down

0 comments on commit 25f0402

Please sign in to comment.