Skip to content

Commit

Permalink
fix docs and isort
Browse files Browse the repository at this point in the history
  • Loading branch information
Helveg committed Mar 28, 2024
1 parent 4a1c80f commit 8f68a42
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 45 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ jobs:
- name: Install dependencies & self
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -r requirements.txt --prefer-binary
pip install -e . --no-deps
pip install -e .[test]
pip install bsb-test==4.0.0rc3 --no-deps
- name: Run tests & coverage
run: |
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.9
python-version: 3.11
- name: Install MPI
run: |
sudo apt-get update
sudo apt-get install -y openmpi-bin libopenmpi-dev
- name: Install dependencies
run: |
python -m pip install pip
pip install -r docs/requirements.txt
pip install sphinx==6.2.1
- name: Install self
run: |
pip install -e . --no-deps
python -m pip install pip --upgrade
pip install -e .[docs]
- name: Fail documentations on warnings
run: cd docs && sphinx-build -nW -b html ./source ./build/html
4 changes: 2 additions & 2 deletions bsb_hdf5/chunks.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def get_chunk_path(self, chunk=None, collection=None, key=None):
Return the full HDF5 path of a chunk.
:param chunk: Chunk
:type chunk: :class:`bsb.storage.Chunk`
:type chunk: :class:`bsb.storage._chunks.Chunk`
:returns: HDF5 path
:rtype: str
"""
Expand Down Expand Up @@ -222,7 +222,7 @@ def append(self, chunk, data, key=None, handle=HANDLED):
:param data: Data to append to the chunked property.
:param chunk: Chunk
:type chunk: :class:`bsb.storage.Chunk`
:type chunk: :class:`bsb.storage._chunks.Chunk`
"""
key = key or self.name
if self.insert is not None:
Expand Down
21 changes: 12 additions & 9 deletions bsb_hdf5/connectivity_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import errr
import numpy as np
from bsb import Chunk
from bsb import CellType, Chunk
from bsb import ConnectivitySet as IConnectivitySet
from bsb import DatasetNotFoundError, chunklist

Expand All @@ -25,6 +25,9 @@ class ConnectivitySet(Resource, IConnectivitySet):
to correctly obtain a :class:`~bsb.storage.interfaces.ConnectivitySet`.
"""

pre_type: CellType
post_type: CellType

@handles_handles("r", handler=lambda args: args[1])
def __init__(self, engine, tag, handle=HANDLED):
self.tag = tag
Expand Down Expand Up @@ -337,10 +340,10 @@ def nested_iter_connections(self, direction=None, local_=None, global_=None):
:type direction: str
:param local_: When omitted, iterates over all local chunks in the set. When
given, it restricts the iteration to the given value(s).
:type local_: Union[~bsb.storage.Chunk, list[~bsb.storage.Chunk]]
:type local_: Union[~bsb.storage._chunks.Chunk, list[~bsb.storage._chunks.Chunk]]
:param global_: When omitted, iterates over all global chunks in the set. When
given, it restricts the iteration to the given value(s).
:type global_: Union[~bsb.storage.Chunk, list[~bsb.storage.Chunk]]
:type global_: Union[~bsb.storage._chunks.Chunk, list[~bsb.storage._chunks.Chunk]]
:returns: An iterator that produces the next unrestricted iteration values, or
the connection dataset that matches the iteration combination.
"""
Expand All @@ -363,13 +366,13 @@ def flat_iter_connections(self, direction=None, local_=None, global_=None):
:type direction: str
:param local_: When omitted, iterates over all local chunks in the set. When
given, it restricts the iteration to the given value(s).
:type local_: Union[~bsb.storage.Chunk, list[~bsb.storage.Chunk]]
:type local_: Union[~bsb.storage._chunks.Chunk, list[~bsb.storage._chunks.Chunk]]
:param global_: When omitted, iterates over all global chunks in the set. When
given, it restricts the iteration to the given value(s).
:type global_: Union[~bsb.storage.Chunk, list[~bsb.storage.Chunk]]
:type global_: Union[~bsb.storage._chunks.Chunk, list[~bsb.storage._chunks.Chunk]]
:returns: Yields the direction, local chunk, global chunk, and data. The data is a
tuple of the local and global connection locations.
:rtype: Tuple[str, ~bsb.storage.Chunk, ~bsb.storage.Chunk,
:rtype: Tuple[str, ~bsb.storage._chunks.Chunk, ~bsb.storage._chunks.Chunk,
Tuple[numpy.ndarray, numpy.ndarray]]
"""
itr = CSIterator(self, direction, local_, global_)
Expand All @@ -389,9 +392,9 @@ def load_block_connections(self, direction, local_, global_, handle=HANDLED):
perspective or ``out`` for the outgoing perspective.
:type direction: str
:param local_: Local chunk
:type local_: ~bsb.storage.Chunk
:type local_: ~bsb.storage._chunks.Chunk
:param global_: Global chunk
:type global_: ~bsb.storage.Chunk
:type global_: ~bsb.storage._chunks.Chunk
:param handle: This parameter is injected and doesn't have to be passed.
:returns: The local and global connections locations
:rtype: Tuple[numpy.ndarray, numpy.ndarray]
Expand All @@ -415,7 +418,7 @@ def load_local_connections(self, direction, local_, handle=HANDLED):
perspective or ``out`` for the outgoing perspective.
:type direction: str
:param local_: Local chunk
:type local_: ~bsb.storage.Chunk
:type local_: ~bsb.storage._chunks.Chunk
:param handle: This parameter is injected and doesn't have to be passed.
:returns: The local connection locations, a vector of the global connection chunks
(1 chunk id per connection) and the global connections locations. To identify a
Expand Down
4 changes: 2 additions & 2 deletions bsb_hdf5/file_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from uuid import uuid4

import numpy as np
from bsb.exceptions import MissingActiveConfigError
from bsb.storage.interfaces import FileStore as IFileStore
from bsb import FileStore as IFileStore
from bsb import MissingActiveConfigError

from .resource import Resource

Expand Down
7 changes: 3 additions & 4 deletions bsb_hdf5/morphology_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
import json

import numpy as np
from bsb import Branch, MissingMorphologyError, Morphology
from bsb import MorphologyRepository as IMorphologyRepository
from bsb import MorphologyRepositoryError, StoredMorphology
from bsb._encoding import EncodedLabels
from bsb.exceptions import MissingMorphologyError, MorphologyRepositoryError
from bsb.morphologies import Branch, Morphology
from bsb.storage.interfaces import MorphologyRepository as IMorphologyRepository
from bsb.storage.interfaces import StoredMorphology

from .resource import HANDLED, Resource, handles_handles

Expand Down
18 changes: 9 additions & 9 deletions bsb_hdf5/placement_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
import json

import numpy as np
from bsb import config
from bsb._encoding import EncodedLabels
from bsb.exceptions import (
from bsb import (
Chunk,
DatasetExistsError,
DatasetNotFoundError,
MissingMorphologyError,
MorphologySelector,
MorphologySet,
)
from bsb.morphologies import MorphologySet, RotationSet
from bsb.morphologies.selector import MorphologySelector
from bsb.storage._chunks import Chunk, chunklist
from bsb.storage.interfaces import PlacementSet as IPlacementSet
from bsb import PlacementSet as IPlacementSet
from bsb import RotationSet, chunklist, config
from bsb._encoding import EncodedLabels

from .chunks import ChunkedCollection, ChunkedProperty, ChunkLoader
from .resource import HANDLED, Resource, handles_handles
Expand Down Expand Up @@ -258,7 +258,7 @@ def append_data(
Append data to the placement set.
:param chunk: The chunk to store data in.
:type chunk: ~bsb.storage.Chunk
:type chunk: ~bsb.storage._chunks.Chunk
:param positions: Cell positions
:type positions: :class:`numpy.ndarray`
:param rotations: Cell rotations
Expand Down Expand Up @@ -313,7 +313,7 @@ def append_entities(self, chunk, count, additional=None):
Append entities to the placement set.
:param chunk: The chunk to store data in.
:type chunk: ~bsb.storage.Chunk
:type chunk: ~bsb.storage._chunks.Chunk
:param count: Amount of entities to place. Excludes the use of any positional,
rotational or morphological data.
:type count: int
Expand Down
8 changes: 0 additions & 8 deletions docs/requirements.txt

This file was deleted.

0 comments on commit 8f68a42

Please sign in to comment.