File tree Expand file tree Collapse file tree 2 files changed +4
-17
lines changed
Expand file tree Collapse file tree 2 files changed +4
-17
lines changed Original file line number Diff line number Diff line change 22# For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE
33# Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt
44
5- import textwrap
6-
75from astroid .brain .helpers import register_module_extender
86from astroid .builder import AstroidBuilder
97from astroid .const import PY312_PLUS
108from astroid .manager import AstroidManager
119
1210
1311def datetime_transform ():
14- """The datetime module was C-accelerated in Python 3.12, so we
15- lack a Python source."""
16- return AstroidBuilder (AstroidManager ()).string_build (
17- textwrap .dedent (
18- """
19- class date: ...
20- class time: ...
21- class datetime(date): ...
22- class timedelta: ...
23- class tzinfo: ...
24- class timezone(tzinfo): ...
25- """
26- )
27- )
12+ """The datetime module was C-accelerated in Python 3.12, so use the
13+ Python source."""
14+ return AstroidBuilder (AstroidManager ()).string_build ("from _pydatetime import *" )
2815
2916
3017if PY312_PLUS :
Original file line number Diff line number Diff line change @@ -26,4 +26,4 @@ def test_parser(self):
2626 """
2727 )
2828 d_type = next (module ["d" ].infer ())
29- self .assertEqual (d_type .qname (), " datetime.datetime" )
29+ self .assertIn (d_type .qname (), { "_pydatetime. datetime" , "datetime .datetime"} )
You can’t perform that action at this time.
0 commit comments