Obtains the lvm, vg_t and lv_t handle. Usually you would never need to use this
        method unless you are doing operations using the ctypes function wrappers in
        conversion.py

        *Raises:*

        *       HandleError
160742
def open(self):
        
        self.vg.open()
        self.__lvh = lvm_lv_from_uuid(self.vg.handle, self.uuid)
        if not bool(self.__lvh):
            raise HandleError("Failed to initialize LV Handle.")
593605
def type(self):
        
        kv_type = ctypes.c_char_p()
        check_call(_LIB.MXKVStoreGetType(self.handle, ctypes.byref(kv_type)))
        return py_str(kv_type.value)
420513
def handler(self):
        

        if not hasattr(self, "_handler"):
            self._handler = sys.modules[self.imported]
        return self._handler
324899
def get_terminal_converted(self, attr):
        
        value = self.data.get(attr.repr_name)
        return self.converter_registry.convert_to_representation(
                                                            value,
                                                            attr.value_type)
852149
def _get_win_argv():
    

    assert is_win

    argc = ctypes.c_int()
    try:
        argv = winapi.CommandLineToArgvW(
            winapi.GetCommandLineW(), ctypes.byref(argc))
    except WindowsError:
        return []

    if not argv:
        return []

    res = argv[max(0, argc.value - len(sys.argv)):argc.value]

    winapi.LocalFree(argv)

    return res
548332
def ctypes_parameter(self):
        
        if self._ctypes_parameter is None:
            #Essentially, we just need to check if we are an array that doesn't have explicitly
            #defined bounds. Assumed-shape arrays have to be 'pointer' or 'allocatable'. However,
            #the deffered/assumed shape arrays always use ':' as the array dimension.
            if self.dimension is not None and ":" in self.dimension:
                result = [self._get_ctypes_name()]
                result.extend([self._get_ctypes_name(i+1) for i in range(self.D)])
                if self.direction == "(inout)" and ("allocatable" in self.modifiers or
                                                    "pointer" in self.modifiers):
                    result.append("{}_o".format(self.name))
                self._ctypes_parameter = result
            elif self.dtype == "logical":
                self._ctypes_parameter = [self._get_ctypes_name()]
            elif hasattr(self, "parameters"):
                #This is the handler for the function return types that are simple
                self._ctypes_parameter = [self.name + "_f"]
            else:
                #Nothing special, just return the standard name.
                self._ctypes_parameter = [self.name]

        return self._ctypes_parameter
1191256
def ctypes2numpy(cptr, length, dtype):
    
    NUMPY_TO_CTYPES_MAPPING = {
        np.float32: ctypes.c_float,
        np.uint32: ctypes.c_uint,
    }
    if dtype not in NUMPY_TO_CTYPES_MAPPING:
        raise RuntimeError('Supported types: {}'.format(NUMPY_TO_CTYPES_MAPPING.keys()))
    ctype = NUMPY_TO_CTYPES_MAPPING[dtype]
    if not isinstance(cptr, ctypes.POINTER(ctype)):
        raise RuntimeError('expected {} pointer'.format(ctype))
    res = np.zeros(length, dtype=dtype)
    if not ctypes.memmove(res.ctypes.data, cptr, length * res.strides[0]):
        raise RuntimeError('memmove failed')
    return res
537447
def get(self):
        
        val = self.pik.unpickle()
        if self.tb_str:
            etype = val.__class__
            msg = '\n%s%s: %s' % (self.tb_str, etype.__name__, val)
            if issubclass(etype, KeyError):
                raise RuntimeError(msg)  # nicer message
            else:
                raise etype(msg)
        return val
1065473
def _get_calls(data, cnv_only=False):
    
    cnvs_supported = set(["cnvkit", "battenberg"])
    out = {}
    for sv in data.get("sv", []):
        if not cnv_only or sv["variantcaller"] in cnvs_supported:
            out[sv["variantcaller"]] = sv
    return out
950378
def open(self):
        
        self.vg.open()
        self.__pvh = lvm_pv_from_uuid(self.vg.handle, self.uuid)
        if not bool(self.__pvh):
            raise HandleError("Failed to initialize PV Handle.")
1165147
def version():
    '''
    
    '''
    cmd = 'lvm version'
    out = __salt__['cmd.run'](cmd).splitlines()
    ret = out[0].split(': ')
    return ret[1].strip()
1244128
def validate_conversion_arguments(to_wrap):
    

    @functools.wraps(to_wrap)
    def wrapper(*args, **kwargs):
        _assert_one_val(*args, **kwargs)
        if kwargs:
            _validate_supported_kwarg(kwargs)

        if len(args) == 0 and "primitive" not in kwargs:
            _assert_hexstr_or_text_kwarg_is_text_type(**kwargs)
        return to_wrap(*args, **kwargs)

    return wrapper
369570
def _return_handler(self, ret_value, func, arguments):
        

        logger.debug('%s%s -> %r',
                     func.__name__, _args_to_str(arguments), ret_value,
                     extra=self._logging_extra)

        try:
            ret_value = StatusCode(ret_value)
        except ValueError:
            pass

        self._last_status = ret_value

        # The first argument of almost all registered visa functions is a session.
        # We store the error code per session
        session = None
        if func.__name__ not in ('viFindNext', ):
            try:
                session = arguments[0]
            except KeyError:
                raise Exception('Function %r does not seem to be a valid '
                                'visa function (len args %d)' % (func, len(arguments)))

            # Functions that use the first parameter to get a session value.
            if func.__name__ in ('viOpenDefaultRM', ):
                # noinspection PyProtectedMember
                session = session._obj.value

            if isinstance(session, integer_types):
                self._last_status_in_session[session] = ret_value
            else:
                # Functions that might or might have a session in the first argument.
                if func.__name__ not in ('viClose', 'viGetAttribute', 'viSetAttribute', 'viStatusDesc'):
                    raise Exception('Function %r does not seem to be a valid '
                                    'visa function (type args[0] %r)' % (func, type(session)))

        if ret_value < 0:
            raise errors.VisaIOError(ret_value)

        if ret_value in self.issue_warning_on:
            if session and ret_value not in self._ignore_warning_in_session[session]:
                warnings.warn(errors.VisaIOWarning(ret_value), stacklevel=2)

        return ret_value
262281
def convert_old_variant_handle(handle_dict):
    """"""
    old_variables = handle_dict.get("variables", {})
    variables = dict(repository_type="filesystem")

    for old_key, key in variant_key_conversions.iteritems():
        value = old_variables.get(old_key)
        #if value is not None:
        variables[key] = value

    path = handle_dict["path"]
    filename = os.path.basename(path)
    if os.path.splitext(filename)[0] == "package":
        key = "filesystem.variant"
    else:
        key = "filesystem.variant.combined"

    return dict(key=key, variables=variables)
1050389
def lvm_info(self, name=None):
		
		cmd = [] if self.sudo() is False else ['sudo']
		cmd.extend([self.command(), '-c'])
		if name is not None:
			cmd.append(name)

		output = subprocess.check_output(cmd, timeout=self.cmd_timeout())
		output = output.decode()
		result = []
		fields_count = self.fields_count()
		for line in output.split('\n'):
			line = line.strip()
			fields = line.split(':')
			if len(fields) == fields_count:
				result.append(fields)
		if name is not None and len(result) != 1:
			raise RuntimeError('Unable to parse command result')
		return tuple(result)
700002
def getVC(self):
        
        _Cr = decompose_GxE(self.full['Cr'])
        RV = {}
        for key in list(_Cr.keys()):
            RV['var_%s' % key] = sp.array([var_CoXX(_Cr[key], self.Xr)])
        RV['var_c'] = self.full['var_c'] 
        RV['var_n'] = self.full['var_n'] 
        return RV
935520
def _converter(data):
    
    handler = REGISTRY.get(data.__class__)
    if handler:
        full_name = '{}.{}'.format(
            data.__class__.__module__,
            data.__class__.__name__)
        return {
            '__class__': full_name,
            '__value__': handler(data),
        }
    raise TypeError(repr(data) + " is not JSON serializable")