Return local time as an aware datetime object. If called without arguments, return current time. Otherwise *dt* argument should be a datetime instance, and it is converted to the local time zone according to the system time zone database. If *dt* is naive (that is, dt.tzinfo is No
(dt=None, isdst=None)
| 473 | # |
| 474 | |
| 475 | def localtime(dt=None, isdst=None): |
| 476 | """Return local time as an aware datetime object. |
| 477 | |
| 478 | If called without arguments, return current time. Otherwise *dt* |
| 479 | argument should be a datetime instance, and it is converted to the |
| 480 | local time zone according to the system time zone database. If *dt* is |
| 481 | naive (that is, dt.tzinfo is None), it is assumed to be in local time. |
| 482 | The isdst parameter is ignored. |
| 483 | |
| 484 | """ |
| 485 | if isdst is not None: |
| 486 | import warnings |
| 487 | warnings._deprecated( |
| 488 | "The 'isdst' parameter to 'localtime'", |
| 489 | message='{name} is deprecated and slated for removal in Python {remove}', |
| 490 | remove=(3, 14), |
| 491 | ) |
| 492 | if dt is None: |
| 493 | dt = datetime.datetime.now() |
| 494 | return dt.astimezone() |
nothing calls this directly
no test coverage detected