This page is not yet available in Spanish. We are working on its translation.
If you have any questions or feedback about our current translation project, feel free to reach out to us!

Metadata

ID: python-code-style/class-name

Language: Python

Severity: Notice

Category: Code Style

Description

Class names should be PascalCase 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

class context(ContextDecorator):
    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