Python / PEP8> E128 I tried to solve continuation line under-indented for visual indent

TensorFlow

Operating environment


GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 14.04 LTS desktop amd64
TensorFlow v0.11
cuDNN v5.1 for Linux
CUDA v8.0
Python 2.7.6
IPython 5.1.0 -- An enhanced Interactive Python.
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4

Preface

original code

Code in the process of implementation. We plan to learn 100 nodes (input) and 100 nodes (output) with TensorFlow.

learn_in100out100.py


#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np

'''
v0.1 Feb. 06, 2017
    - read [test_in.csv],[test_out.csv]
'''

'''
codingrule:PEP8
'''

filename_inp = tf.train.string_input_producer(["test_in.csv"])
filename_out = tf.train.string_input_producer(["test_out.csv"])
NUM_INP_NODE = 100
NUM_OUT_NODE = 100

# parse csv
# a. input node
reader = tf.TextLineReader()
key, value = reader.read(filename_inp)
deflist = [[0.] for idx in range(NUM_INP_NODE)]
input1 = tf.decode_csv(value, record_defaults=deflist)
# b. output node
key, value = reader.read(filename_out)
deflist = [[0.] for idx in range(NUM_OUT_NODE)]
output1 = tf.decode_csv(value, record_defaults=deflist)
# c. pack
inputs = tf.pack([input1])
outputs = tf.pack([output1])

batch_size = 4
inputs_batch, output_batch = tf.train.shuffle_batch([inputs, outputs], batch_size, capacity=40, min_after_dequeue = batch_size)

input_ph = tf.placeholder("float", [None, 1])
output_ph = tf.placeholder("float", [None, 1])

# network

When I checked it with PEP8, I got the following error.

$ pep8 learn_in100out100.py learn_in100out100.py:38:80: E501 line too long (127 > 79 characters)

I tried to break a line

inputs_batch, output_batch = tf.train.shuffle_batch([inputs, outputs], batch_size, capacity=40, min_after_dequeue = batch_size)

Was broken as follows.

inputs_batch, output_batch = tf.train.shuffle_batch(
	[inputs, outputs], batch_size, capacity=40, min_after_dequeue = batch_size)

The second line is now Tab in Sublime Text 2.

$ pep8 learn_in100out100.py learn_in100out100.py:39:1: E101 indentation contains mixed spaces and tabs learn_in100out100.py:39:1: W191 indentation contains tabs

I quit Tab

I quit Tab and left 4 blanks.

inputs_batch, output_batch = tf.train.shuffle_batch(
    [inputs, outputs], batch_size, capacity=40, min_after_dequeue = batch_size)

$ pep8 learn_in100out100.py learn_in100out100.py:39:66: E251 unexpected spaces around keyword / parameter equals learn_in100out100.py:39:68: E251 unexpected spaces around keyword / parameter equals

Changed the position of the argument to start a new line

Not the first list, but the second line from the second batch_size.

inputs_batch, output_batch = tf.train.shuffle_batch([inputs, outputs], 
    batch_size, capacity=40, min_after_dequeue = batch_size)

$ pep8 learn_in100out100.py learn_in100out100.py:39:5: E128 continuation line under-indented for visual indent

Main subject

learn_in100out100.py:39:5: E128 continuation line under-indented for visual indent

Dealing with.

Reference http://stackoverflow.com/questions/15435811/what-is-pep8s-e128-continuation-line-under-indented-for-visual-indent

The position of the argument is to match the parentheses.

inputs_batch, output_batch = tf.train.shuffle_batch([inputs, outputs],
                                                    batch_size, capacity=40, min_after_dequeue = batch_size)

$ pep8 learn_in100out100.py learn_in100out100.py:39:80: E501 line too long (108 > 79 characters) learn_in100out100.py:39:95: E251 unexpected spaces around keyword / parameter equals learn_in100out100.py:39:97: E251 unexpected spaces around keyword / parameter equals

The error in the main subject has been resolved, but one line is over 80 characters and returns to the beginning.

Cars stopped thinking

Recommended Posts

Python / PEP8> E128 I tried to solve continuation line under-indented for visual indent
How to write offline real time I tried to solve E11 with python
How to write offline real time I tried to solve E12 with python
I tried to solve the soma cube with python
I tried to solve the problem with Python Vol.1
I tried to solve AOJ's number theory with Python
[For beginners in competition professionals] I tried to solve 40 AOJ "ITP I" questions with python
I tried to touch Python (installation)
I tried Line notification in Python
I tried to solve the ant book beginner's edition with python
I tried to summarize Python exception handling
I tried to implement PLSA in Python
I tried to refer to the fun rock-paper-scissors poi for beginners with Python
I tried to implement permutation in Python
I tried to implement PLSA in Python 2
Python3 standard input I tried to summarize
I wanted to solve ABC160 with Python
I tried to implement ADALINE in Python
I tried to let optuna solve Sudoku
I wanted to solve ABC159 in Python
I tried to implement PPO in Python
I tried to solve AtCoder's depth-first search (DFS) in Python (result: TLE ...)
I tried to solve TSP with QAOA
I tried to solve the E qualification problem collection [Chapter 1, 5th question]
[Python] I tried to calculate TF-IDF steadily
I tried to touch Python (basic syntax)
I wanted to solve ABC172 with Python
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 5/22]
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part7 / 22]
I tried to explain what a Python generator is for as easily as possible.
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 4/22]
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part3 / 22]
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 1/22]
[Python] I tried to solve 100 past questions that beginners and intermediates should solve [Part 6/22]
I tried to automatically send the literature of the new coronavirus to LINE with Python
[Python] I tried substituting the function name for the function name
vprof --I tried using the profiler for Python
I wanted to solve NOMURA Contest 2020 with Python
I tried to get CloudWatch data with Python
I tried python programming for the first time.
I tried to output LLVM IR with Python
I tried to make AI for Smash Bros.
I tried to implement TOPIC MODEL in Python
I tried to automate sushi making with python
I want to solve APG4b with Python (Chapter 2)
I tried to implement selection sort in python
I tried to put out the frequent word ranking of LINE talk with Python
I tried to build an environment for machine learning with Python (Mac OS X)
The 15th offline real-time I tried to solve the problem of how to write with python
I tried to graph the packages installed in Python
When I tried to introduce python3 to atom, I got stuck
I tried to summarize how to use matplotlib of python
I tried Python on Mac for the first time.
I tried pipenv and asdf for Python version control
I tried to implement Minesweeper on terminal with python
I tried to get started with blender python script_Part 01
I tried to touch the CSV file with Python
I tried to draw a route map with Python
I tried to implement a pseudo pachislot in Python
I tried python on heroku for the first time
I tried to implement Dragon Quest poker in Python