omfg i hate this bug so much if this works i'll be so mad

This commit is contained in:
sneakers-the-rat 2023-10-11 22:38:46 -07:00
parent 92b1a6aac0
commit fee86135a3
3 changed files with 4 additions and 17 deletions

View file

@ -328,7 +328,7 @@ class NWBPydanticGenerator(PydanticGenerator):
if not self.split:
# we are compiling this whole thing in one big file so we don't import anything
return {}
if 'is_namespace' in sv.schema.annotations.keys() and sv.schema.annotations['is_namespace']['value'] == 'True':
if 'is_namespace' in sv.schema.annotations.keys() and sv.schema.annotations['is_namespace']['value'] in ('True', True):
return self._get_namespace_imports(sv)
all_classes = sv.all_classes(imports=True)

View file

@ -703,7 +703,7 @@ class PydanticProvider(Provider):
def get(self, namespace: str,
version: Optional[str] = None,
allow_repo: bool = True) -> ModuleType:
allow_repo: Optional[bool] = None) -> ModuleType:
"""
Get the imported module for a given namespace and version.
@ -735,6 +735,8 @@ class PydanticProvider(Provider):
The imported :class:`types.ModuleType` object that has all the built classes at the root level.
"""
if allow_repo is None:
allow_repo = self.allow_repo
if version is None:
version = self.available_versions[namespace][-1]

View file

@ -1,15 +0,0 @@
import pytest
import warnings
def test_hold_up():
from linkml_runtime.linkml_model import SchemaDefinition, Annotation
schema = SchemaDefinition(
id='myschema',
name='myschema',
annotations=[{'tag':'my_annotation','value':True}]
)
warnings.warn('TYPE OF ANNOTATION IS')
warnings.warn(str(type(schema.annotations['my_annotation'].value)))