# Path: pywr/h5tools.py
# class H5Store(object):
#     def __init__(
#         self,
#         filename,
#         filter_kwds=None,
#         mode="r",
#         title="",
#         metadata=None,
#         create_directories=False,
#     ):
#         self._opened = False
#         if isinstance(filename, (str, os.PathLike)):
#             # filename is a path to open
#             self.filename = filename
#             # Note sure how else to deal with str / unicode requirements in pytables
#             # See this issue: https://github.com/PyTables/PyTables/issues/522
#             import sys
# 
#             if filter_kwds:
#                 if sys.version_info[0] == 2 and "complib" in filter_kwds:
#                     filter_kwds["complib"] = filter_kwds["complib"].encode()
#                 filters = tables.Filters(**filter_kwds)
#             else:
#                 filters = None
# 
#             # Create directories for the filename if required
#             if create_directories:
#                 try:
#                     os.makedirs(os.path.dirname(filename))
#                 except OSError as exception:
#                     import errno
# 
#                     if exception.errno != errno.EEXIST:
#                         raise
# 
#             self.file = tables.open_file(
#                 filename, mode=mode, filters=filters, title=title
#             )
#             self._opened = True
#         elif isinstance(filename, tables.File):
#             # filename is a pytables file
#             self.file = filename
#             assert self.file.isopen
#             self.filename = self.file.filename
#             self._opened = False
#         else:
#             raise TypeError(
#                 f"{self.__class__.__name__} must be initialised with a filename to open or "
#                 f"an open tables.File"
#             )
# 
#         # now update metadata if given
#         if metadata is not None and self.file.mode != "r":
#             for k, v in metadata.items():
#                 setattr(self.file.root._v_attrs, k, v)
# 
#     def __del__(self):
#         if self._opened and self.file.isopen:
#             self.file.close()
# 
# Path: pywr/parameter_property.py
# def parameter_property(private_name):
#     """Factory for parameter properties
# 
#     This property handles adding/removing parameters from the tree.
# 
#     Usage
#     =====
# 
#     class NewParameter(Parameter):
#         control_curve = parameter_property("_control_curve")
#     """
# 
#     def parameter():
#         def fget(self):
#             return getattr(self, private_name)
# 
#         def fset(self, parameter):
#             old_parameter = getattr(self, private_name)
#             if old_parameter:
#                 self.children.remove(old_parameter)
#             self.children.add(parameter)
#             setattr(self, private_name, parameter)
# 
#         return {"fget": fget, "fset": fset}
# 
#     parameter = property(**parameter())
#     return parameter


import sys
import pandas
import numpy as np
import warnings
        import os
        import csv
            import gzip
            import bz2
        import os
        import tables
        import tables
from functools import wraps
from pywr._core import AbstractNode, AbstractStorage
from ._recorders import *
from ._thresholds import *
from ._hydropower import *
from .events import *
from .calibration import *
from .kde import *
from pywr.h5tools import H5Store
from ..parameter_property import parameter_property
            from ..parameters import load_parameter
        from pywr.parameters import IndexParameter
        from pywr._core import AbstractNode, AbstractStorage
        from pywr.parameters import Parameter, IndexParameter

    def __init__(
        self,
        model,
        parameter,
        expected_data=None,
        expected_func=None,
        get_index=False,
        **kwargs,
    ):
        """
        Parameters
        ----------
        model : pywr.model.Model
        parameter : pywr.parameters.Parameter
        expected_data : np.ndarray[timestep, scenario] (optional)
        expected_func : function
        get_index : bool

        See also
        --------
        pywr.recorders.assert_rec
        """
        super(AssertionRecorder, self).__init__(model, **kwargs)
        self._parameter = None
        self.parameter = parameter
        self.expected_data = expected_data
        self.expected_func = expected_func
        self.get_index = get_index


# Path: pywr/h5tools.py
# class H5Store(object):
#     def __init__(
#         self,
#         filename,
#         filter_kwds=None,
#         mode="r",
#         title="",
#         metadata=None,
#         create_directories=False,
#     ):
#         self._opened = False
#         if isinstance(filename, (str, os.PathLike)):
#             # filename is a path to open
#             self.filename = filename
#             # Note sure how else to deal with str / unicode requirements in pytables
#             # See this issue: https://github.com/PyTables/PyTables/issues/522
#             import sys
# 
#             if filter_kwds:
#                 if sys.version_info[0] == 2 and "complib" in filter_kwds:
#                     filter_kwds["complib"] = filter_kwds["complib"].encode()
#                 filters = tables.Filters(**filter_kwds)
#             else:
#                 filters = None
# 
#             # Create directories for the filename if required
#             if create_directories:
#                 try:
#                     os.makedirs(os.path.dirname(filename))
#                 except OSError as exception:
#                     import errno
# 
#                     if exception.errno != errno.EEXIST:
#                         raise
# 
#             self.file = tables.open_file(
#                 filename, mode=mode, filters=filters, title=title
#             )
#             self._opened = True
#         elif isinstance(filename, tables.File):
#             # filename is a pytables file
#             self.file = filename
#             assert self.file.isopen
#             self.filename = self.file.filename
#             self._opened = False
#         else:
#             raise TypeError(
#                 f"{self.__class__.__name__} must be initialised with a filename to open or "
#                 f"an open tables.File"
#             )
# 
#         # now update metadata if given
#         if metadata is not None and self.file.mode != "r":
#             for k, v in metadata.items():
#                 setattr(self.file.root._v_attrs, k, v)
# 
#     def __del__(self):
#         if self._opened and self.file.isopen:
#             self.file.close()
# 
# Path: pywr/parameter_property.py
# def parameter_property(private_name):
#     """Factory for parameter properties
# 
#     This property handles adding/removing parameters from the tree.
# 
#     Usage
#     =====
# 
#     class NewParameter(Parameter):
#         control_curve = parameter_property("_control_curve")
#     """
# 
#     def parameter():
#         def fget(self):
#             return getattr(self, private_name)
# 
#         def fset(self, parameter):
#             old_parameter = getattr(self, private_name)
#             if old_parameter:
#                 self.children.remove(old_parameter)
#             self.children.add(parameter)
#             setattr(self, private_name, parameter)
# 
#         return {"fget": fget, "fset": fset}
# 
#     parameter = property(**parameter())
#     return parameter


# Path: pywr/recorders/recorders.py
import sys
import pandas
import numpy as np
import warnings
        import os
        import csv
            import gzip
            import bz2
        import os
        import tables
        import tables
from functools import wraps
from pywr._core import AbstractNode, AbstractStorage
from ._recorders import *
from ._thresholds import *
from ._hydropower import *
from .events import *
from .calibration import *
from .kde import *
from pywr.h5tools import H5Store
from ..parameter_property import parameter_property
            from ..parameters import load_parameter
        from pywr.parameters import IndexParameter
        from pywr._core import AbstractNode, AbstractStorage
        from pywr.parameters import Parameter, IndexParameter


    def __init__(
        self,
        model,
        parameter,
        expected_data=None,
        expected_func=None,
        get_index=False,
        **kwargs,
    ):
        """
        Parameters
        ----------
        model : pywr.model.Model
        parameter : pywr.parameters.Parameter
        expected_data : np.ndarray[timestep, scenario] (optional)
        expected_func : function
        get_index : bool

        See also
        --------
        pywr.recorders.assert_rec
        """
        super(AssertionRecorder, self).__init__(model, **kwargs)
        self._parameter = None
        self.parameter = parameter
        self.expected_data = expected_data
        self.expected_func = expected_func
        self.get_index = get_index


    parameter = parameter_property("_parameter")