Search code examples
pythonpep8

PEP8 formatting of dictionary with long values gives warning


I'm using pycodestyle to lint, and I have the following code:

__gsignals__ = {
    "flashcards": (
                    GObject.SIGNAL_RUN_FIRST,
                    GObject.TYPE_NONE,
                    GObject.TYPE_PYOBJECT)
    ),
    "game": ( # Gets E113 warning unexpected indent
                    GObject.SIGNAL_RUN_FIRST,
                    GObject.TYPE_NONE, (GObject.TYPE_STRING)
    )
}

As commented in the code, this formatting is gives me a warning, and suggests that the line should have no indent at all. I've tried a few different options, yet I can't seem to configure it to work out.

I've reviewed PEP8 documentation and this thread - this formatting should be valid. Any idea what's going wrong here?


Solution

  • Your error is because of an extra parenthesis in the line GObject.TYPE_PYOBJECT). Removing the extra parenthesis returned no warnings on my computer.