Helper to call the virt functions. Wildcards supported.

    :param domain:
    :param function:
    :param section:
    :param comment:
    :return:
517728
def _virt_call(domain, function, section, comment,
               connection=None, username=None, password=None, **kwargs):
    '''
    
    '''
    ret = {'name': domain, 'changes': {}, 'result': True, 'comment': ''}
    targeted_domains = fnmatch.filter(__salt__['virt.list_domains'](), domain)
    changed_domains = list()
    ignored_domains = list()
    for targeted_domain in targeted_domains:
        try:
            response = __salt__['virt.{0}'.format(function)](targeted_domain,
                                                             connection=connection,
                                                             username=username,
                                                             password=password,
                                                             **kwargs)
            if isinstance(response, dict):
                response = response['name']
            changed_domains.append({'domain': targeted_domain, function: response})
        except libvirt.libvirtError as err:
            ignored_domains.append({'domain': targeted_domain, 'issue': six.text_type(err)})
    if not changed_domains:
        ret['result'] = False
        ret['comment'] = 'No changes had happened'
        if ignored_domains:
            ret['changes'] = {'ignored': ignored_domains}
    else:
        ret['changes'] = {section: changed_domains}
        ret['comment'] = comment

    return ret
822254
def domain(word)
      check_params(word)

      arg1 = ['Wort', word]
      answer = query(@cl_Sachgebiet, arg1)

      get_answer(answer)
    end
512418
function Comment() {
    this.type = 'func'; //func or attr

    this.descs = [];
    this.attr = {
        name: null
    };
    this.func = {
        name: null,
        params: null
    };

    this.clazz = null; //class
    this.zuper = null; //super
    this.tags = {
        /*
        name:[val1,val2]
    */
    };
}
863090
def view(self, function_name, extension_name):
        
        if isinstance(self.Access_Control_Allow_Origin, dict):
            d = {
                "Access-Control-Allow-Origin": self.Access_Control_Allow_Origin[function_name],
                "Access-Control-Allow-Methods": self.Access_Control_Allow_Methods[function_name]
            }
        else:
            d = {
                "Access-Control-Allow-Origin": self.Access_Control_Allow_Origin,
                "Access-Control-Allow-Methods": self.Access_Control_Allow_Methods[function_name]
            }

        def r(*x, **y):
            val = getattr(self._extensions[extension_name], function_name)(*x, **y)
            if isinstance(val, Response):
                val.headers.extend(d)
                return val
            else:
                val = list(val)
                val[2].update(d)
                return tuple(val)
        return r
250487
def del_cached_domain(domains):
    '''
    
    '''
    cache = salt.cache.Cache(__opts__, syspaths.CACHE_DIR)
    if isinstance(domains, six.string_types):
        domains = domains.split(',')
    if not isinstance(domains, list):
        raise CommandExecutionError(
            'You must pass in either a string containing one or more domains '
            'separated by commas, or a list of single domain strings'
        )
    success = []
    failed = []
    for domain in domains:
        try:
            cache.flush('venafi/domains', domain)
            success.append(domain)
        except CommandExecutionError:
            failed.append(domain)
    return {'Succeeded': success, 'Failed': failed}
871867
def _apply_section(self, section, hosts):
        
        # Add the current group name to each host that this section covers.
        if section['name'] is not None:
            for hostname in self._group_get_hostnames(section['name']):
                hosts[hostname]['groups'].add(section['name'])

        # Apply variables
        func_map = {
            "hosts": self._apply_section_hosts,
            "children": self._apply_section_children,
            "vars": self._apply_section_vars,
        }
        func = func_map[section['type']]
        func(section, hosts)
869007
function(details, callback) {
        this.createDomains([ details ], function(err, domains) {
            if (err) {
                callback(err);
                return;
            }

            if (domains && domains.length === 1) {
                callback(err, domains[0]);
            }
            else {
                callback({ unknownError: true }, domains);
            }
        });
    }
1202561
def component_password(domain)
      host = @vhosts.values.find {|host| host.component?(domain) }
      host.password(domain) if host
    end
619099
def list_subdomains(self, domain, limit=None, offset=None):
        
        # The commented-out uri is the official API, but it is
        # horribly slow.
#        uri = "/domains/%s/subdomains" % utils.get_id(domain)
        uri = "/domains?name=%s" % domain.name
        page_qs = self._get_pagination_qs(limit, offset)
        if page_qs:
            uri = "%s&%s" % (uri, page_qs[1:])
        return self._list_subdomains(uri, domain.id)
526575
def domain_delete(domain, logger):
    
    if domain is not None:
        try:
            if domain.isActive():
                domain.destroy()
        except libvirt.libvirtError:
            logger.exception("Unable to destroy the domain.")
        try:
            domain.undefine()
        except libvirt.libvirtError:
            try:
                domain.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA)  # domain with snapshots
            except libvirt.libvirtError:
                logger.exception("Unable to undefine the domain.")
1363948
def add_section(self, section):
        

        if not issubclass(section.__class__, SubSection):
            raise TypeError("Argument should be a subclass of SubSection, \
                             not :" + str(section.__class__))
        self.sections[section.name] = section
        return section
546907
def format_ft_def(func, full_name:str=None)->str:
    ""
    sig = inspect.signature(func)
    name = f'<code>{full_name or func.__name__}</code>'
    fmt_params = [format_param(param) for name,param
                  in sig.parameters.items() if name not in ('self','cls')]
    arg_str = f"({', '.join(fmt_params)})"
    if sig.return_annotation and (sig.return_annotation != sig.empty): arg_str += f" → {anno_repr(sig.return_annotation)}"
    if is_fastai_class(type(func)):        arg_str += f" :: {link_type(type(func))}"
    f_name = f"<code>class</code> {name}" if inspect.isclass(func) else name
    return f'{f_name}',f'{name}{arg_str}'
732530
def _find_function(name,
                   region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    for funcs in __utils__['boto3.paged_call'](conn.list_functions):
        for func in funcs['Functions']:
            if func['FunctionName'] == name:
                return func
    return None
725024
def function_call(self, function, arguments):
        
        #push each argument to stack
        for arg in arguments:
            self.push(self.symbol(arg))
            self.free_if_register(arg)
        self.newline_text("CALL\t"+self.symtab.get_name(function), True)
        args = self.symtab.get_attribute(function)
        #generates stack cleanup if function has arguments
        if args > 0:
            args_space = self.symtab.insert_constant("{0}".format(args * 4), SharedData.TYPES.UNSIGNED)
            self.arithmetic("+", "%15", args_space, "%15")
760004
function(domains, callback) {
        var self = this;

        var listOfDomains = [];
        _.each(domains, function(domain) {
            ['name', 'emailAddress'].forEach(function(required) {
                if (!domain[required]) throw new Error('details.' +
                    required + ' is a required argument.');
            });

            var newDomain = {
                name: domain.name,
                emailAddress: domain.emailAddress
            };

            if (domain.ttl && typeof(domain.ttl) === 'number' && domain.ttl >= 300) {
                newDomain.ttl = domain.ttl;
            }

            if (domain.comment) {
                newDomain.comment = domain.comment;
            }

            listOfDomains.push(newDomain);
        });


        var requestOptions = {
            uri: '/domains',
            method: 'POST',
            data: {
                domains: listOfDomains
            },
            endpoint: rackspace.Endpoints.CloudDns
        };

        self.authorizedRequest(requestOptions, function(err, res, body) {
            if (err || res.statusCode !== 202) {
                callback(err ? err : body);
                return;
            }

            callback(err, new rackspace.Status(self, body));
        });
    }
1107084
def vm_virt_type(domain):
    '''
    
    '''
    ret = __salt__['vmadm.lookup'](search="uuid={uuid}".format(uuid=domain), order='type')
    if not ret:
        raise CommandExecutionError("We can't determine the type of this VM")

    return ret[0]['type']
532145
def domain_block(self, domain=None):
        
        params = self.__generate_params(locals())
        self.__api_request('POST', '/api/v1/domain_blocks', params)