Skip to content

Commit

Permalink
Fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzhenqi77 committed May 22, 2024
1 parent a25bf87 commit 916d556
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
1 change: 0 additions & 1 deletion neuromaps/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@
from .annotations import (
available_annotations, available_tags, fetch_annotation
)

9 changes: 5 additions & 4 deletions neuromaps/datasets/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,13 @@ def fetch_annotation(*, source=None, desc=None, space=None, den=None, res=None,

# get meta_id for each dataset
meta_ids, matched_meta = _matched_to_meta(info)

# warning for specific maps
if verbose > 0:
for _id, entry in zip(meta_ids, matched_meta):
if "warning" in entry:
print(f"[Warning] for {_id}: {entry['warning']}")

# print references
if verbose > 0:
print(
Expand Down Expand Up @@ -381,7 +381,6 @@ def describe_annotations(annots, format="plaintext"):
print(" Secondary references:")
for ref in row["refs.secondary"]:
print(f" ({ref['bibkey']}) {ref['citation']}")
return None
elif format == "dataframe":
return df_annot_info[[
"annot.key", "full_desc",
Expand All @@ -407,9 +406,11 @@ def describe_annotations(annots, format="plaintext"):
f"{i + 1} "
f"& {row['annot.source']} & {row['annot.desc']} "
f"& {row['annot.space']} & {row['annot.denres']} "
f"& {row['full_desc']} & \citep{{{','.join(refs)}}} "
rf"& {row['full_desc']} & \citep{{{','.join(refs)}}} "
"\\\\"
)
else:
raise ValueError("Invalid format. Must be one of 'plaintext', "
"'dataframe', or 'latex'.")

return None
3 changes: 1 addition & 2 deletions neuromaps/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def _check_meta_json():
def _fill_meta_json_refs(bib_file, json_file, overwrite=False, use_defaults=False):
"""
Fill in citation information for references in a JSON file.
For internal use only.
Parameters
Expand Down Expand Up @@ -462,4 +462,3 @@ def _get_citation(key):

with open(json_file, "w") as dst:
json.dump(nm_meta, dst, indent=4)

6 changes: 3 additions & 3 deletions neuromaps/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def fix_coordsys(fn, val=3):

def load_nifti(img):
"""
Load nifti file `img`.
Load nifti file `img`.
If `img` is already a loaded (i.e. is a nib.Nifti1Image object),
it is returned as-is.
Expand Down Expand Up @@ -203,7 +203,7 @@ def load_data(data):
# niimg_like or path_like (nifti)
if (isinstance(err, AttributeError)
or (
"os.PathLike" in str(err)
"os.PathLike" in str(err)
and "not Nifti1Image" in str(err)
)
):
Expand Down
2 changes: 1 addition & 1 deletion neuromaps/tests/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def test_register_cmap():
if "caret_blueorange" in matplotlib.colormaps:
assert True
else:
assert False
assert False
11 changes: 8 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ test = [
requires = ["setuptools", "versioneer[toml]"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages]
find = {}

[tool.setuptools.package-data]
"*" = ["*.json", "*.bib"]

[tool.setuptools.dynamic]
version = {attr = "neuromaps.__version__"}

Expand All @@ -84,11 +90,10 @@ exclude = [
target-version = "py38"

[tool.ruff.lint]
select = ["E", "F", "B", "D", "NPY"]
select = ["E", "F", "B", "W", "D", "NPY"]
ignore = [
"E402"
"E402" # Module level import not at top of cell
]
extend-select = ["E302"]
preview = true

[tool.ruff.lint.pydocstyle]
Expand Down

0 comments on commit 916d556

Please sign in to comment.