Continuation line under indented for visual indent как исправить
Перейти к содержимому

Continuation line under indented for visual indent как исправить

  • автор:

What is PEP8’s E128: continuation line under-indented for visual indent?

Just opened a file with Sublime Text (with Sublime Linter) and noticed a PEP8 formatting error that I’d never seen before. Here’s the text:

urlpatterns = patterns('', url(r'^$', listing, name='investment-listing'), ) 

It’s flagging the second argument, the line that starts url(. ) I was about to disable this check in ST2 but I’d like to know what I’m doing wrong before I ignore it. You never know, if it seems important I might even change my ways 🙂

asked Mar 15, 2013 at 15:10
237k 64 64 gold badges 222 222 silver badges 299 299 bronze badges
PEP8 does not have error messages; the linter does.
Dec 9, 2023 at 14:04

2 Answers 2

PEP-8 recommends you indent lines to the opening parentheses if you put anything on the first line, so it should either be indenting to the opening bracket:

urlpatterns = patterns('', url(r'^$', listing, name='investment-listing')) 

or not putting any arguments on the starting line, then indenting to a uniform level:

urlpatterns = patterns( '', url(r'^$', listing, name='investment-listing'), ) urlpatterns = patterns( '', url(r'^$', listing, name='investment-listing')) 

I suggest taking a read through PEP-8 — you can skim through a lot of it, and it’s pretty easy to understand, unlike some of the more technical PEPs.

В коде у меня есть ошибка, я не понимаю с чем она связана

Ошибка называется
Continuation line under-indented for visual indent
код на скриншоте

Голосование за лучший ответ

Судя по всему, ты городишь «линию» из символов такой очешуительной длины, что она не лезет ни в какие компьютерные ворота.

в строке spic.append(trans[clovo[i]]) ты используешь символ строки clovo под индексом i, как индекс списка trans. И в следующий раз прочитай ошибку до конца, там ангийским языком сказано, в какой линии ошибка

Похожие вопросы

Ошибка continuation line under-indented for visual indent

Вы используете устаревший браузер. Этот и другие сайты могут отображаться в нем неправильно.
Необходимо обновить браузер или попробовать использовать другой.

AlerWaint
Новичок

Пользователь

Сен 8, 2020 2 0 1

1. Windows
2. Python 3.8
3. Только PyGames
4.

import pygame pygame.init() win = pygame.display.set_mode((1000,1000,)) pygame.display.set_caption ("AlerGames") x=50 y=50 width = 40 height= 60 speed = 5 run= True while run: pygame.time.delay(100) for event in pygame.event.get(): if event.type == pygame.QUIT: run = False keys = pygame.key.get_pressed() if keys [pygame.K_LEFT]: x -= speed if keys [pygame.K_RIGHT]: x += speed if keys [pygame.K_DOWN]: y += speed if keys [pygame.K_UP]: y -= speed win.fill((0,0,0)) pygame.draw.rect (win,(0,0,255), (x,y,widht,height) pygame.display.update() pygame.quit()
alext
Популярный

Пользователь

Май 10, 2020 288 66 28

И что? В чем вопрос? В каком месте ошибка хотя бы?

AlerWaint
Новичок

Пользователь

Сен 8, 2020 2 0 1

Строки 33 и 35, не понимаю как исправить ошибку

stud_55
Модератор

Команда форума

Модератор

Апр 3, 2020 1 522 671 113

Строки 33 и 35, не понимаю как исправить ошибку

Вот исправленный пример:

import pygame pygame.init() win = pygame.display.set_mode((1000, 1000)) pygame.display.set_caption("AlerGames") x = 50 y = 50 width = 40 height = 60 speed = 5 run = True while run: pygame.time.delay(100) for event in pygame.event.get(): if event.type == pygame.QUIT: run = False keys = pygame.key.get_pressed() if keys[pygame.K_LEFT]: x -= speed if keys[pygame.K_RIGHT]: x += speed if keys[pygame.K_DOWN]: y += speed if keys[pygame.K_UP]: y -= speed win.fill((0, 0, 0)) pygame.draw.rect(win, (0, 0, 255), (x, y, width, height)) pygame.display.update() pygame.quit()

Re: [pgAdmin4][RM#3063] Add ‘pycodestyle ‘ Python PEP-8 checker module

— I think this should go into web/regression/requirements.txt. Otherwise, it’ll end up being installed in the packages we build.

— We should probably include a new Makefile target to run it, as well as including it in the «check» target.

— Once we expect the output to be clean, I think we should add a runner script to ci/ so we automate checking.

— Would a shorter output be more useful? In particular, it seems to be outputting a paragraph of text every time if finds a line longer than 79 chars. Really, we just need the location of each issue, and then the summary I think, e.g.

./pgadmin/utils/tests/test_versioned_template_loader.py:127: [E501] line too long (104 > 79 characters)

./pgadmin/utils/tests/test_versioned_template_loader.py:118: [E501] line too long (89 > 79 characters)

./pgadmin/utils/tests/test_versioned_template_loader.py:116: [E501] line too long (89 > 79 characters)

3 E111 indentation is not a multiple of four
52 E121 continuation line under-indented for hanging indent
19 E122 continuation line missing indentation or outdented
27 E123 closing bracket does not match indentation of opening bracket’s line
3 E124 closing bracket does not match visual indentation
6 E125 continuation line with same indent as next logical line
79 E126 continuation line over-indented for hanging indent
67 E127 continuation line over-indented for visual indent
15 E128 continuation line under-indented for visual indent
3 E129 visually indented line with same indent as next logical line
11 E131 continuation line unaligned for hanging indent
6 E203 whitespace before ‘,’
1 E211 whitespace before ‘[‘
2 E221 multiple spaces before operator
1 E222 multiple spaces after operator
19 E225 missing whitespace around operator
19 E226 missing whitespace around arithmetic operator
16 E231 missing whitespace after ‘,’
2 E241 multiple spaces after ‘,’
7 E251 unexpected spaces around keyword / parameter equals
1 E261 at least two spaces before inline comment
1 E271 multiple spaces after keyword
17 E302 expected 2 blank lines, found 1
23 E303 too many blank lines (2)
14 E305 expected 2 blank lines after class or function definition, found 1
1 E401 multiple imports on one line
1176 E501 line too long (80 > 79 characters)
15 E502 the backslash is redundant between brackets
4 E703 statement ends with a semicolon
8 E712 comparison to False should be ‘if cond is False:’ or ‘if not cond:’
3 E713 test for membership should be ‘not in’
21 E722 do not use bare except’
1 E741 ambiguous variable name ‘l’
11 W391 blank line at end of file
23 W503 line break before binary operator

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

В списке pgadmin-hackers по дате отправления:

Предыдущее

От: Dave Page
Дата: 26 января 2018 г., 22:56:41
Сообщение: Re: [pgAdmin4][RM#3062] Fix PEP-8 issues in Tools module

Следующее

От: pgAdmin 4 Jenkins
Дата: 26 января 2018 г., 23:45:06
Сообщение: Jenkins build is back to normal : pgadmin4-master-python35 #460

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *