Miss Islington (bot)
1271ee8187
bpo-37868: Improve is_dataclass for instances. (GH-15325)
...
(cherry picked from commit b0f4dab873
)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2019-08-19 22:59:21 -07:00
Kyle Stanley
24b5b360fa
[3.8] Fix typos in docs, comments and test assert messages (GH-14872). ( #14900 )
...
(cherry picked from commit 96e12d5f4f
)
Co-authored-by: Min ho Kim <minho42@gmail.com>
2019-07-21 22:48:45 -04:00
Serhiy Storchaka
f5b89afde1
bpo-37163: Deprecate passing argument obj of dataclasses.replace() by keyword. (GH-13877)
2019-06-19 10:33:27 +03:00
Augusto Hack
01ee12ba35
bpo-33569 Preserve type information with dataclasses.InitVar (GH-8927)
2019-06-02 22:14:48 -04:00
penguindustin
9646630895
bpo-36766: Typos in docs and code comments (GH-13116)
2019-05-06 14:57:17 -04:00
Windson yang
be372d73b4
bpo-36678: Rename duplicate tests in test_dataclasses (GH-12899)
2019-04-22 11:45:34 -07:00
Christopher Hunt
b01786c881
bpo-35960: Fix dataclasses.field throwing away empty metadata. (GH-11815)
2019-02-12 06:50:49 -05:00
Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి)
dd13c88b53
bpo-33947: dataclasses no longer can raise RecursionError in repr (GF9916)
...
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.
2018-10-19 12:54:50 -04:00
Eric V. Smith
9b9d97dd13
bpo-34363: dataclasses.asdict() and .astuple() now handle fields which are namedtuples. (GH-9151)
2018-09-14 11:32:16 -04:00
Vadim Pushtaev
4d12e4dc28
bpo-34213: Allow dataclasses to work with a field named 'object'. (GH-8452)
2018-08-12 07:46:05 -04:00
Serhiy Storchaka
3fe5cccb08
bpo-34184: Fix running Lib/test/test_dataclasses.py as a script. (GH-8382)
2018-07-23 23:37:55 +03:00
Dong-hee Na
3d70f7aef6
bpo-33805: Improve error message of dataclasses.replace() (GH-7580)
2018-06-23 10:46:32 -04:00
Eric V. Smith
e7adf2ba41
bpo-33796: Ignore ClassVar for dataclasses.replace(). (GH-7488)
2018-06-07 14:43:59 -04:00
Eric V. Smith
4e81296b18
bpo-33536: Validate make_dataclass() field names. (GH-6906)
2018-05-16 11:31:29 -04:00
Eric V. Smith
2a7bacbd91
bpo-33453: Handle string type annotations in dataclasses. (GH-6768)
2018-05-15 22:44:27 -04:00
Eric V. Smith
74940913d2
Clean up and enhance frozen dataclass tests. (GH-6380)
...
* Add a test for frozen with unhashable field value.
* Improve a comment.
2018-04-05 06:50:18 -04:00
Ivan Levkivskyi
5a7092de12
Allow dynamic creation of generic dataclasses (GH-6319)
2018-03-31 13:41:17 +01:00
Eric V. Smith
521995205a
bpo-33175: dataclasses should look up __set_name__ on class, not instance (GH-6305)
2018-03-29 11:07:48 -04:00
Eric V. Smith
de7a2f04d6
bpo-33141: Have dataclasses.Field pass through __set_name__ to any default argument. (GH-6260)
...
This is part of PEP 487 and the descriptor protocol.
2018-03-26 13:29:16 -04:00
Eric V. Smith
2b75fc2bc9
Minor fixes to dataclass tests. (GH-6243)
...
Also, re-enable a test for ClassVars with default_factory.
2018-03-25 20:37:33 -04:00
Eric V. Smith
51c9ab42ab
Trivial improvements to dataclasses tests. (GH-6234)
2018-03-25 09:04:32 -04:00
Eric V. Smith
c42e7aa67c
Fix invalid escape sequence: use raw string. (GH-6225)
2018-03-24 23:02:21 -04:00
Eric V. Smith
56970b8ce9
bpo-32505: dataclasses: raise TypeError if a member variable is of type 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.
2018-03-22 16:28:48 -04:00
Eric V. Smith
8e4560a9da
Add 'Field' to dataclasses.__all__. (GH-6182)
...
- Add missing 'Field' to __all__.
- Improve tests to catch this.
2018-03-21 17:10:22 -04:00
Eric V. Smith
8f6eccdc64
bpo-32896: Fix error when subclassing a dataclass with a field that uses a default_factory (GH-6170)
...
Fix the way that new annotations in a class are detected.
2018-03-20 22:00:23 -04:00
Eric V. Smith
7389fd935c
bpo-33100: Dataclasses now handles __slots__ and default values correctly. (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__.
2018-03-19 21:07:51 -04:00
Eric V. Smith
f199bc655e
bpo-32953: Dataclasses: frozen should not be inherited for non-dataclass 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.
2018-03-18 20:40:34 -04:00
Eric V. Smith
2fa6b9eae0
bpo-32960: For dataclasses, disallow inheriting frozen from non-frozen classes and vice-versa, (GH-5919)
...
This restriction will be relaxed at a future date.
2018-02-26 20:38:33 -05:00
Terry Jan Reedy
973cae07d6
Fix 'deecorator' typo in test/test_dataclasses (GH-5899)
2018-02-25 21:38:18 -05:00
Eric V. Smith
dbf9cff48a
bpo-32929: Dataclasses: Change the tri-state hash parameter to the boolean 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.
2018-02-25 21:30:17 -05:00
Eric V. Smith
718070db26
Exhaustively test dataclass hashing when no hash= value is provided. This is in anticipation of changing how non-default hashing is handled. ( #5834 )
2018-02-23 13:01:31 -05:00
Eric V. Smith
7c99e931a9
Fix trivial typo in test_dataclasses.py. (GH-5398)
2018-01-28 19:18:55 -05:00
Eric V. Smith
ea8fc52e75
bpo-32513: Make it easier to override dunders in dataclasses. (GH-5366)
...
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.
2018-01-27 19:07:40 -05:00
Eric V. Smith
d80b443f02
bpo-32279: Add additional params to make_dataclass(), pass through to dataclass(). (gh-5117)
2018-01-06 17:09:58 -05:00
Eric V. Smith
ed7d429ebb
bpo-32278: Allow dataclasses.make_dataclass() to omit type information. (gh-5115)
2018-01-06 16:14:03 -05:00
Eric V. Smith
e7ba013d87
bpo-32499: Add dataclasses.is_dataclass(obj), which returns True if obj is a dataclass or an instance of one. ( #5113 )
2018-01-06 12:41:53 -05:00
Eric V. Smith
03220fdb26
bpo-32427: Expose dataclasses.MISSING object. ( #5045 )
2017-12-29 13:59:58 -05:00
Serhiy Storchaka
13a6c098c2
bpo-32259: Make a TypeError message when unpack non-iterable more specific. ( #4903 )
2017-12-26 12:30:41 +02:00
Mike
53f7a7c281
bpo-32297: Few misspellings found in Python source code comments. ( #4803 )
...
* Fix multiple typos in code comments
* Add spacing in comments (test_logging.py, test_math.py)
* Fix spaces at the beginning of comments in test_logging.py
2017-12-14 13:04:53 +02:00
Eric V. Smith
24e77f9265
Use raw strings for regex to avoid invalid escape sequences. (GH-4741)
2017-12-06 14:00:34 -05:00
Eric V. Smith
f0db54a0a1
bpo-32214: Implement PEP 557: Data Classes ( #4704 )
2017-12-04 16:58:55 -05:00