Sanitize factory
198124
function sanitize(type, sanitizers) {
  return function (name) {
    // this.property(...).sanitize(functon (val) { return val; })
    if (typeof name === 'function') return this.define('sanitize', name);

    // `reset` will remove any existing sanitizers from property;
    if (name === 'reset') {
      delete this.property['sanitize'];
      return this;
    }

    if (!sanitizers[name]) throw new Error('Unknown sanitizer: ' + name);

    // this.property(...).sanitize('sanitizer', args...)
    var args = Array.prototype.slice.call(arguments, 1),
        prop = this.name,
        sanitizer = sanitizers[name],
        sanitizeFn = this.property['sanitize'];

    if (!sanitizeFn) {
      sanitizeFn = function (val) {
        if (type === 'array' ? Array.isArray(val) : typeof val === type) {
          return sanitizeFn.sanitizers.reduce(function (value, sanitizer) {
            return sanitizer.fn.apply(null, [value].concat(sanitizer.args));
          }, val);
        } else {
          return val;
        }
      }
      sanitizeFn.sanitizers = [];
    }
    sanitizeFn.sanitizers.push({ fn: sanitizer, args: args });

    this.property['sanitize'] = sanitizeFn;

    return this;
  };
}
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
132829
def _sanitize(text):
    """"""
    d = {'-LRB-': '(', '-RRB-': ')'}
    return re.sub('|'.join(d.keys()), lambda m: d[m.group(0)], text)
1305004
def _clean(self):
        """"""
        if self._workers:
            for w in self._workers:
                if w.is_finished():
                    self._workers.remove(w)

        if self._threads:
            for t in self._threads:
                if t.isFinished():
                    self._threads.remove(t)
        else:
            self._timer.stop()
1357630
def filter_factory(global_conf, **local_conf):
    """"""
    conf = global_conf.copy()
    conf.update(local_conf)

    def trusted_shared_nets(app):
        return TrustedSharedNetwork(app, conf)
    return trusted_shared_nets
846975
def filter_factory(global_conf, **local_conf):
    """"""
    conf = global_conf.copy()
    conf.update(local_conf)

    def visible(app):
        return VisibleFilter(app, conf)
    return visible
839383
function(content, pos, sanitize) {
			if (sanitize) {
				content = this.sanitize(content);
			}

			var stream = stringStream(content);
			stream.start = stream.pos = pos;
			var stack = [], ranges = [];
			var ch;
			while (ch = stream.next()) {
				if (ch == '{') {
					stack.push(stream.pos - 1);
				} else if (ch == '}') {
					if (!stack.length) {
						throw 'Invalid source structure (check for curly braces)';
					}
					ranges.push(range.create2(stack.pop(), stream.pos));
					if (!stack.length) {
						return ranges;
					}
				} else {
					stream.skipQuoted();
				}
			}

			return ranges;
		}
1313262
public function purify()
    {
        $table = $this->_getTable();
        $fields = $this->_getFields($table);
        $this->_loadBehavior($table, $fields);

        $query = $table->find();
        if ($table->hasFinder('purifier')) {
            $query->find('purifier');
        }
        $total = $query->all()->count();

        $this->info(__d('Burzum/HtmlPurifier', 'Sanitizing fields `{0}` in table `{1}`', implode(',', $fields), $table->table()));

        $this->helper('progress')->output([
            'total' => $total,
            'callback' => function ($progress) use ($total, $table, $fields) {
                $chunkSize = 25;
                $chunkCount = 0;
                while ($chunkCount <= $total) {
                    $this->_process($table, $chunkCount, $chunkSize, $fields);
                    $chunkCount = $chunkCount + $chunkSize;
                    $progress->increment($chunkSize);
                    $progress->draw();
                }
                return;
            }
        ]);
    }
199730
private function sanitizeRequest()
    {
        // The label filter does not work with expanded=1 because the data table IDs have a different meaning
        // depending on whether the table has been loaded yet. expanded=1 causes all tables to be loaded, which
        // is why the label filter can't descend when a recursive label has been requested.
        // To fix this, we remove the expanded parameter if a label parameter is set.
        if (isset($this->request['label']) && !empty($this->request['label'])
            && isset($this->request['expanded']) && $this->request['expanded']
        ) {
            unset($this->request['expanded']);
        }
    }
45869
private function registerSanitizer()
    {
        $this->singleton(Contracts\Sanitizer::class, function ($app) {
            /** @var  \Illuminate\Contracts\Config\Repository  $config */
            $config = $app['config'];

            return new Factory($config->get('sanitizer.filters'));
        });

        $this->singleton('arcanedev.sanitizer', Contracts\Sanitizer::class);
    }
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'))
        });
      }
656155
function () {
                var options = $scope.options || [];
                $scope.filteredOptions.splice(0);
                if (!$scope.scopeBuster.filter) {
                    angular.copy(options, $scope.filteredOptions);
                }
                else {
                    var filter = sanitize($scope.scopeBuster.filter);
                    angular.forEach(options, function (option) {
                        var index = sanitize(option[$scope.labelAttribute]).indexOf(filter);
                        if (index >= 0) {
                            $scope.filteredOptions.push(option);
                        }
                    });
                }
            }
339145
def clean():
    """"""
    d = ['build', 'dist', 'scikits.audiolab.egg-info', HTML_DESTDIR,
            PDF_DESTDIR]
    for i in d:
        paver.path.path(i).rmtree()

    (paver.path.path('docs') / options.sphinx.builddir).rmtree()
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
1173008
def sanitize_mount(mount):
    """"""
    sanitized_mount = mount
    if sanitized_mount.startswith('/'):
        sanitized_mount = sanitized_mount[1:]

    if sanitized_mount.endswith('/'):
        sanitized_mount = sanitized_mount[:-1]

    sanitized_mount = sanitized_mount.replace('//', '/')
    return sanitized_mount
702335
def sanitize(string):
    
    replace_chars = [
        ['\\', '-'], [':', '-'], ['/', '-'],
        ['?', ''], ['<', ''], ['>', ''],
        ['`', '`'], ['|', '-'], ['*', '`'],
        ['"', '\''], ['.', ''], ['&', 'and']
    ]
    for ch in replace_chars:
        string = string.replace(ch[0], ch[1])
    return string
153113
function Sanitization(schema, custom) {
		Inspection.prototype.constructor.call(this, schema, _merge(Sanitization.custom, custom));
		var _reporting = [];

		this._basicFields = Object.keys(_sanitizationAttribut);
		this._customFields = Object.keys(this._custom);
		this.origin = null;

		this.report = function (message) {
			var newNot = {
					message: message || 'was sanitized',
					property: this.userAlias ? (this.userAlias + ' (' + this._dumpStack() + ')') : this._dumpStack()
			};
			if (!_reporting.some(function (e) { return e.property === newNot.property; })) {
				_reporting.push(newNot);
			}
		};

		this.result = function (data) {
			return {
				data: data,
				reporting: _reporting,
				format: function () {
					return this.reporting.map(function (i) {
						return 'Property ' + i.property + ' ' + i.message;
					}).join('\n');
				}
			};
		};
	}