Commit Graph

28 Commits

Author SHA1 Message Date
Hynek Schlawack b0942e1b2e Add str argument to @attr.s
Fixes #112
2016-11-20 15:52:11 +01:00
Tin Tvrtković 0fac9215b8 Introduce attribute metadata. (#96) 2016-11-19 09:47:03 +01:00
Hynek Schlawack cfa6d2e99f Implement immutability (#60) 2016-08-20 18:45:15 +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
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
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
Hynek Schlawack 174d37f941 Allow mandatory attributes after init=False attrs
Maybe not the best design but a valid case nonetheless.
2016-02-06 12:20:37 +01:00
Hynek Schlawack 1af3eaa877 Allow the case of initializing attributes that are set to `init=False`
This allows for clean initializer parameter lists while being able to
initialize attributes to default values.
2015-12-19 13:43:07 +01:00
Hynek Schlawack 788ade3bcf Fix flake8 2015-07-03 12:15:05 +02:00
Hynek Schlawack 0149b538ab Fix tests on Python 2.6
Fixes #14 and #15.
2015-07-03 11:30:53 +02: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 08ff764de7 Pass instances into validators
Also construct the instance first and then run all validators on it.

This allows for cross-attribute validation.
2015-02-09 13:16:56 +01:00
Hynek Schlawack 4e81b7b5e2 Rename add_XXX to no_XXX
Assume you want everything by default and be consistent with the no_XXX
attributes on Attribute.
2015-02-07 09:15:59 +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 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 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 774cf0142a Pass the Attribute object into validators
This allows for more generic validators.
2015-01-29 09:22:06 +01:00
Hynek Schlawack 372c55318c Add validators 2015-01-28 15:54:41 +01:00
Hynek Schlawack 58d5c0a767 Get rid of <> in repr
Closes #1
2015-01-27 23:08:55 +01:00
Hynek Schlawack 9560908555 Initial commit
Docs aren't there yet
2015-01-27 17:53:17 +01:00