Skip to content

Commit

Permalink
Remove some redundant empty lines from dataset.py which codecov is …
Browse files Browse the repository at this point in the history
…counting as untested
  • Loading branch information
frostedoyster committed May 19, 2024
1 parent 4f1a3f6 commit d88732b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/metatensor/models/utils/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@


class Dataset:
"""A version of the `metatensor.learn.Dataset` class that allows for
"""
A version of the `metatensor.learn.Dataset` class that allows for
the use of `mtm::` prefixes in the keys of the dictionary. See
https://github.com/lab-cosmo/metatensor/issues/621.
Expand All @@ -20,22 +21,18 @@ class Dataset:
"""

def __init__(self, dict: Dict):

new_dict = {}
for key, value in dict.items():
key = key.replace("mtm::", "mtm_")
new_dict[key] = value

self.mts_learn_dataset = metatensor.learn.Dataset(**new_dict)

def __getitem__(self, idx: int) -> Dict:

mts_dataset_item = self.mts_learn_dataset[idx]._asdict()
new_dict = {}
for key, value in mts_dataset_item.items():
key = key.replace("mtm_", "mtm::")
new_dict[key] = value

return new_dict

def __len__(self) -> int:
Expand Down Expand Up @@ -99,7 +96,6 @@ def get_all_species(datasets: Union[Dataset, List[Dataset]]) -> List[int]:
# Remove duplicates and sort:
result = list(set(species))
result.sort()

return result


Expand Down

0 comments on commit d88732b

Please sign in to comment.