mirror of
https://github.com/p2p-ld/nwb-linkml.git
synced 2024-11-10 00:34:29 +00:00
lint
This commit is contained in:
parent
2f59f0a69b
commit
bf7f62fd8f
4 changed files with 14 additions and 5 deletions
|
@ -18,6 +18,7 @@ for its domain.
|
||||||
- so **providers** are the things that manage the multistage build process given some cache of
|
- 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.
|
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 :)
|
# ruff: noqa: I001 - import order necessary to avoid circular imports :)
|
||||||
from nwb_linkml.providers.provider import Provider
|
from nwb_linkml.providers.provider import Provider
|
||||||
from nwb_linkml.providers.linkml import LinkMLProvider
|
from nwb_linkml.providers.linkml import LinkMLProvider
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
"""
|
||||||
|
Provider for LinkML schema built from NWB schema
|
||||||
|
"""
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, Optional, TypedDict
|
from typing import Dict, Optional, TypedDict
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
"""
|
||||||
|
Base provider class
|
||||||
|
"""
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
@ -116,6 +120,7 @@ class Provider(ABC):
|
||||||
Dictionary mapping a namespace to a list of built versions
|
Dictionary mapping a namespace to a list of built versions
|
||||||
"""
|
"""
|
||||||
from nwb_linkml.providers import LinkMLProvider
|
from nwb_linkml.providers import LinkMLProvider
|
||||||
|
|
||||||
versions = {} # type: Dict[str, List[Path]]
|
versions = {} # type: Dict[str, List[Path]]
|
||||||
|
|
||||||
# first get any builtins provided by the package itself
|
# first get any builtins provided by the package itself
|
||||||
|
@ -159,5 +164,3 @@ class Provider(ABC):
|
||||||
for k, v_paths in versions.items()
|
for k, v_paths in versions.items()
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Provider for pydantic models.
|
Provider for pydantic models.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
import sys
|
import sys
|
||||||
from importlib.abc import MetaPathFinder
|
from importlib.abc import MetaPathFinder
|
||||||
|
@ -100,8 +101,8 @@ class PydanticProvider(Provider):
|
||||||
# we're given a name of a namespace to build
|
# we're given a name of a namespace to build
|
||||||
name = namespace
|
name = namespace
|
||||||
path = (
|
path = (
|
||||||
LinkMLProvider(path=self.config.cache_dir).namespace_path(namespace, version)
|
LinkMLProvider(path=self.config.cache_dir).namespace_path(namespace, version)
|
||||||
/ "namespace.yaml"
|
/ "namespace.yaml"
|
||||||
)
|
)
|
||||||
if version is None:
|
if version is None:
|
||||||
# Get the most recently built version
|
# Get the most recently built version
|
||||||
|
@ -201,7 +202,7 @@ class PydanticProvider(Provider):
|
||||||
|
|
||||||
return serialized
|
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.
|
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)
|
(ig this could be generalized in depth but lets not go nuts in here with the nesting)
|
||||||
|
|
Loading…
Reference in a new issue