Commit Graph

108 Commits

Author SHA1 Message Date
Timothy Emiola fdfd51e249 Allow optional conversion (#173)
Fixes #105
2017-05-10 15:37:50 +02:00
Tin Tvrtković b79a49e9a4 Fix evolve (cont) (#182) 2017-05-04 13:20:39 +02:00
YevIgn c70a910537 Preserve metaclass when slots=True (#155) 2017-03-07 13:57:03 +01:00
Adam Morris d86e28bdde Add bases argument to make_class (#152)
Fixes #152
2017-03-04 07:40:50 +01:00
Mike Gilbert f232cc8554 Suppress HealthCheck.too_slow for tests using nested_classes (#149)
On very slow hardware, these may time out.

Bug: https://bugs.gentoo.org/show_bug.cgi?id=608570
2017-02-21 11:09:02 +01:00
Hynek Schlawack f560500886 Fix hashing behavior (#142) 2017-02-19 09:51:43 +01:00
Hynek Schlawack 97a02470e8 Fix inheritence of frozen-ness
Fixes #128
2017-02-12 08:33:20 +01:00
Hynek Schlawack 37d38c4dc3 Allow inline definitions of validators using a decorator
Also make previous changes for multiple validators backward-compatible.
2017-02-11 16:56:56 +01:00
Hynek Schlawack 72363a2a09 Allow validator to be a list of validators
Fixes #138
2017-02-04 14:38:05 +01:00
Tin Tvrtković 0d3cf3f624 Evolve and docs. (#135)
assoc is now deprecated in favor of evolve.
2017-01-21 17:11:45 +01:00
Eugene Pakhomov 1481227583 Fix post init hook not being called if validators are disabled (#129) (#130)
Fixes #129
2017-01-06 15:08:17 +01:00
Thomas A Caswell 72743d2b32 ENH: forbid delete attr from frozen class (#118)
Raise FrozenInstanceError when trying to delete an attribute from
a frozen class.
2016-12-14 10:55:43 +01:00
Tin Tvrtković 0c8211d922 Feature/better simple classes (#119) 2016-12-05 09:50:50 +01:00
Hynek Schlawack b0942e1b2e Add str argument to @attr.s
Fixes #112
2016-11-20 15:52:11 +01:00
Hynek Schlawack 3964f9d37b Rename __post_init__ to __attrs_post_init__
This makes it clearer its coming from attrs and is consistent with
__attrs__attrs__.
2016-11-20 14:39:34 +01:00
Hynek Schlawack 7e4cecdac2 Minor tweaks 2016-11-20 14:30:29 +01:00
Tommy Beadle 3dc5fb0a5a Add ability for ``__post_init__`` method to be defined.
If this method is defined for a class, it will get executed at the end
of ``__init__``.  Previously, there was no way to extend what was
done during ``__init__`` when using ``@attr.s``.
2016-11-20 14:05:34 +01:00
Tin Tvrtković 0fac9215b8 Introduce attribute metadata. (#96) 2016-11-19 09:47:03 +01:00
Roger Pate 4849dc12de don't overwrite __name__ with __qualname__ (#100) 2016-09-30 15:48:31 +02:00
Hynek Schlawack 91da85935b Oops 2016-09-11 09:33:38 +02:00
inso 1b419e304b Add attr.astuple
Fixes #77 and fixes #78
2016-09-11 08:55:30 +02:00
Hynek Schlawack adfdbf9560 Stop using deprecated APIs (#86)
Also use nicer exceptions that subclass the old ones.
2016-09-10 19:14:34 +02:00
Tin Tvrtković 024a16c434 Feature/fields properties (#88)
🙈
2016-09-10 17:50:17 +02:00
Tin Tvrtković 1897dfdf19 Improve tests, bandage assoc
Refactored and documented the simple_classes strategy. Applied the strategy to
assoc tests.
2016-09-10 08:40:47 +02:00
Tin Tvrtković 5428710ead Generate __init__ with converters inline
Fixes #80
2016-09-10 08:23:41 +02:00
mathieu longtin e59c360ee2 Fix pickle support for __slots__ classes
We add conditionally pickle methods to frozen __slots__ classes and document
that protocol 2 is required for any __slots__ class.

This fixes #81 and fixes #79.
2016-09-10 07:58:55 +02:00
Hynek Schlawack a624035cec Fix converters on frozen classes
Fixes #76

This should be reasonably fast @Tinche?
2016-09-05 14:47:06 +02:00
Hynek Schlawack eaa8c0d834 Make assoc work on frozen classes
Hi @jml.
2016-08-26 08:22:08 +02:00
Tin Tvrtković a7ba5122f6 Speed up Attribute instantiation. (#70) 2016-08-24 11:30:25 +02:00
Fabian Kochem c6fbec9637 Optionally retain collection types (fixes #69) 2016-08-23 13:31:29 +02:00
Tin Tvrtković dd4140ebcd Optimize init validators. (#64) 2016-08-22 16:35:08 +02:00
Hynek Schlawack cfa6d2e99f Implement immutability (#60) 2016-08-20 18:45:15 +02:00
Hynek Schlawack 111a627e70 Get rid of PY3 constant and codecov badge
Sadly, their service grew unreliable. :(
2016-08-16 12:35:27 +02:00
Hynek Schlawack 07366e18c1 Rename cl to cls 2016-08-15 15:59:10 +02:00
Hynek Schlawack b337f5b9d5 Move test helpers into an utils module
__init__.py should never contain any code.
2016-08-15 15:27:13 +02:00
Tin Tvrtković 46ac6b6046 Make Attribute instances immutable and slotted. (#51) 2016-08-13 16:16:37 +02:00
Tin Tvrtković 588fe48019 Simplify asdict and has (#48) 2016-08-08 08:44:30 +02:00
Tin Tvrtković d10e5c41d6 asdict - propagate dict_factory properly (#45)
* asdict - propagate dict_factory properly. Hypothesis tests.

* Disable Hypothesis health checks on Travis/PyPy.

* Tox - pass the HYPOTHESIS_PROFILE environment variable.

* Shut up pytest again.
2016-06-02 15:40:15 -07:00
Tin Tvrtkovic 6ce0a0d80d Fix flake8. Tweak changelog. 2016-05-15 16:43:17 +02:00
Tin Tvrtkovic 88f33a9375 Review feedback. 2016-05-15 02:00:36 +02:00
Tin Tvrtkovic 17a48c3bc3 Fix comments. 2016-05-08 23:50:53 +02:00
Tin Tvrtkovic cd80208187 Initial dict_factory support for asdict. 2016-05-07 19:55:09 +02:00
Hynek Schlawack 4b94e0314c Fix _Nothing class' __eq__
All instances used to be equal to anything.  Didn't pop up because attrs
always compares them using `is`.
2016-04-28 10:32:38 +02:00
Hynek Schlawack c7842b8cb6 CHANGELOG & small nits
Fixes #35, #31
2016-03-31 13:12:36 +02:00
Tin Tvrtkovic 821e8537af We hypothesizin'. 2016-03-23 00:15:14 +01:00
Tin Tvrtkovic c50d5aaa20 Flipped a bunch of asserts in test_slots. 2016-03-21 22:32:23 +01:00
Tin Tvrtkovic 37bc4b878c Rename class_ to cls.
Fix docstrings.
Fix missing parens in a test.
2016-03-17 19:40:11 +01:00
Tin Tvrtkovic 1d21609c14 Fix reprs. 2016-03-16 22:28:43 +01:00
Tin Tvrtkovic 26b7bff084 Handle some edge cases for slots.
Many more slot tests.
2016-03-16 03:10:28 +01:00
Tin Tvrtkovic 7b201eb199 Initial slots implementation. 2016-03-14 03:02:13 +01:00