Set some configurations for extra ports template interpolation
511261
function(callback) {
        var step = 0

        async.whilst(
          function() {
            return ++step <= pp.options.extra
          },
          function(callback) {
            pp.tryPorts = []
            var c = grunt.config.get('port-pick-' + step)

            // With multiple tasks, do not find a port that we've already found
            // in a previous task
            if(c) {
              callback()
              return
            }

            async.waterfall([
              pp.findPort,

              function(selectedPort, callback) {
                if(selectedPort === false)
                  grunt.fatal('No available port was found')

                grunt.config.set('port-pick-' + this.step, selectedPort)
                grunt.log.writeln( '>> '.green + 'port-pick-' + this.step + '=' +
                  selectedPort)

                callback()
              }.bind({step: step})
            ],
            function(err) {
              callback()
            })
          },
          function(err) {
            done()
          }
        )
      }
70365
public static void config(String host, String personal, String from, String key, int port) {
        config(host, personal, from, key);
        setPort(port);
    }
492152
def addPort(n: LNode, intf: Interface):
    
    d = PortTypeFromDir(intf._direction)
    ext_p = LayoutExternalPort(
        n, name=intf._name, direction=d, node2lnode=n._node2lnode)
    ext_p.originObj = originObjOfPort(intf)
    n.children.append(ext_p)
    addPortToLNode(ext_p, intf, reverseDirection=True)
    return ext_p
236744
def enhance(self):
        
        self.update({'os_default_templates':
                     SubDict(self.api, self.objName,
                             self.payloadObj, self.key,
                             SubItemOsDefaultTemplate)})
        self.update({'config_templates':
                     SubDict(self.api, self.objName,
                             self.payloadObj, self.key,
                             SubItemConfigTemplate)})
        self.update({'ptables':
                     SubDict(self.api, self.objName,
                             self.payloadObj, self.key,
                             SubItemPTable)})
        self.update({'media':
                     SubDict(self.api, self.objName,
                             self.payloadObj, self.key,
                             SubItemMedia)})
        self.update({'architectures':
                     SubDict(self.api, self.objName,
                             self.payloadObj, self.key,
                             SubItemArchitecture)})
325818
def configure(name, host, port, auth, current):
    '''
    
    '''
    Config = ConfigParser.ConfigParser()
    if not os.path.exists(os.path.dirname(filename)):
        try:
            os.makedirs(os.path.dirname(filename))
        except Exception as e:
            click.echo(e)
            return
    section_name = None
    if(current.lower() == 'y'):
        section_name = 'Current'
        change_current()
    else:
        section_name = name.capitalize()
    cfgfile = open(filename,'a')
    Config.add_section(section_name)
    Config.set(section_name,'host',host)
    Config.set(section_name,'port',port)
    Config.set(section_name,'auth',auth)
    Config.set(section_name,'name',name.capitalize())
    Config.write(cfgfile)
    cfgfile.close()
58407
def _set_config(c):
    """"""
    func = sdl2.SDL_GL_SetAttribute
    func(sdl2.SDL_GL_RED_SIZE, c['red_size'])
    func(sdl2.SDL_GL_GREEN_SIZE, c['green_size'])
    func(sdl2.SDL_GL_BLUE_SIZE, c['blue_size'])
    func(sdl2.SDL_GL_ALPHA_SIZE, c['alpha_size'])
    func(sdl2.SDL_GL_DEPTH_SIZE, c['depth_size'])
    func(sdl2.SDL_GL_STENCIL_SIZE, c['stencil_size'])
    func(sdl2.SDL_GL_DOUBLEBUFFER, 1 if c['double_buffer'] else 0)
    samps = c['samples']
    func(sdl2.SDL_GL_MULTISAMPLEBUFFERS, 1 if samps > 0 else 0)
    func(sdl2.SDL_GL_MULTISAMPLESAMPLES, samps if samps > 0 else 0)
    func(sdl2.SDL_GL_STEREO, c['stereo'])
526700
def set_port_info(self, webport, mediaport, httpsport,
                                      onvifport, callback=None):
        '''
        
        '''
        params = {'webPort'   : webport,
                  'mediaPort' : mediaport,
                  'httpsPort' : httpsport,
                  'onvifPort' : onvifport,
                 }
        return self.execute_command('setPortInfo', params, callback=callback)
450412
def _apply_dvportgroup_out_shaping(pg_name, out_shaping, out_shaping_conf):
    '''
    
    '''
    log.trace('Building portgroup\'s \'%s\' out shaping policy', pg_name)
    if out_shaping_conf.get('average_bandwidth'):
        out_shaping.averageBandwidth = vim.LongPolicy()
        out_shaping.averageBandwidth.value = \
                out_shaping_conf['average_bandwidth']
    if out_shaping_conf.get('burst_size'):
        out_shaping.burstSize = vim.LongPolicy()
        out_shaping.burstSize.value = out_shaping_conf['burst_size']
    if 'enabled' in out_shaping_conf:
        out_shaping.enabled = vim.BoolPolicy()
        out_shaping.enabled.value = out_shaping_conf['enabled']
    if out_shaping_conf.get('peak_bandwidth'):
        out_shaping.peakBandwidth = vim.LongPolicy()
        out_shaping.peakBandwidth.value = out_shaping_conf['peak_bandwidth']
664096
def _configure_port_binding(self, is_provider_vlan, duplicate_type,
                                is_native,
                                switch_ip, vlan_id,
                                intf_type, nexus_port, vni):
        """"""

        # This implies VLAN, VNI, and Port are all duplicate.
        # Then there is nothing to configure in Nexus.
        if duplicate_type == const.DUPLICATE_PORT:
            return

        auto_create, auto_trunk = self._gather_config_parms(
            is_provider_vlan, vlan_id)

        # if type DUPLICATE_VLAN, don't create vlan
        if duplicate_type == const.DUPLICATE_VLAN:
            auto_create = False

        if auto_create and auto_trunk:
            LOG.debug("Nexus: create vlan %s and add to interface", vlan_id)
            self.driver.create_and_trunk_vlan(
                switch_ip, vlan_id, intf_type,
                nexus_port, vni, is_native)
        elif auto_create:
            LOG.debug("Nexus: create vlan %s", vlan_id)
            self.driver.create_vlan(switch_ip, vlan_id, vni)
        elif auto_trunk:
            LOG.debug("Nexus: trunk vlan %s", vlan_id)
            self.driver.send_enable_vlan_on_trunk_int(
                switch_ip, vlan_id,
                intf_type, nexus_port, is_native)
1363882
function loadConfigAndGenerateSite(useServer, port) {
  var config = loadConfig();
  if (port) config.port = port;
  generateSite(config, useServer);
}
4859
function compile(tmpl, conf) {
  const c = Object.assign(
    {},
    settings,
    conf,
  );

  const template = new LayoutTemplate({
    conf: c,
    tmpl,
  });

  return bracket.compile(
    template.compile(),
    template.conf,
  );
}
31856
def custom_conf(self, conf):
        ''''''
        if conf:
            for (key, val) in conf.items():
                self.__conf[key] = val
        return self
9062
private Ports getPortBindings(String portSpecs, ExposedPort[] exposedPorts, TestContext context) {
        String[] ports = StringUtils.commaDelimitedListToStringArray(portSpecs);
        Ports portsBindings = new Ports();

        for (String portSpec : ports) {
            String[] binding = context.replaceDynamicContentInString(portSpec).split(":");
            if (binding.length == 2) {
                Integer hostPort = Integer.valueOf(binding[0]);
                Integer port = Integer.valueOf(binding[1]);

                portsBindings.bind(Stream.of(exposedPorts).filter(exposed -> port.equals(exposed.getPort())).findAny().orElse(ExposedPort.tcp(port)), Ports.Binding.bindPort(hostPort));
            }
        }

        Stream.of(exposedPorts).filter(exposed -> !portsBindings.getBindings().keySet().contains(exposed)).forEach(exposed -> portsBindings.bind(exposed, Ports.Binding.empty()));

        return portsBindings;
    }
209388
def configure(self, address):
        """"""
        global nanoconfig_started
        if len(self._endpoints):
            raise ValueError("Nanoconfig address must be sole endpoint")
        endpoint_id = _nn_check_positive_rtn(
            wrapper.nc_configure(self.fd, address)
        )
        if not nanoconfig_started:
            nanoconfig_started = True
        ep = Socket.NanoconfigEndpoint(self, endpoint_id, address)
        self._endpoints.append(ep)
        return ep
444526
function splitHostPort(hostport) {

   let host = hostport;
   let port = 80;
   const parts = hostport.split(':');
   if (parts.length > 1) {
      host = parts[0];
      port = parts[1];
   }

   return {'host': host, 'port': port};
}
1016117
def set(conf):
        """"""
        for name, value in conf.items():
            if value is not None:
                setattr(Conf, name.upper(), value)
919234
def _interpolated_template(self, templateid):
        """"""
        phase, y = self._get_template_by_id(templateid)

        # double-check that phase ranges from 0 to 1
        assert phase.min() >= 0
        assert phase.max() <= 1

        # at the start and end points, we need to add ~5 points to make sure
        # the spline & derivatives wrap appropriately
        phase = np.concatenate([phase[-5:] - 1, phase, phase[:5] + 1])
        y = np.concatenate([y[-5:], y, y[:5]])

        # Univariate spline allows for derivatives; use this!
        return UnivariateSpline(phase, y, s=0, k=5)