A lot of classes in refex predate the attrs type argument, so that they look like this:
@attr.s(...)
class Foo(...)
x = attr.ib(...) # type: SomeTypeHere
The new form is:
@attr.s(...)
class Foo(...)
x = attr.ib(..., type=SomeTypeHere)
Benefits of the new form:
- shows up in documentation.
- better-supported by tools
- formats way better when you need to break across lines etc.
It might be a neat thing to do to, well, automate this via refex and apply it to refex itself. ;) It's a nontrivial matcher, because it involves editing (removing) a comment and editing the arguments to a function, which makes it useful as a demonstration of how to do nontrivial things with Refex. Since pretty much the only time anyone wants to use Refex is when it's something nontrivial, well...
A lot of classes in refex predate the attrs
typeargument, so that they look like this:The new form is:
Benefits of the new form:
It might be a neat thing to do to, well, automate this via refex and apply it to refex itself. ;) It's a nontrivial matcher, because it involves editing (removing) a comment and editing the arguments to a function, which makes it useful as a demonstration of how to do nontrivial things with Refex. Since pretty much the only time anyone wants to use Refex is when it's something nontrivial, well...