Define one resource attribute from one network as being the same as
        that from another network.
967231
def delete_attribute_mapping(resource_attr_a, resource_attr_b, **kwargs):
    
    user_id = kwargs.get('user_id')

    rm = aliased(ResourceAttrMap, name='rm')

    log.info("Trying to delete attribute map. %s -> %s", resource_attr_a, resource_attr_b)
    mapping = db.DBSession.query(rm).filter(
                             rm.resource_attr_id_a == resource_attr_a,
                             rm.resource_attr_id_b == resource_attr_b).first()

    if mapping is not None:
        log.info("Deleting attribute map. %s -> %s", resource_attr_a, resource_attr_b)
        db.DBSession.delete(mapping)
        db.DBSession.flush()

    return 'OK'
1042998
def clone(self, name=None):
        
        resp = self._router.post_env_clone(env_id=self.environmentId, json=dict(name=name) if name else {}).json()
        return Environment(self.organization, id=resp['id']).init_router(self._router)
269397
def _nics_equal(nic1, nic2):
    '''
    
    '''

    def _filter_nic(nic):
        '''
        Filter out elements to ignore when comparing nics
        '''
        return {
            'type': nic.attrib['type'],
            'source': nic.find('source').attrib[nic.attrib['type']] if nic.find('source') is not None else None,
            'mac': nic.find('mac').attrib['address'].lower() if nic.find('mac') is not None else None,
            'model': nic.find('model').attrib['type'] if nic.find('model') is not None else None,
        }
    return _filter_nic(nic1) == _filter_nic(nic2)
299869
def ids_sharing_same_pgn(id_x, pgn_x, id_y, pgn_y):
    # type: (typing.Sequence[canmatrix.ArbitrationId], typing.Sequence[int], typing.Sequence[canmatrix.ArbitrationId], typing.Sequence[int]) -> typing.Iterable[typing.Tuple[canmatrix.ArbitrationId, canmatrix.ArbitrationId]]
    """"""
    for id_a, pgn_a in zip(id_x, pgn_x):
        for id_b, pgn_b in zip(id_y, pgn_y):
            if pgn_a == pgn_b:
                yield (id_a, id_b)
437771
public static boolean sameSubject(SubjectNode s1, String s2) {
        if (s1 instanceof URIReference) {
            return sameResource((URIReference) s1, s2);
        } else {
            return false;
        }
    }
923066
def identical(self, other):
        
        try:
            return (self.name == other.name and
                    self._all_compat(other, 'identical'))
        except (TypeError, AttributeError):
            return False
1272044
def equivalent(self, other):
        """"""
        f = Xor(self, self.box(other))
        return f.satisfy_one() is None
10272
private static ImmutableSet<RelationID> attributeOccurrencesUnion(QuotedID id,
                                                                      RAExpressionAttributes re1,
                                                                      RAExpressionAttributes re2) {

        ImmutableSet<RelationID> s1 = re1.attributeOccurrences.get(id);
        ImmutableSet<RelationID> s2 = re2.attributeOccurrences.get(id);

        if (s1 == null)
            return s2;

        if (s2 == null)
            return s1;

        return ImmutableSet.<RelationID>builder().addAll(s1).addAll(s2).build();
    }
615432
def copy_from(self, other):
        
        # Need to copy all attributes, fields, relations
        self.__attributes__ = {k: v.copy() for k, v in other.__attributes__.items()}
        self.__fields__ = {k: v.copy() for k, v in other.__fields__.items()}
        self.__relations__ = {k: v.copy() for k, v in other.__relations__.items()}
        self.maps = {k: m.copy() for k, m in other.maps.items()}
        self.dimensions = other.dimensions.copy()
241070
def _init_network(self):
        """"""
        self.network = Network(self.problem.layers)
        self.weights = Matrices(self.network.shapes)
        if self.load:
            loaded = np.load(self.load)
            assert loaded.shape == self.weights.shape, (
                'weights to load must match problem definition')
            self.weights.flat = loaded
        else:
            self.weights.flat = np.random.normal(
                self.problem.weight_mean, self.problem.weight_scale,
                len(self.weights.flat))
1145489
def resource_from_params(type, *resources)
      res = resources.clone

      options = res.extract_options!
      r = res.first

      type == :resource ? ActionDispatch::Routing::Mapper::SingletonResource.new(r, options.dup) : ActionDispatch::Routing::Mapper::Resource.new(r, options.dup)
    end
143310
def common_wire_version(self):
        """"""
        servers = self.known_servers
        if servers:
            return min(s.max_wire_version for s in self.known_servers)

        return None
1296439
def copy(self):
        
        _conns = self._conns
        self._conns = {}
        c = copy.deepcopy(self)
        self._conns = _conns
        return c
14662
def same_origin(url1, url2):
    ''' 
    '''
    p1, p2 = urlparse(url1), urlparse(url2)
    try:
        o1 = (p1.scheme, p1.hostname, p1.port or PROTOCOL_TO_PORT[p1.scheme])
        o2 = (p2.scheme, p2.hostname, p2.port or PROTOCOL_TO_PORT[p2.scheme])
        return o1 == o2
    except (ValueError, KeyError):
        return False
359837
def get_network_mappings(network_id, network_2_id=None, **kwargs):
    
    qry = db.DBSession.query(ResourceAttrMap).filter(
        or_(
            and_(
                ResourceAttrMap.resource_attr_id_a == ResourceAttr.id,
                ResourceAttr.network_id == network_id),
            and_(
                ResourceAttrMap.resource_attr_id_b == ResourceAttr.id,
                ResourceAttr.network_id == network_id)))

    if network_2_id is not None:
        aliased_ra = aliased(ResourceAttr, name="ra2")
        qry = qry.filter(or_(
            and_(
                ResourceAttrMap.resource_attr_id_a == aliased_ra.id,
                aliased_ra.network_id == network_2_id),
            and_(
                ResourceAttrMap.resource_attr_id_b == aliased_ra.id,
                aliased_ra.network_id == network_2_id)))

    return qry.all()
1068620
def resource(self, *resources):
        
        resources = tuple(self.resources) + resources
        return Resource(self.client, resources)
1106268
def sameState (s1, s2):
    
    if (len(s1[1]) != len(s2[1])) or (s1[2] != s2[2]):
        return False
    for arcIndex in range(0, len(s1[1])):
        arc1 = s1[1][arcIndex]
        arc2 = s2[1][arcIndex]
        if arc1[:-1] != arc2[:-1]:
            return False
    return True