r"""
        Throats that are uninvaded connected to pores that are both invaded
        should be invaded too.
550252
def _invade_isolated_Ts(self):
        
        """
        net = self.project.network
        Ts = net['throat.conns'].copy()
        invaded_Ps = self['pore.invasion_sequence'] > -1
        uninvaded_Ts = self['throat.invasion_sequence'] == -1
        isolated_Ts = np.logical_and(invaded_Ps[Ts[:, 0]],
                                     invaded_Ps[Ts[:, 1]])
        isolated_Ts = np.logical_and(isolated_Ts, uninvaded_Ts)
        inv_Pc = self['pore.invasion_pressure']
        inv_seq = self['pore.invasion_sequence']
        if np.any(isolated_Ts):
            max_array = Ts[:, 0]
            second_higher = inv_seq[Ts][:, 1] > inv_seq[Ts][:, 0]
            max_array[second_higher] = Ts[:, 1][second_higher]
            mPc = inv_Pc[max_array]
            mSeq = inv_seq[max_array]
            mClu = self['pore.cluster'][max_array]
            self['throat.invasion_pressure'][isolated_Ts] = mPc[isolated_Ts]
            self['throat.invasion_sequence'][isolated_Ts] = mSeq[isolated_Ts]
            self['throat.cluster'][isolated_Ts] = mClu[isolated_Ts]
515964
private Map<String, Object> filterUnexpectedKeys(Map<String, Object> inputProps) {
        Map<String, Object> outputProps = new HashMap<String, Object>();

        Set<Entry<String, Object>> entries = inputProps.entrySet();
        for (Map.Entry<String, Object> entry : entries) {
            String key = entry.getKey();
            if (EXPECTED_KEYS.contains(key)) {
                outputProps.put(key, entry.getValue());
            }
        }
        return outputProps;
    }
546599
public void popIn ()
    {
        String front = _pushed.remove(_pushed.size() - 1);
        if (front != null) {
            _imports.add(front);
        }
    }
810686
public void invalidateRegion (Rectangle rect)
    {
        if (isValidSize(rect.width, rect.height)) {
            addDirtyRegion((Rectangle)rect.clone());
        }
    }
1366272
def unsqueeze(attrs, inputs, cls):
    """"""
    # MXNet can only add one axis at a time.
    mxnet_op = inputs[0]
    for axis in attrs["axes"]:
        mxnet_op = symbol.expand_dims(mxnet_op, axis=axis)

    return mxnet_op, attrs, inputs
1058451
protected void newAttempt() {
        this.attempt++;
        this.initialPrompt.rewind();
        this.reprompt.rewind();
        this.noSpeechReprompt.rewind();
        this.successAnnouncement.rewind();
        this.failureAnnouncement.rewind();
        this.tone = ' ';
        this.speechDetected = false;
    }
407374
def transplant(self, node_u, node_v):
        
        if node_u.parent is None:
            self.root = node_v
        elif node_u is node_u.parent.left:
            node_u.parent.left = node_v
        elif node_u is node_u.parent.right:
            node_u.parent.right = node_v
        # check is node_v is None 
        if node_v:
            node_v.parent = node_u.parent
1118923
def pop(self):
        ''''''
        if self._length == 0:
            raise IndexError()
        newvec = ImmutableVector()
        newvec.tree = self.tree.remove(self._length-1)
        newvec._length = self._length-1
        return newvec
1354722
def attend_fight(self, mappings, node_ip, predictions, ntp):
        

        # Bind listen server socket.
        mappings = self.add_listen_sock(mappings)
        log.debug(mappings)

        # Walk to fight.
        self.simultaneous_cons = []
        predictions = predictions.split(" ")
        self.simultaneous_fight(mappings, node_ip, predictions, ntp)

        # Return hole made in opponent.
        if len(self.simultaneous_cons):
            """
            There may be a problem here. I noticed that when these lines
            were removed during testing that connections tended to
            succeed more. There may be a lack of synchronization between
            the timing for connections to succeed so that a close on
            one side of the fight ends up ruining valid connections on
            this side. Will need to test more.

            Notes: the UNL synchronization code could actually fix
            this (potential) problem as a cool unintended side-effect.
            """

            # Close unneeded holes.
            """
            for i in range(1, len(self.simultaneous_cons)):
                try:
                    print("Closing unneeded hole")
                    #self.simultaneous_cons[i].s.close()
                except:
                    pass
            """

            try:
                # Return open hole.
                return self.simultaneous_cons[0]
            except:
                # Try accept a connection.
                log.debug("No holes found")
                for mapping in mappings:
                    # Check if there's a new con.
                    s = mapping["listen"]
                    r, w, e = select.select(
                        [s],
                        [],
                        [],
                        0
                    )

                    # Find socket.
                    for found_sock in r:
                        # Not us.
                        if found_sock != s:
                            continue

                        # Accept a new con from the listen queue.
                        log.debug("Accept logic works!")
                        client, address = s.accept()
                        con = Sock(blocking=0)
                        con.set_sock(client)
                        return con

        return None
1339169
boolean sweepVertical(EditShape shape, double tolerance) {
		setEditShape_(shape);
		m_b_cracked = false;
		m_tolerance = tolerance;
		m_tolerance_sqr = tolerance * tolerance;
		m_complications = false;
		boolean bresult = sweepImpl_();
		if (!m_complications) {
			int filtered = shape.filterClosePoints(tolerance, true, false);
			m_complications = filtered == 1;
			bresult |= filtered == 1;
		}
		
		if (m_vertex_cluster_index != -1) {
			m_shape.removeUserIndex(m_vertex_cluster_index);
			m_vertex_cluster_index = -1;
		}
		
		m_shape = null;
		return bresult;
	}
386700
def plot_intrusion_curve(self, fig=None, inv_points=None):
        
        """
        data = self.get_intrusion_data(inv_points)
        if fig is None:
            fig = plt.figure()
        a = fig.add_subplot(111)
        a.plot(data.Pcap, data.S_pore, 'r*-', label='pore')
        a.plot(data.Pcap, data.S_throat, 'b*-', label='throat')
        a.plot(data.Pcap, data.S_tot, 'g*-', label='total')
        a.legend(bbox_to_anchor=(0, 1.02, 1, 0.102),
                 loc=3, ncol=3, borderaxespad=0)
        a.set_xlabel("Capillary Pressure [Pa]")
        a.set_ylabel("Saturation")
        a.set_ybound(lower=0.0, upper=1.0)
        return fig
507943
def tshark(*args,**kargs):
    """"""
    sniff(prn=lambda x: x.display(),*args,**kargs)
719117
void scanNewNodes(Set<AstChange> newNodes) {
    BuildGlobalNamespace builder = new BuildGlobalNamespace();

    for (AstChange info : newNodes) {
      if (!info.node.isQualifiedName() && !NodeUtil.mayBeObjectLitKey(info.node)) {
        continue;
      }
      scanFromNode(builder, info.module, info.scope, info.node);
    }
  }
593580
@SubscribeEvent(priority = EventPriority.LOWEST)
	public void onBiomeGenInit(WorldTypeEvent.InitBiomeGens event) {
		// Negative one is flag value for normal world gen
		if (bparams.getBiome() == -1)
			return;
		GenLayer[] replacement = new GenLayer[2];
		replacement[0] = new GenLayerConstant(bparams.getBiome());
		replacement[1] = replacement[0];
		event.setNewBiomeGens(replacement);
	}
103956
def Eg(self, **kwargs):
        '''
        
        '''
        return self.unstrained.Eg(**kwargs) + self.Eg_strain_shift(**kwargs)
607416
def conduit_lengths(network, throats=None, mode='pore'):
    
    """
    if throats is None:
        throats = network.throats()
    Ps = network['throat.conns']
    pdia = network['pore.diameter']

    if mode == 'centroid':
        try:
            pcentroids = network['pore.centroid']
            tcentroids = network['throat.centroid']
            if _sp.sum(_sp.isnan(pcentroids)) + _sp.sum(_sp.isnan(tcentroids)) > 0:
                mode = 'pore'
            else:
                plen1 = _sp.sqrt(_sp.sum(_sp.square(pcentroids[Ps[:, 0]] -
                                         tcentroids), 1))-network['throat.length']/2
                plen2 = _sp.sqrt(_sp.sum(_sp.square(pcentroids[Ps[:, 1]] -
                                         tcentroids), 1))-network['throat.length']/2
        except KeyError:
            mode = 'pore'
    if mode == 'pore':
        # Find half-lengths of each pore
        pcoords = network['pore.coords']
        # Find the pore-to-pore distance, minus the throat length
        lengths = _sp.sqrt(_sp.sum(_sp.square(pcoords[Ps[:, 0]] -
                                   pcoords[Ps[:, 1]]), 1)) - network['throat.length']
        lengths[lengths < 0.0] = 2e-9
        # Calculate the fraction of that distance from the first pore
        try:
            fractions = pdia[Ps[:, 0]]/(pdia[Ps[:, 0]] + pdia[Ps[:, 1]])
            # Don't allow zero lengths
#            fractions[fractions == 0.0] = 0.5
#            fractions[fractions == 1.0] = 0.5
        except:
            fractions = 0.5
        plen1 = lengths*fractions
        plen2 = lengths*(1-fractions)

    return _sp.vstack((plen1, network['throat.length'], plen2)).T[throats]
1288337
void removeEmptyRole(Grantee role) {

        for (int i = 0; i < map.size(); i++) {
            Grantee grantee = (Grantee) map.get(i);

            grantee.roles.remove(role);
        }
    }