Skip to content

Commit deb9869

Browse files
committed
Handle F401 exclusions more granularly
1 parent 8fea6a2 commit deb9869

File tree

11 files changed

+18
-24
lines changed

11 files changed

+18
-24
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
1515
From John Doe:
1616
- Whatever John Doe did.
1717

18+
From Thaddeus Crews:
19+
- Ruff: Handle F401 exclusions more granularly, remove per-file exclusions.
20+
1821
From William Deegan:
1922
- Fix SCons Docbook schema to work with lxml > 5
2023

RELEASE.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ DEVELOPMENT
7070

7171
- Introduce some unit tests for the file locking utility routines
7272

73+
- Ruff: Handle F401 exclusions more granularly, remove per-file exclusions.
74+
7375
Thanks to the following contributors listed below for their contributions to this release.
7476
==========================================================================================
7577
.. code-block:: text

SCons/Util/__init__.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,19 @@
5252
from __future__ import annotations
5353

5454
import copy
55-
import hashlib
5655
import logging
5756
import os
5857
import re
5958
import sys
6059
import time
6160
from collections import UserDict, UserList, deque
6261
from contextlib import suppress
63-
from types import MethodType, FunctionType
6462
from typing import Any
6563
from logging import Formatter
6664

6765
# Util split into a package. Make sure things that used to work
6866
# when importing just Util itself still work:
69-
from .sctypes import (
67+
from .sctypes import ( # noqa: F401
7068
DictTypes,
7169
ListTypes,
7270
SequenceTypes,
@@ -90,7 +88,7 @@
9088
get_os_env_bool,
9189
get_environment_var,
9290
)
93-
from .hashes import (
91+
from .hashes import ( # noqa: F401
9492
ALLOWED_HASH_FORMATS,
9593
DEFAULT_HASH_FORMATS,
9694
get_hash_format,
@@ -103,15 +101,15 @@
103101
MD5filesignature,
104102
MD5collect,
105103
)
106-
from .envs import (
104+
from .envs import ( # noqa: F401
107105
MethodWrapper,
108106
PrependPath,
109107
AppendPath,
110108
AddPathIfNotExists,
111109
AddMethod,
112110
is_valid_construction_var,
113111
)
114-
from .filelock import FileLock, SConsLockFailure
112+
from .filelock import FileLock, SConsLockFailure # noqa: F401
115113

116114
PYPY = hasattr(sys, 'pypy_translation_info')
117115

SCons/Variables/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434

3535
import SCons.Errors
3636
import SCons.Util
37-
import SCons.Warnings
3837

3938
# Note: imports are for the benefit of SCons.Main (and tests); since they
4039
# are not used here, the "as Foo" form is for checkers.

pyproject.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,6 @@ extend-safe-fixes = ["FA", "UP006", "UP007"]
117117
[tool.ruff.format]
118118
quote-style = "preserve" # Equivalent to black's "skip-string-normalization"
119119

120-
[tool.ruff.lint.per-file-ignores]
121-
"SCons/Util/__init__.py" = [
122-
"F401", # Module imported but unused
123-
]
124-
"SCons/Variables/__init__.py" = [
125-
"F401", # Symbol imported but unused
126-
]
127-
128120
[tool.mypy]
129121
python_version = "3.8"
130122
exclude = [

test/Scanner/Python/script.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#
33
# Copyright The SCons Foundation
44

5-
import package1 # noqa: F401
6-
import package2 # noqa: F401
5+
import package1
6+
import package2
77
import sys
88

99
with open(sys.argv[1], 'w') as f:

test/Scanner/Python/to_be_copied/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
#
33
# Copyright The SCons Foundation
44

5-
from . import helper # noqa: F401
5+
from . import helper

test/fixture/python_scanner/from_import_simple_package_module1_func.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
#
33
# Copyright The SCons Foundation
44

5-
from simple_package.module1 import somefunc # noqa: F401
5+
from simple_package.module1 import somefunc

test/fixture/python_scanner/from_nested1_import_multiple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
#
33
# Copyright The SCons Foundation
44

5-
from nested1 import module, nested2 # noqa: F401
5+
from nested1 import module, nested2

test/fixture/python_scanner/imports_unknown_files.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
#
33
# Copyright The SCons Foundation
44

5-
import doesntexist # noqa: F401
6-
import notthere.something # noqa: F401
7-
from notthere import a, few, things # noqa: F401
5+
import doesntexist
6+
import notthere.something
7+
from notthere import a, few, things

0 commit comments

Comments
 (0)