Adds imports, flattening them to make lookup more efficient.  This is particularly useful
when a builder instance is long lived.
333298
public _Private_IonManagedBinaryWriterBuilder withFlatImports(final SymbolTable... tables)
    {
        if (tables != null)
        {
            return withFlatImports(Arrays.asList(tables));
        }
        return this;
    }
336255
def __setIncludes(self, schema):
        
        for schemaLocation, val in schema.includes.items(): 
            if self._includes.has_key(schemaLocation):
                schema.addIncludeSchema(schemaLocation, self._imports[schemaLocation])
86224
def load_imports # :nodoc:
      while fn = @pending_imports.shift
        next if @imported.member?(fn)
        fn_task = lookup(fn) and fn_task.invoke
        ext = File.extname(fn)
        loader = @loaders[ext] || @default_loader
        loader.load(fn)
        if fn_task = lookup(fn) and fn_task.needed?
          fn_task.reenable
          fn_task.invoke
          loader.load(fn)
        end
        @imported << fn
      end
    end
576070
def _add_formatted_imports(self) -> None:
        
        sort_ignore_case = self.config['force_alphabetical_sort_within_sections']
        sections = itertools.chain(self.sections, self.config['forced_separate'])  # type: Iterable[str]

        if self.config['no_sections']:
            self.imports['no_sections'] = {'straight': [], 'from': {}}
            for section in sections:
                self.imports['no_sections']['straight'].extend(self.imports[section].get('straight', []))
                self.imports['no_sections']['from'].update(self.imports[section].get('from', {}))
            sections = ('no_sections', )

        output = []  # type: List[str]
        pending_lines_before = False
        for section in sections:
            straight_modules = self.imports[section]['straight']
            straight_modules = nsorted(straight_modules, key=lambda key: self._module_key(key, self.config, section_name=section))
            from_modules = self.imports[section]['from']
            from_modules = nsorted(from_modules, key=lambda key: self._module_key(key, self.config, section_name=section))

            section_output = []  # type: List[str]
            if self.config['from_first']:
                self._add_from_imports(from_modules, section, section_output, sort_ignore_case)
                if self.config['lines_between_types'] and from_modules and straight_modules:
                    section_output.extend([''] * self.config['lines_between_types'])
                self._add_straight_imports(straight_modules, section, section_output)
            else:
                self._add_straight_imports(straight_modules, section, section_output)
                if self.config['lines_between_types'] and from_modules and straight_modules:
                    section_output.extend([''] * self.config['lines_between_types'])
                self._add_from_imports(from_modules, section, section_output, sort_ignore_case)

            if self.config['force_sort_within_sections']:
                def by_module(line: str) -> str:
                    section = 'B'
                    if line.startswith('#'):
                        return 'AA'

                    line = re.sub('^from ', '', line)
                    line = re.sub('^import ', '', line)
                    if line.split(' ')[0] in self.config['force_to_top']:
                        section = 'A'
                    if not self.config['order_by_type']:
                        line = line.lower()
                    return '{0}{1}'.format(section, line)
                section_output = nsorted(section_output, key=by_module)

            section_name = section
            no_lines_before = section_name in self.config['no_lines_before']

            if section_output:
                if section_name in self.place_imports:
                    self.place_imports[section_name] = section_output
                    continue

                section_title = self.config.get('import_heading_' + str(section_name).lower(), '')
                if section_title:
                    section_comment = "# {0}".format(section_title)
                    if section_comment not in self.out_lines[0:1] and section_comment not in self.in_lines[0:1]:
                        section_output.insert(0, section_comment)

                if pending_lines_before or not no_lines_before:
                    output += ([''] * self.config['lines_between_sections'])

                output += section_output

                pending_lines_before = False
            else:
                pending_lines_before = pending_lines_before or not no_lines_before

        while output and output[-1].strip() == '':
            output.pop()
        while output and output[0].strip() == '':
            output.pop(0)

        output_at = 0
        if self.import_index < self.original_num_of_lines:
            output_at = self.import_index
        elif self._first_comment_index_end != -1 and self._first_comment_index_start <= 2:
            output_at = self._first_comment_index_end
        self.out_lines[output_at:0] = output

        imports_tail = output_at + len(output)
        while [character.strip() for character in self.out_lines[imports_tail: imports_tail + 1]] == [""]:
            self.out_lines.pop(imports_tail)

        if len(self.out_lines) > imports_tail:
            next_construct = ""
            self._in_quote = False  # type: Any
            tail = self.out_lines[imports_tail:]

            for index, line in enumerate(tail):
                in_quote = self._in_quote
                if not self._skip_line(line) and line.strip():
                    if line.strip().startswith("#") and len(tail) > (index + 1) and tail[index + 1].strip():
                        continue
                    next_construct = line
                    break
                elif not in_quote:
                    parts = line.split()
                    if len(parts) >= 3 and parts[1] == '=' and "'" not in parts[0] and '"' not in parts[0]:
                        next_construct = line
                        break

            if self.config['lines_after_imports'] != -1:
                self.out_lines[imports_tail:0] = ["" for line in range(self.config['lines_after_imports'])]
            elif next_construct.startswith("def ") or next_construct.startswith("class ") or \
               next_construct.startswith("@") or next_construct.startswith("async def"):
                self.out_lines[imports_tail:0] = ["", ""]
            else:
                self.out_lines[imports_tail:0] = [""]

        if self.place_imports:
            new_out_lines = []
            for index, line in enumerate(self.out_lines):
                new_out_lines.append(line)
                if line in self.import_placements:
                    new_out_lines.extend(self.place_imports[self.import_placements[line]])
                    if len(self.out_lines) <= index or self.out_lines[index + 1].strip() != "":
                        new_out_lines.append("")
            self.out_lines = new_out_lines
1064032
private void compactImports() {
        Iterator<TypeName> i = imports.iterator();
        while (i.hasNext()) {
            TypeName importName = i.next();
            if (!importName.getSimpleName().equals("*") && registeredPackages.contains(importName.getPackageName())) {
                i.remove();
            }
        }
    }
1326636
private void addImports(Collection<String> sink,
      Collection<String> paths, Multimap<String, String> publicImports) {
    for (String path : paths) {
      if (sink.add(path)) {
        addImports(sink, publicImports.get(path), publicImports);
      }
    }
  }
1322674
public void addStaticImport(String fullyQualifiedName) {
    String[] importSplit = fullyQualifiedName.split("\\.");
    String symbolName = importSplit[importSplit.length - 1];

    methodNameToFullyQualifiedName.put(symbolName, fullyQualifiedName);
    propertyNameToFullyQualifiedName.put(symbolName, fullyQualifiedName);
  }
553958
function(parentFile, importedFile) {
    if (parentFile.includedFiles.indexOf(importedFile.file) < 0) {
      // Add imported file reference:
      parentFile.includedFiles.push(importedFile.file);

      // Add all of imported file's imports:
      for (var i=0; i < importedFile.includedFiles.length; i++) {
        var includeFile = importedFile.includedFiles[i];
        if (parentFile.includedFiles.indexOf(includeFile) < 0) {
          parentFile.includedFiles.push(includeFile);
        }
      }
    }
  }
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)
843723
public void addMunged (Class<?> clazz, String... replace)
    {
        String name = clazz.getName();
        for (int ii = 0; ii < replace.length; ii += 2) {
            name = name.replace(replace[ii], replace[ii+1]);
        }
        _imports.add(name);
    }
1310851
private void ensureBuilders() {
    if (this.builders == null) {
      this.builders = new ArrayList<SingleFieldBuilder<MType, BType, IType>>(messages.size());
      for (int i = 0; i < messages.size(); i++) {
        builders.add(null);
      }
    }
  }
482978
public void addImportVersionClass(I_CmsImport importVersionClass) {

        if (LOG.isDebugEnabled()) {
            LOG.debug(
                Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_ADDED_IMPORT_VERSION_1, importVersionClass));
        }
        m_importVersionClasses.add(importVersionClass);
    }
968659
def addImportSchema(self, schema):
        
        if not isinstance(schema, XMLSchema):
            raise TypeError, 'expecting a Schema instance'
        if schema.targetNamespace != self.targetNamespace:
            self._imported_schemas[schema.targetNamespace] = schema
        else:
            raise SchemaError, 'import schema bad targetNamespace'
527517
public void add(Make make)
  {
    if (make == this)
      throw new IllegalArgumentException("Can't add self as a dependency.");

    int p = _makeList.indexOf(make);

    // matching make overrides old ones
    // server/10ik
    if (p >= 0) {
      Make oldMake = _makeList.get(p);

      if (oldMake != make)
        _makeList.add(p, make);
    }
    else
      _makeList.add(make);
  }
331007
@Nonnull
	public Imports copyAndAdd(final Imports imports) {
		Check.notNull(imports, "imports");
		return copyAndAdd(imports.asList());
	}
768245
private void processStaticImport( DetailAST aAST ) {
        final FullIdent name = FullIdent.createFullIdent(aAST.getFirstChild().getNextSibling());
        if ((name != null) && !name.getText().endsWith(".*")) {
            imports.add(name);
        }
    }
755568
public void setImports(java.util.Collection<String> imports) {
        if (imports == null) {
            this.imports = null;
            return;
        }

        this.imports = new com.amazonaws.internal.SdkInternalList<String>(imports);
    }