Skip to content
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
9 changes: 8 additions & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ reports=no
# locally-disabled: Warning locally suppressed using disable-msg
# cyclic-import: because of https://github.com/PyCQA/pylint/issues/850
# too-many-arguments: Due to the nature of the CLI many commands have large arguments set which reflect in large arguments set in corresponding methods.
disable=missing-docstring,locally-disabled,fixme,cyclic-import,too-many-arguments,invalid-name,duplicate-code
disable=
missing-docstring,
locally-disabled,
fixme,
cyclic-import,
too-many-arguments,
invalid-name,
duplicate-code

[FORMAT]
max-line-length=120
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def invalidate(self):
logger.debug("Command index has been invalidated.")


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

def __init__(self, mod_name, suppress_extension_name, suppress_up_to_version, reason=None, recommend_remove=False,
recommend_update=False):
Expand Down
5 changes: 3 additions & 2 deletions src/azure-cli-core/azure/cli/core/_help_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@

import abc
import os
import yaml

from azure.cli.core._help import (HelpExample, CliHelpFile)

from knack.util import CLIError
from knack.log import get_logger

import yaml

logger = get_logger(__name__)

try:
Expand Down Expand Up @@ -93,7 +94,7 @@ def _update_help_obj_params(help_obj, data_params, params_equal, attr_key_tups):
help_obj.parameters = loaded_params


class YamlLoaderMixin(object): # pylint:disable=too-few-public-methods
class YamlLoaderMixin: # pylint:disable=too-few-public-methods
"""A class containing helper methods for Yaml Loaders."""

# get the list of yaml help file names for the command or group
Expand Down
15 changes: 8 additions & 7 deletions src/azure-cli-core/azure/cli/core/_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
from copy import deepcopy
from enum import Enum

from knack.log import get_logger
from knack.util import CLIError

from azure.cli.core._environment import get_config_dir
from azure.cli.core._session import ACCOUNT
from azure.cli.core.util import get_file_json, in_cloud_console, open_page_in_browser, can_launch_browser,\
is_windows, is_wsl
from azure.cli.core.cloud import get_active_cloud, set_cloud_subscription

from knack.log import get_logger
from knack.util import CLIError

logger = get_logger(__name__)

Expand Down Expand Up @@ -139,7 +140,7 @@ def _get_cloud_console_token_endpoint():


# pylint: disable=too-many-lines,too-many-instance-attributes
class Profile(object):
class Profile:

_global_creds_cache = None

Expand Down Expand Up @@ -759,7 +760,7 @@ def get_installation_id(self):
return installation_id


class MsiAccountTypes(object):
class MsiAccountTypes:
# pylint: disable=no-method-argument,no-self-argument
system_assigned = 'MSI'
user_assigned_client_id = 'MSIClient'
Expand All @@ -785,7 +786,7 @@ def msi_auth_factory(cli_account_name, identity, resource):
raise ValueError("unrecognized msi account name '{}'".format(cli_account_name))


class SubscriptionFinder(object):
class SubscriptionFinder:
'''finds all subscriptions for a user or service principal'''

def __init__(self, cli_ctx, auth_context_factory, adal_token_cache, arm_client_factory=None):
Expand Down Expand Up @@ -970,7 +971,7 @@ def _find_using_specific_tenant(self, tenant, access_token):
return all_subscriptions


class CredsCache(object):
class CredsCache:
'''Caches AAD tokena and service principal secrets, and persistence will
also be handled
'''
Expand Down Expand Up @@ -1128,7 +1129,7 @@ def remove_all_cached_creds(self):
_delete_file(self._token_file)


class ServicePrincipalAuth(object):
class ServicePrincipalAuth:

def __init__(self, password_arg_value, use_cert_sn_issuer=None):
if not password_arg_value:
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/azlogging.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def end_cmd_metadata_logging(self, exit_code): # leave it non '-' prefix to not
self.command_metadata_logger = None


class CommandLoggerContext(object):
class CommandLoggerContext:
def __init__(self, module_logger):
self.logger = module_logger
self.hdlr = logging.getLogger(AzCliLogging._COMMAND_METADATA_LOGGER) # pylint: disable=protected-access
Expand Down
6 changes: 3 additions & 3 deletions src/azure-cli-core/azure/cli/core/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CloudSuffixNotSetException(CLIError):
pass


class CloudEndpoints(object): # pylint: disable=too-few-public-methods,too-many-instance-attributes
class CloudEndpoints: # pylint: disable=too-few-public-methods,too-many-instance-attributes

def __init__(self,
management=None,
Expand Down Expand Up @@ -110,7 +110,7 @@ def __getattribute__(self, name):
return val


class CloudSuffixes(object): # pylint: disable=too-few-public-methods,too-many-instance-attributes
class CloudSuffixes: # pylint: disable=too-few-public-methods,too-many-instance-attributes

def __init__(self,
storage_endpoint=None,
Expand Down Expand Up @@ -212,7 +212,7 @@ def _arm_to_cli_mapper(arm_dict):
acr_login_server_endpoint=arm_dict['suffixes']['acrLoginServer'] if 'acrLoginServer' in arm_dict['suffixes'] else None)) # pylint: disable=line-too-long


class Cloud(object): # pylint: disable=too-few-public-methods
class Cloud: # pylint: disable=too-few-public-methods
""" Represents an Azure Cloud instance """

def __init__(self,
Expand Down
10 changes: 5 additions & 5 deletions src/azure-cli-core/azure/cli/core/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def _pre_command_table_create(cli_ctx, args):


# pylint: disable=too-many-instance-attributes
class CacheObject(object):
class CacheObject:

def path(self, args, kwargs):
from azure.cli.core._environment import get_config_dir
Expand Down Expand Up @@ -349,7 +349,7 @@ def get_models(self, *attr_args, **kwargs):
operation_group=operation_group)

def update_context(self, obj_inst):
class UpdateContext(object):
class UpdateContext:
def __init__(self, instance):
self.instance = instance

Expand Down Expand Up @@ -860,7 +860,7 @@ def _validate_arg_level(self, ns, **_): # pylint: disable=no-self-use
pass


class LongRunningOperation(object): # pylint: disable=too-few-public-methods
class LongRunningOperation: # pylint: disable=too-few-public-methods
def __init__(self, cli_ctx, start_msg='', finish_msg='', poller_done_interval_ms=1000.0):

self.cli_ctx = cli_ctx
Expand Down Expand Up @@ -1048,7 +1048,7 @@ def _load_module_command_loader(loader, args, mod):
return _load_command_loader(loader, args, mod, 'azure.cli.command_modules.')


class ExtensionCommandSource(object):
class ExtensionCommandSource:
""" Class for commands contributed by an extension """

def __init__(self, overrides_command=False, extension_name=None, preview=False, experimental=False):
Expand Down Expand Up @@ -1129,7 +1129,7 @@ def _merge_kwargs(patch_kwargs, base_kwargs, supported_kwargs=None):


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

def __init__(self, overrides=None, **kwargs):
if isinstance(overrides, str):
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/commands/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


# pylint:disable=too-many-lines
class ArmTemplateBuilder(object):
class ArmTemplateBuilder:

def __init__(self):
template = OrderedDict()
Expand Down
8 changes: 4 additions & 4 deletions src/azure-cli-core/azure/cli/core/commands/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
BAR_LEN = 70


class ProgressViewBase(object):
class ProgressViewBase:
""" a view base for progress reporting """
def __init__(self, out):
self.out = out
Expand All @@ -28,7 +28,7 @@ def clear(self):
pass # pylint: disable=unnecessary-pass


class ProgressReporter(object):
class ProgressReporter:
""" generic progress reporter """
def __init__(self, message='', value=None, total_value=None):
self.message = message
Expand All @@ -45,7 +45,7 @@ def add(self, **kwargs):
total_val = kwargs.get('total_val', self.total_val)
value = kwargs.get('value', self.value)
if value and total_val:
assert value >= 0 and value <= total_val and total_val >= 0
assert 0 <= value <= total_val
self.closed = value == total_val
self.total_val = total_val
self.value = value
Expand All @@ -57,7 +57,7 @@ def report(self):
return {'message': self.message, 'percent': percent}


class ProgressHook(object):
class ProgressHook:
""" sends the progress to the view """
def __init__(self):
self.reporter = ProgressReporter()
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


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

def __init__(self, func):
self.func = func
Expand Down
8 changes: 4 additions & 4 deletions src/azure-cli-core/azure/cli/core/extension/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import traceback
import json
import re
import pkginfo

from azure.cli.core._config import GLOBAL_CONFIG_DIR, ENV_VAR_PREFIX
from distutils.sysconfig import get_python_lib

import pkginfo
from knack.config import CLIConfig
from knack.log import get_logger
from azure.cli.core._config import GLOBAL_CONFIG_DIR, ENV_VAR_PREFIX

az_config = CLIConfig(config_dir=GLOBAL_CONFIG_DIR, config_env_var_prefix=ENV_VAR_PREFIX)
_CUSTOM_EXT_DIR = az_config.get('extension', 'dir', None)
Expand Down Expand Up @@ -51,7 +51,7 @@ def __str__(self):
return "The extension {} is not installed.".format(self.extension_name)


class Extension(object):
class Extension:

def __init__(self, name, ext_type, path=None):
self.name = name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def is_homebrew():


# A workaround for https://github.com/Azure/azure-cli/issues/4428
class HomebrewPipPatch(object): # pylint: disable=too-few-public-methods
class HomebrewPipPatch: # pylint: disable=too-few-public-methods

CFG_FILE = os.path.expanduser(os.path.join('~', '.pydistutils.cfg'))

Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli-core/azure/cli/core/local_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _get_current_system_username():
return None


class AzCLILocalContext(object): # pylint: disable=too-many-instance-attributes
class AzCLILocalContext: # pylint: disable=too-many-instance-attributes

def __init__(self, cli_ctx):
self.cli_ctx = cli_ctx
Expand Down Expand Up @@ -180,7 +180,7 @@ def get_value(self, names=None):
return result


class LocalContextAttribute(object):
class LocalContextAttribute:
# pylint: disable=too-few-public-methods
def __init__(self, name, actions, scopes=None):
""" Local Context Attribute arguments
Expand Down
10 changes: 5 additions & 5 deletions src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __str__(self):
PROFILE_TYPE = object()


class CustomResourceType(object): # pylint: disable=too-few-public-methods
class CustomResourceType: # pylint: disable=too-few-public-methods
def __init__(self, import_prefix, client_name):
self.import_prefix = import_prefix
self.client_name = client_name
Expand Down Expand Up @@ -111,7 +111,7 @@ def __init__(self, import_prefix, client_name):
self.client_name = client_name


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

def __init__(self, default_api_version, profile=None):
"""Constructor.
Expand Down Expand Up @@ -281,7 +281,7 @@ def default_api_version(self):
}


class _ApiVersions(object): # pylint: disable=too-few-public-methods
class _ApiVersions: # pylint: disable=too-few-public-methods
def __init__(self, client_type, sdk_profile, post_process):
self._client_type = client_type
self._sdk_profile = sdk_profile
Expand Down Expand Up @@ -342,7 +342,7 @@ def get_api_version(api_profile, resource_type, as_sdk_profile=False):


@total_ordering
class _SemVerAPIFormat(object):
class _SemVerAPIFormat:
"""Basic semver x.y.z API format.
Supports x, or x.y, or x.y.z
"""
Expand All @@ -366,7 +366,7 @@ def __lt__(self, other):


@total_ordering # pylint: disable=too-few-public-methods
class _DateAPIFormat(object):
class _DateAPIFormat:
""" Class to support comparisons for API versions in
YYYY-MM-DD, YYYY-MM-DD-preview, YYYY-MM-DD-profile, YYYY-MM-DD-profile-preview
or any string that starts with YYYY-MM-DD format. A special case is made for 'latest'.
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
CORRELATION_ID_PROP_NAME = 'Reserved.DataModel.CorrelationId'


class TelemetrySession(object): # pylint: disable=too-many-instance-attributes
class TelemetrySession: # pylint: disable=too-many-instance-attributes
def __init__(self, correlation_id=None, application=None):
self.start_time = None
self.end_time = None
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli-core/azure/cli/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import binascii
import platform
import ssl
import six
import re
import logging

import six
from six.moves.urllib.request import urlopen # pylint: disable=import-error
from knack.log import get_logger
from knack.util import CLIError, to_snake_case
Expand Down Expand Up @@ -882,7 +882,7 @@ def _log_response(response, **kwargs):
return response


class ConfiguredDefaultSetter(object):
class ConfiguredDefaultSetter:

def __init__(self, cli_config, use_local_config=None):
self.use_local_config = use_local_config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import tempfile


class RecordsCollection(object):
class RecordsCollection:
def __init__(self, last_sent, config_dir):
from azure.cli.telemetry.components.telemetry_logging import get_logger

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from urllib.error import HTTPError


class CliTelemetryClient(object):
class CliTelemetryClient:
def __init__(self, batch=100, sender=None):
from azure.cli.telemetry.components.telemetry_logging import get_logger

Expand Down
Loading