* Clarify next-gen auto_attribs inference rules
The next-gen auto_attribs api documentation does not clearly describe
cases where (a) only a subset of attributes are annotated and (b)
`field` definitions are provided for a subset of fields. Update
docstring to reflect current, desirable, behavior.
Add tests to clarify `.define` behavior focused on fully-annotated
classes with partially-defined fields, which is commonly used to add
non-default behavior to a subset of a classes fields. For example:
```python
@attr.define
class NewSchool:
x: int
y: list = attr.field()
@y.validator
def _validate_y(self, attribute, value):
if value < 0:
raise ValueError("y must be positive")
```
The previous docstring *could* be read to imply that:
* The new-school API will not infer auto_attribs if there are any
unannotated attributes.
* The new-school API will not infer auto_attribs if *any* attr.ib are
defined, even if those attr.ibs are type annotated.
* Update test to match PR example
* Fix lint error
Co-authored-by: Hynek Schlawack <hs@ox.cx>
* Fixed slots inheritance
* Added changelog
* Added a separate test
* Restored backwards-compatibility and added a test for it
Co-authored-by: Hynek Schlawack <hs@ox.cx>
* Infer annotations from converters
* Use semantic newlines
* Add 787.change.rst
* Don't let type annotations override converters
* Make pipe() infer type annotations
* Use PY2 instead of sys.versioninfo >= (3, 3)
* Avert crashing with a nullary converter
* Small doc change
* Add type inference for optional()
* Make pipe() annotations actually work
Co-authored-by: Hynek Schlawack <hs@ox.cx>
Passing SVG files through `svgo` often makes them harder to edit for applications like InkScape or Sketch. This commit splits the single `path` in the files into multiple paths to resolve this issue. The file is now slightly larger, but should be a lot more maintainable. If more compression is needed then svgo should be applied in a build step, but the repository should contain the raw source file.
* Ease Hypothesis shrinking
This is a tiny performance improvement for shrinking.
Unconditionally drawing and conditionally *using* these boolean flags minimises the impact of mutating other parts of an input on the structure here, which in turn means more attempts will be valid.
* Refactor Hypothesis strategy
Using the composite decorator allows for a much clearer imperative description of how the class is constructed.
* Added kw_only support for py2
* Docs update
* Added changelog
* Better exception message, moved code to function
* Moved py2-only functions under if PY2:
* Tested fancy error message for unexpected kw-only argument
* Tested fancy error message for unexpected kw-only argument
* Fixed line length
* Added versionchanged
* Updated docs
* Moved functions back under if PY2 - seems codecov doesn't like them in module scope
* Blacked
* Fixed changelog.d
* Removed redundant brackets in test
* Added assertion to the _unpack_kw_only_lines_py2 - hope it will increase code coverage
* List comprehension -> for loop
* lines.extend? I do not like for-loops
* Fix code
* Fixed style/added comment
* Fixed docs (removed python2 mention)
* Fix lint
* Better docstring
* Rewritten docstring and added example code
* Added quotes
Co-authored-by: Hynek Schlawack <hs@ox.cx>