summaryrefslogtreecommitdiffstats
path: root/Lib/dataclasses.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-33947: dataclasses no longer can raise RecursionError in repr (GF9916)Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి)2018-10-191-6/+31
| | | The reprlib code was copied here instead of importing reprlib. I'm not sure if we really need to avoid the import, but since I expect dataclasses to be more common that reprlib, it seems wise. Plus, the code is small.
* bpo-34363: dataclasses.asdict() and .astuple() now handle fields which are ↵Eric V. Smith2018-09-141-2/+38
| | | | namedtuples. (GH-9151)
* bpo-34213: Allow dataclasses to work with a field named 'object'. (GH-8452)Vadim Pushtaev2018-08-121-1/+7
|
* Fix typo in dataclasses documentation (GH-8102)Artjom2018-07-051-1/+1
|
* bpo-33805: Improve error message of dataclasses.replace() (GH-7580)Dong-hee Na2018-06-231-0/+3
|
* bpo-33796: Ignore ClassVar for dataclasses.replace(). (GH-7488)Eric V. Smith2018-06-071-1/+5
|
* bpo-33536: Validate make_dataclass() field names. (GH-6906)Eric V. Smith2018-05-161-0/+15
|
* bpo-33534: Remove unneeded test. (GH-6897)Eric V. Smith2018-05-161-6/+5
| | | This condition as already tested before this code is called.
* Reflow dataclasses comments (GH-6893)Eric V. Smith2018-05-161-170/+176
| | | To be more consistent with other code (and so people stop hassling me!), reflow the dataclasses comments to not use a single space indentation when continuing a paragraph of text.
* bpo-33453: Handle string type annotations in dataclasses. (GH-6768)Eric V. Smith2018-05-161-18/+116
|
* bpo-33517: dataclasses: Add the field type to Field repr (GH-6858)Eric V. Smith2018-05-151-4/+10
|
* bpo-33502: dataclass._Dataclassparams repr: use repr of each member. (GH-6812)Eric V. Smith2018-05-141-6/+6
|
* bpo-33494: Change dataclasses.Fields repr to use the repr of each of its ↵Eric V. Smith2018-05-141-8/+8
| | | | members (GH-6798)
* Allow dynamic creation of generic dataclasses (GH-6319)Ivan Levkivskyi2018-03-311-1/+3
|
* bpo-33175: dataclasses should look up __set_name__ on class, not instance ↵Eric V. Smith2018-03-291-2/+2
| | | | (GH-6305)
* bpo-33141: Have dataclasses.Field pass through __set_name__ to any default ↵Eric V. Smith2018-03-261-0/+14
| | | | | argument. (GH-6260) This is part of PEP 487 and the descriptor protocol.
* bpo-33134: dataclasses: use function dispatch table for hash, instead of a ↵Eric V. Smith2018-03-251-40/+36
| | | | | | | string lookup which then is tested with if tests. (GH-6222) * Change _hash_action to be a function table lookup, instead of a list of strings which is then tested with if statements.
* Trivial dataclass cleanups: (GH-6218)Eric V. Smith2018-03-241-23/+26
| | | | | | | | | | - When adding a single element to a list, use .append() instead of += and creating a new list. - For consistency, import the copy module, instead of just deepcopy. This leaves only a module at the class level, instead of a function. - Improve some comments. - Improve some whitespace. - Use tuples instead of lists. - Simplify a test.
* bpo-32505: dataclasses: raise TypeError if a member variable is of type ↵Eric V. Smith2018-03-221-17/+21
| | | | | Field, but doesn't have a type annotation. (GH-6192) If a dataclass has a member variable that's of type Field, but it doesn't have a type annotation, raise TypeError.
* Add 'Field' to dataclasses.__all__. (GH-6182)Eric V. Smith2018-03-211-1/+2
| | | | - Add missing 'Field' to __all__. - Improve tests to catch this.
* bpo-32896: Fix error when subclassing a dataclass with a field that uses a ↵Eric V. Smith2018-03-211-11/+12
| | | | | default_factory (GH-6170) Fix the way that new annotations in a class are detected.
* bpo-33100: Dataclasses now handles __slots__ and default values correctly. ↵Eric V. Smith2018-03-201-0/+3
| | | | | (GH-6152) If the class has a member that's a MemberDescriptorType, it's not a default value, it's from that member being in __slots__.
* bpo-32953: Dataclasses: frozen should not be inherited for non-dataclass ↵Eric V. Smith2018-03-191-31/+89
| | | | | | | derived classes (#6147) If a non-dataclass derives from a frozen dataclass, allow attributes to be set. Require either all of the dataclasses in a class hierarchy to be frozen, or all non-frozen. Store `@dataclass` parameters on the class object under `__dataclass_params__`. This is needed to detect frozen base classes.
* Fixed incorrect default value for dataclass unsafe_hash. (GH-5949)Eric V. Smith2018-03-011-2/+2
|
* bpo-32960: For dataclasses, disallow inheriting frozen from non-frozen ↵Eric V. Smith2018-02-271-6/+13
| | | | | classes and vice-versa, (GH-5919) This restriction will be relaxed at a future date.
* bpo-32929: Dataclasses: Change the tri-state hash parameter to the boolean ↵Eric V. Smith2018-02-261-79/+105
| | | | | unsafe_hash. (#5891) unsafe_hash=False is now the default. It is the same behavior as the old hash=None parameter. unsafe_hash=True will try to add __hash__. If it already exists, TypeError is raised.
* bpo-32513: Make it easier to override dunders in dataclasses. (GH-5366)Eric V. Smith2018-01-281-82/+224
| | | Class authors no longer need to specify repr=False if they want to provide a custom __repr__ for dataclasses. The same thing applies for the other dunder methods that the dataclass decorator adds. If dataclass finds that a dunder methods is defined in the class, it will not overwrite it.
* bpo-32226: PEP 560: improve typing module (#4906)Ivan Levkivskyi2018-01-201-1/+2
| | | | This PR re-designs the internal typing API using the new PEP 560 features. However, there are only few minor changes in the public API.
* Fix obvious typos in docstrings (#5151)Raymond Hettinger2018-01-111-6/+7
|
* bpo-32506: Change dataclasses from OrderedDict to plain dict. (gh-5131)Eric V. Smith2018-01-071-8/+8
|
* Fix dataclasses docstring typo. (gh-5118)Eric V. Smith2018-01-071-2/+2
|
* bpo-32279: Add additional params to make_dataclass(), pass through to ↵Eric V. Smith2018-01-061-3/+7
| | | | dataclass(). (gh-5117)
* bpo-32278: Allow dataclasses.make_dataclass() to omit type information. ↵Eric V. Smith2018-01-061-6/+14
| | | | (gh-5115)
* bpo-32499: Add dataclasses.is_dataclass(obj), which returns True if obj is a ↵Eric V. Smith2018-01-061-6/+13
| | | | dataclass or an instance of one. (#5113)
* bpo-32427: Expose dataclasses.MISSING object. (#5045)Eric V. Smith2017-12-291-20/+21
|
* bpo-32214: Implement PEP 557: Data Classes (#4704)Eric V. Smith2017-12-041-0/+776