class name should be CamelCase

Cette page n'est pas encore disponible en français, sa traduction est en cours.
Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.

Metadata

ID: python-code-style/class-name

Language: Python

Severity: Notice

Category: Code Style

Description

Class names should be CamelCase and not camelCase or snake_case.

Learn More

Non-Compliant Code Examples

class _runtimeMetricsStatus(type):
    pass
class myClass(Parent):
    def __init__(self):
        pass

Compliant Code Examples

class REQUESTS_MODE(IntEnum):
    AGENTLESS_EVENTS = 0
    EVP_PROXY_EVENTS = 1
class _RuntimeMetricsStatus(type):
    pass
class Migration(migrations.Migration):

    dependencies = [
        ('tweets', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='tweet',
            name='parent',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='replies', to='tweets.tweet'),
        ),
        migrations.DeleteModel(
            name='Reply',
        ),
    ]
class MyClass(Parent):
    def __init__(self):
        pass

class TestRestapiV4Lock(FunctionalTestController):
    pass

class TestS3Storage(TestCase):
    pass

class TestS35Storage(TestCase):
    pass

class TestS35Storage(TestCase):
    pass

class Float64Serializer(object):
    pass

class LongNameThatHa5SomeNumbers999:
    pass

class K8sFaultyChangeSignal:
    pass

class ModeA:
    pass

class CreateAMode:
    pass
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Analysis