Gets the human friendly location of where the violation was raised.
420259
public static String getMessage(ConstraintViolation<?> v, Invocable invocable) {
        final Pair<Path, ? extends ConstraintDescriptor<?>> of =
                Pair.of(v.getPropertyPath(), v.getConstraintDescriptor());
        final String cachePrefix = PREFIX_CACHE.getIfPresent(of);
        if (cachePrefix == null) {
            final String prefix = calculatePrefix(v, invocable);
            PREFIX_CACHE.put(of, prefix);
            return prefix + v.getMessage();
        }
        return cachePrefix + v.getMessage();
    }
799585
protected function matchLocation()
    {
        return ReplyRuleKeyword::find()
            ->andFilterWhere(['type' => [ReplyRuleKeyword::TYPE_LOCATION]])
            ->wechatRule($this->getWechat()->id)
            ->limitTime(TIMESTAMP)
            ->all();
    }
909491
def _check_location_part(cls, val, regexp):
        """"""
        cls._deprecation_warning()
        return CourseLocator._check_location_part(val, regexp)
184373
def clean_subject_location(self):
        
        cleaned_data = super(ImageAdminForm, self).clean()
        subject_location = cleaned_data['subject_location']
        if not subject_location:
            # if supplied subject location is empty, do not check it
            return subject_location

        # use thumbnail's helper function to check the format
        coordinates = normalize_subject_location(subject_location)

        if not coordinates:
            err_msg = ugettext_lazy('Invalid subject location format. ')
            err_code = 'invalid_subject_format'

        elif (
            coordinates[0] > self.instance.width
            or coordinates[1] > self.instance.height
        ):
            err_msg = ugettext_lazy(
                'Subject location is outside of the image. ')
            err_code = 'subject_out_of_bounds'
        else:
            return subject_location

        self._set_previous_subject_location(cleaned_data)
        raise forms.ValidationError(
            string_concat(
                err_msg,
                ugettext_lazy('Your input: "{subject_location}". '.format(
                    subject_location=subject_location)),
                'Previous value is restored.'),
            code=err_code)
520718
def location(self):
        
        if not hasattr(self, '_loc'):
            self._loc = conf.lib.clang_getCursorLocation(self)

        return self._loc
690398
def location(self):
        
        if self._location.lower() == 'n':
            return NEUTRAL
        if self._location.lower() == '@':
            return AWAY
        return HOME
1185526
def get_location(self):
        
        response = self.connection.make_request('GET', self.name,
                                                query_args='location')
        body = response.read()
        if response.status == 200:
            rs = ResultSet(self)
            h = handler.XmlHandler(rs, self)
            xml.sax.parseString(body, h)
            return rs.LocationConstraint
        else:
            raise self.connection.provider.storage_response_error(
                response.status, response.reason, body)
1057738
def location(self):
        
        if self.is_logged_in_user: 
            # Retrieve the logged-in user's profile location
            return self._user_location_xpb.get_text_(self.profile_tree)
        else:
            # Retrieve a non logged-in user's profile location
            return self._location_xpb.get_text_(self.profile_tree)
1096447
public String getLocation() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getLocation -> " + location);
        }
        return this.location;
    }
535483
def _check_position(self, feature, info):
        
        pos = info.get('position')
        if pos is not None:
            feature_pos = self.get_feature_position(feature)
            if feature_pos is not None:
                if feature_pos != pos:
                    message = '{feature} has a forced position on ({pos}) but is on position {feature_pos}.'.format(
                        feature=feature,
                        pos=pos,
                        feature_pos=feature_pos
                    )
                    self.violations.append((feature, message))
1057128
def sanitize(self):
        '''
        
        '''
        super(MapRequestMessage, self).sanitize()

        # A: This is an authoritative bit, which is set to 0 for UDP-based Map-
        # Requests sent by an ITR.  Set to 1 when an ITR wants the
        # destination site to return the Map-Reply rather than the mapping
        # database system.
        if not isinstance(self.authoritative, bool):
            raise ValueError('Authoritative flag must be a boolean')

        # M: This is the map-data-present bit, when set, it indicates a Map-
        # Reply Record segment is included in the Map-Request.
        # Checked below

        # P: This is the probe-bit which indicates that a Map-Request SHOULD be
        # treated as a locator reachability probe.  The receiver SHOULD
        # respond with a Map-Reply with the probe-bit set, indicating the
        # Map-Reply is a locator reachability probe reply, with the nonce
        # copied from the Map-Request.  See Section 6.3.2 for more details.
        if not isinstance(self.probe, bool):
            raise ValueError('Probe flag must be a boolean')

        # S: This is the Solicit-Map-Request (SMR) bit.  See Section 6.6.2 for
        # details.
        if not isinstance(self.smr, bool):
            raise ValueError('SMR flag must be a boolean')

        # p: This is the PITR bit.  This bit is set to 1 when a PITR sends a
        # Map-Request.
        if not isinstance(self.pitr, bool):
            raise ValueError('PITR flag must be a boolean')

        # s: This is the SMR-invoked bit.  This bit is set to 1 when an xTR is
        # sending a Map-Request in response to a received SMR-based Map-
        # Request.
        if not isinstance(self.smr_invoked, bool):
            raise ValueError('SMR-invoked flag must be a boolean')

        # IRC:  This 5-bit field is the ITR-RLOC Count which encodes the
        # additional number of (ITR-RLOC-AFI, ITR-RLOC Address) fields
        # present in this message.  At least one (ITR-RLOC-AFI, ITR-RLOC-
        # Address) pair MUST be encoded.  Multiple ITR-RLOC Address fields
        # are used so a Map-Replier can select which destination address to
        # use for a Map-Reply.  The IRC value ranges from 0 to 31.  For a
        # value of 0, there is 1 ITR-RLOC address encoded, and for a value
        # of 1, there are 2 ITR-RLOC addresses encoded and so on up to 31
        # which encodes a total of 32 ITR-RLOC addresses.
        if len(self.itr_rlocs) < 1 or len(self.itr_rlocs) > 32:
            raise ValueError('Number of ITR RLOCs must be between 1 and 32')

        # Record Count:  The number of records in this Map-Request message.  A
        # record is comprised of the portion of the packet that is labeled
        # 'Rec' above and occurs the number of times equal to Record Count.
        # For this version of the protocol, a receiver MUST accept and
        # process Map-Requests that contain one or more records, but a
        # sender MUST only send Map-Requests containing one record.  Support
        # for requesting multiple EIDs in a single Map-Request message will
        # be specified in a future version of the protocol.
        if len(self.eid_prefixes) < 1 or len(self.eid_prefixes) > 32:
            raise ValueError('Number of EID prefix records must be between ' +
                             '1 and 255')

        # Nonce: An 8-octet random value created by the sender of the Map-
        # Request.  This nonce will be returned in the Map-Reply.  The
        # security of the LISP mapping protocol depends critically on the
        # strength of the nonce in the Map-Request message.  The nonce
        # SHOULD be generated by a properly seeded pseudo-random (or strong
        # random) source.  See [RFC4086] for advice on generating security-
        # sensitive random data.
        if len(bytes(self.nonce)) != 8:
            raise ValueError('Invalid nonce')

        # Source EID Address:  This is the EID of the source host which
        # originated the packet which is caused the Map-Request.  When Map-
        # Requests are used for refreshing a map-cache entry or for RLOC-
        # probing, an AFI value 0 is used and this field is of zero length.
        if self.source_eid is not None:
            # Extract the address(es)
            if isinstance(self.source_eid, LCAFAddress):
                addresses = self.source_eid.get_addresses()
            else:
                addresses = [self.source_eid]

            # We must have exactly one address
            if len(addresses) != 1:
                raise ValueError('Source EID must be one address')

            if not isinstance(addresses[0], (IPv4Address, IPv6Address)):
                raise ValueError('Invalid source EID: %r' % self.source_eid)

        # ITR-RLOC Address:  Used to give the ETR the option of selecting the
        # destination address from any address family for the Map-Reply
        # message.  This address MUST be a routable RLOC address of the
        # sender of the Map-Request message.
        for itr_rloc in self.itr_rlocs:
            if not isinstance(itr_rloc, (IPv4Address, IPv6Address)):
                raise ValueError('Invalid ITR RLOC')

        # EID-prefix:  4 octets if an IPv4 address-family, 16 octets if an IPv6
        # address-family.  When a Map-Request is sent by an ITR because a
        # data packet is received for a destination where there is no
        # mapping entry, the EID-prefix is set to the destination IP address
        # of the data packet.  And the 'EID mask-len' is set to 32 or 128
        # for IPv4 or IPv6, respectively.  When an xTR wants to query a site
        # about the status of a mapping it already has cached, the EID-
        # prefix used in the Map-Request has the same mask-length as the
        # EID-prefix returned from the site when it sent a Map-Reply
        # message.
        for eid_prefix in self.eid_prefixes:
            # Extract the address(es)
            if isinstance(eid_prefix, LCAFAddress):
                addresses = eid_prefix.get_addresses()
            else:
                addresses = [eid_prefix]

            for address in addresses:
                if not isinstance(address, (IPv4Network, IPv4Address,
                                            IPv6Network, IPv6Address)):
                    raise ValueError('Invalid EID prefix: %r' % address)

        # Map-Reply Record:  When the M bit is set, this field is the size of a
        # single "Record" in the Map-Reply format.  This Map-Reply record
        # contains the EID-to-RLOC mapping entry associated with the Source
        # EID.  This allows the ETR which will receive this Map-Request to
        # cache the data if it chooses to do so.
        if self.map_reply is not None:
            if not isinstance(self.map_reply, MapReplyRecord):
                raise ValueError('Invalid Map-Reply')

            self.map_reply.sanitize()
1050699
function(responseObject) {
                var location = this._getLocationHeader(responseObject);
                return location ? location.substr(location.lastIndexOf('/') + 1) : undefined;
            }
1050966
function getSeedsAtLocation(location) {
  // load the file as JSON
  const result = require(location);

  // Ensure the output is an array
  if (Array.isArray(result)) {
    return _.forEach(result, unmarshalBuffer);
  } else {
    return [ unmarshalBuffer(result) ];
  }
}
923416
def _sanity_check_registered_locations_parent_locations(query_metadata_table):
    """"""
    for location, location_info in query_metadata_table.registered_locations:
        if (location != query_metadata_table.root_location and
                not query_metadata_table.root_location.is_revisited_at(location)):
            # If the location is not the root location and is not a revisit of the root,
            # then it must have a parent location.
            if location_info.parent_location is None:
                raise AssertionError(u'Found a location that is not the root location of the query '
                                     u'or a revisit of the root, but does not have a parent: '
                                     u'{} {}'.format(location, location_info))

        if location_info.parent_location is not None:
            # Make sure the parent_location is also registered.
            # If the location is not registered, the following line will raise an error.
            query_metadata_table.get_location_info(location_info.parent_location)
755897
def get_valid_location(location):
    """"""
    # If we're given None, return None
    if location is not None and cellular_components.get(location) is None:
        loc = cellular_components_reverse.get(location)
        if loc is None:
            raise InvalidLocationError(location)
        else:
            return loc
    return location
921151
public static Filter getFilterForLocation(String location, String context) throws IllegalArgumentException {
        String filter = makeLocationFilterString(location, context);
        try {
            return FrameworkUtil.createFilter(filter);
        } catch (InvalidSyntaxException e) {
            throw new IllegalArgumentException("location is invalid: " + location, e);
        }
    }
1138772
@SuppressWarnings("WeakerAccess")
  public String getZone() {
    LocationName location = Verify.verifyNotNull(LocationName.parse(stateProto.getLocation()));
    //noinspection ConstantConditions
    return location.getLocation();
  }