Normalize scope_spec to a set of strings.
351047
def NormalizeScopes(scope_spec):
    """"""
    if isinstance(scope_spec, six.string_types):
        return set(scope_spec.split(' '))
    elif isinstance(scope_spec, collections.Iterable):
        return set(scope_spec)
    raise exceptions.TypecheckError(
        'NormalizeScopes expected string or iterable, found %s' % (
            type(scope_spec),))
620961
function normalizeModuleIdentifiers(ast, load, options) {
	visitRequireArgument(ast, function(argument) {
		var normalized = optionsNormalize(
			options,
			argument.value,
			load.name,
			load.address
		);

		argument.value = normalized;
		argument.raw = `"${normalized}"`;
	});
}
631514
def _normalize_options(options):
    """"""
    normalized_options = {}
    for key, value in iteritems(options):
        optname = str(key).lower()
        intname = INTERNAL_URI_OPTION_NAME_MAP.get(optname, key)
        normalized_options[intname] = options[key]
    return normalized_options
1116640
function getMutations(spec, attr) {
      var fns = compose(extraction, cleanup, stitch)(spec);
      return _.callmap(fns, attr);
    }
1268862
def split_scoped_hparams(scopes, merged_hparams):
  """"""
  split_values = {scope: {} for scope in scopes}
  merged_values = merged_hparams.values()
  for scoped_key, value in six.iteritems(merged_values):
    scope = scoped_key.split(".")[0]
    key = scoped_key[len(scope) + 1:]
    split_values[scope][key] = value

  return [
      hparam.HParams(**split_values[scope]) for scope in scopes
  ]
1098311
def standardize_snps(G):
    
    """
    mean = G.mean(0)
    std = G.std(0)
    return (G - mean) / std
1109040
def canonicalize_spec(spec, parent_context):
  """"""

  test_specs = {k:v for (k,v) in spec.items() if k.startswith("Test")}
  local_context = {k:v for (k,v) in spec.items() if not k.startswith("Test")}

  context = reduce_contexts(parent_context, local_context)

  if test_specs:
    return {k: canonicalize_spec(v, context) for (k,v) in test_specs.items()}
  else:
    program_chunks = sum([resolve_module(m,context['Definitions']) for m in context['Modules']],[]) + [context['Program']]
    test_spec = {
      'Arguments': context['Arguments'],
      'Program': "\n".join(program_chunks),
      'Expect': context['Expect'],
    }
    return test_spec
1099475
def ParseCellSpec (spec):
        """"""
        m = __specRe.match(spec)
        (column, row) = m.groups()
        return (int(row), ColumnToIndex(column))
1119644
def split_spec(spec, sep):
    """"""
    parts = spec.rsplit(sep, 1)
    spec_start = parts[0].strip()
    spec_end = ''
    if len(parts) == 2:
        spec_end = parts[-1].strip()
    return spec_start, spec_end
324475
def require_scopes(self, scope_string):
        
        scopes = _process_scopes(scope_string)
        if not scopes:
            # asking for tokens with no scopes
            return self.filter(scopes__isnull=True)
        from .models import Scope
        scope_pks = Scope.objects.filter(name__in=scopes).values_list('pk', flat=True)
        if not len(scopes) == len(scope_pks):
            # there's a scope we don't recognize, so we can't have any tokens for it
            return self.none()
        tokens = self.all()
        for pk in scope_pks:
            tokens = tokens.filter(scopes__pk=pk)
        return tokens
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))}]
353917
def scope(self, key, *tags, default=None):
        """"""
        scope = self._scopes[key]
        tags = self._ensure_exclamation(tags)
        default = default if not default or default.startswith("!") else "!" + default

        if scope:
            scope[0] = scope[0] + tags
            scope[1] = default if default else scope[1]
        else:
            scope.append(tags)
            scope.append(default)
331738
def _fill_scope_refs(name, scope):
        
        symbol = scope.resolve(name)
        if symbol is None:
            return

        orig_scope = symbol.scope
        scope.refs[name] = orig_scope
        while scope is not orig_scope:
            scope = scope.get_enclosing_scope()
            scope.refs[name] = orig_scope
273484
def _check_and_assign_normalization_members(self, normalization_ctor,
                                              normalization_kwargs):
    """"""
    if isinstance(normalization_ctor, six.string_types):
      normalization_ctor = util.parse_string_to_constructor(normalization_ctor)
    if normalization_ctor is not None and not callable(normalization_ctor):
      raise ValueError(
          "normalization_ctor must be a callable or a string that specifies "
          "a callable, got {}.".format(normalization_ctor))
    self._normalization_ctor = normalization_ctor
    self._normalization_kwargs = normalization_kwargs
632290
def from_spec(cls, string_spec):
        
        old_ns, new_ns = string_spec.split('=')
        return cls(old_ns, new_ns)
468843
def genrepl(scope):
    """"""

    def repl(match):
        """Internal replacement function."""

        name = match.group('name')

        value = lookup(name, scope=scope)

        result = name.replace('.', '_')
        scope[result] = value

        return result

    return repl
161321
def __normalize_list(self, msg):
        """"""
        if isinstance(msg, list):
            msg = "".join(msg)
        return list(map(lambda x: x.strip(), msg.split(",")))