How to use _list_command method in avocado

Best Python code snippet using avocado_python

deprecated_completers.py

Source:deprecated_completers.py Github

copy

Full Screen

1# Copyright 2017 Google Inc. All Rights Reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14"""Deprecated completers to assist the completion cache refactor."""15from googlecloudsdk.command_lib.util import parameter_info_lib16from googlecloudsdk.core import remote_completion17# TODO(b/38374705): Drop the DeprecatedListCommandCompleter.18class DeprecatedListCommandCompleter(object):19 """A ListCommandCompleter for deprecated parser.add_argument() kwargs.20 This class is also temporarily used to allow new completers to use the old21 cache. This will allow a small CL to switch from the old cache to the new22 one.23 Attributes:24 _deprecated_list_command: The gcloud list command, either space or '.'25 separated, that returns the list of current resource URIs.26 _deprecated_list_command_callback: A function that returns list_command27 given the parsed args.28 """29 def __init__(self, collection=None, list_command=None,30 list_command_callback=None, **kwargs):31 del kwargs32 self.collection = collection33 self._list_command = list_command34 self._list_command_callback = list_command_callback35 def ParameterInfo(self, parsed_args, argument):36 """Returns the parameter info object.37 Args:38 parsed_args: The command line parsed args object.39 argument: The argparse argument object attached to this completer.40 Returns:41 The parameter info object.42 """43 return parameter_info_lib.ParameterInfoByConvention(parsed_args, argument)44 def GetListCommand(self, parameter_info):45 """Returns the completion value list command argv."""46 if self._list_command_callback:47 return self._list_command_callback(parameter_info.parsed_args)48 if not self._list_command:49 return None50 list_command = self._list_command.split()51 if ' --quiet' not in self._list_command:52 list_command.append('--quiet')53 if ' --uri' in self._list_command and '--format' not in self._list_command:54 list_command.append('--format=disable')55 return list_command56 def Complete(self, prefix, parameter_info):57 """Returns the list of strings matching prefix.58 Args:59 prefix: The resource prefix string to match.60 parameter_info: A ParamaterInfo object for accessing parameter values in61 the program state.62 Returns:63 The list of strings matching prefix.64 """65 list_command = self.GetListCommand(parameter_info)66 command_line = ' '.join(list_command) if list_command else None67 completer = remote_completion.RemoteCompletion.GetCompleterForResource(68 resource=self.collection, command_line=command_line)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful