Extract all types of Modification INDRA Statements.
435268
def get_modifications(self):
        """"""
        # Get all the specific mod types
        mod_event_types = list(ont_to_mod_type.keys())
        # Add ONT::PTMs as a special case
        mod_event_types += ['ONT::PTM']
        mod_events = []
        for mod_event_type in mod_event_types:
            events = self.tree.findall("EVENT/[type='%s']" % mod_event_type)
            mod_extracted = self.extracted_events.get(mod_event_type, [])
            for event in events:
                event_id = event.attrib.get('id')
                if event_id not in mod_extracted:
                    mod_events.append(event)

        # Iterate over all modification events
        for event in mod_events:
            stmts = self._get_modification_event(event)
            if stmts:
                for stmt in stmts:
                    self.statements.append(stmt)
980464
def modified_lines(self, r, file_name):
        """"""
        cmd = self.file_diff_cmd(r, file_name)
        diff = shell_out_ignore_exitcode(cmd, cwd=self.root)
        return list(self.modified_lines_from_diff(diff))
587466
def _get_entity_mods(bpe):
        """"""
        if _is_entity(bpe):
            features = bpe.getFeature().toArray()
        else:
            features = bpe.getEntityFeature().toArray()
        mods = []
        for feature in features:
            if not _is_modification(feature):
                continue
            mc = BiopaxProcessor._extract_mod_from_feature(feature)
            if mc is not None:
                mods.append(mc)
        return mods
273379
def getInstIdFromIndices(self, *indices):
        """"""
        try:
            return self._idxToIdCache[indices]
        except TypeError:
            cacheable = False
        except KeyError:
            cacheable = True
        idx = 0
        instId = ()
        parentIndices = []
        for impliedFlag, modName, symName in self._indexNames:
            if idx >= len(indices):
                break
            mibObj, = mibBuilder.importSymbols(modName, symName)
            syntax = mibObj.syntax.clone(indices[idx])
            instId += self.valueToOid(syntax, impliedFlag, parentIndices)
            parentIndices.append(syntax)
            idx += 1
        if cacheable:
            self._idxToIdCache[indices] = instId
        return instId
649660
def export_modifications(self):
        

        result = {}

        for key, value in self.__modified_data__.items():
            try:
                result[key] = value.export_data()
            except AttributeError:
                result[key] = value

        for key, value in self.__original_data__.items():
            if key in result.keys() or key in self.__deleted_fields__:
                continue
            try:
                if not value.is_modified():
                    continue
                modifications = value.export_modifications()
            except AttributeError:
                continue

            try:
                result.update({'{}.{}'.format(key, f): v for f, v in modifications.items()})
            except AttributeError:
                result[key] = modifications

        return result
1277113
def extract_deps(bundles, log=None):
    """"""
    def _flatten(bundle):
        deps = []
        if hasattr(bundle, 'npm'):
            deps.append(bundle.npm)
        for content in bundle.contents:
            if isinstance(content, BundleBase):
                deps.extend(_flatten(content))
        return deps

    flatten_deps = []
    for bundle in bundles:
        flatten_deps.extend(_flatten(bundle))

    packages = defaultdict(list)
    for dep in flatten_deps:
        for pkg, version in dep.items():
            packages[pkg].append(version)

    deps = {}
    for package, versions in packages.items():
        deps[package] = semver.max_satisfying(versions, '*', True)

        if log and len(versions) > 1:
            log('Warn: {0} version {1} resolved to: {2}'.format(
                repr(package), versions, repr(deps[package])
            ))

    return deps
148874
public void findAllArtifacts() {
        binArtifacts = findAllFiles(binDir);
        gensrcArtifacts = findAllFiles(gensrcDir);
        headerArtifacts = findAllFiles(headerDir);
    }
11433
def extract_statements(self):
        

        # Look for events that have an AGENT and an AFFECTED, and get the
        # start and ending text indices for each.
        query = prefixes + """
        SELECT
            ?agent_start
            ?agent_end
            ?affected_start
            ?affected_end
        WHERE {
            ?rel role:AGENT ?agent .
            ?rel role:AFFECTED ?affected .
            ?agent lf:start ?agent_start .
            ?agent lf:end ?agent_end .
            ?affected lf:start ?affected_start .
            ?affected lf:end ?affected_end .
        }
        """
        results = self.graph.query(query)
        for res in results:
            # Make a statement for each query match
            self.extract_statement_from_query_result(res)

        # Look for events that have an AGENT and a RESULT, and get the start
        # and ending text indices for each.
        query = query.replace('role:AFFECTED', 'role:RESULT')
        results = self.graph.query(query)
        for res in results:
            # Make a statement for each query match
            self.extract_statement_from_query_result(res)
773096
def _get_changes(rsync_out):
    '''
    
    '''
    copied = list()
    deleted = list()

    for line in rsync_out.split("\n\n")[0].split("\n")[1:]:
        if line.startswith("deleting "):
            deleted.append(line.split(" ", 1)[-1])
        else:
            copied.append(line)

    ret = {
        'copied': os.linesep.join(sorted(copied)) or "N/A",
        'deleted': os.linesep.join(sorted(deleted)) or "N/A",
    }

    # Return whether anything really changed
    ret['changed'] = not ((ret['copied'] == 'N/A') and (ret['deleted'] == 'N/A'))

    return ret
478311
def find_and_modify(self, query={}, update=None,
                        upsert=False, sort=None, full_response=False,
                        manipulate=False, **kwargs):
        
        warnings.warn("find_and_modify is deprecated, use find_one_and_delete"
                      ", find_one_and_replace, or find_one_and_update instead",
                      DeprecationWarning, stacklevel=2)

        if not update and not kwargs.get('remove', None):
            raise ValueError("Must either update or remove")

        if update and kwargs.get('remove', None):
            raise ValueError("Can't do both update and remove")

        # No need to include empty args
        if query:
            kwargs['query'] = query
        if update:
            kwargs['update'] = update
        if upsert:
            kwargs['upsert'] = upsert
        if sort:
            # Accept a list of tuples to match Cursor's sort parameter.
            if isinstance(sort, list):
                kwargs['sort'] = helpers._index_document(sort)
            # Accept OrderedDict, SON, and dict with len == 1 so we
            # don't break existing code already using find_and_modify.
            elif (isinstance(sort, ORDERED_TYPES) or
                  isinstance(sort, dict) and len(sort) == 1):
                warnings.warn("Passing mapping types for `sort` is deprecated,"
                              " use a list of (key, direction) pairs instead",
                              DeprecationWarning, stacklevel=2)
                kwargs['sort'] = sort
            else:
                raise TypeError("sort must be a list of (key, direction) "
                                "pairs, a dict of len 1, or an instance of "
                                "SON or OrderedDict")

        fields = kwargs.pop("fields", None)
        if fields is not None:
            kwargs["fields"] = helpers._fields_list_to_dict(fields, "fields")

        collation = validate_collation_or_none(kwargs.pop('collation', None))

        cmd = SON([("findAndModify", self.__name)])
        cmd.update(kwargs)

        write_concern = self._write_concern_for_cmd(cmd, None)

        def _find_and_modify(session, sock_info, retryable_write):
            if (sock_info.max_wire_version >= 4 and
                    not write_concern.is_server_default):
                cmd['writeConcern'] = write_concern.document
            result = self._command(
                sock_info, cmd, read_preference=ReadPreference.PRIMARY,
                allowable_errors=[_NO_OBJ_ERROR], collation=collation,
                session=session, retryable_write=retryable_write,
                user_fields=_FIND_AND_MODIFY_DOC_FIELDS)

            _check_write_command_response(result)
            return result

        out = self.__database.client._retryable_write(
            write_concern.acknowledged, _find_and_modify, None)

        if not out['ok']:
            if out["errmsg"] == _NO_OBJ_ERROR:
                return None
            else:
                # Should never get here b/c of allowable_errors
                raise ValueError("Unexpected Error: %s" % (out,))

        if full_response:
            return out
        else:
            document = out.get('value')
            if manipulate:
                document = self.__database._fix_outgoing(document, self)
            return document
1086574
def _find_logs(self, compile_workunit):
    """"""
    for idx, workunit in enumerate(compile_workunit.children):
      for output_name, outpath in workunit.output_paths().items():
        if output_name in ('stdout', 'stderr'):
          yield idx, workunit.name, output_name, outpath
650706
def extract_statement_from_query_result(self, res):
        
        agent_start, agent_end, affected_start, affected_end = res

        # Convert from rdflib literals to python integers so we can use
        # them to index strings
        agent_start = int(agent_start)
        agent_end = int(agent_end)
        affected_start = int(affected_start)
        affected_end = int(affected_end)

        # Find the text corresponding to these indices
        agent = self.text[agent_start:agent_end]
        affected = self.text[affected_start:affected_end]

        # Strip off surrounding whitespace
        agent = agent.lstrip().rstrip()
        affected = affected.lstrip().rstrip()

        # Make an Agent object for both the subject and the object
        subj = Agent(agent, db_refs={'TEXT': agent})
        obj = Agent(affected, db_refs={'TEXT': affected})

        statement = Influence(subj=subj, obj=obj)

        # Add the statement to the list of statements
        self.statements.append(statement)
676820
def _get_changed_cfg_pkgs(self, data):
        '''
        
        '''
        f_data = dict()
        for pkg_name, pkg_files in data.items():
            cfgs = list()
            cfg_data = list()
            if self.grains_core.os_data().get('os_family') == 'Debian':
                cfg_data = salt.utils.stringutils.to_str(self._syscall("dpkg", None, None, '--verify',
                                                           pkg_name)[0]).split(os.linesep)
            elif self.grains_core.os_data().get('os_family') in ['Suse', 'redhat']:
                cfg_data = salt.utils.stringutils.to_str(self._syscall("rpm", None, None, '-V', '--nodeps', '--nodigest',
                                                           '--nosignature', '--nomtime', '--nolinkto',
                                                           pkg_name)[0]).split(os.linesep)
            for line in cfg_data:
                line = line.strip()
                if not line or line.find(" c ") < 0 or line.split(" ")[0].find("5") < 0:
                    continue
                cfg_file = line.split(" ")[-1]
                if cfg_file in pkg_files:
                    cfgs.append(cfg_file)
            if cfgs:
                f_data[pkg_name] = cfgs

        return f_data
161658
def _normalize_merge_diff_incr(diff):
        
        new_diff = []

        changes_found = False
        for line in diff.splitlines():
            if re.search(r"order-dependent line.*re-ordered", line):
                changes_found = True
            elif "No changes were found" in line:
                # IOS in the re-order case still claims "No changes were found"
                if not changes_found:
                    return ""
                else:
                    continue

            if line.strip() == "end":
                continue
            elif "List of Commands" in line:
                continue
            # Filter blank lines and prepend +sign
            elif line.strip():
                if re.search(r"^no\s+", line.strip()):
                    new_diff.append("-" + line)
                else:
                    new_diff.append("+" + line)
        return "\n".join(new_diff)
407288
def get_statements(self):
        """"""
        for k, v in self.reader_output.items():
            for interaction in v['interactions']:
                self._process_interaction(k, interaction, v['text'], self.pmid,
                                          self.extra_annotations)
945583
def extract_modified_lines(file_path, options)
      lines = Set.new

      flags = '--cached' if options[:staged]
      refs = options[:refs]
      subcmd = options[:subcmd] || 'diff'

      `git #{subcmd} --no-color --no-ext-diff -U0 #{flags} #{refs} -- "#{file_path}"`.
        scan(DIFF_HUNK_REGEX) do |start_line, lines_added|
        lines_added = (lines_added || 1).to_i # When blank, one line was added
        cur_line = start_line.to_i

        lines_added.times do
          lines.add cur_line
          cur_line += 1
        end
      end

      lines
    end
879086
def extract_code_objects(pe):
    """"""
    script_res = _get_scripts_resource(pe)
    dump = _resource_dump(pe, script_res)
    return _get_co_from_dump(dump)