From ae3158cd1f5b9d626a7b3e9e96352abd6e3716fc Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 17 Jul 2022 08:29:15 +0200 Subject: [PATCH] No need to inherit from `object` in Python 3 --- tests/test_cli.py | 2 +- tests/test_config.py | 2 +- yamllint/config.py | 2 +- yamllint/parser.py | 6 +++--- yamllint/rules/indentation.py | 2 +- yamllint/rules/key_duplicates.py | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 3ac5b09..7d16412 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -29,7 +29,7 @@ from yamllint import cli from yamllint import config -class RunContext(object): +class RunContext: """Context manager for ``cli.run()`` to capture exit code and streams.""" def __init__(self, case): diff --git a/tests/test_config.py b/tests/test_config.py index 3618a30..c84be1e 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -121,7 +121,7 @@ class SimpleConfigTestCase(unittest.TestCase): self.assertEqual(c.rules['hyphens'], False) def test_validate_rule_conf(self): - class Rule(object): + class Rule: ID = 'fake' self.assertFalse(config.validate_rule_conf(Rule, False)) diff --git a/yamllint/config.py b/yamllint/config.py index 4fc9ef6..939fe4a 100644 --- a/yamllint/config.py +++ b/yamllint/config.py @@ -25,7 +25,7 @@ class YamlLintConfigError(Exception): pass -class YamlLintConfig(object): +class YamlLintConfig: def __init__(self, content=None, file=None): assert (content is None) ^ (file is None) diff --git a/yamllint/parser.py b/yamllint/parser.py index 086613f..d6b71d9 100644 --- a/yamllint/parser.py +++ b/yamllint/parser.py @@ -16,7 +16,7 @@ import yaml -class Line(object): +class Line: def __init__(self, line_no, buffer, start, end): self.line_no = line_no self.start = start @@ -28,7 +28,7 @@ class Line(object): return self.buffer[self.start:self.end] -class Token(object): +class Token: def __init__(self, line_no, curr, prev, next, nextnext): self.line_no = line_no self.curr = curr @@ -37,7 +37,7 @@ class Token(object): self.nextnext = nextnext -class Comment(object): +class Comment: def __init__(self, line_no, column_no, buffer, pointer, token_before=None, token_after=None, comment_before=None): self.line_no = line_no diff --git a/yamllint/rules/indentation.py b/yamllint/rules/indentation.py index dfee0f2..3853f6f 100644 --- a/yamllint/rules/indentation.py +++ b/yamllint/rules/indentation.py @@ -218,7 +218,7 @@ ROOT, B_MAP, F_MAP, B_SEQ, F_SEQ, B_ENT, KEY, VAL = range(8) labels = ('ROOT', 'B_MAP', 'F_MAP', 'B_SEQ', 'F_SEQ', 'B_ENT', 'KEY', 'VAL') -class Parent(object): +class Parent: def __init__(self, type, indent, line_indent=None): self.type = type self.indent = indent diff --git a/yamllint/rules/key_duplicates.py b/yamllint/rules/key_duplicates.py index 371d2ed..3f93e7d 100644 --- a/yamllint/rules/key_duplicates.py +++ b/yamllint/rules/key_duplicates.py @@ -64,7 +64,7 @@ TYPE = 'token' MAP, SEQ = range(2) -class Parent(object): +class Parent: def __init__(self, type): self.type = type self.keys = []