Evaluates attempts to add location instances to arc, ensuring they are from same outline.
552022
def validate_location_instance_valid_for_arc(sender, instance, action, reverse, pk_set, *args, **kwargs):
    '''
    
    '''
    if action == 'pre_add':
        if reverse:
            # Fetch arc definition through link.
            for apk in pk_set:
                arc_node = ArcElementNode.objects.get(pk=apk)
                if arc_node.parent_outline != instance.outline:
                    raise IntegrityError(_('Location instance must be from same outline as arc element.'))
        else:
            for lpk in pk_set:
                loc_instance = LocationInstance.objects.get(pk=lpk)
                if loc_instance.outline != instance.parent_outline:
                    raise IntegrityError(_('Location Instance must be from the same outline as arc element.'))
515053
def adjust_locations(ast_node, first_lineno, first_offset):
    

    line_delta = first_lineno - 1

    def _fix(node):
        if 'lineno' in node._attributes:
            lineno = node.lineno
            col = node.col_offset

            # adjust the offset on the first line
            if lineno == 1:
                col += first_offset

            lineno += line_delta

            node.lineno = lineno
            node.col_offset = col

        for child in iter_child_nodes(node):
            _fix(child)

    _fix(ast_node)
260860
public static void checkUpdate(DatasetDescriptor existing,
                                 DatasetDescriptor updated) {
    checkNotChanged("location", existing.getLocation(), updated.getLocation());
    checkCompatible(existing, updated);
  }
1096984
public void addLines(Collection<TaintLocation> locations) {
        Objects.requireNonNull(detector, "locations");
        for (TaintLocation location : locations) {
            lines.add(SourceLineAnnotation.fromVisitedInstruction(
                location.getMethodDescriptor(), location.getPosition()));
        }
    }
1195924
function ensureExists(path, mask, cb) {
    if (typeof mask == 'function') {
        cb = mask;
        mask = 0777;
    }

    filesystem.mkdir(path, mask, function(err) {
        if (err) {
            if (err.code == 'EEXIST') cb(null);
            else cb(err);
        } else cb(null);
    });
}
217744
function(editor, syntax, profile) {
			var curPos = editor.getCaretPos();
			var newPoint = findNewEditPoint(editor, -1);
				
			if (newPoint == curPos)
				// we're still in the same point, try searching from the other place
				newPoint = findNewEditPoint(editor, -1, -2);
			
			if (newPoint != -1) {
				editor.setCaretPos(newPoint);
				return true;
			}
			
			return false;
		}
1303111
private void checkUniquePoint(final Point point) {
		final boolean isStillUnique = (uniquePoint == null || uniquePoint.equals(point));
		if (!isStillUnique) {
			isUnique = false;
		}
		if (!geoFields.isEmpty()) {
			Assert.isTrue(uniquePoint == null || uniquePoint.equals(point),
				"Different Points are used - Distance is ambiguous");
			uniquePoint = point;
		}
	}
705984
private void createNeighborhoods() {
    neighbours = new ArrayList<List<Integer>>(solutionListSize);

    for (int i = 0; i < solutionListSize; i++) {
      neighbours.add(new ArrayList<Integer>());
      neighbours.get(i).add(i);
    }
  }
443737
def add_arc(self, src, dst, char):
        
        if src not in self.automaton.states():
            self.add_state()
        arc = fst.Arc(self.isyms[char], self.osyms[char],  fst.Weight.One(self.automaton.weight_type()), dst)
        self.automaton.add_arc(src, arc)
414314
def _sanity_check_all_marked_locations_are_registered(ir_blocks, query_metadata_table):
    """"""
    # Grab all the registered locations, then make sure that:
    # - Any location that appears in a MarkLocation block is also registered.
    # - There are no registered locations that do not appear in a MarkLocation block.
    registered_locations = {
        location
        for location, _ in query_metadata_table.registered_locations
    }

    ir_encountered_locations = {
        block.location
        for block in ir_blocks
        if isinstance(block, MarkLocation)
    }

    unregistered_locations = ir_encountered_locations - registered_locations
    unencountered_locations = registered_locations - ir_encountered_locations
    if unregistered_locations:
        raise AssertionError(u'IR blocks unexpectedly contain locations not registered in the '
                             u'QueryMetadataTable: {}'.format(unregistered_locations))
    if unencountered_locations:
        raise AssertionError(u'QueryMetadataTable unexpectedly contains registered locations that '
                             u'never appear in the IR blocks: {}'.format(unencountered_locations))
99395
def _construct_location_stack_entry(location, num_traverses):
    """"""
    if not isinstance(num_traverses, int) or num_traverses < 0:
        raise AssertionError(u'Attempted to create a LocationStackEntry namedtuple with an invalid '
                             u'value for "num_traverses" {}. This is not allowed.'
                             .format(num_traverses))
    if not isinstance(location, Location):
        raise AssertionError(u'Attempted to create a LocationStackEntry namedtuple with an invalid '
                             u'value for "location" {}. This is not allowed.'
                             .format(location))
    return LocationStackEntry(location=location, num_traverses=num_traverses)
173282
function (endpoint, anchorPos) {
                                continuousAnchorLocations[endpoint.id] = [ anchorPos[0], anchorPos[1], anchorPos[2], anchorPos[3] ];
                                continuousAnchorOrientations[endpoint.id] = orientation;
                            }
886785
def _sanity_check_every_location_is_marked(ir_blocks):
    """"""
    # Exactly one MarkLocation block is found between any block that starts an interval of blocks
    # that all affect the same query position, and the first subsequent block that affects a
    # different position in the query. Such intervals include the following examples:
    # - from Fold to Unfold
    # - from QueryRoot to Traverse/Recurse
    # - from one Traverse to the next Traverse
    # - from Traverse to Backtrack
    found_start_block = False
    mark_location_blocks_count = 0

    start_interval_types = (QueryRoot, Traverse, Recurse, Fold)
    end_interval_types = (Backtrack, ConstructResult, Recurse, Traverse, Unfold)

    for block in ir_blocks:
        # Terminate started intervals before opening new ones.
        if isinstance(block, end_interval_types) and found_start_block:
            found_start_block = False
            if mark_location_blocks_count != 1:
                raise AssertionError(u'Expected 1 MarkLocation block between traversals, found: '
                                     u'{} {}'.format(mark_location_blocks_count, ir_blocks))

        # Now consider opening new intervals or processing MarkLocation blocks.
        if isinstance(block, MarkLocation):
            mark_location_blocks_count += 1
        elif isinstance(block, start_interval_types):
            found_start_block = True
            mark_location_blocks_count = 0
490293
def validate_location!(response)
      return if location.nil? || location === response.headers['Location']
      raise Exceptions::Validation.new("LOCATION does not match #{location.inspect}")
    end
838367
def verify(self):
        '''
        
        '''
        # Verify size of arcs list
        if (len(self.arcs) < 2):
            raise VennRegionException("At least two arcs needed in a poly-arc region")
        if (len(self.arcs) > 4):
            raise VennRegionException("At most 4 arcs are supported currently for poly-arc regions")
        
        TRIG_TOL = 100*tol  # We need to use looser tolerance level here because conversion to angles and back is prone to large errors.
        # Verify connectedness of arcs
        for i in range(len(self.arcs)):
            if not np.all(self.arcs[i-1].end_point() - self.arcs[i].start_point() < TRIG_TOL):
                raise VennRegionException("Arcs of an poly-arc-gon must be connected via endpoints")
        
        # Verify that arcs do not cross-intersect except at endpoints
        for i in range(len(self.arcs)-1):
            for j in range(i+1, len(self.arcs)):
                ips = self.arcs[i].intersect_arc(self.arcs[j])
                for ip in ips:
                    if not (np.all(abs(ip - self.arcs[i].start_point()) < TRIG_TOL) or np.all(abs(ip - self.arcs[i].end_point()) < TRIG_TOL)):
                        raise VennRegionException("Arcs of a poly-arc-gon may only intersect at endpoints")
                
                if len(ips) != 0 and (i - j) % len(self.arcs) > 1 and (j - i) % len(self.arcs) > 1:
                    # Two non-consecutive arcs intersect. This is in general not good, but
                    # may occasionally happen when all arcs inbetween have length 0.
                    pass # raise VennRegionException("Non-consecutive arcs of a poly-arc-gon may not intersect")
        
        # Verify that vertices are ordered so that at each point the direction along the polyarc changes towards the left.
        # Note that this test only makes sense for polyarcs obtained using circle intersections & subtractions.
        # A "flower-like" polyarc may have its vertices ordered counter-clockwise yet the direction would turn to the right at each of them.
        for i in range(len(self.arcs)):
            prev_arc = self.arcs[i-1]
            cur_arc = self.arcs[i]
            if box_product(prev_arc.direction_vector(prev_arc.to_angle), cur_arc.direction_vector(cur_arc.from_angle)) < -tol:
                raise VennRegionException("Arcs must be ordered so that the direction at each vertex changes counter-clockwise")
884109
function Arc(start, end, height) {
    this.start = start;
    this.end = end;
    this.height = height;
}
1258755
def validate_character_instance_valid_for_arc(sender, instance, action, reverse, pk_set, *args, **kwargs):
    '''
    
    '''
    if action == 'pre_add':
        if reverse:
            # Fetch arc definition through link.
            for apk in pk_set:
                arc_node = ArcElementNode.objects.get(pk=apk)
                if arc_node.parent_outline != instance.outline:
                    raise IntegrityError(_('Character Instance and Arc Element must be from same outline.'))
        else:
            for cpk in pk_set:
                char_instance = CharacterInstance.objects.get(pk=cpk)
                if char_instance.outline != instance.parent_outline:
                    raise IntegrityError(_('Character Instance and Arc Element must be from the same outline.'))