python类fromtimestamp()的实例源码

press_sec_bot_plus.py 文件源码 项目:PressSecBotPlus 作者: robmathers 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def render_tweet_html(tweet):
    date_format = '%B %-d, %Y'
    context = {
        'body': process_tweet_text(tweet),
        'date': date.fromtimestamp(tweet.created_at_in_seconds).strftime(date_format)
    }
    return jinja2.Environment(
        loader=jinja2.FileSystemLoader('./')
    ).get_template('release_template.html').render(context)
idatetime.py 文件源码 项目:AskTanmay-NLQA-System- 作者: tanmayb123 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def today():
        """Return the current local time.

        This is equivalent to date.fromtimestamp(time.time())"""
idatetime.py 文件源码 项目:AskTanmay-NLQA-System- 作者: tanmayb123 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def fromtimestamp(timestamp):
        """Return the local date from a POSIX timestamp (like time.time())

        This may raise ValueError, if the timestamp is out of the range of
        values supported by the platform C localtime() function. It's common
        for this to be restricted to years from 1970 through 2038. Note that
        on non-POSIX systems that include leap seconds in their notion of a
        timestamp, leap seconds are ignored by fromtimestamp().
        """
idatetime.py 文件源码 项目:AskTanmay-NLQA-System- 作者: tanmayb123 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
def today():
        """Return the current local datetime, with tzinfo None.

        This is equivalent to datetime.fromtimestamp(time.time()).
        See also now(), fromtimestamp().
        """
idatetime.py 文件源码 项目:AskTanmay-NLQA-System- 作者: tanmayb123 项目源码 文件源码 阅读 246 收藏 0 点赞 0 评论 0
def utcfromtimestamp(timestamp):
        """Return the UTC datetime from the POSIX timestamp with tzinfo None.

        This may raise ValueError, if the timestamp is out of the range of
        values supported by the platform C gmtime() function. It's common for
        this to be restricted to years in 1970 through 2038.

        See also fromtimestamp().
        """
ei.py 文件源码 项目:etunexus_api 作者: etusolution 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def __init__(self, name, group, ds_id, start_time, end_time, data):
        super(PopulationTimeline, self).__init__({
            'name': name,
            'group': group,
            'data_source_id': ds_id,
            'start_time': start_time,
            'end_time': end_time,
            'data': [(date.fromtimestamp(x[0]/1000), x[1]) for x in data]
        })
appcachepoison.py 文件源码 项目:mitmf 作者: ParrotSec 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def cacheForFuture(self, headers):
        ten_years = 315569260
        headers.setRawHeaders("Cache-Control",["max-age={}".format(ten_years)])
        headers.setRawHeaders("Last-Modified",["Mon, 29 Jun 1998 02:28:12 GMT"]) # it was modifed long ago, so is most likely fresh
        in_ten_years = date.fromtimestamp(time.time() + ten_years)
        headers.setRawHeaders("Expires",[in_ten_years.strftime("%a, %d %b %Y %H:%M:%S GMT")])
appcachepoison.py 文件源码 项目:SEF 作者: ahmadnourallah 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def cacheForFuture(self, headers):
        ten_years = 315569260
        headers.setRawHeaders("Cache-Control",["max-age={}".format(ten_years)])
        headers.setRawHeaders("Last-Modified",["Mon, 29 Jun 1998 02:28:12 GMT"]) # it was modifed long ago, so is most likely fresh
        in_ten_years = date.fromtimestamp(time.time() + ten_years)
        headers.setRawHeaders("Expires",[in_ten_years.strftime("%a, %d %b %Y %H:%M:%S GMT")])
AppCachePoison.py 文件源码 项目:SEF 作者: ahmadnourallah 项目源码 文件源码 阅读 45 收藏 0 点赞 0 评论 0
def cacheForFuture(self, headers):
        ten_years = 315569260
        headers.setRawHeaders("Cache-Control",["max-age="+str(ten_years)])
        headers.setRawHeaders("Last-Modified",["Mon, 29 Jun 1998 02:28:12 GMT"]) # it was modifed long ago, so is most likely fresh
        in_ten_years = date.fromtimestamp(time.time() + ten_years)
        headers.setRawHeaders("Expires",[in_ten_years.strftime("%a, %d %b %Y %H:%M:%S GMT")])
ctp_data_source.py 文件源码 项目:rqalpha-mod-ctp 作者: ricequant 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def available_data_range(self, frequency):
        if frequency != 'tick':
            raise NotImplementedError
        s = date.today()
        e = date.fromtimestamp(2147483647)
        return s, e
audit_log.py 文件源码 项目:insights-core 作者: RedHatInsights 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def get_after(self, timestamp, s=None):
        """
        Find all the (available) logs that are after the given time stamp.
        Override this function in class LogFileOutput.

        Parameters:

            timestamp(datetime.datetime): lines before this time are ignored.
            s(str or list): one or more strings to search for.
                If not supplied, all available lines are searched.

        Yields:
            (dict): the parsed data of lines with timestamps after this date in the
            same format they were supplied.
        """
        search_by_expression = self._valid_search(s)
        for line in self.lines:
            # If `s` is not None, keywords must be found in the line
            if s and not search_by_expression(line):
                continue
            info = self._parse_line(line)
            try:
                logtime = date.fromtimestamp(float(info.get('timestamp', 0)))
                if logtime > timestamp:
                    yield info
            except:
                pass
idatetime.py 文件源码 项目:zenchmarks 作者: squeaky-pl 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def today():
        """Return the current local time.

        This is equivalent to date.fromtimestamp(time.time())"""
idatetime.py 文件源码 项目:zenchmarks 作者: squeaky-pl 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def fromtimestamp(timestamp):
        """Return the local date from a POSIX timestamp (like time.time())

        This may raise ValueError, if the timestamp is out of the range of
        values supported by the platform C localtime() function. It's common
        for this to be restricted to years from 1970 through 2038. Note that
        on non-POSIX systems that include leap seconds in their notion of a
        timestamp, leap seconds are ignored by fromtimestamp().
        """
idatetime.py 文件源码 项目:zenchmarks 作者: squeaky-pl 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def today():
        """Return the current local datetime, with tzinfo None.

        This is equivalent to datetime.fromtimestamp(time.time()).
        See also now(), fromtimestamp().
        """
idatetime.py 文件源码 项目:zenchmarks 作者: squeaky-pl 项目源码 文件源码 阅读 45 收藏 0 点赞 0 评论 0
def utcfromtimestamp(timestamp):
        """Return the UTC datetime from the POSIX timestamp with tzinfo None.

        This may raise ValueError, if the timestamp is out of the range of
        values supported by the platform C gmtime() function. It's common for
        this to be restricted to years in 1970 through 2038.

        See also fromtimestamp().
        """
everbox.py 文件源码 项目:one-week 作者: tonnie17-archive 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def load_file(guid):
    file = None
    try:
        file = get_box_store().getNote(dev_token, guid, True, True, False, False)
    except Exception, e:
        return None

    file_content = parse_file(file.content)
    return {
        'title': file.title,
        'content': base64.b64decode(file_content + '=' * (-len(file_content) % 4)),
        'created': date.fromtimestamp(file.created / 100).strftime('%d/%m/%Y')
    }
everbox.py 文件源码 项目:one-week 作者: tonnie17-archive 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def datetime_format(time):
    return datetime.fromtimestamp(int(str(time)[:-3])).strftime('%Y-%m-%d %H:%M:%S')
views.py 文件源码 项目:kakaobot_hyoammeal 作者: SerenityS 项目源码 文件源码 阅读 62 收藏 0 点赞 0 评论 0
def message(request):
    json_str = ((request.body).decode('utf-8'))
    received_json_data = json.loads(json_str)
    meal = received_json_data['content']

    daystring = ["?", "?", "?", "?", "?", "?", "?"]
    today = datetime.datetime.today().weekday()

    nextdaystring = ["?", "?", "?", "?", "?", "?", "?"]

    today_date = datetime.date.today().strftime("%m? %d? ")
    tomorrow_date = date.fromtimestamp(time.time() + 60 * 60 * 24).strftime("%m? %d? ")

    if meal == '??' or meal == '??' or meal == '??':
        return JsonResponse({
            'message': {
                'text': today_date + daystring[today] + '?? ' + meal + ' ?????. \n \n' + crawl(request)
            },
            'keyboard': {
                'type': 'buttons',
                'buttons': ['??', '??', '??', '??? ??', '??? ??', '??? ??']
            }
        })
    if meal == '??? ??' or meal == '??? ??' or meal == '??? ??':
        return JsonResponse({
            'message': {
                'text': '[' + meal + '] \n' + tomorrow_date + nextdaystring[today] + '?? ?? ?????. \n \n' + crawl(request)
            },
            'keyboard': {
                'type': 'buttons',
                'buttons': ['??', '??', '??', '??? ??', '??? ??', '??? ??']
            }
        })

# message ?? ??? ??? ??
appcachepoison.py 文件源码 项目:SEF 作者: hossamhasanin 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def cacheForFuture(self, headers):
        ten_years = 315569260
        headers.setRawHeaders("Cache-Control",["max-age={}".format(ten_years)])
        headers.setRawHeaders("Last-Modified",["Mon, 29 Jun 1998 02:28:12 GMT"]) # it was modifed long ago, so is most likely fresh
        in_ten_years = date.fromtimestamp(time.time() + ten_years)
        headers.setRawHeaders("Expires",[in_ten_years.strftime("%a, %d %b %Y %H:%M:%S GMT")])
AppCachePoison.py 文件源码 项目:SEF 作者: hossamhasanin 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def cacheForFuture(self, headers):
        ten_years = 315569260
        headers.setRawHeaders("Cache-Control",["max-age="+str(ten_years)])
        headers.setRawHeaders("Last-Modified",["Mon, 29 Jun 1998 02:28:12 GMT"]) # it was modifed long ago, so is most likely fresh
        in_ten_years = date.fromtimestamp(time.time() + ten_years)
        headers.setRawHeaders("Expires",[in_ten_years.strftime("%a, %d %b %Y %H:%M:%S GMT")])


问题


面经


文章

微信
公众号

扫码关注公众号