set mesh local prefix
339404
def setMLPrefix(self, sMeshLocalPrefix):
        """"""
        print '%s call setMLPrefix' % self.port
        try:
            cmd = 'dataset meshlocalprefix %s' % sMeshLocalPrefix
            self.hasActiveDatasetToCommit = True
            return self.__sendCommand(cmd)[0] == 'Done'
        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger("setMLPrefix() Error: " + str(e))
1046409
def add_prefix(arg, opts, shell_opts):
    

    # sanity checks
    if 'from-pool' not in opts and 'from-prefix' not in opts and 'prefix' not in opts:
        print("ERROR: 'prefix', 'from-pool' or 'from-prefix' must be specified.", file=sys.stderr)
        sys.exit(1)

    if len([opt for opt in opts if opt in ['from-pool', 'from-prefix', 'prefix']]) > 1:
        print("ERROR: Use either assignment 'from-pool', 'from-prefix' or manual mode (using 'prefix')", file=sys.stderr)
        sys.exit(1)

    if 'from-pool' in opts:
        return add_prefix_from_pool(arg, opts)

    args = {}
    p = _prefix_from_opts(opts)
    p.vrf = get_vrf(opts.get('vrf_rt'), abort=True)

    for avp in opts.get('extra-attribute', []):
        try:
            key, value = avp.split('=', 1)
        except ValueError:
            print("ERROR: Incorrect extra-attribute: %s. Accepted form: 'key=value'\n" % avp, file=sys.stderr)
            return
        p.avps[key] = value

    if 'from-prefix' in opts:
        args['from-prefix'] = [ opts['from-prefix'], ]

    if 'prefix_length' in opts:
        args['prefix_length'] = int(opts['prefix_length'])

    if 'family' in opts:
        if opts['family'] == 'ipv4':
            family = 4
        elif opts['family'] == 'ipv6':
            family = 6
        elif opts['family'] == 'dual-stack':
            print("ERROR: dual-stack mode only valid for from-pool assignments", file=sys.stderr)
            sys.exit(1)

        args['family'] = family

    # try to automatically figure out type for new prefix when not
    # allocating from a pool

    # get a list of prefixes that contain this prefix
    vrf_id = 0
    if p.vrf:
        vrf_id = p.vrf.id

    if 'from-prefix' in args:
        parent_prefix = args['from-prefix'][0]
        parent_op = 'equals'
    else:
        # If no prefix length is specified it is assumed to be a host and we do
        # a search for prefixes that contains the specified prefix. The last
        # entry will be the parent of the new prefix and we can look at it to
        # determine type.
        # If prefix length is specified (i.e. CIDR format) we check if prefix
        # length equals max length in which case we assume a host prefix,
        # otherwise we search for the network using an equal match and by
        # zeroing out bits in the host part.
        if len(opts.get('prefix').split("/")) == 2:
            ip = IPy.IP(opts.get('prefix').split("/")[0])
            plen = int(opts.get('prefix').split("/")[1])
            if ip.version() == 4 and plen == 32 or ip.version() == 6 and plen == 128:
                parent_prefix = str(ip)
                parent_op = 'contains'
            else:
                parent_prefix = str(IPy.IP(opts.get('prefix'), make_net=True))
                parent_op = 'equals'
        else:
            parent_prefix = opts.get('prefix')
            parent_op = 'contains'

    auto_type_query = {
            'val1': {
                'val1'      : 'prefix',
                'operator'  : parent_op,
                'val2'      : parent_prefix
                },
            'operator': 'and',
            'val2': {
                'val1'      : 'vrf_id',
                'operator'  : 'equals',
                'val2'      : vrf_id
                }
        }
    res = Prefix.search(auto_type_query, { })

    # no results, ie the requested prefix is a top level prefix
    if len(res['result']) == 0:
        if p.type is None:
            print("ERROR: Type of prefix must be specified ('assignment' or 'reservation').", file=sys.stderr)
            sys.exit(1)
    else:
        # last prefix in list will be the parent of the new prefix
        parent = res['result'][-1]

        # if the parent is an assignment, we can assume the new prefix to be
        # a host and act accordingly
        if parent.type == 'assignment':
            # automatically set type
            if p.type is None:
                print("WARNING: Parent prefix is of type 'assignment'. Automatically setting type 'host' for new prefix.", file=sys.stderr)
            elif p.type == 'host':
                pass
            else:
                print("WARNING: Parent prefix is of type 'assignment'. Automatically overriding specified type '%s' with type 'host' for new prefix." % p.type, file=sys.stderr)
            p.type = 'host'

            # if it's a manually specified prefix
            if 'prefix' in opts:
                # fiddle prefix length to all bits set
                if parent.family == 4:
                    p.prefix = p.prefix.split('/')[0] + '/32'
                else:
                    p.prefix = p.prefix.split('/')[0] + '/128'

            # for from-prefix, we set prefix_length to host length
            elif 'from-prefix' in opts:
                if parent.family == 4:
                    args['prefix_length'] = 32
                else:
                    args['prefix_length'] = 128

    try:
        p.save(args)
    except NipapError as exc:
        print("Could not add prefix to NIPAP: %s" % str(exc), file=sys.stderr)
        sys.exit(1)

    if p.type == 'host':
        print("Host %s added to %s: %s" % (p.display_prefix,
                vrf_format(p.vrf), p.node or p.description))
    else:
        print("Network %s added to %s: %s" % (p.display_prefix,
                vrf_format(p.vrf), p.description))

    if opts.get('add-hosts') is not None:
        if p.type != 'assignment':
            print("ERROR: Not possible to add hosts to non-assignment", file=sys.stderr)
            sys.exit(1)

        for host in opts.get('add-hosts').split(','):
            h_opts = {
                    'from-prefix': p.prefix,
                    'vrf_rt': p.vrf.rt,
                    'type': 'host',
                    'node': host
                    }
            add_prefix({}, h_opts, {})
716386
def add_prefix(self, name, stmt):
        
        if self.gg_level: return name
        pref, colon, local = name.partition(":")
        if colon:
            return (self.module_prefixes[stmt.i_module.i_prefixes[pref][0]]
                    + ":" + local)
        else:
            return self.prefix_stack[-1] + ":" + pref
424619
def prefix_iter(self, ns_uri):
        """"""
        ni = self.__lookup_uri(ns_uri)
        return iter(ni.prefixes)
383581
public void setMeSHList(FSArray v) {
    if (ManualDescriptor_Type.featOkTst && ((ManualDescriptor_Type)jcasType).casFeat_meSHList == null)
      jcasType.jcas.throwFeatMissing("meSHList", "de.julielab.jules.types.pubmed.ManualDescriptor");
    jcasType.ll_cas.ll_setRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_meSHList, jcasType.ll_cas.ll_getFSRef(v));}
1359998
def prefix(cls, name):
        
        attrs = dict([(name + attr, value) for attr, value in cls.get_attrs()])
        return TreeModelMeta(
            '_'.join([name, cls.__name__]),
            (TreeModel,), attrs)
1338046
public void clearLocalPrefixes() {
		final Map<Integer, PrefixConfig> prefixConfigs = getPrefixConfigs();
		for (final PrefixConfig config : prefixConfigs.values()) {
			config.setPrefix(null);
		}
	}
912069
def _make_local_block(x, depth, batch, heads, num_blocks, block_length):
  """"""
  prev_block = tf.slice(x, [0, 0, 0, 0, 0],
                        [-1, -1, num_blocks - 1, -1, -1])
  cur_block = tf.slice(x, [0, 0, 1, 0, 0], [-1, -1, -1, -1, -1])
  local_block = tf.concat([prev_block, cur_block], 3)
  return tf.reshape(local_block,
                    [batch, heads, num_blocks - 1, block_length * 2, depth])
1129945
def update_prompt(self):
        
        prefix = ""
        if self._local_endpoint is not None:
            prefix += "(%s:%d) " % self._local_endpoint
        prefix += self.engine.region
        if self.engine.partial:
            self.prompt = len(prefix) * " " + "> "
        else:
            self.prompt = prefix + "> "
781339
private FPTree getLocalFPTree(FPTree.Node node, int[] localItemSupport, int[] prefixItemset) {
        FPTree tree = new FPTree(localItemSupport, minSupport);

        while (node != null) {
            Node parent = node.parent;
            int i = prefixItemset.length;
            while (parent != null) {
                if (localItemSupport[parent.id] >= minSupport) {
                    prefixItemset[--i] = parent.id;
                }
                parent = parent.parent;
            }
            if (i < prefixItemset.length) {
                tree.add(i, prefixItemset.length, prefixItemset, node.count);
            }

            node = node.next;
        }

        return tree;
    }
996866
def set_neighbor_data(self, elev_fn, dem_proc, interp=None):
        
        if interp is None:
            interp = self.build_interpolator(dem_proc)
        opp = {'top': 'bottom', 'left': 'right'}
        for key in self.neighbors[elev_fn].keys():
            tile = self.neighbors[elev_fn][key]
            if tile == '':
                continue
            oppkey = key
            for me, neigh in opp.iteritems():
                if me in key:
                    oppkey = oppkey.replace(me, neigh)
                else:
                    oppkey = oppkey.replace(neigh, me)
            opp_edge = self.neighbors[tile][oppkey]
            if opp_edge == '':
                continue

            interp.values = dem_proc.uca[::-1, :]
#            interp.values[:, 0] = np.ravel(dem_proc.uca)  # for other interp.
            # for the top-left tile we have to set the bottom and right edges
            # of that tile, so two edges for those tiles
            for key_ed in oppkey.split('-'):
                self.edges[tile][key_ed].set_data('data', interp)

            interp.values = dem_proc.edge_done[::-1, :].astype(float)
#            interp.values[:, 0] = np.ravel(dem_proc.edge_done)
            for key_ed in oppkey.split('-'):
                self.edges[tile][key_ed].set_data('done', interp)
765039
public void setMesh(GVRMesh mesh) {
        mMesh = mesh;
        NativeMeshCollider.setMesh(getNative(), mesh.getNative());
    }
210197
def apply_namespace(qname, apply_prefix, apply_uri)
      local_part, prefix, uri = qname
      
      if !prefix
        prefix = apply_prefix
        uri = apply_uri
      end

      [local_part, prefix, uri].compact
    end
975152
private void buildExternalLink(MeshData tile, Poly node, MeshData neighbourTile) {
		if (neighbourTile.header.bmin[0] > tile.header.bmin[0]) {
			node.neis[PolyUtils.findEdge(node, tile, neighbourTile.header.bmin[0], 0)] = NavMesh.DT_EXT_LINK;
		} else if (neighbourTile.header.bmin[0] < tile.header.bmin[0]) {
			node.neis[PolyUtils.findEdge(node, tile, tile.header.bmin[0], 0)] = NavMesh.DT_EXT_LINK | 4;
		} else if (neighbourTile.header.bmin[2] > tile.header.bmin[2]) {
			node.neis[PolyUtils.findEdge(node, tile, neighbourTile.header.bmin[2], 2)] = NavMesh.DT_EXT_LINK | 2;
		} else {
			node.neis[PolyUtils.findEdge(node, tile, tile.header.bmin[2], 2)] = NavMesh.DT_EXT_LINK | 6;
		}
	}
1246486
def set_prefix(self, prefix=None):
        
        if prefix is None:
            self._pfx = None
        else:
            self._pfx = prefix + self.SEP
70865
def _init_filled_edges(self, renderer, properties, edge_mapping):
        ""
        glyph_model = Patches if self.filled else Bezier
        allowed_properties = glyph_model.properties()
        for glyph_type in ('', 'selection_', 'nonselection_', 'hover_', 'muted_'):
            glyph = getattr(renderer.edge_renderer, glyph_type+'glyph', None)
            if glyph is None:
                continue
            group_properties = dict(properties)
            props = self._process_properties(self.edge_glyph, group_properties, {})
            filtered = self._filter_properties(props, glyph_type, allowed_properties)
            new_glyph = glyph_model(**dict(filtered, **edge_mapping))
            setattr(renderer.edge_renderer, glyph_type+'glyph', new_glyph)
1033922
def merge_mesh( x1, ngroups1, conns1, x2, ngroups2, conns2, cmap, eps = 1e-8 ):
    """"""
    n1 = x1.shape[0]
    n2 = x2.shape[0]

    err = nm.sum( nm.sum( nm.abs( x1[cmap[:,0],:-1] - x2[cmap[:,1],:-1] ) ) )
    if abs( err ) > (10.0 * eps):
        print 'nonmatching meshes!', err
        raise ValueError

    mask = nm.ones( (n2,), dtype = nm.int32 )
    mask[cmap[:,1]] = 0
#    print mask, nm.cumsum( mask )
    remap = nm.cumsum( mask ) + n1 - 1
    remap[cmap[:,1]] = cmap[:,0]
#    print remap

    i2 = nm.setdiff1d( nm.arange(  n2, dtype = nm.int32 ),
                       cmap[:,1] )
    xx = nm.r_[x1, x2[i2]]
    ngroups = nm.r_[ngroups1, ngroups2[i2]]

    conns = []
    for ii in xrange( len( conns1 ) ):
        conn = nm.vstack( (conns1[ii], remap[conns2[ii]]) )
        conns.append( conn )
    
    return xx, ngroups, conns