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

Method replace

src/pendulum/datetime.py:1290–1334  ·  view source on GitHub ↗
(
        self,
        year: SupportsIndex | None = None,
        month: SupportsIndex | None = None,
        day: SupportsIndex | None = None,
        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 | None = None,
    )

Source from the content-addressed store, hash-verified

1288 )
1289
1290 def replace(
1291 self,
1292 year: SupportsIndex | None = None,
1293 month: SupportsIndex | None = None,
1294 day: SupportsIndex | None = None,
1295 hour: SupportsIndex | None = None,
1296 minute: SupportsIndex | None = None,
1297 second: SupportsIndex | None = None,
1298 microsecond: SupportsIndex | None = None,
1299 tzinfo: bool | datetime.tzinfo | Literal[True] | None = True,
1300 fold: int | None = None,
1301 ) -> Self:
1302 if year is None:
1303 year = self.year
1304 if month is None:
1305 month = self.month
1306 if day is None:
1307 day = self.day
1308 if hour is None:
1309 hour = self.hour
1310 if minute is None:
1311 minute = self.minute
1312 if second is None:
1313 second = self.second
1314 if microsecond is None:
1315 microsecond = self.microsecond
1316 if tzinfo is True:
1317 tzinfo = self.tzinfo
1318 if fold is None:
1319 fold = self.fold
1320
1321 if tzinfo is not None:
1322 tzinfo = pendulum._safe_timezone(tzinfo)
1323
1324 return self.__class__.create(
1325 year,
1326 month,
1327 day,
1328 hour,
1329 minute,
1330 second,
1331 microsecond,
1332 tz=tzinfo,
1333 fold=fold,
1334 )
1335
1336 def __getnewargs__(self) -> tuple[Self]:
1337 return (self,)

Callers 2

in_timezoneMethod · 0.45
to_iso8601_stringMethod · 0.45

Calls 1

createMethod · 0.80

Tested by

no test coverage detected