@@ -1562,7 +1562,7 @@ def preamble_lookup(
1562
1562
doc
1563
1563
), f'enumeration class { self .target !r} should have an explicit docstring'
1564
1564
1565
- args = self ._preamble_args ()
1565
+ args = self ._preamble_args (functional_constructor = False )
1566
1566
return self ._preamble (doc = doc , args = args , indent = indent , ** options )
1567
1567
1568
1568
def preamble_constructor (
@@ -1572,7 +1572,7 @@ def preamble_constructor(
1572
1572
doc
1573
1573
), f'enumeration class { self .target !r} should have an explicit docstring'
1574
1574
1575
- args = self ._preamble_args ()
1575
+ args = self ._preamble_args (functional_constructor = True )
1576
1576
return self ._preamble (doc = doc , args = args , indent = indent , ** options )
1577
1577
1578
1578
def _preamble (
@@ -1582,12 +1582,25 @@ def _preamble(
1582
1582
return self ._node ('class' , self .name , doc , args = args , indent = indent , ** options )
1583
1583
1584
1584
@staticmethod
1585
- def _preamble_args ():
1585
+ def _preamble_args (functional_constructor : bool = False ):
1586
1586
"""EnumType.__call__() is a dual-purpose method:
1587
1587
1588
1588
* Look an enum member (valid only if the enum has members)
1589
1589
* Create a new enum class (functional API)
1590
1590
"""
1591
+ if sys .version_info [:2 ] >= (3 , 13 ) or sys .version_info [:3 ] >= (3 , 12 , 3 ):
1592
+ if functional_constructor :
1593
+ return (
1594
+ '(new_class_name, /, names, *, module=None, '
1595
+ 'qualname=None, type=None, start=1, boundary=None)'
1596
+ )
1597
+ else :
1598
+ return '(*values)'
1599
+ if sys .version_info [:2 ] >= (3 , 12 ):
1600
+ return (
1601
+ '(value, names=None, *values, module=None, '
1602
+ 'qualname=None, type=None, start=1, boundary=None)'
1603
+ )
1591
1604
return '(value)'
1592
1605
1593
1606
def method (
0 commit comments