Betriebsumgebung
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
Ich versuche PEP8-Überprüfung des in Python geschriebenen Codes. Referenz http://qiita.com/clarinet758/items/312e95ee1513560dfdd1
Lauf
$ pep8 read_chpoint.py | head
read_chpoint.py:20:1: E302 expected 2 blank lines, found 1
read_chpoint.py:21:1: E101 indentation contains mixed spaces and tabs
read_chpoint.py:21:1: W191 indentation contains tabs
...
Der relevante Teil des Codes ist die def-Zeile von "wrap_fromfile ()" unten.
read_chpoint.py
import numpy as np
import array
import sys
'''
v0.5 Dec. 23, 2016
- wrap_fromfile() takes [num] arg
v0.4 Dec. 21, 2016
- read from "auxiliary" file [auxfp]
+ add read_auxiliary_info()
v0.3 Dec. 19, 2016
- add wrap_fromfile()
- read [inprodR],[prev_err],[resid_scale]
v0.2 Dec. 19, 2016
- fix bug > read [local_nRows] for "size_t" type
v0.1 Dec. 18, 2016
- read_chpoint_file() > read [ind_m],[local_nRows],[niter],[counter]
'''
def wrap_fromfile(rfp, typecode, num):
res = array.array(typecode)
...
Es gab eine leere Zeile unter dem Kommentar, aber es scheint zwei Zeilen zu sein.
read_chpoint.py
import numpy as np
import array
import sys
'''
v0.5 Dec. 23, 2016
- wrap_fromfile() takes [num] arg
v0.4 Dec. 21, 2016
- read from "auxiliary" file [auxfp]
+ add read_auxiliary_info()
v0.3 Dec. 19, 2016
- add wrap_fromfile()
- read [inprodR],[prev_err],[resid_scale]
v0.2 Dec. 19, 2016
- fix bug > read [local_nRows] for "size_t" type
v0.1 Dec. 18, 2016
- read_chpoint_file() > read [ind_m],[local_nRows],[niter],[counter]
'''
def wrap_fromfile(rfp, typecode, num):
res = array.array(typecode)
res.fromfile(rfp, num)
...
Mit dem obigen Fix verschwand der zugehörige Fehler.
Lauf
$ pep8 read_chpoint.py | head
read_chpoint.py:22:1: E101 indentation contains mixed spaces and tabs
read_chpoint.py:22:1: W191 indentation contains tabs
read_chpoint.py:23:1: W191 indentation contains tabs
read_chpoint.py:24:1: W191 indentation contains tabs
read_chpoint.py:26:1: E302 expected 2 blank lines, found 1
read_chpoint.py:27:1: W191 indentation contains tabs
read_chpoint.py:28:1: W191 indentation contains tabs
read_chpoint.py:28:35: E261 at least two spaces before inline comment
read_chpoint.py:28:36: E262 inline comment should start with '# '
read_chpoint.py:29:1: W191 indentation contains tabs
Recommended Posts