Python datetime.datetime.html() Examples

The following are code examples for showing how to use datetime.datetime.html(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. You can also save this page to your account.

Example 1
Project: CodingDojo   Author: ComputerSocietyUNB   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 2
Project: CodingDojo   Author: ComputerSocietyUNB   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 3
Project: DataVisPlanner   Author: fablabbcn   File: hello_world_template.py    (license) View Source Project 5 votes vote down vote up
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
# 
Example 4
Project: steamwatch   Author: akeil   File: model.py    (license) View Source Project 5 votes vote down vote up
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 
Example 5
Project: lifesoundtrack   Author: MTG   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 6
Project: lifesoundtrack   Author: MTG   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 7
Project: aiorestframework   Author: Skorpyon   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 8
Project: aiorestframework   Author: Skorpyon   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 9
Project: liberator   Author: libscie   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 10
Project: liberator   Author: libscie   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 11
Project: djanoDoc   Author: JustinChavez   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 12
Project: djanoDoc   Author: JustinChavez   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 13
Project: django-next-train   Author: bitpixdigital   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 14
Project: django-next-train   Author: bitpixdigital   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 15
Project: django-wechat-api   Author: crazy-canux   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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 
Example 16
Project: django-wechat-api   Author: crazy-canux   File: timezone.py    (license) View Source Project 5 votes vote down vote up
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