Get the vsphere object associated with a given text name or MOID
6016
def get_obj(self, vimtype, name, return_all=False, path=""):
        """"""
        obj = list()
        if path:
            obj_folder = self.content.searchIndex.FindByInventoryPath(path)
            container = self.content.viewManager.CreateContainerView(
                obj_folder, vimtype, True
            )
        else:
            container = self.content.viewManager.CreateContainerView(
                self.content.rootFolder, vimtype, True)

        for c in container.view:
            if name in [c.name, c._GetMoId()]:
                if return_all is False:
                    return c
                    break
                else:
                    obj.append(c)

        if len(obj) > 0:
            return obj
        else:
            # for backwards-compat
            return None
151251
def read_wavefront(fname_obj):
    """"""
    fname_mtl = ''
    geoms = read_objfile(fname_obj)
    for line in open(fname_obj):
        if line:
            split_line = line.strip().split(' ', 1)
            if len(split_line) < 2:
                continue

            prefix, data = split_line[0], split_line[1]
            if 'mtllib' in prefix:
                fname_mtl = data
                break

    if fname_mtl:
        materials = read_mtlfile(path.join(path.dirname(fname_obj), fname_mtl))

        for geom in geoms.values():
            geom['material'] = materials[geom['usemtl']]

    return geoms
448193
def get_object_from_string(object_path):
    
    # split like crosspm.template.GUS => crosspm.template, GUS
    try:
        module_name, object_name = object_path.rsplit('.', maxsplit=1)
        module_ = __import__(module_name, globals(), locals(), ['App'], 0)
        variable_ = getattr(module_, object_name)
    except Exception:
        variable_ = None
    return variable_
223628
function findTextMethods(virtualNode) {
	const { nativeElementType, nativeTextMethods } = text;
	const nativeType = nativeElementType.find(({ matches }) => {
		return axe.commons.matches(virtualNode, matches);
	});

	// Use concat because namingMethods can be a string or an array of strings
	const methods = nativeType ? [].concat(nativeType.namingMethods) : [];

	return methods.map(methodName => nativeTextMethods[methodName]);
}
577054
def get_cls_doc(elt, full_name:str)->str:
    ""
    parent_class = inspect.getclasstree([elt])[-1][0][1][0]
    name,args = format_ft_def(elt, full_name)
    if parent_class != object: args += f' :: {link_type(parent_class, include_bt=True)}'
    return name,args
839365
def get_object(ns, element_name, ext_class)
      elements = getlist(ns, element_name)
      return nil if elements.empty?
      ext_class.new(:namespace => ns, :elem => elements.first)
    end
1274767
def from_indexed_arrays(cls, name, verts, normals):
        """"""

        # Put header in string
        wavefront_str = "o {name}\n".format(name=name)


        new_verts, face_indices = face_index(verts)
        assert new_verts.shape[1] == 3, "verts should be Nx3 array"
        assert face_indices.ndim == 2

        face_indices = fan_triangulate(face_indices)

        # Write Vertex data from vert_dict
        for vert in new_verts:
            wavefront_str += "v {0} {1} {2}\n".format(*vert)

        # Write (false) UV Texture data
        wavefront_str += "vt 1.0 1.0\n"

        for norm in normals:
            wavefront_str += "vn {0} {1} {2}\n".format(*norm)

        assert len(face_indices) == len(normals) * 2
        for norm_idx, vert_idx,  in enumerate(face_indices):
            wavefront_str += "f"
            for vv in vert_idx:
                wavefront_str += " {}/{}/{}".format(vv + 1, 1, (norm_idx // 2) + 1 )
            wavefront_str += "\n"

        return cls(string=wavefront_str)
1267543
function vhostof (req, regexp) {
  var host = req.headers.host
  var hostname = hostnameof(req)

  if (!hostname) {
    return
  }

  var match = regexp.exec(hostname)

  if (!match) {
    return
  }

  var obj = Object.create(null)

  obj.host = host
  obj.hostname = hostname
  obj.length = match.length - 1

  for (var i = 1; i < match.length; i++) {
    obj[i - 1] = match[i]
  }

  return obj
}
1061012
def getTextualNode(self, subreference: CtsReference=None):
        
        if not isinstance(subreference, CtsReference):
            subreference = CtsReference(subreference)
        return self.textObject.getTextualNode(subreference)
336030
def named_object(name):
    """"""
    name_parts = name.split('.')
    module = named_module('.'.join(name_parts[:-1]))
    return getattr(module, name_parts[-1])
837041
def get_context(self):
        "  "
        return {
                'content_type_name' : str(self.name),
                'content_type_verbose_name' : self.verbose_name,
                'content_type_verbose_name_plural' : self.verbose_name_plural,
                'object' : self.obj,
                'box' : self,
        }
298930
def get_network_adapter_object_type(adapter_object):
    '''
    
    '''
    if isinstance(adapter_object, vim.vm.device.VirtualVmxnet2):
        return 'vmxnet2'
    if isinstance(adapter_object, vim.vm.device.VirtualVmxnet3):
        return 'vmxnet3'
    if isinstance(adapter_object, vim.vm.device.VirtualVmxnet):
        return 'vmxnet'
    if isinstance(adapter_object, vim.vm.device.VirtualE1000e):
        return 'e1000e'
    if isinstance(adapter_object, vim.vm.device.VirtualE1000):
        return 'e1000'

    raise ValueError('An unknown network adapter object type.')
596078
def from_dicts(cls, mesh_name, vert_dict, normal_dict):
        """"""

        # Put header in string
        wavefront_str = "o {name}\n".format(name=mesh_name)

        # Write Vertex data from vert_dict
        for wall in vert_dict:
            for vert in vert_dict[wall]:
                wavefront_str += "v {0} {1} {2}\n".format(*vert)

        # Write (false) UV Texture data
        wavefront_str += "vt 1.0 1.0\n"

        # Write Normal data from normal_dict
        for wall, norm in normal_dict.items():
            wavefront_str += "vn {0} {1} {2}\n".format(*norm)

        # Write Face Indices (1-indexed)
        vert_idx = 0
        for wall in vert_dict:
            for _ in range(0, len(vert_dict[wall]), 3):
                wavefront_str += 'f '
                for vert in range(3): # 3 vertices in each face
                    vert_idx += 1
                    wavefront_str += "{v}/1/{n} ".format(v=vert_idx, n=wall+1)
                wavefront_str = wavefront_str[:-1] + '\n'  # Cutoff trailing space and add a newline.

        # Return Wavefront string
        return WavefrontWriter(string=wavefront_str)
891290
def get_variable(self, name):
        
        name = get_op_tensor_name(name)[1]
        if len(self.vs_name):
            name_with_vs = self.vs_name + "/" + name
        else:
            name_with_vs = name
        return get_op_or_tensor_by_name(name_with_vs)
550469
def from_wms(cls, filename, vector, resolution, destination_file=None):
        """"""
        doc = wms_vrt(filename,
                      bounds=vector,
                      resolution=resolution).tostring()
        filename = cls._save_to_destination_file(doc, destination_file)
        return GeoRaster2.open(filename)
544503
def _get_group_object(name):
    '''
    
    '''
    with salt.utils.winapi.Com():
        nt = win32com.client.Dispatch('AdsNameSpaces')
    return nt.GetObject('', 'WinNT://./' + name + ',group')
120309
function (moduleNamePlusExt, relModuleMap) {
                var index = moduleNamePlusExt.lastIndexOf("."),
                    ext = null;

                if (index !== -1) {
                    ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
                    moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
                }

                return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
            }