Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct indention for pep8 on long lines with argument list and assignment

What is the correct indention for this scenario:

class StorageType(models.Model):
    """ Defining a general typ of storage """

    name = models.CharField(
            max_length=50,
            help_text=_("The name for a storage type. Should be unique")
        )

pep8 complains with

../models.py:68:13: E126 continuation line over-indented for hanging indent
../models.py:70:9: E121 continuation line under-indented for hanging indent
like image 955
frlan Avatar asked Jan 18 '16 16:01

frlan


2 Answers

I don't know about the "correct one", but here's my favorite which passes pep8 check:

name = models.CharField(
    max_length=50,
    help_text=_("The name for a storage type. Should be unique")
)
like image 186
bakkal Avatar answered Nov 14 '22 21:11

bakkal


This is one correct indentation:

class StorageType(models.Model):
    """ Defining a general typ of storage """

    name = models.CharField(
        max_length=50,
        help_text=_("The name for a storage type. Should be unique")
        )
like image 29
gtlambert Avatar answered Nov 14 '22 21:11

gtlambert