| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
(GH-9518) (#17532)
(cherry picked from commit d219cc4180e7589807ebbef7421879f095e72a98)
Co-authored-by: Yury Selivanov <yury@magic.io>
|
| |
|
|
|
| |
(cherry picked from commit b0f4dab8735f692bcfedcf0fa9a25e238a554bab)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
| |
(cherry picked from commit 96e12d5f4f3c5a20986566038ee763dff3c228a1)
Co-authored-by: Min ho Kim <minho42@gmail.com>
|
| |
|
|
|
|
| |
(GH-13877) (GH-14405)
(cherry picked from commit f5b89af)
|
| |
|
|
|
|
|
| |
(GH-11826)
(cherry picked from commit b01786c8812c4cc24dd561b5941025bdd6f444c0)
Co-authored-by: Christopher Hunt <chrahunt@gmail.com>
|
| |
|
|
|
|
|
|
| |
(#9970)
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.
(cherry picked from commit dd13c88b5371e13fc16b84e2f9b8715d917de269)
Co-authored-by: Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) <srinivasreddy@users.noreply.github.com>
|
| |
|
|
|
|
|
| |
namedtuples. (GH-9151) (GH-9304)
(cherry picked from commit 9b9d97dd139a799d28ff8bc90d118b1cac190b03)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
| |
(cherry picked from commit 4d12e4dc28b7c782c368bae2e8fd3815167ed37d)
Co-authored-by: Vadim Pushtaev <pushtaev.vm@gmail.com>
|
| |
|
|
|
| |
(cherry picked from commit e55ca3fdcbb8dda04f6f9fb2ccd1069aa1100cd5)
Co-authored-by: Artjom <tjomk@users.noreply.github.com>
|
| |
|
|
|
| |
(cherry picked from commit 3d70f7aef614c396f516b5fccedeebe98598714d)
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
|
| |
|
|
|
| |
(cherry picked from commit e7adf2ba41832404100313f9ac9d9f7fabedc1fd)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
| |
(cherry picked from commit 4e81296b1874829912c687eba4d39361ab51e145)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
| |
This condition as already tested before this code is called.
(cherry picked from commit 9285835a05ad0319acef111340266c0f85ed549c)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
| |
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.
(cherry picked from commit f8e7549490d61c92b34bf2de3e03ba2f7b0ac6e1)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
| |
(cherry picked from commit 2a7bacbd913cf2bf568b3c0f85a758946d3cf4e9)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
| |
(cherry picked from commit 01abc6ec3a61769c55ee86834a432fb97801d28f)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
| |
(cherry picked from commit 3059042410dce69806b94be72d5c8055d616f3a3)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
|
| |
members (GH-6798)
(cherry picked from commit 2473eea65d592a80a5362a00362738a33196aba1)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
| |
(cherry picked from commit 5a7092de1226a95a50f0f384eea8ddb288959249)
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
|
| |
|
|
|
|
|
| |
(GH-6305)
(cherry picked from commit 521995205a2cb6b504fe0e39af22a81f785350a3)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
|
|
| |
argument. (GH-6260)
This is part of PEP 487 and the descriptor protocol.
(cherry picked from commit de7a2f04d6b9427d568fcb43b6f512f9b4c4bd84)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
| |
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.
(cherry picked from commit 01d618c5606a239b03ad1269541eddb6e724775d)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
(cherry picked from commit f96ddade0094d162cb6c2fd7255c5e8a90b5c37d)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
|
|
| |
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.
(cherry picked from commit 56970b8ce9d23269d20a76f13c80e670c856ba7f)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
|
| |
- Add missing 'Field' to __all__.
- Improve tests to catch this.
(cherry picked from commit 8e4560a9da6a02aa157dd7df8bd0be0d258c0a73)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
|
|
| |
default_factory (GH-6170) (GH-6171)
Fix the way that new annotations in a class are detected.
(cherry picked from commit 8f6eccdc64cab735c47620fea948e64b19f83684)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
|
|
| |
(GH-6152) (GH-6153)
If the class has a member that's a MemberDescriptorType, it's not a default value, it's from that member being in __slots__.
(cherry picked from commit 7389fd935c95b4b6f094312294e703ee0de18719)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
| |
derived classes (GH-6147) (GH-6148)
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.
(cherry picked from commit f199bc655eb50c28e94010714629b376bbbd077b)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
| |
(cherry picked from commit 5da8cfb838fa1bf3529c085c6dce1adf3d1eaf62)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
|
|
| |
classes and vice-versa, (GH-5919) (GH-5920)
This restriction will be relaxed at a future date.
(cherry picked from commit 2fa6b9eae07e2385e2acbf2e40093a21fb3a10c4)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
|
|
|
|
|
| |
unsafe_hash. (GH-5891) (GH-5902)
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.
(cherry picked from commit dbf9cff48a4ad0fd58e1c623ce1f36c3dd3d5f38)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
|
| |
|
| |
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.
|
| |
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
dataclass(). (gh-5117)
|
| |
|
|
| |
(gh-5115)
|
| |
|
|
| |
dataclass or an instance of one. (#5113)
|
| | |
|
| |
|