Skip to content

Commit

Permalink
Merge pull request #379 from yarikoptic/bf-codespell
Browse files Browse the repository at this point in the history
Make codespell happy again: afile -> f, ignore typoed line in CHANGELOG
  • Loading branch information
yarikoptic authored Jul 24, 2023
2 parents 02199f4 + fff2298 commit 61844b2
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 14 deletions.
1 change: 1 addition & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[codespell]
skip = .git,*.pdf,*.svg,*.js,*.ttl
ignore-regex = Splitted.*is not a word
# Commun - abbreviation in publication venue
# nd - some css within .rst
# Groth - name
Expand Down
20 changes: 20 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ your user space and use the pull request GitHub feature to submit code for
review. Please provide a reasonably detailed description of what was changed
and why in the pull request.

To establish development environment, we recommend to install the
clone of this repository in development mode with development tools
installed via

.. code:: bash
$ pip install -e .[devel]
We also recommend using
`pre-commit <https://github.com/pre-commit/pre-commit>`_ for ensuring
that your contributions would conform our conventions for code quality
etc. You can enable ``pre-commit`` by running once in your clone

.. code:: bash
$ pre-commit install
which would then ensure that all commits would be subject to `black
<https://pypi.org/project/black/>`_ code reformatting etc.

Reporting Issues or Problems
============================
If you encounter a bug, you can directly report it in the issues section.
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ install_requires =
tools =
matplotlib
seaborn
devel =
pytest
pre-commit

[options.packages.find]
where = src
Expand Down
1 change: 0 additions & 1 deletion src/nidm/experiment/Project.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def add_dataelements(self, dataelement):
# dataelement.add_attributes({pm.QualifiedName(pm.Namespace("dct", Constants.DCT), 'isPartOf'): self})
return True


def __str__(self):
return "NIDM-Experiment Project Class"

Expand Down
6 changes: 3 additions & 3 deletions src/nidm/experiment/Query.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,11 +1356,11 @@ def OpenGraph(file):

BLOCKSIZE = 65536
hasher = hashlib.md5()
with open(file, "rb") as afile:
buf = afile.read(BLOCKSIZE)
with open(file, "rb") as f:
buf = f.read(BLOCKSIZE)
while len(buf) > 0:
hasher.update(buf)
buf = afile.read(BLOCKSIZE)
buf = f.read(BLOCKSIZE)
digest = hasher.hexdigest()

pickle_file = f"{tempfile.gettempdir()}/rdf_graph.{digest}.pickle"
Expand Down
26 changes: 16 additions & 10 deletions src/nidm/experiment/tools/bidsmri2nidm.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
Project,
Session,
)
from nidm.experiment.Core import getUUID
from nidm.experiment.Utils import (
add_attributes_with_cde,
addGitAnnexSources,
map_variables_to_terms,
)
from nidm.experiment.Core import getUUID


def getRelPathToBIDS(filepath, bids_root):
Expand Down Expand Up @@ -231,7 +231,13 @@ def addbidsignore(directory, filename_to_add):


def addimagingsessions(
bids_layout, subject_id, session, participant, directory, collection, img_session=None
bids_layout,
subject_id,
session,
participant,
directory,
collection,
img_session=None,
):
"""
This function adds imaging acquistions to the NIDM file and deals with BIDS structures potentially having
Expand Down Expand Up @@ -992,15 +998,15 @@ def bidsmri2project(directory, args):
provgraph = project.getGraph()
collection = provgraph.collection(Constants.NIIRI[getUUID()])
# 7/22/23 add type as bids:Dataset
collection.add_attributes({PROV_TYPE: QualifiedName(
Namespace("bids", Constants.BIDS), "Dataset"
)})
collection.add_attributes(
{PROV_TYPE: QualifiedName(Namespace("bids", Constants.BIDS), "Dataset")}
)

# if there are git annex sources then add them
num_sources = addGitAnnexSources(obj=project.get_uuid(), bids_root=directory)
# else just add the local path to the dataset
#if num_sources == 0:
# 7/22/23 - modified to add location attribute to collection of acquisition objects
# if num_sources == 0:
# 7/22/23 - modified to add location attribute to collection of acquisition objects
# collection.add_attributes({Constants.PROV["Location"]: "file:/" + directory})

# add various attributes if they exist in BIDS dataset description file
Expand Down Expand Up @@ -1163,7 +1169,7 @@ def bidsmri2project(directory, args):
acq_entity = AssessmentObject(acquisition=acq)

# Modified 7/22/23 to add acq_entity to collection
provgraph.hadMember(collection,acq_entity)
provgraph.hadMember(collection, acq_entity)

# create participant dictionary indexed by subjid to get agen UUIDs for later use
participant[subjid] = {}
Expand Down Expand Up @@ -1490,7 +1496,7 @@ def bidsmri2project(directory, args):
)
# else just add the local path to the dataset
# 7/22/23 commented out to not add local source if no gitAnnex source found
#if num_sources == 0:
# if num_sources == 0:
# acq_entity.add_attributes(
# {Constants.PROV["Location"]: "file:/" + tsv_file}
# )
Expand Down Expand Up @@ -1527,7 +1533,7 @@ def bidsmri2project(directory, args):
)
# else just add the local path to the dataset
# 7/22/23 commented out so local source file isn't stored if no gitAnnex sources
#if num_sources == 0:
# if num_sources == 0:
# json_entity.add_attributes(
# {Constants.PROV["Location"]: "file:/" + data_dict}
# )
Expand Down

0 comments on commit 61844b2

Please sign in to comment.