Add a file and all its recursive dependencies to the graph.

        Args:
          filename: The name of the file.
          trim: Whether to trim the dependencies of builtin and system files.
765279
def add_file_recursive(self, filename, trim=False):
        

        assert not self.final, 'Trying to mutate a final graph.'
        self.add_source_file(filename)
        queue = collections.deque([filename])
        seen = set()
        while queue:
            filename = queue.popleft()
            self.graph.add_node(filename)
            try:
                deps, broken = self.get_file_deps(filename)
            except parsepy.ParseError:
                # Python couldn't parse `filename`. If we're sure that it is a
                # Python file, we mark it as unreadable and keep the node in the
                # graph so importlab's callers can do their own syntax error
                # handling if desired.
                if filename.endswith('.py'):
                    self.unreadable_files.add(filename)
                else:
                    self.graph.remove_node(filename)
                continue
            for f in broken:
                self.broken_deps[filename].add(f)
            for f in deps:
                if self.follow_file(f, seen, trim):
                    queue.append(f)
                    seen.add(f)
                self.graph.add_node(f)
                self.graph.add_edge(filename, f)
1186497
def chmod_add_excute(filename):
        
        st = os.stat(filename)
        os.chmod(filename, st.st_mode | stat.S_IEXEC)
1201237
def add_file(self, file_to_add):
        
        from .files import File
        assert isinstance(file_to_add, File), "Files being added must be instances of a subclass of File class"
        file_to_add.node = self
        if file_to_add not in self.files:
            self.files.append(file_to_add)
471689
def _add_filename_details(full_f):
    
    out = {"vrn_file": full_f}
    f = os.path.basename(full_f)
    for vc in list(genotype.get_variantcallers().keys()) + ["ensemble"]:
        if f.find("-%s.vcf" % vc) > 0:
            out["variantcaller"] = vc
    if f.find("-germline-") >= 0:
        out["germline"] = full_f
    return out
714746
def add_image(self, filename, *, width=NoEscape(r'0.8\textwidth'),
                  placement=NoEscape(r'\centering')):
        

        if width is not None:
            if self.escape:
                width = escape_latex(width)

            width = 'width=' + str(width)

        if placement is not None:
            self.append(placement)

        self.append(StandAloneGraphic(image_options=width,
                                      filename=fix_filename(filename)))
918780
def add(self, files, items):
        
        if isinstance(files, (str, bytes)):
            files = iter([files])
        for pathname in files:
            try:
                values = self._filemap[pathname]
            except KeyError:
                self._filemap[pathname] = items
            else:
                values.extend(items)
1036249
def add(self, files):
    
    if files.__class__.__name__ == 'str':
      self._files.append(files)
    else:
      self._files.extend(files)
1022189
def _addDataFile(self, filename):
        
        if filename.endswith('.ttl'):
            self._rdfGraph.parse(filename, format='n3')
        else:
            self._rdfGraph.parse(filename, format='xml')
392420
def add_history(self, filename):
        
        filename = encoding.to_unicode_from_fs(filename)
        if filename in self.filenames:
            return
        editor = codeeditor.CodeEditor(self)
        if osp.splitext(filename)[1] == '.py':
            language = 'py'
        else:
            language = 'bat'
        editor.setup_editor(linenumbers=self.get_option('line_numbers'),
                            language=language,
                            scrollflagarea=False)
        editor.focus_changed.connect(lambda: self.focus_changed.emit())
        editor.setReadOnly(True)
        color_scheme = self.get_color_scheme()
        editor.set_font( self.get_plugin_font(), color_scheme )
        editor.toggle_wrap_mode( self.get_option('wrap') )

        # Avoid a possible error when reading the history file
        try:
            text, _ = encoding.read(filename)
        except (IOError, OSError):
            text = "# Previous history could not be read from disk, sorry\n\n"
        text = normalize_eols(text)
        linebreaks = [m.start() for m in re.finditer('\n', text)]
        maxNline = self.get_option('max_entries')
        if len(linebreaks) > maxNline:
            text = text[linebreaks[-maxNline - 1] + 1:]
            # Avoid an error when trying to write the trimmed text to
            # disk.
            # See issue 9093
            try:
                encoding.write(text, filename)
            except (IOError, OSError):
                pass
        editor.set_text(text)
        editor.set_cursor_position('eof')

        self.editors.append(editor)
        self.filenames.append(filename)
        index = self.tabwidget.addTab(editor, osp.basename(filename))
        self.find_widget.set_editor(editor)
        self.tabwidget.setTabToolTip(index, filename)
        self.tabwidget.setCurrentIndex(index)
260331
function addFile(filename) {
        if (ignoredPaths.contains(filename)) {
            return;
        }
        filename = fs.realpathSync(filename);
        if (added[filename]) {
            return;
        }
        files.push(filename);
        added[filename] = true;
    }
206954
def add_path(self, path, path_filter=None):
        
        for root, _, files in os.walk(path):
            for filename in files:
                full_path_and_filename = os.path.join(root, filename)
                if path_filter is None or path_filter(full_path_and_filename):
                    relative_path_and_filename = full_path_and_filename.replace(path + '/', '')
                    with open(full_path_and_filename, 'rb') as handle:
                        self.files[relative_path_and_filename] = b64encode(handle.read()).decode('utf-8')
716155
def insert(self, filename):
        
        errors = []
        if os.path.isfile(filename):
            log.info('loading IOC from: {}'.format(filename))
            if not self.parse(filename):
                log.warning('Failed to prase [{}]'.format(filename))
                errors.append(filename)
        elif os.path.isdir(filename):
            log.info('loading IOCs from: {}'.format(filename))
            for fn in glob.glob(filename + os.path.sep + '*.ioc'):
                if not os.path.isfile(fn):
                    continue
                else:
                    if not self.parse(fn):
                        log.warning('Failed to parse [{}]'.format(filename))
                        errors.append(fn)
        else:
            pass
        log.info('Parsed [%s] IOCs' % str(len(self)))
        return errors
742111
def add_file_to_repo(filename):
    
    try:
        repo = Repo()
        index = repo.index
        index.add([_delta_dir() + filename])
    except Exception as e:
        print("exception while gitadding file: %s" % e.message)
907273
def add_path(self, path):
        
        abspath = os.path.abspath(path)
        self.children.append(_build_project_tree(abspath, self.followsymlinks, self.file_filter))
1322463
def add_line_if_absent(filename: str, line: str) -> None:
    
    assert "\n" not in line
    if not is_line_in_file(filename, line):
        log.info("Appending line {!r} to file {!r}", line, filename)
        with open(filename, "a") as file:
            file.writelines([line])
975065
def prepare_filename_graph!
      @filename_graph = {}
      @encountered_graph.each do |filename, encountered_classes|
        dependent_class_names =
          if @definition_graph[filename].nil?
            encountered_classes
          else
            class_names_defined_in_file = @definition_graph[filename].keys
            # all superclass names that this file depends on
            class_names_dependent_by_superclass = @definition_graph[filename].values.compact - class_names_defined_in_file
            class_names_dependent_by_use = encountered_classes - class_names_defined_in_file
            class_names_dependent_by_superclass + class_names_dependent_by_use
          end
        dependent_class_names.each do |dep|
          dependent_definition_fname = @definition_graph.detect { |fname, hash| hash.has_key?(dep) }.first rescue nil
          if dependent_definition_fname
            @filename_graph[filename] ||= []
            unless @filename_graph[filename].include?(dependent_definition_fname)
              @filename_graph[filename] << dependent_definition_fname
            end
          end
        end
      end
    end
311492
function addModuleToDependencies(cwd, name, version) {
  version = version || 'latest';
  let pkgFile = { dependencies: {} };
  const pkgPath = path.join(cwd, 'package.json');
  if (fs.existsSync(pkgPath)) {
    pkgFile = fs.readJsonSync(pkgPath);
  }
  pkgFile.dependencies[name] = version;
  fs.outputJsonSync(pkgPath, pkgFile);
}