Cleanup: unused vars, imports

This commit is contained in:
Campbell Barton 2018-11-26 09:26:15 +11:00
parent 24c383cfc4
commit cb66a28d82
11 changed files with 13 additions and 25 deletions

View File

@ -20,17 +20,15 @@
# <pep8 compliant>
import argparse
import functools
import shutil
import pathlib
import subprocess
import sys
import tempfile
import unittest
from modules.test_utils import (with_tempdir,
AbstractBlenderRunnerTest,
)
from modules.test_utils import (
with_tempdir,
AbstractBlenderRunnerTest,
)
class AbcPropError(Exception):

View File

@ -157,7 +157,7 @@ def main():
parser.add_option("-S", "--start", dest="start", help="From collected files, start with this index", metavar='int')
parser.add_option("-E", "--end", dest="end", help="From collected files, end with this index", metavar='int')
options, args = parser.parse_args(argv) # In this example we wont use the args
options, _args = parser.parse_args(argv) # In this example we wont use the args
if not argv:
parser.print_help()

View File

@ -175,8 +175,6 @@ class SimpleImportTest(AbstractAlembicTest):
self.assertAlmostEqual(z, 0)
def test_change_path_modifier(self):
import math
fname = 'animated-mesh.abc'
abc = self.testdir / fname
relpath = bpy.path.relpath(str(abc))
@ -188,7 +186,6 @@ class SimpleImportTest(AbstractAlembicTest):
# Check that the file loaded ok.
bpy.context.scene.frame_set(6)
scene = bpy.context.scene
layer = scene.view_layers[scene.active_layer]
mesh = plane.to_mesh(bpy.context.depsgraph, True, True, False)
self.assertAlmostEqual(-1, mesh.vertices[0].co.x)
self.assertAlmostEqual(-1, mesh.vertices[0].co.y)

View File

@ -102,7 +102,7 @@ def reload_addons(do_reload=True, do_reverse=True):
disable_addons()
# Run twice each time.
for i in (0, 1):
for _ in (0, 1):
for mod in modules:
mod_name = mod.__name__
print("\tenabling:", mod_name)

View File

@ -197,7 +197,7 @@ def load_modules():
assert(os.path.samefile(mod_imp.__file__, submod_full))
modules.append(mod_imp)
except Exception as e:
except Exception:
import traceback
# Module might fail to import, but we don't want whole test to fail here.
# Reasoning:

View File

@ -114,7 +114,7 @@ def test_builtins():
getattr(bpy.ops.mesh, func)(location=(x * 2.5, y * 2.5, 0))
data = bpy.context.active_object.data
try:
for n in range(BUILTINS_NBRCHANGES):
for _ in range(BUILTINS_NBRCHANGES):
rnd = random.randint(1, 3)
if rnd == 1:
# Make fun with some edge.

View File

@ -141,7 +141,7 @@ def reset_blend():
if USE_RANDOM_SCREEN:
import random
for i in range(random.randint(0, len(bpy.data.screens))):
for _ in range(random.randint(0, len(bpy.data.screens))):
bpy.ops.screen.delete()
print("Scree IS", bpy.context.screen)
@ -237,7 +237,7 @@ if USE_ATTRSET:
seq = getattr(bpy.data, attr)
if seq.__class__.__name__ == 'bpy_prop_collection':
for id_data in seq:
for val, prop, tp in id_walk(id_data, bpy.data):
for val, prop, _tp in id_walk(id_data, bpy.data):
# print(id_data)
for val_rnd in _random_values:
try:

View File

@ -20,12 +20,8 @@
# <pep8 compliant>
import argparse
import functools
import shutil
import pathlib
import subprocess
import sys
import tempfile
import unittest
from modules.test_utils import AbstractBlenderRunnerTest

View File

@ -19,13 +19,10 @@
# <pep8 compliant>
import argparse
import functools
import shutil
import pathlib
import re
import subprocess
import sys
import tempfile
import unittest

View File

@ -62,7 +62,7 @@ def is_pep8(path):
return 1
f = open(path, 'r', encoding="utf8")
for i in range(PEP8_SEEK_COMMENT):
for _ in range(PEP8_SEEK_COMMENT):
line = f.readline()
if line.startswith("# <pep8"):
if line.startswith("# <pep8 compliant>"):

View File

@ -71,7 +71,7 @@ def api_dump(use_properties=True, use_functions=True):
def dump_funcs():
data = []
for struct_id, v in sorted(struct.items()):
for _struct_id, v in sorted(struct.items()):
struct_id_str = struct_full_id(v)
funcs = [(func.identifier, func) for func in v.functions]
@ -90,7 +90,7 @@ def api_dump(use_properties=True, use_functions=True):
def dump_props():
data = []
for struct_id, v in sorted(struct.items()):
for _struct_id, v in sorted(struct.items()):
struct_id_str = struct_full_id(v)
props = [(prop.identifier, prop) for prop in v.properties]