Commit Graph

245 Commits

Author SHA1 Message Date
George Macon 4c41099fb8 Do not copy __weakref__ from original _cls_dict (#410)
self._cls_dict["__weakref__"] holds a reference to self._cls, preventing
self._cls from being released after the new, slots-enabled class is
returned.

Fixes #407
2018-07-28 11:24:53 +01:00
Hynek Schlawack 0693f47b82 Disable hypothesis.HealthCheck.too_slow globally (#396)
* Disable hypothesis.HealthCheck.too_slow globally

Fixes #364

* Add newsfragment
2018-06-17 13:32:48 +02:00
Tin Tvrtković 908cb018f2 Feature/recursive asdict (#395)
* Fix recursive asdict.

* Blacken.

* Add tests.

* Fix docstring. Add changelog entry.

* Update 395.change.rst
2018-06-17 07:55:55 +02:00
Hynek Schlawack 2834ee4a0c
Raise DeprecationWarning when comparing subclasses (#394)
* Raise DeprecationWarning when comparing subclasses

* Grammar

* Add newsfragment
2018-06-16 17:00:45 +02:00
Hynek Schlawack 9ffb013ea7 Clean up changelog.d 2018-06-16 08:07:25 +02:00
Zac Hatfield-Dodds a3dbdfc687 Improve error for in_(a_string) with a non-string value (#383)
* Improve error for in_(a_string) with a non-string value

* Tighten exception handling and test description

* Improve changelog for Hynek

* Final changelog edit
2018-05-25 10:32:13 +02:00
Hynek Schlawack 5b5a9c4ba3 Use new slotted lingo 2018-05-03 18:00:38 +02:00
Hynek Schlawack 879f43d355 Add narrative chapter about initialization (#370)
* Add narrative chapter on initialization

* Be more explicit about defining validators both ways

* Stress that the name of default/validator != attr name

* Mention nested schemas

* Explain handling of private attributes

* Add another consequence of _ stripping

* Stress that nothing should overwrite attributes on class body

* Better wording

* typo

* Dedup examples

* Address review feedback

* Add newsfragments
2018-04-25 00:07:03 +02:00
David Euresti fc033b41a1 Annotate __init__ with type hints (#363)
* Annotate __init__ with type hints

This just adds the annotations found at run-time to the
`__annotations__` attribute of the created `__init__` function

Fixes #249

* More tests. Add return annotation

* Documentation

* This is not markdown
2018-04-06 10:36:29 +02:00
Glyph 5e46afda49
return "..." rather than raising RecursionError for repr() on a cyclic object
Fixes #95
2018-03-17 01:32:28 -07:00
Hynek Schlawack 780e1e5e1e
Add syntactic sugar for attr.ib(default=attr.Factory) (#356)
Fixes #178
2018-03-14 19:05:48 +01:00
Andy Freeland bf65b96a91 Add attr.fields_dict() (#349) 2018-03-03 15:09:05 +01:00
Hynek Schlawack 538d75f60c Retain order if these or make_class are passed an ordered dict (#343)
* Retain order if these or make_class are passed an ordered dict

Fixes #339

* Add newsfragment

* Another newsfragment

Fixes #300

* Docs and change tags

* Disable coverage and explain why

* PyPy has ordered dicts too

* Import OrderedDict only when necessary
2018-02-17 12:24:23 +01:00
Tin Tvrtković b47c6ce8b1 Eliminate __init__ overhead for frozen dict classes. (#336) 2018-01-29 07:35:01 +01:00
Hynek Schlawack dc6040f9d5 Make cell setting completely best effort (#334)
* Make cell setting completely best effort

We just try, catch any exception and warn if it doesn't work on a Python 3.
Should cover edge cases such as Jython or GAE.

Fixes #321

* Add news fragment

* Typing is hard yo
2018-01-27 21:07:14 +01:00
Hynek Schlawack 825de4f008 Make NOTHING's hash vegan (#332)
...and fit into a 32bit integer.

Fixes #331
2018-01-26 14:30:23 +01:00
Hynek Schlawack 8278088a70
Ignore __weakref__ in __setstate__ & __getstate__ (#326) 2018-01-17 13:16:39 +01:00
Hynek Schlawack 1f0d851996 Kill off old newsfragments 2018-01-16 20:28:13 +01:00
Hynek Schlawack fc2062ea0c
Do not delete attributes from class body if these is passed (#323)
Fixes #322
2018-01-16 19:09:23 +01:00
Hynek Schlawack b778e5c987 Fix release stuff 2017-12-30 09:03:45 +01:00
Hynek Schlawack 3cffdfa3dd Encourage kwargs-based initialization
ref #304
2017-12-29 09:41:33 +01:00
Hynek Schlawack ea99d26666 Clean up main directory a bit 2017-12-27 13:32:32 +01:00
Hynek Schlawack 8249305e12 Remove superfluous word 2017-12-27 12:01:08 +01:00
Hynek Schlawack d33906ab90 Better working of the consequences of #304 2017-12-27 11:59:37 +01:00
Hynek Schlawack 9e1f1360a8
Add __module__ and __qualname__ to methods, fix __name__ (#316) 2017-12-27 11:54:18 +01:00
Hynek Schlawack bc0b437e58
Rename convert to converter (#315) 2017-12-23 08:46:10 +01:00
Hynek Schlawack 051da6872a Wordsmith newsfragment 2017-12-19 08:41:06 +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 5ed8c4a015
Fix MRO traversal with multiple inheritance (#304)
* Fix MRO traversal with multiple inheritance

* Add newsfragments
2017-12-13 15:33:44 +01:00
Yann Kaiser 9d441d70ab Fix __repr__ crashing when a member is uninitialized or deleted (#308) 2017-12-06 10:21:58 -08:00
Hynek Schlawack cd8890c744
Speed up __eq__ by generating code (#306)
* Speed up __eq__ by generating code

* Add newsfragment
2017-12-04 18:48:25 +01:00
Hynek Schlawack defa6b6f40 Fix and accelerate generated __hash__ methods (#296)
* Fix and accelerate generated __hash__ methods

We now create a method like we do for __init__ and hash also the class of the
instance.

* Add/fix news fragments

* Hash random numbers instead of the actual class

* Even simpler: let's hash the unique filename

Or rather it's hash, because hashing ints is very fast.
2017-11-30 10:16:11 +01:00
Hynek Schlawack f5b59a01f8
Handle inherited __annotations__ (#292)
* Handle inherited __annotations__

Fixes #291

* Add pr fragment
2017-11-14 06:27:50 +01:00
Hynek Schlawack a84a36d45f
Handle attrib redefs thru multiple inheritance (#287) 2017-11-11 07:09:17 +01:00
Hynek Schlawack 1e6627c9ad
Make ctypes optional (#286) 2017-11-10 17:23:53 +01:00
Hynek Schlawack aa097d62a1 Kill off merged news fragments 2017-11-08 18:44:09 +01:00
Hynek Schlawack 88aa1c897d
Add auto_attribs (#277)
Allow for attr.ib-less attribute definitions using class variable annotations.
2017-11-08 11:15:21 +01:00
Stanis Trendelenburg c1adf5cfc6 Fix pickling for instances of classes created using make_class() (#282) 2017-11-04 14:38:03 +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 f47efca44e Some changelog adjustments 2017-10-03 10:45:00 +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
Chad Dombrova 566ada9848 Basic type support (#239)
* Add support for passing a type to attr.ib() and gathering the type from PEP526-style annotations.

* Address review notes.

* More review notes.

* A few more review changes.

* Quick final fix to the changelog.
2017-09-17 16:22:49 +02:00
Hynek Schlawack 4faf5f9c26 Allow subclasses to overwrite attributes (#229)
Simply filter out all attributes from super classes that are present in the
current class.

Fixes #221
2017-08-21 00:39:34 +02:00
Hynek Schlawack 5184ecac99 Obey own naming scheme 2017-08-20 08:11:12 +02:00
Hynek Schlawack 55ae1945b3 Move changelog to towncrier (#236) 2017-08-20 07:58:08 +02:00