client-py/venv/lib/python3.12/site-packages/astroid/brain/brain_datetime.py
2026-05-02 13:34:53 +05:00

20 lines
813 B
Python

# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE
# Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt
from astroid import nodes
from astroid.brain.helpers import register_module_extender
from astroid.builder import AstroidBuilder
from astroid.const import PY312_PLUS
from astroid.manager import AstroidManager
def datetime_transform() -> nodes.Module:
"""The datetime module was C-accelerated in Python 3.12, so use the
Python source."""
return AstroidBuilder(AstroidManager()).string_build("from _pydatetime import *")
def register(manager: AstroidManager) -> None:
if PY312_PLUS:
register_module_extender(manager, "datetime", datetime_transform)