Commit Graph

20 Commits

Author SHA1 Message Date
Hynek Schlawack 11634733c5 Extract strategies into proper module (#365) 2018-04-11 00:00:57 +02:00
Hynek Schlawack bc0b437e58
Rename convert to converter (#315) 2017-12-23 08:46:10 +01:00
Kyle Altendorf 1addd3534d Make _CountingAttr empty metadata unique (#280)
* Make _CountingAttr empty metadata unique

Issue #278

* Correct st.none().map() to st.builds()

* Add 'real' and 'force coverage' tests for not None metadata

* Add changelog for pr 280

* Correct import order in tests/test_make.py

* Add back coverage force test

* Remove debug print from test/utils.py
2017-12-19 07:51:24 +01:00
Hynek Schlawack 3040bdabbc Refactor class creation (#272)
Instead of adding and possibly later deleting attributes, the class creation is delegated into a cleaner building pattern.
2017-10-26 12:55:34 +02:00
Hynek Schlawack 8b490b8586 Stop setting attributes on class bodies (#253)
* Stop setting attributes on class bodies

This behavior has been deprecated since 16.1 and can now be removed in
accordance with our backward-compatibility policy.

* We don't need iterkeys anymore
2017-10-02 12:14:37 +02:00
Tin Tvrtković 82ea73cb47 Compatibility fixes. (#193)
* Restore hash to validators.

* Restore Attribute.default and Attribute.validator.

* _AndValidator is hashable now. Test validator hashability.

* Add in_ to validators.__all__.
2017-05-19 11:31:00 -07:00
Hynek Schlawack a328e67169 Add takes_self to Factory and @_CountingAttr.default (#189)
* Add takes_self to Factory and @_CountingAttr.default

Fixes #165

* Add dark @Tinche magic
2017-05-16 09:36:39 +02:00
Hynek Schlawack f560500886 Fix hashing behavior (#142) 2017-02-19 09:51:43 +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
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
inso 1b419e304b Add attr.astuple
Fixes #77 and fixes #78
2016-09-11 08:55:30 +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ć a7ba5122f6 Speed up Attribute instantiation. (#70) 2016-08-24 11:30:25 +02:00
Tin Tvrtković dd4140ebcd Optimize init validators. (#64) 2016-08-22 16:35:08 +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