Skip to content

Commit d1a5844

Browse files
authored
{Pylint} Fix super-with-arguments (#30367)
1 parent a9c6b39 commit d1a5844

File tree

181 files changed

+467
-496
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+467
-496
lines changed

pylintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ disable=
3030
no-value-for-parameter,
3131
raise-missing-from,
3232
subprocess-run-check,
33-
super-with-arguments,
3433
too-many-arguments,
3534
too-many-positional-arguments,
3635
too-many-function-args,

scripts/dump_command_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Exporter(json.JSONEncoder):
1616

1717
def default(self, o):#pylint: disable=method-hidden
1818
try:
19-
return super(Exporter, self).default(o)
19+
return super().default(o)
2020
except TypeError:
2121
return str(o)
2222

scripts/dump_help.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Exporter(json.JSONEncoder):
1616

1717
def default(self, o):#pylint: disable=method-hidden
1818
try:
19-
return super(Exporter, self).default(o)
19+
return super().default(o)
2020
except TypeError:
2121
return str(o)
2222

scripts/generate_command_inventory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Exporter(json.JSONEncoder):
1414

1515
def default(self, o):#pylint: disable=method-hidden
1616
try:
17-
return super(Exporter, self).default(o)
17+
return super().default(o)
1818
except TypeError:
1919
return str(o)
2020

src/azure-cli-core/azure/cli/core/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _configure_knack():
5656
class AzCli(CLI):
5757

5858
def __init__(self, **kwargs):
59-
super(AzCli, self).__init__(**kwargs)
59+
super().__init__(**kwargs)
6060

6161
from azure.cli.core.breaking_change import register_upcoming_breaking_change_info
6262
from azure.cli.core.commands import register_cache_arguments
@@ -200,7 +200,7 @@ class MainCommandsLoader(CLICommandsLoader):
200200
item_ext_format_string = item_format_string + " %s"
201201

202202
def __init__(self, cli_ctx=None):
203-
super(MainCommandsLoader, self).__init__(cli_ctx)
203+
super().__init__(cli_ctx)
204204
self.cmd_to_loader_map = {}
205205
self.loaders = []
206206

@@ -677,9 +677,9 @@ def __init__(self, cli_ctx=None, command_group_cls=None, argument_context_cls=No
677677
suppress_extension=None, **kwargs):
678678
from azure.cli.core.commands import AzCliCommand, AzCommandGroup, AzArgumentContext
679679

680-
super(AzCommandsLoader, self).__init__(cli_ctx=cli_ctx,
681-
command_cls=AzCliCommand,
682-
excluded_command_handler_args=EXCLUDED_PARAMS)
680+
super().__init__(cli_ctx=cli_ctx,
681+
command_cls=AzCliCommand,
682+
excluded_command_handler_args=EXCLUDED_PARAMS)
683683
self.suppress_extension = suppress_extension
684684
self.module_kwargs = kwargs
685685
self.command_name = None

src/azure-cli-core/azure/cli/core/_help.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
# Most of these methods override print methods in CLIHelp
5151
class CLIPrintMixin(CLIHelp):
5252
def _print_header(self, cli_name, help_file):
53-
super(CLIPrintMixin, self)._print_header(cli_name, help_file)
53+
super()._print_header(cli_name, help_file)
5454

5555
links = help_file.links
5656
if links:
@@ -61,7 +61,7 @@ def _print_header(self, cli_name, help_file):
6161

6262
def _print_detailed_help(self, cli_name, help_file):
6363
CLIPrintMixin._print_extensions_msg(help_file)
64-
super(CLIPrintMixin, self)._print_detailed_help(cli_name, help_file)
64+
super()._print_detailed_help(cli_name, help_file)
6565
self._print_az_find_message(help_file.command)
6666

6767
@staticmethod
@@ -131,12 +131,11 @@ def _print_extensions_msg(help_file):
131131
class AzCliHelp(CLIPrintMixin, CLIHelp):
132132

133133
def __init__(self, cli_ctx):
134-
super(AzCliHelp, self).__init__(cli_ctx,
135-
privacy_statement=PRIVACY_STATEMENT,
136-
welcome_message=WELCOME_MESSAGE,
137-
command_help_cls=CliCommandHelpFile,
138-
group_help_cls=CliGroupHelpFile,
139-
help_cls=CliHelpFile)
134+
super().__init__(cli_ctx, privacy_statement=PRIVACY_STATEMENT,
135+
welcome_message=WELCOME_MESSAGE,
136+
command_help_cls=CliCommandHelpFile,
137+
group_help_cls=CliGroupHelpFile,
138+
help_cls=CliHelpFile)
140139
from knack.help import HelpObject
141140

142141
# TODO: This workaround is used to avoid a bizarre bug in Python 2.7. It
@@ -247,7 +246,7 @@ class CliHelpFile(KnackHelpFile):
247246

248247
def __init__(self, help_ctx, delimiters):
249248
# Each help file (for a command or group) has a version denoting the source of its data.
250-
super(CliHelpFile, self).__init__(help_ctx, delimiters)
249+
super().__init__(help_ctx, delimiters)
251250
self.links = []
252251

253252
from knack.deprecation import resolve_deprecate_info, ImplicitDeprecated, Deprecated
@@ -376,7 +375,7 @@ def load(self, options):
376375
class CliCommandHelpFile(KnackCommandHelpFile, CliHelpFile):
377376

378377
def __init__(self, help_ctx, delimiters, parser):
379-
super(CliCommandHelpFile, self).__init__(help_ctx, delimiters, parser)
378+
super().__init__(help_ctx, delimiters, parser)
380379
self.type = 'command'
381380
self.command_source = getattr(parser, 'command_source', None)
382381

@@ -409,7 +408,7 @@ def __init__(self, help_ctx, delimiters, parser):
409408
param.__class__ = HelpParameter
410409

411410
def _load_from_data(self, data):
412-
super(CliCommandHelpFile, self)._load_from_data(data)
411+
super()._load_from_data(data)
413412

414413
if isinstance(data, str) or not self.parameters or not data.get('parameters'):
415414
return
@@ -433,7 +432,7 @@ class ArgumentGroupRegistry(KnackArgumentGroupRegistry): # pylint: disable=too-
433432

434433
def __init__(self, group_list):
435434

436-
super(ArgumentGroupRegistry, self).__init__(group_list)
435+
super().__init__(group_list)
437436
self.priorities = {
438437
None: 0,
439438
'Resource Id Arguments': 1,
@@ -454,7 +453,7 @@ def __init__(self, **_data):
454453
# Old attributes
455454
_data['name'] = _data.get('name', '')
456455
_data['text'] = _data.get('text', '')
457-
super(HelpExample, self).__init__(_data)
456+
super().__init__(_data)
458457

459458
self.name = _data.get('summary', '') if _data.get('summary', '') else self.name
460459
self.text = _data.get('command', '') if _data.get('command', '') else self.text
@@ -483,11 +482,8 @@ def command(self, value):
483482

484483
class HelpParameter(KnackHelpParameter): # pylint: disable=too-many-instance-attributes
485484

486-
def __init__(self, **kwargs):
487-
super(HelpParameter, self).__init__(**kwargs)
488-
489485
def update_from_data(self, data):
490-
super(HelpParameter, self).update_from_data(data)
486+
super().update_from_data(data)
491487
# original help.py value_sources are strings, update command strings to value-source dict
492488
if self.value_sources:
493489
self.value_sources = [str_or_dict if isinstance(str_or_dict, dict) else {"link": {"command": str_or_dict}}

src/azure-cli-core/azure/cli/core/_session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Session(MutableMapping):
2121
"""
2222

2323
def __init__(self, encoding=None):
24-
super(Session, self).__init__()
24+
super().__init__()
2525
self.filename = None
2626
self.data = {}
2727
self._encoding = encoding if encoding else 'utf-8-sig'

src/azure-cli-core/azure/cli/core/aaz/_arg.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,6 @@ def _type_in_help(self):
358358

359359
class AAZCompoundTypeArg(AAZBaseArg):
360360

361-
def __init__(self, **kwargs):
362-
super().__init__(**kwargs)
363-
364361
@abc.abstractmethod
365362
def _build_cmd_action(self):
366363
raise NotImplementedError()

src/azure-cli-core/azure/cli/core/aaz/_field_type.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ class AAZSimpleType(AAZBaseType):
2424

2525
_ValueCls = AAZSimpleValue
2626

27-
def __init__(self, *args, **kwargs):
28-
super().__init__(*args, **kwargs)
29-
3027
def process_data(self, data, **kwargs):
3128
if data == None: # noqa: E711, pylint: disable=singleton-comparison
3229
# data can be None or AAZSimpleValue == None
@@ -276,9 +273,6 @@ class AAZBaseDictType(AAZBaseType):
276273

277274
_PatchDataCls = dict
278275

279-
def __init__(self, *args, **kwargs):
280-
super().__init__(*args, **kwargs)
281-
282276
@abc.abstractmethod
283277
def __getitem__(self, key):
284278
raise NotImplementedError()

src/azure-cli-core/azure/cli/core/azlogging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ class AzCliLogging(CLILogging):
4242
COMMAND_METADATA_LOGGER = 'az_command_data_logger'
4343

4444
def __init__(self, name, cli_ctx=None):
45-
super(AzCliLogging, self).__init__(name, cli_ctx)
45+
super().__init__(name, cli_ctx)
4646
self.command_log_dir = os.path.join(cli_ctx.config.config_dir, 'commands')
4747
self.command_logger_handler = None
4848
self.command_metadata_logger = None
4949
self.cli_ctx.register_event(EVENT_INVOKER_PRE_CMD_TBL_TRUNCATE, AzCliLogging.init_command_file_logging)
5050
self.cli_ctx.register_event(EVENT_CLI_POST_EXECUTE, AzCliLogging.deinit_cmd_metadata_logging)
5151

5252
def configure(self, args):
53-
super(AzCliLogging, self).configure(args)
53+
super().configure(args)
5454
from knack.log import CliLogLevel
5555
if self.log_level == CliLogLevel.DEBUG:
5656
# As azure.core.pipeline.policies.http_logging_policy is a redacted version of

0 commit comments

Comments
 (0)