Return a tuple of etag, last_modified by mtime from stat.
174585
def _conditions(self, full_path, environ):
        """"""
        mtime = os.stat(full_path).st_mtime
        size = os.stat(full_path).st_size
        return str(mtime), rfc822.formatdate(mtime), size
1145949
def last(self, db=_DefaultDB):
        '''
        
        '''
        self._acqXactForReading()
        try:
            with self.xact.cursor(db=db.db) as curs:
                if not curs.last():
                    return None
                return curs.key(), curs.value()
        finally:
            self._relXactForReading()
1230347
def get_path_modified_time(path):
        

        return float(foundations.common.get_first_item(str(os.path.getmtime(path)).split(".")))
772525
def check_if_modified_since(self, dt, etag=None):
        """"""
        dt = dt.replace(microsecond=0)
        if request.if_modified_since and dt <= request.if_modified_since:
            raise SameContentException(etag, last_modified=dt)
345854
def _get_last_cachefile_modification(self):
        

        try:
            mtime = os.path.getmtime(self._tld_list_path)
        except OSError:
            return None

        return datetime.fromtimestamp(mtime)
329528
def etag(self):
        """"""
        if self.is_fake:
            return

        entry = None
        for entry in self.journal.list():
            pass

        return entry.uid if entry is not None else hashlib.sha256(b"").hexdigest()
415043
def get_response(self, environ=None):
        """"""
        response = super(SameContentException, self).get_response(
            environ=environ
        )
        if self.etag is not None:
            response.set_etag(self.etag)
        if self.last_modified is not None:
            response.headers['Last-Modified'] = http_date(self.last_modified)
        return response
135758
def _cache_get_last_in_slice(url_dict, start_int, total_int, authn_subj_list):
    """"""
    key_str = _gen_cache_key_for_slice(url_dict, start_int, total_int, authn_subj_list)
    # TODO: Django docs state that cache.get() should return None on unknown key.
    try:
        last_ts_tup = django.core.cache.cache.get(key_str)
    except KeyError:
        last_ts_tup = None
    logging.debug('Cache get. key="{}" -> last_ts_tup={}'.format(key_str, last_ts_tup))
    return last_ts_tup
693484
def _StrftimeGm(value, unused_context, args):
    
    time_tuple = time.gmtime(value)
    return _StrftimeHelper(args, time_tuple)
892735
def etag(cls, request, *args, **kwargs):
        ''''''
        pid = kwargs[cls.pid_url_kwarg]
        date = kwargs.get(cls.as_of_date_url_kwarg, None)
        return datastream_etag(
            request, pid, cls.datastream_id,
            type=cls.object_type, repo=cls.repository_class(request=request),
            accept_range_request=cls.accept_range_request, as_of_date=date)
1315532
def g_parameter(time_residual):
    """"""
    mean = np.mean(time_residual)
    time_residual_prime = (time_residual - np.ones(time_residual.shape) * mean)
    time_residual_prime *= time_residual_prime / (-2 * 1.5 * 1.5)
    time_residual_prime = np.exp(time_residual_prime)
    g = np.sum(time_residual_prime) / len(time_residual)
    return g
704765
def etag(func):
    
    @functools.wraps(func)
    def wrapped(*args, **kwargs):
        """Call the view function and generate an ETag value, checking the
        headers to determine what response to send."""
        # only for HEAD and GET requests
        assert request.method in ['HEAD', 'GET'],\
            '@etag is only supported for GET requests'
        response = func(*args, **kwargs)
        response = make_response(response)
        etag_value = '"' + hashlib.md5(response.get_data()).hexdigest() + '"'
        response.headers['ETag'] = etag_value
        if_match = request.headers.get('If-Match')
        if_none_match = request.headers.get('If-None-Match')
        if if_match:
            etag_list = [tag.strip() for tag in if_match.split(',')]
            if etag_value not in etag_list and '*' not in etag_list:
                response = precondition_failed()
        elif if_none_match:
            etag_list = [tag.strip() for tag in if_none_match.split(',')]
            if etag_value in etag_list or '*' in etag_list:
                response = not_modified()
        return response
    return wrapped
1355691
def get_last_doc(self):
        """"""
        return max(self.doc_dict.values(), key=lambda x: x.ts).meta_dict
1169625
def st_mtime(self):
        """"""
        mtime = self._st_mtime_ns / 1e9
        return mtime if self.use_float else int(mtime)
1370324
def get_last_modified_timestamp(self):
        
        cmd = "find . -print0 | xargs -0 stat -f '%T@ %p' | sort -n | tail -1 | cut -f2- -d' '"
        ps = subprocess.Popen(cmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
        output = ps.communicate()[0]
        print output
301860
def last_modified(self):
        
        if self.entries:
            latest = max(self.entries, key=lambda x: x.last_modified)
            return arrow.get(latest.last_modified)
        return arrow.get()
721003
def mtime(self, key):
        """"""
        if key not in self.__dict:
            raise CacheKeyError(key)
        else:
            node = self.__dict[key]
            return node.mtime