text
stringlengths
0
828
print('Path : ', summary.config.vmPathName)
print('Guest : ', summary.config.guestFullName)
annotation = summary.config.annotation
if annotation is not None and annotation != '':
print('Annotation : ', annotation)
print('State : ', summary.runtime.powerState)
if summary.guest is not None:
ip = summary.guest.ipAddress
if ip is not None and ip != '':
print('IP : ', ip)
if summary.runtime.question is not None:
print('Question : ', summary.runtime.question.text)
print('')"
1149,"def module_import(module_path):
""""""Imports the module indicated in name
Args:
module_path: string representing a module path such as
'app.config' or 'app.extras.my_module'
Returns:
the module matching name of the last component, ie: for
'app.extras.my_module' it returns a
reference to my_module
Raises:
BadModulePathError if the module is not found
""""""
try:
# Import whole module path.
module = __import__(module_path)
# Split into components: ['contour',
# 'extras','appengine','ndb_persistence'].
components = module_path.split('.')
# Starting at the second component, set module to a
# a reference to that component. at the end
# module with be the last component. In this case:
# ndb_persistence
for component in components[1:]:
module = getattr(module, component)
return module
except ImportError:
raise BadModulePathError(
'Unable to find module ""%s"".' % (module_path,))"
1150,"def find_contour_yaml(config_file=__file__, names=None):
""""""
Traverse directory trees to find a contour.yaml file
Begins with the location of this file then checks the
working directory if not found
Args:
config_file: location of this file, override for
testing
Returns:
the path of contour.yaml or None if not found
""""""
checked = set()
contour_yaml = _find_countour_yaml(os.path.dirname(config_file), checked,
names=names)
if not contour_yaml:
contour_yaml = _find_countour_yaml(os.getcwd(), checked, names=names)
return contour_yaml"
1151,"def _find_countour_yaml(start, checked, names=None):
""""""Traverse the directory tree identified by start
until a directory already in checked is encountered or the path
of countour.yaml is found.
Checked is present both to make the loop termination easy
to reason about and so the same directories do not get
rechecked
Args:
start: the path to start looking in and work upward from
checked: the set of already checked directories
Returns:
the path of the countour.yaml file or None if it is not found
""""""
extensions = []
if names:
for name in names:
if not os.path.splitext(name)[1]:
extensions.append(name + "".yaml"")
extensions.append(name + "".yml"")
yaml_names = (names or []) + CONTOUR_YAML_NAMES + extensions
directory = start
while directory not in checked:
checked.add(directory)
for fs_yaml_name in yaml_names:
yaml_path = os.path.join(directory, fs_yaml_name)