Sanitize the event params.
 Prevents passing values that could cause errors later in Announcer.
963963
def _sanitize_params(params)
      Hash[params.map { |key, value| [key.to_sym, _sanitize_value(key, value)] }].freeze
    end
1257630
def _evaluate_params(params)
      unless params.is_a?(Hash)
        raise ArgumentError, 'event parameters must be a hash'
      end

      params = params.dup
      @instance = params.delete(:instance)
      @params = _sanitize_params(params)
    end
1208231
def sanitize_http_request_cookies(client, event):
    

    # sanitize request.cookies dict
    try:
        cookies = event["context"]["request"]["cookies"]
        event["context"]["request"]["cookies"] = varmap(_sanitize, cookies)
    except (KeyError, TypeError):
        pass

    # sanitize request.header.cookie string
    try:
        cookie_string = event["context"]["request"]["headers"]["cookie"]
        event["context"]["request"]["headers"]["cookie"] = _sanitize_string(cookie_string, "; ", "=")
    except (KeyError, TypeError):
        pass
    return event
506010
def _sanitize_parameters(self):
        

        # Check additional_edges
        if isinstance(self._additional_edges, (list, set, tuple)):
            new_dict = defaultdict(list)
            for s, d in self._additional_edges:
                new_dict[s].append(d)
            self._additional_edges = new_dict

        elif isinstance(self._additional_edges, dict):
            pass

        else:
            raise AngrCFGError('Additional edges can only be a list, set, tuple, or a dict.')

        # Check _advanced_backward_slicing
        if self._advanced_backward_slicing and self._enable_symbolic_back_traversal:
            raise AngrCFGError('Advanced backward slicing and symbolic back traversal cannot both be enabled.')

        if self._advanced_backward_slicing and not self._keep_state:
            raise AngrCFGError('Keep state must be enabled if advanced backward slicing is enabled.')

        # Sanitize avoid_runs
        self._avoid_runs = [ ] if self._avoid_runs is None else self._avoid_runs
        if not isinstance(self._avoid_runs, (list, set)):
            raise AngrCFGError('"avoid_runs" must either be None, or a list or a set.')

        self._sanitize_starts()
245139
def sanitize(self):
        '''
        
        '''
        # Let the parent do its stuff
        super(Protocol, self).sanitize()

        # Check if the next header is of the right type, and fix this header
        # if we know better (i.e. the payload is a ProtocolElement so we know
        # the header_type)
        if isinstance(self.payload, Protocol):
            self.next_header = self.payload.header_type
290394
def sanitize_filterrific_param(val)
      case val
      when Array
        # Return Array
        val.map { |e| sanitize_filterrific_param(e) }
      when Hash
        # Return Hash
        val.inject({}) { |m, (k,v)| m[k] = sanitize_filterrific_param(v); m }
      when NilClass
        # Nothing to do, use val as is
        val
      when String
        helpers.sanitize(val)
      else
        # Nothing to do, use val as is
        val
      end
    end
807802
static List<String> sanitiseAndSplit(final String param) {
        if (Strings.isNullOrEmpty(param)) return ImmutableList.of();
        // sanitize the user input, only keep letters, digits, and any of a small number of approved params
        final String sanitized = JAVA_LETTER_OR_DIGIT.or(anyOf(".,_-[]")).retainFrom(param);
        return Splitter.on(',').trimResults().omitEmptyStrings().splitToList(sanitized);
    }
204688
function (event, parameters) {
    if (event === 'COMMAND') {
        event = 'command_' + parameters[3];
    }
    parameters.unshift(event);
    this.emit.apply(this, parameters);
}
760928
protected String formatAnnounceEvent(
          AnnounceRequestMessage.RequestEvent event) {
    return AnnounceRequestMessage.RequestEvent.NONE.equals(event)
            ? ""
            : String.format(" %s", event.name());
  }
302179
def sanitize_http_wsgi_env(client, event):
    
    try:
        env = event["context"]["request"]["env"]
        event["context"]["request"]["env"] = varmap(_sanitize, env)
    except (KeyError, TypeError):
        pass
    return event
977385
def clean(self, value):
        """"""

        if not isinstance(value, six.string_types):
            raise ParameterNotValidError

        try:
            source, value = value.split('://', 1)
        except ValueError:
            raise ParameterNotValidError

        if source == 'service':
            if '@' in value:
                value, timestamp = value.split('@', 1)

                try:
                    service_time = timestamp_to_date(int(timestamp))
                except ValueError:
                    raise ParameterNotValidError
            else:
                service_time = None

            if ':' in value:
                service_name, variable_name = value.split(':', 1)
            else:
                service_name = value
                variable_name = None

            try:
                self.service = Service.objects.get(name=service_name)
            except ObjectDoesNotExist:
                raise ParameterNotValidError("Service '{}' not found".format(service_name))

            if variable_name:
                try:
                    variable = self.service.variable_set.all().get(variable=variable_name)
                except ObjectDoesNotExist:
                    raise ParameterNotValidError("Variable '{}' not found".format(variable_name))

                if service_time is not None:
                    time_index = best_fit(variable.time_stops, service_time)
                else:
                    time_index = None

                data = self.get_grid_for_variable(variable, time_index=time_index)
                return Raster(data, variable.full_extent, 1, 0, self.is_y_increasing(variable))
            else:
                return self.dataset
        else:
            raise ParameterNotValidError('Invalid source: {}'.format(source))
386590
function sanitize(arr, opts) {
  return _.reduce(arr, function (acc, keywords) {
    keywords = keywords.split(' ').filter(Boolean);
    return acc.concat(keywords).map(function (keyword, i) {
      if (opts && opts.sanitize) {
        return opts.sanitize(keyword, i, keywords);
      }
      return keyword.toLowerCase();
    }).sort();
  }, []);
}
930772
def clean_value
      if (type == :string || type == :text) && !Axlsx::trust_input
        Axlsx::sanitize(::CGI.escapeHTML(@value.to_s))
      else
        @value.to_s
      end
    end
527904
def sanitize_type(raw_type):
    """"""
    cleaned = get_printable(raw_type).strip()
    for bad in [
            r'__drv_aliasesMem', r'__drv_freesMem',
            r'__drv_strictTypeMatch\(\w+\)',
            r'__out_data_source\(\w+\)',
            r'_In_NLS_string_\(\w+\)',
            r'_Frees_ptr_', r'_Frees_ptr_opt_', r'opt_',
            r'\(Mem\) '
    ]:
        cleaned = re.sub(bad, '', cleaned).strip()
    if cleaned in ['_EXCEPTION_RECORD *', '_EXCEPTION_POINTERS *']:
        cleaned = cleaned.strip('_')
    cleaned = cleaned.replace('[]', '*')
    return cleaned
367605
def _sanitize_value(key, value)
      case value
      when String
        value.dup.freeze
      when Symbol, Integer, Float, NilClass, TrueClass, FalseClass
        value
      when Array
        _sanitize_array(key, value)
      when Hash
        _sanitize_params(value)
      else
        raise Errors::UnsafeValueError.new(key, value)
      end
    end
73112
function sanitizeFalsies(obj) {
	var key;
	if (!obj._) {
		delete obj._;
		for (key in obj) {
			if (obj[key] === false) delete obj[key];
		}
	}
	return obj;
}
663589
def sanitize(self):
        '''
        
        '''
        super(MapReferralMessage, self).sanitize()

        # WARNING: http://tools.ietf.org/html/draft-ietf-lisp-ddt-00
        # does not define this field so the description is taken from
        # http://tools.ietf.org/html/draft-ietf-lisp-24
        #
        # 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')

        # Map-Referral Records:  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.
        for record in self.records:
            if not isinstance(record, MapReferralRecord):
                raise ValueError('Invalid record')

            record.sanitize()