MCPcopy Index your code
hub / github.com/python/cpython / replace

Method replace

Lib/_pydatetime.py:2083–2106  ·  view source on GitHub ↗

Return a new datetime with new values for the specified fields.

(self, year=None, month=None, day=None, hour=None,
                minute=None, second=None, microsecond=None, tzinfo=True,
                *, fold=None)

Source from the content-addressed store, hash-verified

2081 self._tzinfo, fold=self.fold)
2082
2083 def replace(self, year=None, month=None, day=None, hour=None,
2084 minute=None, second=None, microsecond=None, tzinfo=True,
2085 *, fold=None):
2086 """Return a new datetime with new values for the specified fields."""
2087 if year is None:
2088 year = self.year
2089 if month is None:
2090 month = self.month
2091 if day is None:
2092 day = self.day
2093 if hour is None:
2094 hour = self.hour
2095 if minute is None:
2096 minute = self.minute
2097 if second is None:
2098 second = self.second
2099 if microsecond is None:
2100 microsecond = self.microsecond
2101 if tzinfo is True:
2102 tzinfo = self.tzinfo
2103 if fold is None:
2104 fold = self.fold
2105 return type(self)(year, month, day, hour, minute, second,
2106 microsecond, tzinfo, fold=fold)
2107
2108 __replace__ = replace
2109

Callers 4

_local_timezoneMethod · 0.95
astimezoneMethod · 0.95
_cmpMethod · 0.95
__hash__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected