MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / replace

Method replace

src/pendulum/time.py:265–292  ·  view source on GitHub ↗
(
        self,
        hour: SupportsIndex | None = None,
        minute: SupportsIndex | None = None,
        second: SupportsIndex | None = None,
        microsecond: SupportsIndex | None = None,
        tzinfo: bool | datetime.tzinfo | Literal[True] | None = True,
        fold: int = 0,
    )

Source from the content-addressed store, hash-verified

263 # Compatibility methods
264
265 def replace(
266 self,
267 hour: SupportsIndex | None = None,
268 minute: SupportsIndex | None = None,
269 second: SupportsIndex | None = None,
270 microsecond: SupportsIndex | None = None,
271 tzinfo: bool | datetime.tzinfo | Literal[True] | None = True,
272 fold: int = 0,
273 ) -> Self:
274 if tzinfo is True:
275 tzinfo = self.tzinfo
276
277 hour = hour if hour is not None else self.hour
278 minute = minute if minute is not None else self.minute
279 second = second if second is not None else self.second
280 microsecond = microsecond if microsecond is not None else self.microsecond
281
282 t = super().replace(
283 hour,
284 minute,
285 second,
286 microsecond,
287 tzinfo=cast("Optional[datetime.tzinfo]", tzinfo),
288 fold=fold,
289 )
290 return self.__class__(
291 t.hour, t.minute, t.second, t.microsecond, tzinfo=t.tzinfo
292 )
293
294 def __getnewargs__(self) -> tuple[Time]:
295 return (self,)

Callers 15

test_replaceFunction · 0.95
__repr__Method · 0.45
add_durationFunction · 0.45
__new__Method · 0.45
_parse_iso8601_durationFunction · 0.45
convertMethod · 0.45
fromutcMethod · 0.45
_get_unix_timezoneFunction · 0.45

Calls

no outgoing calls