0

在我编写代码时,有没有办法针对未实现的方法发出 pylance 警告?

在运行时,我们可以使用raise NotImplementedError它来确保每个子类在调用它之前覆盖父类方法。

class blueprint:
    def methodA(self):
        raise NotImplementedError

class myClass(blueprint):
      def methodB(self):
        pass

myInstance = myClass()
myInstance.methodA() #raises error at runtime, I want this to show error or warning before runtime

因为我可能不会在每个阶段测试应用程序的每个部分。我想确保它通知我,即使我没有在运行时调用未实现的方法

4

0 回答 0