Skip to content
Snippets Groups Projects
Commit b82a09d8 authored by Campbell Barton's avatar Campbell Barton
Browse files

Cleanup: remove unused imports & variables

parent 750b0f9a
Branches
No related tags found
No related merge requests found
Showing
with 20 additions and 26 deletions
......@@ -14,7 +14,7 @@ class UnitTesting(SceiptUnitTesting):
def main():
# Slice command line arguments by '--'
unittest_args, parser_args = sliceCommandLineArguments()
unittest_args, _parser_args = sliceCommandLineArguments()
# Construct and run unit tests.
unittest.main(argv=unittest_args)
......
......@@ -17,7 +17,7 @@ class UnitTesting(SceiptUnitTesting):
def main():
# Slice command line arguments by '--'
unittest_args, parser_args = sliceCommandLineArguments()
unittest_args, _parser_args = sliceCommandLineArguments()
# Construct and run unit tests.
unittest.main(argv=unittest_args)
......
......@@ -17,7 +17,7 @@ class UnitTesting(SceiptUnitTesting):
def main():
# Slice command line arguments by '--'
unittest_args, parser_args = sliceCommandLineArguments()
unittest_args, _parser_args = sliceCommandLineArguments()
# Construct and run unit tests.
unittest.main(argv=unittest_args)
......
......@@ -29,7 +29,7 @@ def load_tests(loader, standard_tests, pattern):
def main():
# Slice command line arguments by '--'
unittest_args, parser_args = sliceCommandLineArguments()
unittest_args, _parser_args = sliceCommandLineArguments()
# Construct and run unit tests.
unittest.main(argv=unittest_args)
......
......@@ -5,11 +5,12 @@ import os
from pathlib import Path
import re
import subprocess
import sys
import unittest
from check_utils import (sliceCommandLineArguments,
parseArguments)
from check_utils import (
sliceCommandLineArguments,
parseArguments,
)
ALLOWED_LIBS = (
......@@ -180,7 +181,7 @@ class UnitTesting(unittest.TestCase):
def main():
# Slice command line arguments by '--'
unittest_args, parser_args = sliceCommandLineArguments()
unittest_args, _parser_args = sliceCommandLineArguments()
# Construct and run unit tests.
unittest.main(argv=unittest_args)
......
......@@ -3,7 +3,7 @@
import subprocess
import os
from os.path import join, splitext
from os.path import join
from autopep8_clean_config import PATHS, PATHS_EXCLUDE
......@@ -95,7 +95,6 @@ def autopep8_format_file(f: str) -> None:
def main() -> None:
import sys
import subprocess
if os.path.samefile(sys.argv[-1], __file__):
paths = path_expand(PATHS, is_source_and_included)
......
......@@ -5,7 +5,6 @@ import collections
import os
import subprocess
import sys
import tempfile
# Hashes to be ignored
#
......
......@@ -154,7 +154,7 @@ def main():
args = argparse_create().parse_args()
from git_log import GitCommit, GitCommitIter
from git_log import GitCommitIter
# --------------
# Filter Commits
......
......@@ -573,7 +573,7 @@ def main():
messages |= release_log_extract_messages(path)
args.filter_exclude_releaselogs = messages
from git_log import GitCommit, GitCommitIter
from git_log import GitCommitIter
# --------------
# Filter Commits
......
......@@ -426,7 +426,7 @@ import bpy
def module_classes(mod):
classes = []
for key, value in mod.__dict__.items():
for value in mod.__dict__.values():
try:
is_subclass = issubclass(value, BaseFakeUI)
except:
......
......@@ -20,7 +20,7 @@ BASE_URL = "https://developer.blender.org/diffusion/B/browse"
def main():
dirname, filename = os.path.split(SOURCE_FILE)
dirname, _filename = os.path.split(SOURCE_FILE)
process = subprocess.Popen(
["git", "rev-parse", "--symbolic-full-name", "--abbrev-ref",
......
......@@ -23,7 +23,6 @@ data = txt.split("\n")
# first detect blocks
def block_data(data, i_start):
ok = False
i_begin = -1
i_index = -1
i_end = -1
......
......@@ -94,7 +94,7 @@ def autopep8_ensure_version(autopep8_format_cmd_argument: str) -> Optional[Tuple
try:
version_output = subprocess.check_output((*cmd, "--version")).decode('utf-8')
except FileNotFoundError as e:
except FileNotFoundError:
continue
AUTOPEP8_FORMAT_CMD = autopep8_format_cmd
break
......
......@@ -47,7 +47,7 @@ def sort_struct_lists(fn: str, data_src: str) -> Optional[str]:
# eg:
# extern char datatoc_splash_png[];
re_match_datatoc = re.compile(r"extern\s+(char)\s+datatoc_[A-Za-z_].*;")
# re_match_datatoc = re.compile(r"extern\s+(char)\s+datatoc_[A-Za-z_].*;")
lines = data_src.splitlines(keepends=True)
......
......@@ -43,8 +43,6 @@ re_match_struct = re.compile(r"struct\s+([A-Za-z_][A-Za-z_0-9]*)\s*;")
def clean_structs(fn: str, data_src: str) -> Optional[str]:
import re
from pygments.token import Token
from pygments import lexers
......@@ -55,7 +53,7 @@ def clean_structs(fn: str, data_src: str) -> Optional[str]:
ty_exact = (Token.Comment.Preproc, Token.Comment.PreprocFile)
for ty, text in lex.get_tokens(data_src):
for ty, _text in lex.get_tokens(data_src):
if ty not in ty_exact:
if ty in Token.String: # type: ignore
continue
......
......@@ -135,7 +135,7 @@ def clang_format_ensure_version() -> Optional[Tuple[int, int, int]]:
)
try:
version_output = subprocess.check_output((clang_format_cmd, "-version")).decode('utf-8')
except FileNotFoundError as e:
except FileNotFoundError:
continue
CLANG_FORMAT_CMD = clang_format_cmd
break
......
......@@ -1119,7 +1119,7 @@ class edit_generators:
# Currently this is not handled in a clever way, just try add in brackets
# and rely on matching build output to know if they were added in the right place.
text = match.group(2)
span = (beg, end)
# `span = (beg, end)`.
for offset_end in range(end + 1, len(data)):
# Not technically correct, but it's rare that this will span lines.
if "\n" == data[offset_end]:
......
......@@ -5,7 +5,6 @@ from typing import (
Generator,
Optional,
Sequence,
Tuple,
)
TextOpFn = Callable[
......@@ -45,7 +44,6 @@ def run(
for filename in filenames:
if filename.startswith("."):
continue
ext = os.path.splitext(filename)[1]
filepath = os.path.join(dirpath, filename)
if is_text(filepath):
yield filepath
......
......@@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
import os
from os.path import join, splitext
from os.path import join
from trailing_space_clean_config import PATHS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment