Python datetime.datetime.__new__() Examples
The following are 18
code examples of datetime.datetime.__new__().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
datetime.datetime
, or try the search function
.
Example #1
Source File: items.py From pipenv with MIT License | 5 votes |
def __new__( cls, year, month, day, hour, minute, second, microsecond, tzinfo, trivia, raw, **kwargs ): # type: (int, int, int, int, int, int, int, ..., Trivia, ...) -> datetime return datetime.__new__( cls, year, month, day, hour, minute, second, microsecond, tzinfo=tzinfo, **kwargs )
Example #2
Source File: dt.py From ladybug with GNU General Public License v3.0 | 5 votes |
def __new__(cls, hour=0, minute=0): """Create Ladybug Time. """ hour, minute = cls._calculate_hour_and_minute(hour + minute / 60.0) try: return time.__new__(cls, hour, minute) except ValueError as e: raise ValueError("{}:\n\t({}:{})(h:m)".format(e, hour, minute))
Example #3
Source File: dt.py From ladybug with GNU General Public License v3.0 | 5 votes |
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.leap_year))
Example #4
Source File: dt.py From ladybug with GNU General Public License v3.0 | 5 votes |
def __new__(cls, month=1, day=1, leap_year=False): """Create Ladybug Date. """ year = 2016 if leap_year else 2017 try: return date.__new__(cls, year, month, day) except ValueError as e: raise ValueError("{}:\n\t({}/{})(m/d)".format(e, month, day))
Example #5
Source File: dt.py From ladybug with GNU General Public License v3.0 | 5 votes |
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))
Example #6
Source File: dt.py From ladybug with GNU General Public License v3.0 | 5 votes |
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 ))
Example #7
Source File: test_datapoint.py From datapoint-python with GNU General Public License v3.0 | 5 votes |
def __new__(cls, *args, **kwargs): return datetime.__new__(datetime, *args, **kwargs)
Example #8
Source File: items.py From pipenv with MIT License | 5 votes |
def __new__( cls, hour, minute, second, microsecond, tzinfo, *_ ): # type: (int, int, int, int, ...) -> time return time.__new__(cls, hour, minute, second, microsecond, tzinfo)
Example #9
Source File: items.py From pipenv with MIT License | 5 votes |
def __new__(cls, year, month, day, *_): # type: (int, int, int, ...) -> date return date.__new__(cls, year, month, day)
Example #10
Source File: items.py From tomlkit with MIT License | 5 votes |
def __new__(cls, value, trivia, raw): # type: (int, Trivia, str) -> Integer return super(Integer, cls).__new__(cls, value)
Example #11
Source File: items.py From pipenv with MIT License | 5 votes |
def __new__(cls, value, trivia, raw): # type: (float, Trivia, str) -> Integer return super(Float, cls).__new__(cls, value)
Example #12
Source File: items.py From pipenv with MIT License | 5 votes |
def __new__(cls, value, trivia, raw): # type: (int, Trivia, str) -> Integer return super(Integer, cls).__new__(cls, value)
Example #13
Source File: fake_datetime.py From airflow with Apache License 2.0 | 5 votes |
def __new__(cls, *args, **kwargs): # pylint: disable=signature-differs return datetime.__new__(datetime, *args, **kwargs)
Example #14
Source File: sleep_schedule_test.py From PokemonGo-Bot with MIT License | 5 votes |
def __new__(cls, *args, **kwargs): return datetime.__new__(datetime, *args, **kwargs)
Example #15
Source File: items.py From tomlkit with MIT License | 5 votes |
def __new__( cls, hour, minute, second, microsecond, tzinfo, *_ ): # type: (int, int, int, int, Optional[datetime.tzinfo], Any) -> time return time.__new__(cls, hour, minute, second, microsecond, tzinfo)
Example #16
Source File: items.py From tomlkit with MIT License | 5 votes |
def __new__(cls, year, month, day, *_): # type: (int, int, int, Any) -> date return date.__new__(cls, year, month, day)
Example #17
Source File: items.py From tomlkit with MIT License | 5 votes |
def __new__( cls, year, month, day, hour, minute, second, microsecond, tzinfo, trivia, raw, **kwargs ): # type: (int, int, int, int, int, int, int, Optional[datetime.tzinfo], Trivia, str, Any) -> datetime return datetime.__new__( cls, year, month, day, hour, minute, second, microsecond, tzinfo=tzinfo, **kwargs )
Example #18
Source File: items.py From tomlkit with MIT License | 5 votes |
def __new__(cls, value, trivia, raw): # type: (float, Trivia, str) -> Integer return super(Float, cls).__new__(cls, value)