# Path: argos/utils/cls.py
# def check_class(obj, target_class, allow_none = False):
#     """ Checks that the  obj is a (sub)type of target_class.
#         Raises a TypeError if this is not the case.
# 
#         :param obj: object whos type is to be checked
#         :type obj: any type
#         :param target_class: target type/class
#         :type target_class: any class or type
#         :param allow_none: if true obj may be None
#         :type allow_none: boolean
#     """
#     if not isinstance(obj, target_class):
#         if not (allow_none and obj is None):
#             raise TypeError("obj must be a of type {}, got: {}"
#                             .format(target_class, type(obj)))
# 
# def is_an_array(var, allow_none=False):
#     """ Returns True if var is a numpy array.
#     """
#     return isinstance(var, np.ndarray) or (var is None and allow_none)
# 
# def check_is_an_array(var, allow_none=False):
#     """ Calls is_an_array and raises a type error if the check fails.
#     """
#     if not is_an_array(var, allow_none=allow_none):
#         raise TypeError("var must be a NumPy array, however type(var) is {}"
#                         .format(type(var)))
# 
# def array_is_structured(array):
#     """ Returns True if the array has a structured data type.
#     """
#     return bool(array.dtype.names)


import logging
import numpy as np
import numpy.ma as ma
from argos.utils.cls import check_class, is_an_array, check_is_an_array, array_is_structured


    @property
    def shape(self):
        """ Convenience method, returns the shape of the data.
        """
        return self.data.shape


    @property
    def dtype(self):
        """ Convenience method, returns the dtype of the data.
        """
        return self.data.dtype


    def __getitem__(self, index):
        """ Called when using the awm with an index (e.g. rti[0]).
        """
        newMask = self.mask if isinstance(self.mask, bool) else self.maskIndex()[index]
        return ArrayWithMask(self.data[index], newMask, fill_value=self.fill_value)


    def transpose(self, *args, **kwargs):
        """ Transposes the array and mask separately

            :param awm: ArrayWithMask
            :return: copy/view with transposed
        """
        tdata = np.transpose(self.data, *args, **kwargs)

# Path: argos/utils/cls.py
# def check_class(obj, target_class, allow_none = False):
#     """ Checks that the  obj is a (sub)type of target_class.
#         Raises a TypeError if this is not the case.
# 
#         :param obj: object whos type is to be checked
#         :type obj: any type
#         :param target_class: target type/class
#         :type target_class: any class or type
#         :param allow_none: if true obj may be None
#         :type allow_none: boolean
#     """
#     if not isinstance(obj, target_class):
#         if not (allow_none and obj is None):
#             raise TypeError("obj must be a of type {}, got: {}"
#                             .format(target_class, type(obj)))
# 
# def is_an_array(var, allow_none=False):
#     """ Returns True if var is a numpy array.
#     """
#     return isinstance(var, np.ndarray) or (var is None and allow_none)
# 
# def check_is_an_array(var, allow_none=False):
#     """ Calls is_an_array and raises a type error if the check fails.
#     """
#     if not is_an_array(var, allow_none=allow_none):
#         raise TypeError("var must be a NumPy array, however type(var) is {}"
#                         .format(type(var)))
# 
# def array_is_structured(array):
#     """ Returns True if the array has a structured data type.
#     """
#     return bool(array.dtype.names)


# Path: argos/utils/masks.py
import logging
import numpy as np
import numpy.ma as ma
from argos.utils.cls import check_class, is_an_array, check_is_an_array, array_is_structured



    @property
    def shape(self):
        """ Convenience method, returns the shape of the data.
        """
        return self.data.shape


    @property
    def dtype(self):
        """ Convenience method, returns the dtype of the data.
        """
        return self.data.dtype


    def __getitem__(self, index):
        """ Called when using the awm with an index (e.g. rti[0]).
        """
        newMask = self.mask if isinstance(self.mask, bool) else self.maskIndex()[index]
        return ArrayWithMask(self.data[index], newMask, fill_value=self.fill_value)


    def transpose(self, *args, **kwargs):
        """ Transposes the array and mask separately

            :param awm: ArrayWithMask
            :return: copy/view with transposed
        """
        tdata = np.transpose(self.data, *args, **kwargs)

        tmask = np.transpose(self.mask, *args, **kwargs) if is_an_array(self.mask) else self.mask