Skip to content

Commit d75c378

Browse files
committed
🐍 Remove unnecessary (object) inheritance
1 parent 71af8ee commit d75c378

35 files changed

+55
-55
lines changed

detect_secrets/core/bidirectional_iterator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class BidirectionalIterator(object):
1+
class BidirectionalIterator:
22
def __init__(self, collection):
33
self.collection = collection
44
self.index = -1 # Starts on -1, as index is increased _before_ getting result

detect_secrets/core/code_snippet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def get_code_snippet(self, file_lines, line_number, lines_of_context=5):
4343
)
4444

4545

46-
class CodeSnippet(object):
46+
class CodeSnippet:
4747

4848
def __init__(self, snippet, start_line, target_index):
4949
"""

detect_secrets/core/potential_secret.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import hashlib
22

33

4-
class PotentialSecret(object):
4+
class PotentialSecret:
55
"""This custom data type represents a string found, matching the
66
plugin rules defined in SecretsCollection, that has the potential
77
to be a secret that we actually care about.

detect_secrets/core/secrets_collection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from detect_secrets.util import build_automaton
1414

1515

16-
class SecretsCollection(object):
16+
class SecretsCollection:
1717

1818
def __init__(
1919
self,

detect_secrets/core/usage.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def add_no_verify_flag(parser):
4242
)
4343

4444

45-
class ParserBuilder(object):
45+
class ParserBuilder:
4646

4747
def __init__(self):
4848
self.parser = argparse.ArgumentParser()
@@ -133,7 +133,7 @@ def _add_no_verify_flag(self):
133133
return self
134134

135135

136-
class ScanOptions(object):
136+
class ScanOptions:
137137

138138
def __init__(self, subparser):
139139
self.parser = subparser.add_parser(
@@ -209,7 +209,7 @@ def _add_adhoc_scanning_argument(self):
209209
)
210210

211211

212-
class AuditOptions(object):
212+
class AuditOptions:
213213

214214
def __init__(self, subparser):
215215
self.parser = subparser.add_parser(
@@ -320,7 +320,7 @@ def get_disabled_help_text(plugin):
320320
return 'Disables {}'.format(line)
321321

322322

323-
class PluginOptions(object):
323+
class PluginOptions:
324324

325325
all_plugins = [
326326
PluginDescriptor.from_plugin_class(plugin, name)

detect_secrets/plugins/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __get__(self, cls, owner):
2424
return classmethod(self.fget).__get__(None, owner)()
2525

2626

27-
class BasePlugin(object):
27+
class BasePlugin:
2828
"""
2929
This is an abstract class to define Plugins API.
3030

detect_secrets/plugins/common/ini_file_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def append(self, lineno, line):
1717
configparser.ParsingError = EfficientParsingError
1818

1919

20-
class IniFileParser(object):
20+
class IniFileParser:
2121

2222
_comment_regex = re.compile(r'\s*[;#]')
2323

detect_secrets/plugins/common/yaml_file_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from .constants import ALLOWLIST_REGEX
44

55

6-
class YamlFileParser(object):
6+
class YamlFileParser:
77
"""
88
Yaml config files are interesting, because they don't necessarily conform
99
to our basic regex for detecting HighEntropyStrings as strings don't

testing/mocks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def mock_printer(obj):
133133
"""
134134
:type obj: module
135135
"""
136-
class PrinterShim(object):
136+
class PrinterShim:
137137
def __init__(self):
138138
self.clear()
139139

@@ -150,7 +150,7 @@ def clear(self):
150150

151151
@contextmanager
152152
def mock_log(namespace):
153-
class MockLogWrapper(object):
153+
class MockLogWrapper:
154154
"""This is used to check what is being logged."""
155155

156156
def __init__(self):

tests/core/audit_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def reset_file_cache():
2121
audit._open_file_with_cache.cache_clear()
2222

2323

24-
class TestAuditBaseline(object):
24+
class TestAuditBaseline:
2525

2626
def test_no_baseline(self, mock_printer):
2727
with self.mock_env(baseline='') as m:
@@ -310,7 +310,7 @@ def leapfrog_baseline(self):
310310
}
311311

312312

313-
class TestCompareBaselines(object):
313+
class TestCompareBaselines:
314314

315315
def test_raises_error_if_comparing_same_file(self):
316316
with pytest.raises(audit.RedundantComparisonError):
@@ -486,7 +486,7 @@ def new_baseline(self):
486486
}
487487

488488

489-
class TestDetermineAuditResults(object):
489+
class TestDetermineAuditResults:
490490

491491
@pytest.fixture
492492
def mock_get_raw_secret_value(self):
@@ -724,7 +724,7 @@ def test_print_audit_results_none(
724724
assert expected_message in mock_printer.message
725725

726726

727-
class TestPrintContext(object):
727+
class TestPrintContext:
728728

729729
def run_logic(
730730
self,
@@ -1028,7 +1028,7 @@ def test_unicode_in_output(self, mock_printer):
10281028
""")[1:-1]
10291029

10301030

1031-
class TestGetUserDecision(object):
1031+
class TestGetUserDecision:
10321032

10331033
@pytest.mark.parametrize(
10341034
'user_input, expected_value',
@@ -1086,7 +1086,7 @@ def mock_user_input(inputs):
10861086
:type inputs: list
10871087
:param inputs: list of user choices
10881088
"""
1089-
class InputShim(object):
1089+
class InputShim:
10901090
def __init__(self):
10911091
self.message = ''
10921092
self.index = 0

tests/core/baseline_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from testing.mocks import SubprocessMock
2222

2323

24-
class TestInitializeBaseline(object):
24+
class TestInitializeBaseline:
2525

2626
def setup(self):
2727
self.plugins = (
@@ -186,7 +186,7 @@ def test_scan_all_files_with_bad_symlinks(self):
186186
assert len(results.keys()) == 0
187187

188188

189-
class TestGetSecretsNotInBaseline(object):
189+
class TestGetSecretsNotInBaseline:
190190

191191
def test_nothing_new(self):
192192
# We want a secret, but just a default secret (no overriding parameters)
@@ -292,7 +292,7 @@ def test_rolled_creds(self):
292292
assert baseline.data == backup_baseline
293293

294294

295-
class TestUpdateBaselineWithRemovedSecrets(object):
295+
class TestUpdateBaselineWithRemovedSecrets:
296296

297297
def test_deleted_secret(self):
298298
new_findings = secrets_collection_factory([
@@ -393,7 +393,7 @@ def test_no_baseline_modifications(self, results_dict, baseline_dict):
393393
)
394394

395395

396-
class TestMergeBaseline(object):
396+
class TestMergeBaseline:
397397

398398
def test_copies_is_secret_label_accurately(self):
399399
assert merge_baseline(
@@ -496,7 +496,7 @@ def test_copies_is_secret_label_accurately(self):
496496
pass
497497

498498

499-
class TestMergeResults(object):
499+
class TestMergeResults:
500500

501501
def test_new_results_has_nothing(self):
502502
old_result = {
@@ -620,7 +620,7 @@ def get_secret():
620620
}
621621

622622

623-
class TestFormatBaselineForOutput(object):
623+
class TestFormatBaselineForOutput:
624624

625625
def test_sorts_by_line_number_then_hash(self):
626626
output_string = format_baseline_for_output({

tests/core/bidirectional_iterator_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from detect_secrets.core import bidirectional_iterator
66

77

8-
class TestBidirectionalIterator(object):
8+
class TestBidirectionalIterator:
99

1010
def test_no_input(self):
1111
iterator = bidirectional_iterator.BidirectionalIterator([])

tests/core/potential_secret_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from testing.factories import potential_secret_factory
77

88

9-
class TestPotentialSecret(object):
9+
class TestPotentialSecret:
1010

1111
@pytest.mark.parametrize(
1212
'a, b, is_equal',

tests/core/secrets_collection_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def mock_gmtime():
4141
yield current_time
4242

4343

44-
class TestScanFile(object):
44+
class TestScanFile:
4545
"""Testing file scanning, and interactions with different plugins."""
4646

4747
def test_file_is_symbolic_link(self):
@@ -141,7 +141,7 @@ def test_unicode_decode_error(self, mock_log):
141141
assert len(logic.data) == 0
142142

143143

144-
class TestScanDiff(object):
144+
class TestScanDiff:
145145

146146
def test_success(self):
147147
secrets = self.load_from_diff().format_for_baseline_output()['results']
@@ -200,7 +200,7 @@ def load_from_diff(self, existing_secrets=None, baseline_filename='', exclude_fi
200200
return collection
201201

202202

203-
class TestGetSecret(object):
203+
class TestGetSecret:
204204
"""Testing retrieval of PotentialSecret from SecretsCollection"""
205205

206206
@pytest.mark.parametrize(
@@ -258,7 +258,7 @@ def _mock_secret_hash(self, secret_hash='secret_hash'):
258258
yield
259259

260260

261-
class TestBaselineInputOutput(object):
261+
class TestBaselineInputOutput:
262262
"""A critical part of the SecretsCollection is the ability to write a baseline, then
263263
read from that same baseline to recreate state. This test suite checks the functions
264264
related to that ability.

tests/core/usage_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from detect_secrets.plugins.common.util import import_plugins
77

88

9-
class TestPluginOptions(object):
9+
class TestPluginOptions:
1010

1111
@staticmethod
1212
def parse_args(argument_string=''):

tests/main_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def get_plugin_report(extra=None):
7474
) + '\n'
7575

7676

77-
class TestMain(object):
77+
class TestMain:
7878
"""These are smoke tests for the console usage of detect_secrets.
7979
Most of the functional test cases should be within their own module tests.
8080
"""

tests/plugins/artifactory_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from detect_secrets.plugins.artifactory import ArtifactoryDetector
66

77

8-
class TestArtifactoryDetector(object):
8+
class TestArtifactoryDetector:
99

1010
@pytest.mark.parametrize(
1111
'payload, should_flag',

tests/plugins/aws_key_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
EXAMPLE_SECRET = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
1616

1717

18-
class TestAWSKeyDetector(object):
18+
class TestAWSKeyDetector:
1919

2020
def setup(self):
2121
self.example_key = 'AKIAZZZZZZZZZZZZZZZZ'

tests/plugins/basic_auth_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from detect_secrets.plugins.basic_auth import BasicAuthDetector
66

77

8-
class TestBasicAuthDetector(object):
8+
class TestBasicAuthDetector:
99

1010
@pytest.mark.parametrize(
1111
'payload, should_flag',

tests/plugins/cloudant_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
CL_API_KEY = 'abcdefghijabcdefghijabcd'
1818

1919

20-
class TestCloudantDetector(object):
20+
class TestCloudantDetector:
2121

2222
@pytest.mark.parametrize(
2323
'payload, should_flag',

tests/plugins/common/filters_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from detect_secrets.plugins.common import filters
66

77

8-
class TestIsSequentialString(object):
8+
class TestIsSequentialString:
99
@pytest.mark.parametrize(
1010
'secret',
1111
(
@@ -43,7 +43,7 @@ def test_failure(self, secret):
4343
assert not filters.is_sequential_string(secret)
4444

4545

46-
class TestIsLikelyIdString(object):
46+
class TestIsLikelyIdString:
4747
@pytest.mark.parametrize(
4848
'secret, line',
4949
[
@@ -75,7 +75,7 @@ def test_failure(self, secret, line):
7575
assert not filters.is_likely_id_string(secret, line)
7676

7777

78-
class TestIsPotentialUuid(object):
78+
class TestIsPotentialUuid:
7979
@pytest.mark.parametrize(
8080
'secret',
8181
[

tests/plugins/common/initialize_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from detect_secrets.plugins.high_entropy_strings import HexHighEntropyString
99

1010

11-
class TestFromPluginClassname(object):
11+
class TestFromPluginClassname:
1212

1313
def test_success(self):
1414
plugin = initialize.from_plugin_classname(
@@ -39,7 +39,7 @@ def test_fails_on_bad_initialization(self):
3939
)
4040

4141

42-
class TestFromSecretType(object):
42+
class TestFromSecretType:
4343

4444
def setup(self):
4545
self.settings = [

tests/plugins/common/yaml_file_parser_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from testing.mocks import mock_file_object
99

1010

11-
class TestYamlFileParser(object):
11+
class TestYamlFileParser:
1212

1313
def test_get_ignored_lines(self):
1414
content = """keyA: value

tests/plugins/high_entropy_strings_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from testing.mocks import mock_file_object
1111

1212

13-
class HighEntropyStringsTest(object):
13+
class HighEntropyStringsTest:
1414
"""
1515
Some explaining should be done regarding the "enforced" format of the parametrized
1616
abstract pytests.

0 commit comments

Comments
 (0)