This commit is contained in:
sneakers-the-rat 2024-07-09 23:54:28 -07:00
parent 2f59f0a69b
commit bf7f62fd8f
Signed by untrusted user who does not match committer: jonny
GPG key ID: 6DCB96EF1E4D232D
4 changed files with 14 additions and 5 deletions

View file

@ -18,6 +18,7 @@ for its domain.
- so **providers** are the things that manage the multistage build process given some cache of
the stages so that you can go like "gimme model i want my model" and you will probably get it.
"""
# ruff: noqa: I001 - import order necessary to avoid circular imports :)
from nwb_linkml.providers.provider import Provider
from nwb_linkml.providers.linkml import LinkMLProvider

View file

@ -1,3 +1,7 @@
"""
Provider for LinkML schema built from NWB schema
"""
import shutil
from pathlib import Path
from typing import Dict, Optional, TypedDict

View file

@ -1,3 +1,7 @@
"""
Base provider class
"""
import importlib
import os
from abc import ABC, abstractmethod
@ -116,6 +120,7 @@ class Provider(ABC):
Dictionary mapping a namespace to a list of built versions
"""
from nwb_linkml.providers import LinkMLProvider
versions = {} # type: Dict[str, List[Path]]
# first get any builtins provided by the package itself
@ -159,5 +164,3 @@ class Provider(ABC):
for k, v_paths in versions.items()
}
return res

View file

@ -1,6 +1,7 @@
"""
Provider for pydantic models.
"""
import importlib
import sys
from importlib.abc import MetaPathFinder
@ -100,8 +101,8 @@ class PydanticProvider(Provider):
# we're given a name of a namespace to build
name = namespace
path = (
LinkMLProvider(path=self.config.cache_dir).namespace_path(namespace, version)
/ "namespace.yaml"
LinkMLProvider(path=self.config.cache_dir).namespace_path(namespace, version)
/ "namespace.yaml"
)
if version is None:
# Get the most recently built version
@ -201,7 +202,7 @@ class PydanticProvider(Provider):
return serialized
def _make_inits(self, out_file: Path):
def _make_inits(self, out_file: Path) -> None:
"""
Make __init__.py files for the directory a model is output to and its immediate parent.
(ig this could be generalized in depth but lets not go nuts in here with the nesting)