Skip to content

Commit

Permalink
add pathlib compatibility in sio_io as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor-Schwan committed Oct 24, 2024
1 parent 3119c2b commit cb01730
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions python/podio/sio_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""Python module for reading sio files containing podio Frames"""

from ROOT import gSystem
from root_io import convert_to_str_paths

if gSystem.DynamicPathName("libpodioSioIO.so", True):
gSystem.Load("libpodioSioIO") # noqa: 402
Expand All @@ -20,8 +21,9 @@ def __init__(self, filename):
"""Create a reader that reads from the passed file.
Args:
filename (str): File to open and read data from
filename (str or Path): File to open and read data from.
"""
filename = convert_to_str_paths(filename)
self._reader = podio.SIOReader()
self._reader.openFile(filename)

Expand All @@ -39,8 +41,9 @@ def __init__(self, filename):
"""Create a reader that reads from the passed file.
Args:
filename (str): File to open and read data from
filename (str or Path): File to open and read data from.
"""
filename = convert_to_str_paths(filename)
self._reader = podio.SIOLegacyReader()
self._reader.openFile(filename)
self._is_legacy = True
Expand All @@ -49,13 +52,15 @@ def __init__(self, filename):


class Writer(BaseWriterMixin):
"""Writer class for writing podio root files"""
"""Writer class for writing podio root files."""

def __init__(self, filename):
"""Create a writer for writing files
"""Create a writer for writing files.
Args:
filename (str): The name of the output file
filename (str or Path): The name of the output file.
"""
filename = convert_to_str_paths(filename)
self._writer = podio.SIOWriter(filename)

super().__init__()

0 comments on commit cb01730

Please sign in to comment.