Skip to content

Remove #type: comments for attributes. #16

@ssbr

Description

@ssbr

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:

  1. shows up in documentation.
  2. better-supported by tools
  3. 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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions