Sanitizes command options.
435545
def sanitize_command_options(options):
    
    multiples = [
        'badges',
        'exclude_badges',
    ]

    for option in multiples:
        if options.get(option):
            value = options[option]
            if value:
                options[option] = [v for v in value.split(' ') if v]

    return options
207597
def _sanitize_config(config):
        ''''''
        if 'checks' in config:
            checks = config['checks']
            if 'structural_checks' not in checks:
                checks['structural_checks'] = []
            if 'neuron_checks' not in checks:
                checks['neuron_checks'] = []
        else:
            raise ConfigError('Need to have "checks" in the config')

        if 'options' not in config:
            L.debug('Using default options')
            config['options'] = {}

        if 'color' not in config:
            config['color'] = False

        return config
1193062
def _clean_flags(args, caller):
    '''
    
    '''
    flags = ''
    if args is None:
        return flags
    allowed = ('a', 'B', 'h', 'H', 'i', 'k', 'l', 'P', 't', 'T', 'x', 'v')
    for flag in args:
        if flag in allowed:
            flags += flag
        else:
            raise CommandExecutionError(
                'Invalid flag passed to {0}'.format(caller)
            )
    return flags
1018241
def sanitize(self):
        '''
        
        '''
        super(EncapsulatedControlMessage, self).sanitize()

        # S: This is the Security bit.  When set to 1 the following
        # authentication information will be appended to the end of the Map-
        # Reply.  The detailed format of the Authentication Data Content is
        # for further study.
        if not isinstance(self.security, bool):
            raise ValueError('Security flag must be a boolean')

        if self.security:
            raise NotImplementedError('Handling security data is not ' +
                                      'implemented yet')

        # "D" is the "DDT-originated" flag and is set by a DDT client to
        # indicate that the receiver can and should return Map-Referral
        # messages as appropriate.
        if not isinstance(self.ddt_originated, bool):
            raise ValueError('DDT originated flag must be a boolean')

        # The 6th bit in the ECM LISP header is allocated as the "R"
        # bit.  The R bit indicates that the encapsulated Map-Register is
        # to be processed by an RTR.
        if not isinstance(self.for_rtr, bool):
            raise ValueError('For-RTR flag must be a boolean')

        # The 7th bit in the ECM header is allocated as the "N" bit.  The
        # N bit indicates that this Map-Register is being relayed by an
        # RTR.  When an RTR relays the ECM-ed Map-Register to a Map-Server,
        # the N bit must be set to 1.
        if not isinstance(self.relayed_by_rtr, bool):
            raise ValueError('Relayed-by-RTR flag must be a boolean')
498155
function clean(type, options) {
  options = assign({}, defaults, options);
  if (type === 'dblclick') {
    options.detail = 2;
  }
  if (isString(options.key)) {
    options.key = keycode(options.key);
  }
  return options;
}
853498
function sanitizeAndConfigure() {
        if (!opts.target) {
          throw Error(
            '$mdMenu.show() expected a target to animate from in options.target'
          );
        }
        angular.extend(opts, {
          alreadyOpen: false,
          isRemoved: false,
          target: angular.element(opts.target), // make sure it's not a naked DOM node
          parent: angular.element(opts.parent),
          menuContentEl: angular.element(element[0].querySelector('md-menu-content'))
        });
      }
1197028
def _sanitize(recipe):
        """"""
        recipe = recipe.copy()
        for k in list(recipe):
            if k not in ("start", "error") and int(k) and k != int(k):
                recipe[int(k)] = recipe[k]
                del recipe[k]
        for k in list(recipe):
            if "output" in recipe[k] and not isinstance(
                recipe[k]["output"], (list, dict)
            ):
                recipe[k]["output"] = [recipe[k]["output"]]
            # dicts should be normalized, too
        if "start" in recipe:
            recipe["start"] = [tuple(x) for x in recipe["start"]]
        return recipe
455652
function removeInvalidOptions(options, param) {
  const packageOptions = JSON.parse(JSON.stringify(options));
  if (options.platform === 'win32' && !isWindows()) {
    if (!hasBinary.sync('wine')) {
      log.warn(
        `Wine is required to use "${param}" option for a Windows app when packaging on non-windows platforms`,
      );
      packageOptions[param] = null;
    }
  }
  return packageOptions;
}
107143
public function sanitize()
    {
        $this->addCustomFilters();
        $this->sanitizer = app('sanitizer')->make($this->input(), $this->filters());
        $this->replace($this->sanitizer->sanitize());
    }
645835
def sanitize(self, content):
        """"""
        import html5lib
        from html5lib import sanitizer
        p = html5lib.HTMLParser(tokenizer=sanitizer.HTMLSanitizer)
        dom_tree = p.parseFragment(content)
        return dom_tree.text
1066545
def _sanitize(self, unsanitized):
        

        sanitized = ""

        # strip punctuation and diacritics
        replace_punct = str.maketrans( string.punctuation + "᾽᾿῾", ' '*(len(string.punctuation) + 3)  )
        sanitized = unsanitized.translate( replace_punct )
        sanitized = "".join(c for c in unicodedata.normalize("NFD", sanitized) if unicodedata.category(c) != "Mn")

        #finally, lose all whitespace
        sanitized = re.sub(r'\s+','', sanitized)

        return sanitized
1071374
protected function removeLaravelCommands(): void
    {
        $devCommands = ['AuthMake', 'ControllerMake', 'MiddlewareMake',
            'NotificationTable', 'ExceptionMake', 'SessionTable',
            'ChannelMake',
            'ConsoleMake',
            'EventGenerate',
            'EventMake',
            'ExceptionMake',
            'FactoryMake',
            'JobMake',
            'ListenerMake',
            'MailMake',
            'MiddlewareMake',
            'ModelMake',
            'NotificationMake',
            'ObserverMake',
            'PolicyMake',
            'ProviderMake',
            'TestMake',
            'RequestMake',
            'ResourceMake',
            'RuleMake',
            'SeederMake',
        ];

        array_map(function ($item) {
            unset($this->devCommands[$item]);
        }, $devCommands);

        $commands = ['Optimize',
            'OptimizeClear', 'ClearResets', 'RouteCache',
            'RouteClear',
            'RouteList', 'Preset', 'ViewCache',
            'ViewClear', 'Serve', 'StorageLink', ];
        array_map(function ($item) {
            unset($this->commands[$item]);
        }, $commands);
    }
1294682
def cli(ctx, pattern):
    """"""
    matches = utils.grep_commands(pattern)
    if matches:
        selected = utils.select_command(matches)
        if selected >= 0:
            cmd, desc = matches[selected]
            command = "$ {} :: {}".format(cmd, desc)
            if click.confirm("Remove\n\t{}\n\n?".format(command), default=True):
                utils.remove_command(cmd)
                click.echo('Command successfully removed!')
    elif matches == []:
        click.echo('No saved commands matches the pattern {}'.format(pattern))
    else:
        click.echo("No commands to remove, Add one by 'keep new'. ")
260890
def sanitize_proxies (self):
        """"""
        if os.name != 'posix':
            return
        if "http" not in self["proxy"]:
            http_proxy = get_gconf_http_proxy() or get_kde_http_proxy()
            if http_proxy:
                self["proxy"]["http"] = http_proxy
        if "ftp" not in self["proxy"]:
            ftp_proxy = get_gconf_ftp_proxy() or get_kde_ftp_proxy()
            if ftp_proxy:
                self["proxy"]["ftp"] = ftp_proxy
401534
function sanitizeOptions(options) {
    // Set to base URL on empty parameters
    options.path = typeof options.path === 'undefined' ? HOST : options.path;

    if (typeof options.path !== 'string') {
      // Reject if input path isn't a string
      return Promise.reject().catch(function () {
        throw new TypeError('Path must be a string.');
      });
    } else if (typeof options.value !== 'undefined' && (typeof options.value !== 'string' && typeof options.value !== 'number' || typeof options.value === 'number' && options.value % 1 !== 0)) {
      // Reject if input value isn't a string or integer
      return Promise.reject().catch(function () {
        throw new TypeError('Value must be a string or number.');
      });
    } else if (typeof options.format !== 'undefined' && options.format !== 'paged') {
      // Reject if input format is invalid
      return Promise.reject().catch(function () {
        throw new Error('Invalid format parameter.');
      });
    } else {
      // All is well, continue!
      return parseOptions(options);
    }
  }
1141631
function sanitize( $input ) {
		$options = [];

		if ( ! is_array( $input ) ) {
			$input = [];
		}

		if ( property_exists( $this, 'booleans' ) ) {
			foreach ( $this->booleans as $key ) {
				if ( empty( $input[ $key ] ) ) {
					$options[ $key ] = 0;
				} else {
					$options[ $key ] = 1;
				}
			}
		}

		if ( property_exists( $this, 'strings' ) ) {
			foreach ( $this->strings as $key ) {
				if ( empty( $input[ $key ] ) ) {
					unset( $options[ $key ] );
				} else {
					$options[ $key ] = sanitize_text_field( $input[ $key ] );
				}
			}
		}

		if ( property_exists( $this, 'urls' ) ) {
			foreach ( $this->urls as $key ) {
				if ( empty( $input[ $key ] ) ) {
					unset( $options[ $key ] );
				} else {
					$value = trim( strip_tags( stripslashes( $input[ $key ] ) ) );
					if ( $value ) {
						$options[ $key ] = \Pressbooks\Sanitize\canonicalize_url( $value );
					} else {
						unset( $options[ $key ] );
					}
				}
			}
		}

		if ( property_exists( $this, 'integers' ) ) {
			foreach ( $this->integers as $key ) {
				if ( empty( $input[ $key ] ) ) {
					unset( $options[ $key ] );
				} else {
					$options[ $key ] = absint( $input[ $key ] );
				}
			}
		}

		if ( property_exists( $this, 'floats' ) ) {
			foreach ( $this->floats as $key ) {
				if ( empty( $input[ $key ] ) ) {
					unset( $options[ $key ] );
				} else {
					$options[ $key ] = filter_var( $input[ $key ], FILTER_VALIDATE_FLOAT );
				}
			}
		}

		if ( property_exists( $this, 'predefined' ) ) {
			foreach ( $this->predefined as $key ) {
				if ( empty( $input[ $key ] ) ) {
					unset( $options[ $key ] );
				} else {
					$options[ $key ] = $input[ $key ];
				}
			}
		}

		return $options;
	}
732830
def _sanitizeFilename(filename):
    """"""
    global _sanitize_trans
    out = filename.translate(_sanitize_trans)
    # leading dot becomes "_"
    if out and out[0] == '.':
        out = out[1:]
    return out