当前位置: 首页>>代码示例>>Python>>正文


Python datetime.html方法代码示例

本文整理汇总了Python中datetime.datetime.html方法的典型用法代码示例。如果您正苦于以下问题:Python datetime.html方法的具体用法?Python datetime.html怎么用?Python datetime.html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在datetime.datetime的用法示例。


在下文中一共展示了datetime.html方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def __init__(self, *args, **kwargs):
        """
        We initialize the timer and set the update interval (one minute) and start it and update the clock at least
        once.
        """
        super().__init__(*args, **kwargs)

        # customize format if desired (https://docs.python.org/3.5/library/datetime.html#strftime-strptime-behavior)
        self.time_format = '%H:%M'

        # initial update
        self.update_clock()

        # create and start timer for all following updates
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.update_clock)
        self.timer.setInterval(60000)
        self.timer.start() 
开发者ID:Trilarion,项目名称:imperialism-remake,代码行数:20,代码来源:qt.py

示例2: get_time

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def get_time(self, sample):
        """Getting the date and the time from a sample.

        Args:
            sample (:class:`blue_st_sdk.feature.Sample`): Sample data.

        Returns:
            :class:`datetime`: The date and the time of the recognized activity
            if the sample is valid, "None" otherwise.
            Refer to
            `datetime <https://docs.python.org/2/library/datetime.html>`_
            for more information.
        """
        if sample is not None:
            if sample._data:
                if sample._data[self.TIME_FIELD] is not None:
                    return sample._data[self.TIME_FIELD]
        return None 
开发者ID:STMicroelectronics,项目名称:BlueSTSDK_Python,代码行数:20,代码来源:feature_activity_recognition.py

示例3: update_advertising_data

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def update_advertising_data(self, advertising_data):
        """Update advertising data.

        Args:
            advertising_data (list): Advertising data. Refer to 'getScanData()'
            method of
            `ScanEntry <https://ianharvey.github.io/bluepy-doc/scanentry.html>`_
            class for more information.

        Raises:
            :exc:`blue_st_sdk.utils.blue_st_exceptions.BlueSTInvalidAdvertisingDataException`
            is raised if the advertising data is not well formed.
        """
        try:
            self._advertising_data = BlueSTAdvertisingDataParser.parse(
                advertising_data)
        except BlueSTInvalidAdvertisingDataException as e:
            raise e 
开发者ID:STMicroelectronics,项目名称:BlueSTSDK_Python,代码行数:20,代码来源:node.py

示例4: characteristic_can_be_read

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def characteristic_can_be_read(self, characteristic):
        """Check if a characteristics can be read.

        Args:
            characteristic (Characteristic): The BLE characteristic to check.
            Refer to
            `Characteristic <https://ianharvey.github.io/bluepy-doc/characteristic.html>`_
            for more information.

        Returns:
            bool: True if the characteristic can be read, False otherwise.
        """
        try:
            if characteristic is not None:
                with lock(self):
                    return "READ" in characteristic.propertiesToString()
            return False
        except BTLEException as e:
            self._unexpected_disconnect() 
开发者ID:STMicroelectronics,项目名称:BlueSTSDK_Python,代码行数:21,代码来源:node.py

示例5: characteristic_can_be_written

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def characteristic_can_be_written(self, characteristic):
        """Check if a characteristics can be written.

        Args:
            characteristic (Characteristic): The BLE characteristic to check.
            Refer to
            `Characteristic <https://ianharvey.github.io/bluepy-doc/characteristic.html>`_
            for more information.

        Returns:
            bool: True if the characteristic can be written, False otherwise.
        """
        try:
            if characteristic is not None:
                with lock(self):
                    return "WRITE" in characteristic.propertiesToString()
            return False
        except BTLEException as e:
            self._unexpected_disconnect() 
开发者ID:STMicroelectronics,项目名称:BlueSTSDK_Python,代码行数:21,代码来源:node.py

示例6: characteristic_can_be_notified

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def characteristic_can_be_notified(self, characteristic):
        """Check if a characteristics can be notified.

        Args:
            characteristic (Characteristic): The BLE characteristic to check.
            Refer to
            `Characteristic <https://ianharvey.github.io/bluepy-doc/characteristic.html>`_
            for more information.

        Returns:
            bool: True if the characteristic can be notified, False otherwise.
        """
        try:
            if characteristic is not None:
                with lock(self):
                    return "NOTIFY" in characteristic.propertiesToString()
            return False
        except BTLEException as e:
            self._unexpected_disconnect() 
开发者ID:STMicroelectronics,项目名称:BlueSTSDK_Python,代码行数:21,代码来源:node.py

示例7: characteristic_has_other_notifying_features

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def characteristic_has_other_notifying_features(self, characteristic, feature):
        """Check whether a characteristic has other enabled features beyond the
        given one.

        Args:
            characteristic (Characteristic): The BLE characteristic to check.
            Refer to
            `Characteristic <https://ianharvey.github.io/bluepy-doc/characteristic.html>`_
            for more information.
            feature (:class:`blue_st_sdk.feature.Feature`): The given feature.

        Returns:
            True if the characteristic has other enabled features beyond the
            given one, False otherwise.
        """
        with lock(self):
            features = self._get_corresponding_features(
                characteristic.getHandle())
        for feature_entry in features:
            if feature_entry == feature:
                pass
            elif feature_entry.is_notifying():
                return True
        return False 
开发者ID:STMicroelectronics,项目名称:BlueSTSDK_Python,代码行数:26,代码来源:node.py

示例8: utc_timestamp

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def utc_timestamp(d):
    # See https://docs.python.org/3/library/datetime.html#datetime.datetime.timestamp
    # for why we're calculating this UTC timestamp explicitly
    return (d - datetime(1970, 1, 1)) / timedelta(seconds=1) 
开发者ID:mozilla,项目名称:probe-scraper,代码行数:6,代码来源:git_scraper.py

示例9: is_aware

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
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 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:10,代码来源:timezone.py

示例10: is_naive

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
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 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:10,代码来源:timezone.py

示例11: is_aware

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def is_aware(value):
    """
    Determine 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 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:13,代码来源:timezone.py

示例12: is_naive

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def is_naive(value):
    """
    Determine 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 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:13,代码来源:timezone.py

示例13: to_dict

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def to_dict(self, only=(), rules=(),
                date_format=None, datetime_format=None, time_format=None, tzinfo=None,
                decimal_format=None, serialize_types=None):
        """
        Returns SQLAlchemy model's data in JSON compatible format

        For details about datetime formats follow:
        https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior

        :param only: exclusive schema to replace default one (always have higher priority than rules)
        :param rules: schema to extend default one or schema defined in "only"
        :param date_format: str
        :param datetime_format: str
        :param time_format: str
        :param decimal_format: str
        :param tzinfo: datetime.tzinfo converts datetimes to local user timezone
        :return: data: dict
        """
        s = Serializer(
            date_format=date_format or self.date_format,
            datetime_format=datetime_format or self.datetime_format,
            time_format=time_format or self.time_format,
            decimal_format=decimal_format or self.decimal_format,
            tzinfo=tzinfo or self.get_tzinfo(),
            serialize_types=serialize_types or self.serialize_types
        )
        return s(self, only=only, extend=rules) 
开发者ID:n0nSmoker,项目名称:SQLAlchemy-serializer,代码行数:29,代码来源:serializer.py

示例14: bulk_create_datetimes

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def bulk_create_datetimes(date_start: DateTime,
                              date_end: DateTime, **kwargs) -> List[DateTime]:
        """Bulk create datetime objects.

        This method creates list of datetime objects from
        ``date_start`` to ``date_end``.

        You can use the following keyword arguments:

        * ``days``
        * ``hours``
        * ``minutes``
        * ``seconds``
        * ``microseconds``

        See datetime module documentation for more:
        https://docs.python.org/3.7/library/datetime.html#timedelta-objects


        :param date_start: Begin of the range.
        :param date_end: End of the range.
        :param kwargs: Keyword arguments for datetime.timedelta
        :return: List of datetime objects
        :raises: ValueError: When ``date_start``/``date_end`` not passed and
            when ``date_start`` larger than ``date_end``.
        """
        dt_objects = []

        if not date_start and not date_end:
            raise ValueError('You must pass date_start and date_end')

        if date_end < date_start:
            raise ValueError('date_start can not be larger than date_end')

        while date_start <= date_end:
            date_start += timedelta(**kwargs)
            dt_objects.append(date_start)

        return dt_objects 
开发者ID:lk-geimfari,项目名称:mimesis,代码行数:41,代码来源:date.py

示例15: is_aware

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import html [as 别名]
def is_aware(value):
    """
    Determine if a given datetime.datetime is aware.

    The concept is defined in Python's docs:
    https://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 
开发者ID:PacktPublishing,项目名称:Hands-On-Application-Development-with-PyCharm,代码行数:13,代码来源:timezone.py


注:本文中的datetime.datetime.html方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。