Skip to content

Commit

Permalink
Remove comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bebound committed Nov 13, 2023
1 parent 8b6a7bb commit 6ce9dad
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
21 changes: 0 additions & 21 deletions src/azure-cli-core/azure/cli/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,32 +704,12 @@ def _apply_doc_string(self, dest, command_kwargs):
raise CLIError("command authoring error: applying doc_string_source '{}' directly will cause slowdown. "
'Import by string name instead.'.format(doc_string_source.__name__))

# print('kk doc string source', doc_string_source)
# if doc_string_source is azure.mgmt.netapp.models#Snapshot, APIVersionException is raised
# if doc_string_source is azure.mgmt.keyvault.v2023_02_01.models#VaultProperties, ignored,
# self.get_models(doc_string_source) is always None
# doc_string_source is file#FileService.list_directories_and_files in azure stack
# it becomes _get_attr azure.multiapi.storage.v2017_04_17.file#FileService.list_directories_and_files
if doc_string_source == 'azure.mgmt.netapp.models#Snapshot':
pass
if doc_string_source == 'azure.mgmt.keyvault.v2023_02_01.models#VaultProperties':
pass
if doc_string_source == 'file#FileService.list_directories_and_files':
pass
# try:
# model = self.get_models(doc_string_source, ignore=True)
# except APIVersionException:
# model = None
# if model:
# print('wat model not empty', doc_string_source)
# if not model:
from importlib import import_module
(path, model_name) = doc_string_source.split('#', 1)
method_name = None
if '.' in model_name:
(model_name, method_name) = model_name.split('.', 1)
module = import_module(path)
# print('kk import module', module,'model_name',model_name)
model = getattr(module, model_name)
if method_name:
model = getattr(model, method_name, None)
Expand Down Expand Up @@ -788,7 +768,6 @@ def get_models(self, *attr_args, **kwargs):
from azure.cli.core.profiles import get_sdk
resource_type = kwargs.get('resource_type', self._get_resource_type())
operation_group = kwargs.get('operation_group', self.module_kwargs.get('operation_group', None))
# print('get_models', resource_type, attr_args)
return get_sdk(self.cli_ctx, resource_type, *attr_args, mod='models', operation_group=operation_group)

def command_group(self, group_name, command_type=None, **kwargs):
Expand Down
10 changes: 0 additions & 10 deletions src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,15 +644,6 @@ def supported_resource_type(api_profile, resource_type):


def _get_attr(sdk_path, mod_attr_path, checked=True):
# print('_get_attr', sdk_path, mod_attr_path)
# In _apply_doc_string, doc_string_source can be a full path and be passed as mod_attr_path
# ex: azure.mgmt.keyvault.v2023_02_01.models#VaultProperties
# Then full_mod_path become azure.mgmt.keyvault.v2023_02_01.azure.mgmt.keyvault.v2023_02_01.models
# We need to skip this import
# Later _apply_doc_string will import the full path directly
# if sdk_path.startswith('azure.') and mod_attr_path.startswith('azure.'):
# print('ignore', sdk_path, mod_attr_path)
# return None
try:
attr_mod, attr_path = mod_attr_path.split('#') \
if '#' in mod_attr_path else (mod_attr_path, '')
Expand Down Expand Up @@ -697,7 +688,6 @@ def get_versioned_sdk(api_profile, resource_type, *attr_args, **kwargs):
sub_mod_prefix = kwargs.get('mod', None)
operation_group = kwargs.get('operation_group', None)
sdk_path = get_versioned_sdk_path(api_profile, resource_type, operation_group)
# print('get version sdk', sdk_path, attr_args )
if not attr_args:
# No attributes to load. Return the versioned sdk
return import_module(sdk_path)
Expand Down

0 comments on commit 6ce9dad

Please sign in to comment.