Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.2
hooks:
- id: ruff
- id: ruff-check
# - repo: https://github.com/econchick/interrogate
# rev: 1.5.0
# hooks:
Expand Down
12 changes: 7 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies = [
'numpy>=1.19.3',
"pandas>=1.2.0",
"ruamel.yaml>=0.16",
"pydantic>=2.0.0",
]
dynamic = ["version"]

Expand Down Expand Up @@ -84,6 +85,7 @@ min-reqs = [
"numpy==1.19.3",
"pandas==1.2.0",
"ruamel.yaml==0.16.0",
"pydantic==2.0.0",
"scipy==1.7.0",
"tqdm==4.41.0",
"zarr==2.12.0",
Expand Down Expand Up @@ -151,11 +153,11 @@ omit = [
"*/hdmf/testing/*",
]

# [tool.black]
# line-length = 120
# preview = true
# exclude = ".git|.mypy_cache|.tox|.venv|venv|.ipynb_checkpoints|_build/|dist/|__pypackages__|.ipynb"
# force-exclude = "src/hdmf/common/hdmf-common-schema|docs/gallery"
[tool.black]
line-length = 120
preview = true
exclude = ".git|.mypy_cache|.tox|.venv|venv|.ipynb_checkpoints|_build/|dist/|__pypackages__|.ipynb"
force-exclude = "src/hdmf/common/hdmf-common-schema|docs/gallery"

[tool.ruff]
lint.select = ["E", "F", "T100", "T201", "T203", "C901"]
Expand Down
5 changes: 2 additions & 3 deletions src/hdmf/build/classgenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import numpy as np

from ..container import Container, Data, MultiContainerInterface
from ..spec import AttributeSpec, LinkSpec, RefSpec, GroupSpec
from ..spec.spec import BaseStorageSpec, ZERO_OR_MANY, ONE_OR_MANY
from ..spec import AttributeSpec, LinkSpec, RefSpec, GroupSpec, BaseStorageSpec
from ..utils import docval, getargs, ExtenderMeta, get_docval, popargs, AllowPositional


Expand Down Expand Up @@ -379,7 +378,7 @@ class MCIClassGenerator(CustomClassGenerator):
@classmethod
def apply_generator_to_field(cls, field_spec, bases, type_map):
"""Return True if the field spec has quantity * or +, False otherwise."""
return getattr(field_spec, 'quantity', None) in (ZERO_OR_MANY, ONE_OR_MANY)
return isinstance(field_spec, (BaseStorageSpec, LinkSpec)) and field_spec.is_many()

@classmethod
def process_field_spec(cls, classdict, docval_args, parent_cls, attr_name, not_inherited_fields, type_map, spec):
Expand Down
3 changes: 1 addition & 2 deletions src/hdmf/build/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
from .classgenerator import ClassGeneratorManager, CustomClassGenerator, MCIClassGenerator
from ..container import AbstractContainer, Container, Data
from ..term_set import TypeConfigurator
from ..spec import DatasetSpec, GroupSpec, NamespaceCatalog, RefSpec
from ..spec.spec import BaseStorageSpec
from ..spec import BaseStorageSpec, DatasetSpec, GroupSpec, NamespaceCatalog, RefSpec
from ..utils import docval, getargs, ExtenderMeta, get_docval


Expand Down
3 changes: 1 addition & 2 deletions src/hdmf/build/objectmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
from ..term_set import TermSetWrapper
from ..data_utils import DataIO, AbstractDataChunkIterator
from ..query import ReferenceResolver
from ..spec import Spec, AttributeSpec, DatasetSpec, GroupSpec, LinkSpec, RefSpec
from ..spec.spec import BaseStorageSpec
from ..spec import BaseStorageSpec, Spec, AttributeSpec, DatasetSpec, GroupSpec, LinkSpec, RefSpec
from ..utils import docval, getargs, ExtenderMeta, get_docval, get_data_shape, StrDataset

_const_arg = '__constructor_arg'
Expand Down
8 changes: 6 additions & 2 deletions src/hdmf/spec/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from .catalog import SpecCatalog
from .namespace import NamespaceCatalog, SpecNamespace, SpecReader
from .spec import (AttributeSpec, DatasetSpec, DtypeHelper, DtypeSpec, GroupSpec, LinkSpec,
NAME_WILDCARD, RefSpec, Spec)
# from .spec import (AttributeSpec, DatasetSpec, DtypeHelper, DtypeSpec, GroupSpec, LinkSpec,
# NAME_WILDCARD, RefSpec, Spec)
from .spec2 import (
AttributeSpec, DatasetSpec, DtypeHelper, DtypeSpec, GroupSpec, LinkSpec, RefSpec, Spec, BaseStorageSpec,
QuantityEnum
)
from .write import NamespaceBuilder, SpecWriter, export_spec
2 changes: 1 addition & 1 deletion src/hdmf/spec/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import warnings
from collections import OrderedDict

from .spec import BaseStorageSpec, GroupSpec
from .spec2 import BaseStorageSpec, GroupSpec
from ..utils import docval, getargs


Expand Down
6 changes: 3 additions & 3 deletions src/hdmf/spec/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import graphlib

from .catalog import SpecCatalog
from .spec import DatasetSpec, GroupSpec, BaseStorageSpec
from .spec2 import DatasetSpec, GroupSpec, BaseStorageSpec
from ..utils import docval, getargs, popargs, get_docval, is_newer_version

_namespace_args = [
Expand Down Expand Up @@ -567,9 +567,9 @@ def __register_type(self, ndt, inc_ns, catalog, registered_types):
spec_file = inc_ns.catalog.get_spec_source_file(ndt)
self.__register_dependent_types(spec, inc_ns, catalog, registered_types)
if isinstance(spec, DatasetSpec):
built_spec = self.dataset_spec_cls.build_spec(spec)
built_spec = spec # TODO self.dataset_spec_cls.build_spec(spec)
else:
built_spec = self.group_spec_cls.build_spec(spec)
built_spec = spec # TODO self.group_spec_cls.build_spec(spec)
registered_types.add(ndt)
catalog.register_spec(built_spec, spec_file)

Expand Down
Loading
Loading