# Path: zfs_autobackup/CachedProperty.py
# class CachedProperty(object):
#     """ A property that is only computed once per instance and
#     then stores the result in _cached_properties of the object.
# 
#         Source: https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76
#         """
# 
#     def __init__(self, func):
#         self.__doc__ = getattr(func, '__doc__')
#         self.func = func
# 
#     def __get__(self, obj, cls):
#         if obj is None:
#             return self
# 
#         propname = self.func.__name__
# 
#         if not hasattr(obj, '_cached_properties'):
#             obj._cached_properties = {}
# 
#         if propname not in obj._cached_properties:
#             obj._cached_properties[propname] = self.func(obj)
#             # value = obj.__dict__[propname] = self.func(obj)
# 
#         return obj._cached_properties[propname]
# 
#     @staticmethod
#     def clear(obj):
#         """clears cache of obj"""
#         if hasattr(obj, '_cached_properties'):
#             obj._cached_properties = {}
# 
#     @staticmethod
#     def is_cached(obj, propname):
#         if hasattr(obj, '_cached_properties') and propname in obj._cached_properties:
#             return True
#         else:
#             return False
# 
# Path: zfs_autobackup/ExecuteNode.py
# class ExecuteError(Exception):
#     pass


import re
import time
from .CachedProperty import CachedProperty
from .ExecuteNode import ExecuteError
        else:
            snapshot_name = snapshot.snapshot_name

        for snapshot in self.snapshots:
            if snapshot.snapshot_name == snapshot_name:
                return snapshot

        return None

    def find_snapshot_index(self, snapshot):
        """find snapshot index by snapshot (can be a snapshot_name or
        ZfsDataset)

        Args:
            :type snapshot: str or ZfsDataset
        """

        if not isinstance(snapshot, ZfsDataset):
            snapshot_name = snapshot
        else:
            snapshot_name = snapshot.snapshot_name

        index = 0
        for snapshot in self.snapshots:
            if snapshot.snapshot_name == snapshot_name:
                return index
            index = index + 1

        return None


# Path: zfs_autobackup/CachedProperty.py
# class CachedProperty(object):
#     """ A property that is only computed once per instance and
#     then stores the result in _cached_properties of the object.
# 
#         Source: https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76
#         """
# 
#     def __init__(self, func):
#         self.__doc__ = getattr(func, '__doc__')
#         self.func = func
# 
#     def __get__(self, obj, cls):
#         if obj is None:
#             return self
# 
#         propname = self.func.__name__
# 
#         if not hasattr(obj, '_cached_properties'):
#             obj._cached_properties = {}
# 
#         if propname not in obj._cached_properties:
#             obj._cached_properties[propname] = self.func(obj)
#             # value = obj.__dict__[propname] = self.func(obj)
# 
#         return obj._cached_properties[propname]
# 
#     @staticmethod
#     def clear(obj):
#         """clears cache of obj"""
#         if hasattr(obj, '_cached_properties'):
#             obj._cached_properties = {}
# 
#     @staticmethod
#     def is_cached(obj, propname):
#         if hasattr(obj, '_cached_properties') and propname in obj._cached_properties:
#             return True
#         else:
#             return False
# 
# Path: zfs_autobackup/ExecuteNode.py
# class ExecuteError(Exception):
#     pass


# Path: zfs_autobackup/ZfsDataset.py
import re
import time
from .CachedProperty import CachedProperty
from .ExecuteNode import ExecuteError

        else:
            snapshot_name = snapshot.snapshot_name

        for snapshot in self.snapshots:
            if snapshot.snapshot_name == snapshot_name:
                return snapshot

        return None

    def find_snapshot_index(self, snapshot):
        """find snapshot index by snapshot (can be a snapshot_name or
        ZfsDataset)

        Args:
            :type snapshot: str or ZfsDataset
        """

        if not isinstance(snapshot, ZfsDataset):
            snapshot_name = snapshot
        else:
            snapshot_name = snapshot.snapshot_name

        index = 0
        for snapshot in self.snapshots:
            if snapshot.snapshot_name == snapshot_name:
                return index
            index = index + 1

        return None


    @CachedProperty