TODO: include aliases once the avro Ruby gem supports them
 Note: permitted values for defaults are not enforced here.
 That should be done at the schema level, and is not done currently
 in the Avro Ruby gem
766945
def normalize_field(field)
      default_value = if field.default?
                        { default: field.default }
                      else
                        {}
                      end
      super.merge(default_value)
    end
1374787
def make_valid_avro(items,          # type: Avro
                    alltypes,       # type: Dict[Text, Dict[Text, Any]]
                    found,          # type: Set[Text]
                    union=False     # type: bool
                    ):
    # type: (...) -> Union[Avro, Dict, Text]
    """"""
    # Possibly could be integrated into our fork of avro/schema.py?
    if isinstance(items, MutableMapping):
        items = copy.copy(items)
        if items.get("name") and items.get("inVocab", True):
            items["name"] = avro_name(items["name"])

        if "type" in items and items["type"] in (
                "https://w3id.org/cwl/salad#record",
                "https://w3id.org/cwl/salad#enum", "record", "enum"):
            if (hasattr(items, "get") and items.get("abstract")) or ("abstract"
                                                                     in items):
                return items
            if items["name"] in found:
                return cast(Text, items["name"])
            found.add(items["name"])
        for field in ("type", "items", "values", "fields"):
            if field in items:
                items[field] = make_valid_avro(
                    items[field], alltypes, found, union=True)
        if "symbols" in items:
            items["symbols"] = [avro_name(sym) for sym in items["symbols"]]
        return items
    if isinstance(items, MutableSequence):
        ret = []
        for i in items:
            ret.append(make_valid_avro(i, alltypes, found, union=union))  # type: ignore
        return ret
    if union and isinstance(items, string_types):
        if items in alltypes and avro_name(items) not in found:
            return cast(Dict, make_valid_avro(alltypes[items], alltypes, found,
                                              union=union))
        items = avro_name(items)
    return items
200331
function normalizeOptions(config) {
  var alias = config.alias || "foreign";
  var type = config.type;

  //
  if ((0, _typeof3.default)(config.options) !== "object" || Array.isArray(config.options)) {
    throw new TypeError("Invalid options type for " + alias);
  }

  //
  var options = (0, _assign2.default)({}, config.options);

  if (type !== "arguments") {
    if (options.filename !== undefined) {
      throw new Error(alias + ".filename is only allowed as a root argument");
    }

    if (options.babelrc !== undefined) {
      throw new Error(alias + ".babelrc is only allowed as a root argument");
    }
  }

  if (type === "preset") {
    if (options.only !== undefined) {
      throw new Error(alias + ".only is not supported in a preset");
    }
    if (options.ignore !== undefined) {
      throw new Error(alias + ".ignore is not supported in a preset");
    }
    if (options.extends !== undefined) {
      throw new Error(alias + ".extends is not supported in a preset");
    }
    if (options.env !== undefined) {
      throw new Error(alias + ".env is not supported in a preset");
    }
  }

  if (options.sourceMap !== undefined) {
    if (options.sourceMaps !== undefined) {
      throw new Error("Both " + alias + ".sourceMap and .sourceMaps have been set");
    }

    options.sourceMaps = options.sourceMap;
    delete options.sourceMap;
  }

  for (var key in options) {
    // check for an unknown option
    if (!optionNames.has(key)) {
      if (_removed2.default[key]) {
        throw new ReferenceError("Using removed Babel 5 option: " + alias + "." + key + " - " + _removed2.default[key].message);
      } else {
        // eslint-disable-next-line max-len
        var unknownOptErr = "Unknown option: " + alias + "." + key + ". Check out http://babeljs.io/docs/usage/options/ for more information about options.";

        throw new ReferenceError(unknownOptErr);
      }
    }
  }

  if (options.parserOpts && typeof options.parserOpts.parser === "string") {
    options.parserOpts = (0, _assign2.default)({}, options.parserOpts);
    options.parserOpts.parser = (0, _files.loadParser)(options.parserOpts.parser, config.dirname).value;
  }

  if (options.generatorOpts && typeof options.generatorOpts.generator === "string") {
    options.generatorOpts = (0, _assign2.default)({}, options.generatorOpts);
    options.generatorOpts.generator = (0, _files.loadGenerator)(options.generatorOpts.generator, config.dirname).value;
  }

  delete options.passPerPreset;
  delete options.plugins;
  delete options.presets;

  return options;
}
594131
function build_aliases_hash(aliases) {
  var hash={};
  _.each(aliases, function(a) {
    var m;
    if ( (m = a.match(/^([^.]+)\.(.+)$/)) ) {
      if (hash[m[1]])
        hash[m[1]].push(m[2]);
      else
        hash[m[1]] = [m[2]];
    }
  });
  
  return hash;
}
1017785
function Field(attrs, opts) {
  var name = attrs.name;
  if (typeof name != 'string' || !isValidName(name)) {
    throw new Error(f('invalid field name: %s', name));
  }

  this._name = name;
  this._type = createType(attrs.type, opts);
  this._aliases = attrs.aliases || [];

  this._order = (function (order) {
    switch (order) {
      case 'ascending':
        return 1;
      case 'descending':
        return -1;
      case 'ignore':
        return 0;
      default:
        throw new Error(f('invalid order: %j', order));
    }
  })(attrs.order === undefined ? 'ascending' : attrs.order);

  var value = attrs['default'];
  if (value !== undefined) {
    // We need to convert defaults back to a valid format (unions are
    // disallowed in default definitions, only the first type of each union is
    // allowed instead).
    // http://apache-avro.679487.n3.nabble.com/field-union-default-in-Java-td1175327.html
    var type = this._type;
    var val = type._copy(value, {coerce: 2, wrap: 2});
    // The clone call above will throw an error if the default is invalid.
    if (isPrimitive(type.getTypeName()) && type.getTypeName() !== 'bytes') {
      // These are immutable.
      this.getDefault = function () { return val; };
    } else {
      this.getDefault = function () { return type._copy(val); };
    }
  }
}
1313699
public function initializeShortAliases()
    {
        foreach ($this->schemaManager->getSchemaTables() as $table) {
            if ($tableName = $table->getName()) {
                $mainAlias = $this->getContentTypeFromAlias($table->getOption('alias'));
                $this->aliases[$mainAlias] = $tableName;
                $slugAlias = $this->normalizeClassName($this->getContentTypeFromAlias($table->getOption('alias'), true));
                $singularAlias = $this->normalizeClassName($this->getContentTypeFromAlias($table->getOption('alias'), 'singular'));

                if ($mainAlias !== $slugAlias) {
                    $this->aliases[$slugAlias] = $tableName;
                }
                if ($mainAlias !== $singularAlias) {
                    $this->aliases[$singularAlias] = $tableName;
                }
            }
        }
    }
487812
function (runtime, names) {
            var ret = [].concat(names),
                i,
                m,
                alias,
                ok = 0,
                j,
                mods = runtime['Env'].mods;
            while (!ok) {
                ok = 1;
                for (i = ret.length - 1; i >= 0; i--) {
                    if ((m = mods[ret[i]]) && (alias = m.alias)) {
                        ok = 0;
                        for (j = alias.length - 1; j >= 0; j--) {
                            if (!alias[j]) {
                                alias.splice(j, 1);
                            }
                        }
                        ret.splice.apply(ret, [i, 1].concat(indexMap(alias)));
                    }
                }
            }
            return ret;
        }
456156
def nested_alias_escape(query, alias_name)
      sql_query = Arel::Nodes::Grouping.new(to_arel_sql(query))
      Arel::Nodes::As.new(sql_query, to_arel_sql(double_quote(alias_name)))
    end
849578
def _add_aliases(self, node):
        
        assert isinstance(node, (ast.Import, ast.ImportFrom))
        for name_and_alias in node.names:
            # Store only top-level module name ("os.path" -> "os").
            # We can't easily detect when "os.path" is used.
            name = name_and_alias.name.partition('.')[0]
            alias = name_and_alias.asname
            self._define(
                self.defined_imports, alias or name, node,
                confidence=90, ignore=_ignore_import)
            if alias is not None:
                self.used_names.add(name_and_alias.name)
668594
def register_property_alias(aliaz, attribute)
      std = standard_attribute(attribute)
      raise ArgumentError.new("#{self} attribute not found: #{attribute}") if std.nil?
      @local_std_prop_hash[aliaz.to_sym] = std
    end
545816
def field_added(name, type, args, options)
      if (default = options[:ruby_default])
        attr_default name, default
      elsif (default = options[:default]) && default.is_a?(Proc)
        ActiveSupport::Deprecation.warn(':default => Proc has been deprecated. Use :ruby_default.', caller)
        attr_default name, default
        options.delete(:default)
        options[:ruby_default] = default
      end
    end
962262
def make_alias(self, entry):
        
        entry.add_alias(self)
        self.alias = entry
        self.scope = entry.scope  # Local aliases can be "global" (static)
        self.byref = entry.byref
        self.offset = entry.offset
        self.addr = entry.addr
709583
function combineAliases (aliases) {
  var aliasArrays = []
  var change = true
  var combined = {}

  // turn alias lookup hash {key: ['alias1', 'alias2']} into
  // a simple array ['key', 'alias1', 'alias2']
  Object.keys(aliases).forEach(function (key) {
    aliasArrays.push(
      [].concat(aliases[key], key)
    )
  })

  // combine arrays until zero changes are
  // made in an iteration.
  while (change) {
    change = false
    for (var i = 0; i < aliasArrays.length; i++) {
      for (var ii = i + 1; ii < aliasArrays.length; ii++) {
        var intersect = aliasArrays[i].filter(function (v) {
          return aliasArrays[ii].indexOf(v) !== -1
        })

        if (intersect.length) {
          aliasArrays[i] = aliasArrays[i].concat(aliasArrays[ii])
          aliasArrays.splice(ii, 1)
          change = true
          break
        }
      }
    }
  }

  // map arrays back to the hash-lookup (de-dupe while
  // we're at it).
  aliasArrays.forEach(function (aliasArray) {
    aliasArray = aliasArray.filter(function (v, i, self) {
      return self.indexOf(v) === i
    })
    combined[aliasArray.pop()] = aliasArray
  })

  return combined
}
470193
def default_fields_for(value, operator = nil)

      column_types  = [:virtual]
      column_types += [:string, :text]                if [nil, :like, :unlike, :ne, :eq].include?(operator)
      column_types += [:double, :float, :decimal]     if value =~ NUMERICAL_REGXP
      column_types += [:integer]                      if value =~ INTEGER_REGXP
      column_types += [:uuid]                         if value =~ UUID_REGXP
      column_types += [:datetime, :date, :timestamp]  if (parse_temporal(value))

      default_fields.select { |field| !field.set? && column_types.include?(field.type) }
    end
1102541
def get_export_options(model, options)
      default_options = { only: model.attribute_names.map(&:to_sym),
                          except: [],
                          methods: [],
                          header: true }
      options = default_options.merge(options)
      unless options[:only].is_a?(Array) && options[:except].is_a?(Array) && options[:methods].is_a?(Array)
        raise ArgumentError, 'Exportable: Expecting Array type for field options'
      end
      fields = options[:only] - options[:except] + options[:methods]
      { fields: fields, header: options[:header] }
    end
768615
def apply_default(name)
      unless attributes.key?(name)
        if field = fields[name]
          default = field.eval_default(self)
          unless default.nil? || field.lazy?
            attribute_will_change!(name)
            attributes[name] = default
          end
        end
      end
    end
1171470
function Mixed (path, options) {
  // make sure empty array defaults are handled
  if (options &&
      options.default &&
      Array.isArray(options.default) &&
      0 === options.default.length) {
    options.default = Array;
  }

  SchemaType.call(this, path, options);
}