Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,18 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: setup mpi
uses: mpi4py/setup-mpi@v1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: setup mpi
uses: mpi4py/setup-mpi@v1
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
cache: poetry
- name: check pyproject.toml
run: cat pyproject.toml

Expand All @@ -47,7 +45,6 @@ jobs:
run: poetry run mypy opencosmo

build-docs:
needs: lint-typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -175,7 +172,6 @@ jobs:
build:
name: build
runs-on: ubuntu-latest
needs: [run-tests, run-parallel-tests, lint-typecheck]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion opencosmo/link/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __init__(
self.__filters = filters

def __repr__(self):
structure_type = self.header.file.data_type.split("_")[0] + "s"
structure_type = self.__header.file.data_type.split("_")[0] + "s"
dtype_str = ", ".join(self.__handlers.keys())
return f"Collection of {structure_type} with linked datasets {dtype_str}"

Expand Down
4 changes: 4 additions & 0 deletions opencosmo/link/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ def open_linked_files(*files: Path):
Open a collection of files that are linked together, such as a
properties file and a particle file.
"""
if len(files) == 1 and isinstance(files[0], list):
return open_linked_files(*files[0])


file_handles = [File(file, "r") for file in files]
headers = [read_header(file) for file in file_handles]
properties_file, linked_files = verify_links(*headers)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "opencosmo"
version = "0.6.0"
version = "0.6.1"
description = "OpenCosmo Python Toolkit"
authors = ["Patrick Wells <pwells@anl.gov>"]
readme = "README.md"
Expand Down
8 changes: 8 additions & 0 deletions test/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ def test_multi_filter(multi_path):
for ds in collection.values():
assert all(ds.data["sod_halo_mass"] > 0)

def test_multi_repr(multi_path):
collection = oc.read(multi_path)
assert isinstance(collection.__repr__(), str)

def test_multi_filter_write(multi_path, tmp_path):
collection = oc.read(multi_path)
Expand Down Expand Up @@ -85,6 +88,11 @@ def test_data_linking(halo_paths):
assert n_particles > 0
assert n_profiles > 0

def test_data_link_repr(halo_paths):
collection = open_linked_files(halo_paths)
assert isinstance(collection.__repr__(), str)



def test_data_link_selection(halo_paths):
collection = open_linked_files(*halo_paths)
Expand Down
4 changes: 4 additions & 0 deletions test/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ def test_all_columns_included(input_path):
def test_read_multi(multi_path):
dataset = oc.read(multi_path)
assert isinstance(dataset, oc.collection.collection.SimulationCollection)

def test_dataset_repr(input_path):
dataset = oc.read(input_path)
assert isinstance(dataset.__repr__(), str)
Loading