Lines Matching refs:__new__
267 '_value_ not set in __new__, unable to create it'
496 def __new__(metacls, cls, bases, classdict, *, boundary=None, _simple=False, **kwds):
499 # inherited __new__ unless a new __new__ is defined (or the resulting
503 return super().__new__(metacls, cls, bases, classdict, **kwds)
528 __new__, save_new, use_args = metacls._find_new_(
531 classdict['_new_member_'] = __new__
559 enum_class = super().__new__(metacls, cls, bases, classdict, **kwds)
561 # any exceptions raised by member.__new__ will get converted to a
615 # replace any other __new__ with our own (as long as Enum is not None,
618 # if the user defined their own __new__, save it before it gets
621 enum_class.__new_member__ = __new__
622 enum_class.__new__ = Enum.__new__
711 return cls.__new__(cls, value)
759 if cls._new_member_ is not object.__new__:
760 interesting.add('__new__')
888 return metacls.__new__(metacls, class_name, bases, classdict, boundary=boundary)
945 bases: the tuple of bases that was given to __new__
977 # a datatype has a __new__ method
990 elif '__new__' in base.__dict__ or '__dataclass_fields__' in base.__dict__:
1007 Returns the __new__ to be used for creating the enum members.
1009 classdict: the class dictionary given to __new__
1010 member_type: the data type whose __new__ will be used by default
1011 first_enum: enumeration to check for an overriding __new__
1013 # now find the correct __new__, checking to see of one was defined
1014 # by the user; also check earlier enum classes in case a __new__ was
1016 __new__ = classdict.get('__new__', None)
1018 # should __new__ be saved as __new_member__ later?
1019 save_new = first_enum is not None and __new__ is not None
1021 if __new__ is None:
1023 # __new__
1024 for method in ('__new_member__', '__new__'):
1029 None.__new__,
1030 object.__new__,
1031 Enum.__new__,
1033 __new__ = target
1035 if __new__ is not None:
1038 __new__ = object.__new__
1040 # if a non-object.__new__ is used then whatever value/tuple was
1041 # assigned to the enum member name will be passed to __new__ and to the
1043 if first_enum is None or __new__ in (Enum.__new__, object.__new__):
1047 return __new__, save_new, use_args
1091 def __new__(cls, value):
1266 def __new__(cls, *values):
1283 member = str.__new__(cls, value)
1432 pseudo_member = object.__new__(cls)
1434 pseudo_member = cls._member_type_.__new__(cls, value)
1662 __new__ = cls.__dict__.get('__new__')
1663 if __new__ is not None:
1664 new_member = __new__.__func__
1666 new_member = etype._member_type_.__new__
1669 if __new__ is not None:
1739 if __new__ is None:
1786 if __new__ is None:
1799 if '__new__' in body:
1800 enum_class.__new_member__ = enum_class.__new__
1801 enum_class.__new__ = Enum.__new__