Skip to content
This repository was archived by the owner on Oct 25, 2018. It is now read-only.

Commit 354f755

Browse files
author
Сосна Евгений
committed
PEP8 исправления.
1 parent 1a07da5 commit 354f755

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

pyv8unpack.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
import sys
55
import subprocess
66
import shutil
7-
from os.path import exists
87
import logging
98
import tempfile
109
import re
1110
import platform
1211
import argparse
12+
from subprocess import PIPE
1313

14-
__version__ = "0.0.2"
14+
__version__ = "0.0.3"
1515

1616
logging.basicConfig(level=logging.INFO) # DEBUG => print ALL msgs
1717
log = logging.getLogger("pyv8unpack")
@@ -34,7 +34,7 @@ def get_config_param(param):
3434
try:
3535
with open(os.path.join(loc, "precommit1c.ini")) as source:
3636
if sys.version_info<(3,0,0):
37-
from ConfigParser import ConfigParser
37+
from ConfigParser import ConfigParser # @NoMove @UnusedImport
3838
else:
3939
from configparser import ConfigParser
4040

@@ -94,7 +94,7 @@ def get_path_to_1c():
9494
#FIXME: проверить архетиктуру.
9595
program_files = os.getenv("PROGRAMFILES")
9696
if program_files is None:
97-
raise Exeption("path to Program files not found");
97+
raise "path to Program files not found";
9898
cmd = os.path.join(program_files, "1cv8")
9999
maxversion = max(list(filter((lambda x: '8.' in x), os.listdir(cmd))))
100100
if maxversion is None:
@@ -165,8 +165,7 @@ def decompile(list_of_files, source=None, platform=None):
165165

166166
for filename in dataprocessor_files:
167167
logging.info("file %s" % filename)
168-
#TODO: добавить копирование этих же файлов в каталог src/имяфайла/...
169-
#get file name.
168+
170169
fullpathfile = os.path.abspath(filename)
171170
basename = os.path.splitext(os.path.basename(filename))[0]
172171
fullbasename = os.path.basename(filename)
@@ -221,7 +220,7 @@ def add_to_git(pathlists):
221220
logging.error(result)
222221
exit(result)
223222

224-
def compile(input, output, ext):
223+
def compilefromsource(input, output, ext):
225224
import codecs
226225

227226
assert not input is None, "Не указан путь к входящему каталогу"
@@ -244,22 +243,22 @@ def compile(input, output, ext):
244243
for l in lines:
245244
if l.startswith(u'\ufeff'):
246245
l = l[1:]
247-
list = l.split("-->")
248-
if len(list) < 2:
246+
listline = l.split("-->")
247+
if len(listline) < 2:
249248
continue
250249
log.debug(l)
251-
newPath = os.path.join(tempPath, list[0])
250+
newPath = os.path.join(tempPath, listline[0])
252251
dirname = os.path.dirname(newPath)
253252
if not os.path.exists(dirname):
254253
os.mkdir(dirname)
255254
oldPath = os.path.join(dirsource,
256-
list[1].replace(
255+
listline[1].replace(
257256
"\\", os.path.sep)
258257
)
259258

260259
if os.path.isdir(oldPath):
261260
#tempFile = tempfile.mkstemp()
262-
newPath = os.path.join(tempPath, list[0])
261+
newPath = os.path.join(tempPath, listline[0])
263262
shutil.copytree(oldPath, newPath)
264263
else:
265264
log.debug(oldPath)
@@ -320,7 +319,7 @@ def main():
320319
add_to_git(indexes)
321320

322321
if(args.compile):
323-
compile(args.inputPath, args.output, args.type)
322+
compilefromsource(args.inputPath, args.output, args.type)
324323
if args.inputPath is not None:
325324
files = [os.path.abspath(
326325
os.path.join(os.path.curdir, args.inputPath))]

tests/test_compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_compile_from_source(self):
1313
assert pyv8unpack.decompile([file], tpath)
1414
tpath = path.join(tpath, "tests", "Fixture")
1515
filenew = tempfile.mktemp()
16-
assert pyv8unpack.compile(tpath, filenew, "epf") == filenew
16+
assert pyv8unpack.compilefromsource(tpath, filenew, "epf") == filenew
1717

1818
def test_decompile(self):
1919

0 commit comments

Comments
 (0)