mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-06 08:00:18 +07:00
A class containing at least one method declared with `abstractmethod` decorator that hasn’t been overridden yet cannot be instantiated. Also report instantiation of classes that directly inherit ABC or have metaclass set to ABCMeta. GitOrigin-RevId: 55cb4dc90c55ddc63991a4c3f6b50b4e34a3b4bd
17 lines
297 B
Python
17 lines
297 B
Python
from abc import ABCMeta, abstractmethod
|
|
|
|
|
|
class AbstractClass(metaclass=ABCMeta):
|
|
@abstractmethod
|
|
def foo(self):
|
|
...
|
|
|
|
|
|
def bar(cls: type[AbstractClass]):
|
|
return cls().foo()
|
|
|
|
|
|
AC = AbstractClass
|
|
|
|
<warning descr="Cannot instantiate abstract class 'AbstractClass'">AC()</warning>
|