Skip to content

Commit

Permalink
Fix lint and _export->_to_zip
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmetNSimsek committed Feb 1, 2024
1 parent 66d8450 commit 5334047
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion e2e/features/connectivity/test_connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_copy_is_returned():
assert matrix_again.iloc[0, 0] == prev_val


def test_export():
def test_to_zip():
# for now, only test the first feature, given the ci resource concern
feat: RegionalConnectivity = all_conn_instances[0]
feat.to_zip("file.zip")
Expand Down
2 changes: 1 addition & 1 deletion siibra/features/connectivity/regional_connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def _plot_matrix(
f"Plotting connectivity matrices with {backend} is not supported."
)

def _export(self, fh: ZipFile):
def _to_zip(self, fh: ZipFile):
super()._to_zip(fh)
if self.feature is None:
fh.writestr(f"sub/{self._filename}/matrix.csv", self.data.to_csv())
Expand Down
2 changes: 1 addition & 1 deletion siibra/features/dataset/ebrains.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ def __eq__(self, o: object) -> bool:
return False
return self._dataset == o._dataset

def _export(self, fh: ZipFile):
def _to_zip(self, fh: ZipFile):
super()._to_zip(fh)
fh.writestr("doi.md", DOI_TMPL.format(doi=self.url))
4 changes: 2 additions & 2 deletions siibra/features/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def id(self):

def _to_zip(self, fh: ZipFile):
"""
Internal implementation. Subclasses can override but call super()._export(fh).
Internal implementation. Subclasses can override but call super()._to_zip(fh).
This allows all classes in the __mro__ to have the opportunity to append files
of interest.
"""
Expand Down Expand Up @@ -882,7 +882,7 @@ def _get_instance_by_id(cls, feature_id: str, **kwargs):
else:
raise ParseCompoundFeatureIdException

def _export(self, fh: ZipFile):
def _to_zip(self, fh: ZipFile):
super()._to_zip(fh)
for idx, element in siibra_tqdm(self._elements.items(), desc="Exporting elements", unit="element"):
if '/' in str(idx):
Expand Down
2 changes: 1 addition & 1 deletion siibra/features/image/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(
self._description_cached = None
self._name_cached = name

def _export(self, fh: ZipFile):
def _to_zip(self, fh: ZipFile):
super()._to_zip(fh)
# How, what do we download?
# e.g. for marcel's volume, do we download at full resolution?
Expand Down
2 changes: 1 addition & 1 deletion siibra/features/tabular/tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(
def data(self):
return self._data_cached.copy()

def _export(self, fh: ZipFile):
def _to_zip(self, fh: ZipFile):
super()._to_zip(fh)
fh.writestr("tabular.csv", self.data.to_csv())

Expand Down
3 changes: 1 addition & 2 deletions siibra/volumes/parcellationmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
from ..retrieval import requests

import numpy as np
from zipfile import ZipFile
from typing import Union, Dict, List, TYPE_CHECKING, Iterable, Tuple, BinaryIO
from typing import Union, Dict, List, TYPE_CHECKING, Iterable, Tuple
from scipy.ndimage import distance_transform_edt
from collections import defaultdict
from nilearn import image
Expand Down

0 comments on commit 5334047

Please sign in to comment.