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


Python datetime.__new__方法代码示例

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


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

示例1: __new__

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import __new__ [as 别名]
def __new__(cls, value, trivia, raw):  # type: (int, Trivia, str) -> Integer
        return super(Integer, cls).__new__(cls, value) 
开发者ID:sdispater,项目名称:tomlkit,代码行数:4,代码来源:items.py

示例2: __new__

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import __new__ [as 别名]
def __new__(cls, *args, **kwargs):
        return datetime.__new__(datetime, *args, **kwargs) 
开发者ID:PokemonGoF,项目名称:PokemonGo-Bot,代码行数:4,代码来源:sleep_schedule_test.py

示例3: __new__

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import __new__ [as 别名]
def __new__(cls, *args, **kwargs):  # pylint: disable=signature-differs
        return datetime.__new__(datetime, *args, **kwargs) 
开发者ID:apache,项目名称:airflow,代码行数:4,代码来源:fake_datetime.py

示例4: __new__

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import __new__ [as 别名]
def __new__(cls, *args, **kwargs):
		return datetime.__new__(datetime, *args, **kwargs) 
开发者ID:EJEP,项目名称:datapoint-python,代码行数:4,代码来源:test_datapoint.py

示例5: __new__

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import __new__ [as 别名]
def __new__(cls, month=1, day=1, hour=0, minute=0, leap_year=False):
        """Create Ladybug datetime.
        """
        year = 2016 if leap_year else 2017
        hour, minute = Time._calculate_hour_and_minute(hour + minute / 60.0)
        try:
            return datetime.__new__(cls, year, month, day, hour, minute)
        except ValueError as e:
            raise ValueError("{}:\n\t({}/{}@{}:{})(m/d@h:m)".format(
                e, month, day, hour, minute
            )) 
开发者ID:ladybug-tools,项目名称:ladybug,代码行数:13,代码来源:dt.py

示例6: __reduce_ex__

# 需要导入模块: from datetime import datetime [as 别名]
# 或者: from datetime.datetime import __new__ [as 别名]
def __reduce_ex__(self, protocol):
        """Call the __new__() constructor when the class instance is unpickled.

        This method is necessary for the pickle.loads() call to work.
        """
        return (type(self), (self.month, self.day, self.hour, self.minute)) 
开发者ID:ladybug-tools,项目名称:ladybug,代码行数:8,代码来源:dt.py


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