import os


class DelayedStopMark(object):
    def __init__(self, filename, delay_ticks):
        """
        :type filename: str | unicode
        :type delay_ticks: int
        """
        self._filename = filename
        self._delay_ticks = delay_ticks
        self._ticks = 0

    def is_set(self):
        """
        :rtype: bool
        """
        if os.path.exists(self._filename):
            self._ticks += 1
        else:
            self._ticks = 0

        return self._ticks > self._delay_ticks
