Commit Graph

33 Commits

Author SHA1 Message Date
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
YevIgn c70a910537 Preserve metaclass when slots=True (#155) 2017-03-07 13:57:03 +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
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ć 0fac9215b8 Introduce attribute metadata. (#96) 2016-11-19 09:47:03 +01: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 cfa6d2e99f Implement immutability (#60) 2016-08-20 18:45:15 +02:00
Tin Tvrtkovic 821e8537af We hypothesizin'. 2016-03-23 00:15:14 +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 7b201eb199 Initial slots implementation. 2016-03-14 03:02:13 +01:00
cyli b3ef2844c5 If you subclass an attr class, the repr should include the name of the subclass, not the superclass, even if you don't redecorate with another @attr.s 2015-07-21 16:25:28 -07:00
Hynek Schlawack d964845899 Make __attrs_attrs__ a tuple
Having a mutable and rather heavy data structure for something that is supposed
to be immutable doesn't seem to make sense.
2015-03-23 09:17:54 +01:00
Hynek Schlawack fba942270b Stay happy and positive
Closes #6
2015-02-20 13:29:47 +01:00
Hynek Schlawack 980067d8f1 We're ASCII-clean 2015-02-20 11:22:10 +01:00
Hynek Schlawack 5648b28e0e Accidental smart quote 2015-02-18 21:54:27 +01:00
Hynek Schlawack b88b85779e Add smart support for sub-classing 2015-02-18 21:31:32 +01:00
Hynek Schlawack 82892487fb Remove assignment validation again
Mainly because:

1. I don't want to encourage mutations.
2. It's impossible to protect the attributes from becoming invalid anyway so
   this is a lot of complexity (and __setattr__ overwriting) but only little
   benefit.
2015-01-31 18:01:31 +01:00
Hynek Schlawack e7ebf4bf81 Allow single attributes to be excluded 2015-01-30 17:48:34 +01:00
Hynek Schlawack 943d686509 Validate assignments 2015-01-30 13:30:47 +01:00
Hynek Schlawack 5753281838 Add attrs.make_class 2015-01-30 08:57:33 +01:00
Hynek Schlawack f61fb5d185 Eliminate factory field
Instead, have only one default field.  If the default value is an instance of
attr.Factory, use it as a factory.
2015-01-29 23:10:56 +01:00
Hynek Schlawack 717dcdadca Short default_value to default 2015-01-29 22:32:41 +01:00
Hynek Schlawack 9cb48a5814 Shorten default_factory to factory 2015-01-29 22:29:37 +01:00
Hynek Schlawack 16d9c464e3 Rename ls to fields 2015-01-29 21:55:25 +01:00
Hynek Schlawack b79c3afec3 Rename to_dict to asdict
For stdlib compatability.
2015-01-29 21:50:07 +01:00
Hynek Schlawack 8f98b38136 Increase branch coverage
And a lot of under the hood work.
2015-01-29 17:31:49 +01:00
Hynek Schlawack 3e45f0559e Strip underscore for __init__
There is not such thing as private parameters.
2015-01-29 13:05:04 +01:00
Hynek Schlawack 692e4613a0 Add instance_of validator 2015-01-29 12:20:17 +01:00
Hynek Schlawack 372c55318c Add validators 2015-01-28 15:54:41 +01:00
Hynek Schlawack 5ce5e48074 Change attr.a to attr.ib
Closes #2
2015-01-27 23:03:42 +01:00
Hynek Schlawack 9560908555 Initial commit
Docs aren't there yet
2015-01-27 17:53:17 +01:00