Skip to content

@abstractmethod on virtual methods #4270

@david-waterworth

Description

@david-waterworth

There are a number of methods of the LightningDataModule which are marked as @abstractmethod even though they're not really abstract i.e. transfer_batch_to_device.

Requires that the metaclass is ABCMeta or derived from it. A
class that has a metaclass derived from ABCMeta cannot be
instantiated unless all of its abstract methods are overridden.
The abstract methods can be called using any of the normal
'super' call mechanisms. abstractmethod() may be used to declare
abstract methods for properties and descriptors.

The issue is the linter complains that my DataModule cannot be instantiated since I've not implemented transfer_batch_to_device and my IDE highlights my lightning modules red.

Is there any need for this decorator? It seems that transfer_batch_to_device is virtual, not abstract, and all python methods are virtual.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedOpen to be worked onpriority: 1Medium priority taskwon't fixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions