Normalize a schema.
322923
def _normalize(schema, allow_none=True):
    
    if allow_none and schema is None:
        return schema
    if isinstance(schema, CommonSchema):
        return schema
    if isinstance(schema, StreamSchema):
        return schema

    if isinstance(schema, basestring):
        return StreamSchema(schema)

    py_types = {
        _spl_object: CommonSchema.Python,
        _spl_str: CommonSchema.String,
        json: CommonSchema.Json,
        }

    if schema in py_types:
        return py_types[schema]

    # With Python 3 allow a named tuple with type hints
    # to be used as a schema definition
    if sys.version_info.major == 3:
        import typing
        if isinstance(schema, type) and  issubclass(schema, tuple):
            if hasattr(schema, '_fields') and hasattr(schema, '_field_types'):
                return _from_named_tuple(schema)

    raise ValueError("Unknown stream schema type:" + str(schema))
1318915
function normalize(result) {
  return {
    relevance: result.relevance || 0,
    language: result.language || null,
    value: result.value || []
  }
}
1216263
def normalize(rendered):
    """"""
    out = ''.join([line.strip()
                   for line in rendered.splitlines()
                   if line.strip()])
    out = out.replace(', ', ',')
    return out
1178623
private function normalizeFields()
    {
        foreach ($this->fields as $key => $field) {
            if (is_array($field)) {
                $this->fields[$key] = \Meare\Juggler\json_object($field);
            }
        }
    }
369094
function normalizeFields(fields) {
	const _fields = {};
	Object.keys(fields).forEach(k => {
		if (fields[k].constructor == Object && !fields[k].type) {
			_fields[k] = normalizeFields(fields[k]);
		} else {
			_fields[k] = 1;
		}
	});
	return _fields;
}
692747
def schema_map(schema):
    """"""
    mapper = {}
    for name in getFieldNames(schema):
        mapper[name] = name
    return mapper
741236
def _normalize_purge_unknown(mapping, schema):
        
        for field in [x for x in mapping if x not in schema]:
            mapping.pop(field)
        return mapping
984779
def _normalize(self, name, columns, points):
        """"""

        for i, _ in enumerate(points):
            # Supported type:
            # https://docs.influxdata.com/influxdb/v1.5/write_protocols/line_protocol_reference/
            if points[i] is None:
                # Ignore points with None value
                del(points[i])
                del(columns[i])
                continue
            try:
                points[i] = float(points[i])
            except (TypeError, ValueError):
                pass
            else:
                continue
            try:
                points[i] = str(points[i])
            except (TypeError, ValueError):
                pass
            else:
                continue

        return [{'measurement': name,
                 'tags': self.parse_tags(self.tags),
                 'fields': dict(zip(columns, points))}]
122876
def _filter_schemas(schemas, schema_tables, exclude_table_columns):
    """"""
    return [_filter_schema(s, schema_tables, exclude_table_columns)
            for s in schemas]
1253859
def normalize_type(self, names):
        """"""
        self.name = names[0]
        self.is_kwarg = False
        self.is_arg = False
        self.names = []

        try:
            # http://stackoverflow.com/a/16488383/5006 uses ask forgiveness because
            # of py2/3 differences of integer check
            self.index = int(self.name)
            self.name = ""
            self.is_arg = True

        except ValueError:
            self.is_kwarg = True
            self.names = names
446274
def normalise_filled(self, meta, val):
        """"""
        available = list(meta.everything["images"].keys())
        val = sb.formatted(sb.string_spec(), formatter=MergedOptionStringFormatter).normalise(meta, val)
        if val not in available:
            raise BadConfiguration("Specified image doesn't exist", specified=val, available=available)
        return val
251463
public function normalizeColumns()
	{
		$model_alias = $this->getAlias();
		$ret = array();

		foreach( $this->getColumns() as $descriptor )
		{
			$alias = $descriptor[0];
			if( $alias === $model_alias )
			{
				if( null === $descriptor[2] && $descriptor[1] === '*' )
				{
					foreach( array_keys($this->schemaColumnsGet()) as $column_name )
					{
						$ret []= array($alias, $column_name, null);
					}
				}
				else
				{
					$ret []= $descriptor;
				}
			}
			else
			{
				$ret []= $descriptor;
			}
		}

		$this->resetColumns( $ret );
	}
468358
def normalize(self):
        
        maximum = self.max()
        if maximum:
            self.values = [value / maximum for value in self.values]
610538
def convert(schema):
    """"""
    # pylint: disable=too-many-return-statements,too-many-branches
    if isinstance(schema, vol.Schema):
        schema = schema.schema

    if isinstance(schema, Mapping):
        val = []

        for key, value in schema.items():
            description = None
            if isinstance(key, vol.Marker):
                pkey = key.schema
                description = key.description
            else:
                pkey = key

            pval = convert(value)
            pval['name'] = pkey
            if description is not None:
                pval['description'] = description

            if isinstance(key, (vol.Required, vol.Optional)):
                pval[key.__class__.__name__.lower()] = True

                if key.default is not vol.UNDEFINED:
                    pval['default'] = key.default()

            val.append(pval)

        return val

    if isinstance(schema, vol.All):
        val = {}
        for validator in schema.validators:
            val.update(convert(validator))
        return val

    if isinstance(schema, (vol.Clamp, vol.Range)):
        val = {}
        if schema.min is not None:
            val['valueMin'] = schema.min
        if schema.max is not None:
            val['valueMax'] = schema.max
        return val

    if isinstance(schema, vol.Length):
        val = {}
        if schema.min is not None:
            val['lengthMin'] = schema.min
        if schema.max is not None:
            val['lengthMax'] = schema.max
        return val

    if isinstance(schema, vol.Datetime):
        return {
            'type': 'datetime',
            'format': schema.format,
        }

    if isinstance(schema, vol.In):
        if isinstance(schema.container, Mapping):
            return {
                'type': 'select',
                'options': list(schema.container.items()),
            }
        return {
            'type': 'select',
            'options': [(item, item) for item in schema.container]
        }

    if schema in (vol.Lower, vol.Upper, vol.Capitalize, vol.Title, vol.Strip):
        return {
            schema.__name__.lower(): True,
        }

    if isinstance(schema, vol.Coerce):
        schema = schema.type

    if schema in TYPES_MAP:
        return {'type': TYPES_MAP[schema]}

    raise ValueError('Unable to convert schema: {}'.format(schema))
389527
function normalize(value, callback) {
  if (!value) {
    return [];
  }

  if (!Array.isArray(value)) {
    value = [ value ];
  }

  return value.map(callback);
}
1251450
def normalize(self):
        """"""
        chrfunc = chr if py3k else HTMLEntity._unichr
        if self.named:
            return chrfunc(htmlentities.name2codepoint[self.value])
        if self.hexadecimal:
            return chrfunc(int(self.value, 16))
        return chrfunc(int(self.value))
703678
function normalizeProperties(input) {
  if (!input) return;

  if (Array.isArray(input)) {
    return flatten(input).reduce(function (acc, o) {
      return Object.assign(acc, o);
    }, {});
  }

  return clone(input);
}