PY3.W0240
Subclassed final class
Used when a class decorated with typing.final has been subclassed.
Noncompliant Code:
Copy
from typing import final
@final
class PlatypusData:
"""General Platypus data."""
average_length = 46
average_body_temperature = 32
class FluorescentPlaytipus(PlatypusData):
"""Playtipus with fluorescent fur."""
Compliant Code:
Copy
from typing import final
@final
class PlatypusData:
"""General Platypus data."""
average_length = 46
average_body_temperature = 32
def print_average_length_platypus():
output = f"The average length of a platypus is: {PlatypusData.average_length}cm"
print(output)
Additional details:
This message is emitted when a class which is decorated with final is subclassed; the decorator indicates that the class is not intended to be extended. Note this message can't be emitted when using Python < 3.8.