Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{Pylint} Fix useless-object-inheritance #30331

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/ci/automation_full_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def save_pipeline_result(pipeline_result):
logger.info(f"save pipeline result to file: {filename}")


class AutomaticScheduling(object):
class AutomaticScheduling:

def __init__(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/command_recommender.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def get_error_type(error_msg):
return error_type.value


class CommandRecommender(): # pylint: disable=too-few-public-methods
class CommandRecommender: # pylint: disable=too-few-public-methods
"""Recommend a command for user when user's command fails.
It combines Aladdin recommendations and examples in help files."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ERR_UNABLE_TO_GET_EXTENSIONS)


class MockResponse(object):
class MockResponse:
def __init__(self, status_code, data):
self.status_code = status_code
self.data = data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
from knack.util import CLIError


class ListTestObject(object):
class ListTestObject:

def __init__(self, val):
self.list_value = list(val)


class DictTestObject(object):
class DictTestObject:

def __init__(self, val):
self.dict_value = dict(val)


class ObjectTestObject(object):
class ObjectTestObject:

def __init__(self, str_val, int_val, bool_val):
self.my_string = str(str_val)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def dummy_handler(arg1, arg2=None, arg3=None, arg4=None):
# region Test Help Loader


class JsonLoaderMixin(object):
class JsonLoaderMixin:
"""A class containing helper methods for Json Loaders."""

# get the list of json help file names for the command or group
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def mock_add_extension(*args, **kwargs):
self.assertIn("Extension another-ext-name installed. Please rerun your command.", logger_msgs[6])


class VerifyError(object): # pylint: disable=too-few-public-methods
class VerifyError: # pylint: disable=too-few-public-methods

def __init__(self, test, substr=None):
self.test = test
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli-core/azure/cli/core/tests/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ def test_get_auth_info_for_newly_created_service_principal(self):
self.assertEqual('very_secret', extended_info['clientSecret'])


class FileHandleStub(object): # pylint: disable=too-few-public-methods
class FileHandleStub: # pylint: disable=too-few-public-methods

def write(self, content):
pass
Expand Down Expand Up @@ -1538,7 +1538,7 @@ def __init__(self, tenant_id): # pylint: disable=redefined-builtin
self.tenant_id = tenant_id


class TenantStub(object): # pylint: disable=too-few-public-methods
class TenantStub: # pylint: disable=too-few-public-methods

def __init__(self, tenant_id, display_name=MOCK_TENANT_DISPLAY_NAME, default_domain=MOCK_TENANT_DEFAULT_DOMAIN):
self.tenant_id = tenant_id
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli-testsdk/azure/cli/testsdk/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
COVERAGE_FILE = 'az_command_coverage.txt'


class CheckerMixin(object):
class CheckerMixin:

def _apply_kwargs(self, val):
try:
Expand Down Expand Up @@ -235,7 +235,7 @@ def get_subscription_id(self):
return self.cmd('account list --query "[?isDefault].id" -o tsv').output.strip()


class ExecutionResult(object):
class ExecutionResult:
def __init__(self, cli_ctx, command, expect_failure=False):
self.output = ''
self.applog = ''
Expand Down
18 changes: 9 additions & 9 deletions src/azure-cli-testsdk/azure/cli/testsdk/checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .exceptions import JMESPathCheckAssertionError


class JMESPathCheck(object): # pylint: disable=too-few-public-methods
class JMESPathCheck: # pylint: disable=too-few-public-methods
def __init__(self, query, expected_result, case_sensitive=True):
self._query = query
self._expected_result = expected_result
Expand Down Expand Up @@ -37,7 +37,7 @@ def __call__(self, execution_result):
execution_result.output)


class JMESPathCheckExists(object): # pylint: disable=too-few-public-methods
class JMESPathCheckExists: # pylint: disable=too-few-public-methods
def __init__(self, query):
self._query = query

Expand All @@ -50,7 +50,7 @@ def __call__(self, execution_result):
execution_result.output)


class JMESPathCheckNotExists(object): # pylint: disable=too-few-public-methods
class JMESPathCheckNotExists: # pylint: disable=too-few-public-methods
def __init__(self, query):
self._query = query

Expand All @@ -63,7 +63,7 @@ def __call__(self, execution_result):
execution_result.output)


class JMESPathCheckGreaterThan(object): # pylint: disable=too-few-public-methods
class JMESPathCheckGreaterThan: # pylint: disable=too-few-public-methods
def __init__(self, query, expected_result):
self._query = query
self._expected_result = expected_result
Expand All @@ -82,7 +82,7 @@ def __call__(self, execution_result):
execution_result.output)


class JMESPathPatternCheck(object): # pylint: disable=too-few-public-methods
class JMESPathPatternCheck: # pylint: disable=too-few-public-methods
def __init__(self, query, expected_result):
self._query = query
self._expected_result = expected_result
Expand All @@ -96,7 +96,7 @@ def __call__(self, execution_result):
execution_result.output)


class NoneCheck(object): # pylint: disable=too-few-public-methods
class NoneCheck: # pylint: disable=too-few-public-methods
def __call__(self, execution_result): # pylint: disable=no-self-use
none_strings = ['[]', '{}', 'false']
try:
Expand All @@ -107,7 +107,7 @@ def __call__(self, execution_result): # pylint: disable=no-self-use
"string in {}".format(data, none_strings))


class StringCheck(object): # pylint: disable=too-few-public-methods
class StringCheck: # pylint: disable=too-few-public-methods
def __init__(self, expected_result):
self.expected_result = expected_result

Expand All @@ -120,7 +120,7 @@ def __call__(self, execution_result):
"Actual value '{}' != Expected value {}".format(result, self.expected_result))


class StringContainCheck(object): # pylint: disable=too-few-public-methods
class StringContainCheck: # pylint: disable=too-few-public-methods
def __init__(self, expected_result):
self.expected_result = expected_result

Expand All @@ -134,7 +134,7 @@ def __call__(self, execution_result):
self.expected_result))


class StringContainCheckIgnoreCase(object): # pylint: disable=too-few-public-methods
class StringContainCheckIgnoreCase: # pylint: disable=too-few-public-methods
def __init__(self, expected_result):
self.expected_result = expected_result.lower()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .const import ENV_LIVE_TEST


class TestConfig(object): # pylint: disable=too-few-public-methods
class TestConfig: # pylint: disable=too-few-public-methods
def __init__(self, parent_parsers=None, config_file=None):
parent_parsers = parent_parsers or []
self.parser = configargparse.ArgumentParser(parents=parent_parsers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def record_only():
'This test is excluded from being run live. To force a recording, please remove the recording file.')


class AllowLargeResponse(object): # pylint: disable=too-few-public-methods
class AllowLargeResponse: # pylint: disable=too-few-public-methods

def __init__(self, size_kb=1024):
self.size_kb = size_kb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# Core Utility

class AbstractPreparer(object):
class AbstractPreparer:
def __init__(self, name_prefix, name_len, disable_recording=False):
self.name_prefix = name_prefix
self.name_len = name_len
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .utilities import is_text_payload, is_json_payload


class RecordingProcessor(object):
class RecordingProcessor:
def process_request(self, request): # pylint: disable=no-self-use
return request

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self):
self.cloud = get_active_cloud(self)


class MockLoader(object):
class MockLoader:
def __init__(self, ctx):
self.ctx = ctx

Expand All @@ -43,7 +43,7 @@ def get_models(self, *attr_args, **_):
mod='models', operation_group='managed_clusters')


class MockCmd(object):
class MockCmd:
def __init__(self, ctx, arguments={}):
self.cli_ctx = ctx
self.loader = MockLoader(self.cli_ctx)
Expand Down Expand Up @@ -694,7 +694,7 @@ def test_k8s_install_kubelogin_with_custom_source_url(self, logger_mock, mock_ur
shutil.rmtree(temp_dir)


class mockUrlretrieveUrlValidator(object):
class mockUrlretrieveUrlValidator:
def __init__(self, url, version):
self.url = url
self.version = version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self):
self.cloud = get_active_cloud(self)


class MockLoader(object):
class MockLoader:
def __init__(self, ctx):
self.ctx = ctx

Expand All @@ -31,7 +31,7 @@ def get_models(self, *attr_args, **_):
mod='models', operation_group='managed_clusters')


class MockCmd(object):
class MockCmd:
def __init__(self, ctx, arguments={}):
self.cli_ctx = ctx
self.loader = MockLoader(self.cli_ctx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get_models(self, *attr_args, **kwargs):
return self.cmd.get_models(*attr_args, **kwargs)


class MockUrlretrieveUrlValidator(object):
class MockUrlretrieveUrlValidator:
def __init__(self, url, version):
self.url = url
self.version = version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _map_mru(mru):
return mapped_obj


class MediaV2Client():
class MediaV2Client:
""" Media V2 Client """
def __init__(self, cli_ctx, resource_group_name, account_name):
from azure.cli.core._profile import Profile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
DOTNET_REFERENCES_DIR_IN_ZIP = ".az-references"


class FUNCTIONS_STACKS_API_KEYS():
class FUNCTIONS_STACKS_API_KEYS:
# pylint:disable=too-few-public-methods,too-many-instance-attributes
def __init__(self):
self.NAME = 'name'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def test_create_managed_ssl_cert(self, generic_site_op_mock, client_factory_mock
certificate_envelope=cert_def)


class FakedResponse(object): # pylint: disable=too-few-public-methods
class FakedResponse: # pylint: disable=too-few-public-methods
def __init__(self, status_code):
self.status_code = status_code

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from azure.cli.command_modules.batch import _command_type


class TestObj(object): # pylint: disable=too-few-public-methods
class TestObj: # pylint: disable=too-few-public-methods
pass


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from azure.cli.testsdk.decorators import serial_test
from knack.util import CLIError

class DirectLineClient(object):
class DirectLineClient:
"""Shared methods for the parsed result objects."""

def __init__(self, direct_line_secret):
Expand Down
Loading