ChandlerSong
ChandlerSong

Reputation: 487

How to find and implement all the abstract methods in PyCharm?

Is there a smart way to find and implement all the abstract methods in PyCharm Community Edition?

I've found there's a "Implement methods (Ctrl+I)", but it's always been disabled.

For example:

class Base():
  @abstractmethod
  def abstract1(self):
     raise NotImplementedError

  @abstractmethod
  def abstract2(self):
     raise NotImplementedError

  def method1(self):
    print("ok")

If I write a sub class, is there a smart way to implement abstract1 and abstract2 in my sub class, but not method1?

Because I found use Ctrl+O will need to read the source before.

Upvotes: 4

Views: 1739

Answers (1)

user2235698
user2235698

Reputation: 7639

Definition of subclass would be highlighted as below.

enter image description here

Use Alt+Enter on class name to call intention that will suggest methods to implement.

enter image description here

There is an issue for Implement Methods.. action, please vote for it.

Upvotes: 4

Related Questions