Python datetime.datetime 模块,html() 实例源码

我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用datetime.datetime.html()

项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
def is_aware(value):
    """
    Determines if a given datetime.datetime is aware.

    The concept is defined in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo

    Assuming value.tzinfo is either None or a proper datetime.tzinfo,
    value.utcoffset() implements the appropriate logic.
    """
    return value.utcoffset() is not None
项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
def is_naive(value):
    """
    Determines if a given datetime.datetime is naive.

    The concept is defined in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo

    Assuming value.tzinfo is either None or a proper datetime.tzinfo,
    value.utcoffset() implements the appropriate logic.
    """
    return value.utcoffset() is None
项目:DataVisPlanner    作者:fablabbcn    | 项目源码 | 文件源码
def clean_data(**kwargs):
    global pg_hook
    ti = kwargs["ti"]
    new_id = ti.xcom_pull(task_ids="hello_task_01")
    # Load data from the raw_data column, it's only 1 value
    pg_command = """SELECT raw_data FROM dag_dag WHERE id = %s"""
    data = pg_hook.get_records(pg_command, parameters=[new_id])[0][0]
    # clean the data for the Meteor visualisation
    data = {"number of labs": len(data)}
    # Transform the dict into a string for PostgreSQL
    data = json.dumps(data)
    # Save the data
    pg_command = """UPDATE dag_dag SET clean_data = %s WHERE id = %s"""
    pg_hook.run(pg_command, parameters=[data, new_id])
    return "Data prepared for the visualisation successfully."


# Setup the DAG
#
# schedule_interval uses the cron format
#
# * * * * * *
# | | | | | |
# | | | | | +-- Year              (range: 1900-3000)
# | | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
# | | | +------ Month of the Year (range: 1-12)
# | | +-------- Day of the Month  (range: 1-31)
# | +---------- Hour              (range: 0-23)
# +------------ Minute            (range: 0-59)
#
# See more: http://www.nncron.ru/help/EN/working/cron-format.htm
#
# Or datetime.timedelta
# See more: https://docs.python.org/2/library/datetime.html#datetime.timedelta
#
项目:steamwatch    作者:akeil    | 项目源码 | 文件源码
def __repr__(self):
        return '<Snapshot id={s.id!r} package={s.package!r}>'.format(s=self)


# Helpers ---------------------------------------------------------------------


# https://docs.python.org/3.3/library/datetime.html#strftime-and-strptime-behavior
项目:lifesoundtrack    作者:MTG    | 项目源码 | 文件源码
def is_aware(value):
    """
    Determines if a given datetime.datetime is aware.

    The concept is defined in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo

    Assuming value.tzinfo is either None or a proper datetime.tzinfo,
    value.utcoffset() implements the appropriate logic.
    """
    return value.utcoffset() is not None
项目:lifesoundtrack    作者:MTG    | 项目源码 | 文件源码
def is_naive(value):
    """
    Determines if a given datetime.datetime is naive.

    The concept is defined in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo

    Assuming value.tzinfo is either None or a proper datetime.tzinfo,
    value.utcoffset() implements the appropriate logic.
    """
    return value.utcoffset() is None
项目:aiorestframework    作者:Skorpyon    | 项目源码 | 文件源码
def is_aware(value):
    """
    Determines if a given datetime.datetime is aware.

    The concept is defined in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo

    Assuming value.tzinfo is either None or a proper datetime.tzinfo,
    value.utcoffset() implements the appropriate logic.
    """
    return value.utcoffset() is not None
项目:aiorestframework    作者:Skorpyon    | 项目源码 | 文件源码
def is_naive(value):
    """
    Determines if a given datetime.datetime is naive.

    The concept is defined in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo

    Assuming value.tzinfo is either None or a proper datetime.tzinfo,
    value.utcoffset() implements the appropriate logic.
    """
    return value.utcoffset() is None
项目:liberator    作者:libscie    | 项目源码 | 文件源码
def is_aware(value):
    """
    Determines if a given datetime.datetime is aware.

    The concept is defined in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo

    Assuming value.tzinfo is either None or a proper datetime.tzinfo,
    value.utcoffset() implements the appropriate logic.
    """
    return value.utcoffset() is not None
项目:liberator    作者:libscie    | 项目源码 | 文件源码
def is_naive(value):
    """
    Determines if a given datetime.datetime is naive.

    The concept is defined in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo

    Assuming value.tzinfo is either None or a proper datetime.tzinfo,
    value.utcoffset() implements the appropriate logic.
    """
    return value.utcoffset() is None
项目:djanoDoc    作者:JustinChavez    | 项目源码 | 文件源码
def is_aware(value):
    """
    Determines if a given datetime.datetime is aware.

    The concept is defined in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo

    Assuming value.tzinfo is either None or a proper datetime.tzinfo,
    value.utcoffset() implements the appropriate logic.
    """
    return value.utcoffset() is not None
项目:djanoDoc    作者:JustinChavez    | 项目源码 | 文件源码
def is_naive(value):
    """
    Determines if a given datetime.datetime is naive.

    The concept is defined in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo

    Assuming value.tzinfo is either None or a proper datetime.tzinfo,
    value.utcoffset() implements the appropriate logic.
    """
    return value.utcoffset() is None
项目:django-next-train    作者:bitpixdigital    | 项目源码 | 文件源码
def is_aware(value):
    """
    Determines if a given datetime.datetime is aware.

    The concept is defined in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo

    Assuming value.tzinfo is either None or a proper datetime.tzinfo,
    value.utcoffset() implements the appropriate logic.
    """
    return value.utcoffset() is not None
项目:django-next-train    作者:bitpixdigital    | 项目源码 | 文件源码
def is_naive(value):
    """
    Determines if a given datetime.datetime is naive.

    The concept is defined in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo

    Assuming value.tzinfo is either None or a proper datetime.tzinfo,
    value.utcoffset() implements the appropriate logic.
    """
    return value.utcoffset() is None
项目:django-wechat-api    作者:crazy-canux    | 项目源码 | 文件源码
def is_aware(value):
    """
    Determines if a given datetime.datetime is aware.

    The logic is described in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo
    """
    return value.tzinfo is not None and value.tzinfo.utcoffset(value) is not None
项目:django-wechat-api    作者:crazy-canux    | 项目源码 | 文件源码
def is_naive(value):
    """
    Determines if a given datetime.datetime is naive.

    The logic is described in Python's docs:
    http://docs.python.org/library/datetime.html#datetime.tzinfo
    """
    return value.tzinfo is None or value.tzinfo.utcoffset(value) is None