p113380 - rewrite entire method of product interoperability.
435599
private void writeObject(java.io.ObjectOutputStream out) throws IOException
    {
        out.defaultWriteObject();

        // Write out header information.
        out.write(EYECATCHER);
        out.writeShort(PLATFORM);
        out.writeShort(ivActualVersion);

        // Write EJBHome to output stream using HandleDelegate object.
        HandleHelper.lookupHandleDelegate().writeEJBHome(ivEjbHome, out);

        // If actual version is V1, then we need to write the V1 data.
        if (ivActualVersion == Constants.HOME_HANDLE_V1)
        {
            out.writeObject(ivInitialContextProperties);
            out.writeUTF(ivHomeInterface);
            out.writeUTF(ivJndiName);
        }
    }
1129239
def rewrite_properties(self, properties):
        """"""
        with self.__library_storage_lock:
            self.__library_storage = properties
        self.__write_properties(None)
335729
def rewrite_file_imports(item, vendored_libs):
    """"""
    text = item.read_text(encoding='utf-8')
    for lib in vendored_libs:
        text = re.sub(
            r'(\n\s*)import %s(\n\s*)' % lib,
            r'\1from pythonfinder._vendor import %s\2' % lib,
            text,
        )
        text = re.sub(
            r'(\n\s*)from %s' % lib,
            r'\1from pythonfinder._vendor.%s' % lib,
            text,
        )
    item.write_text(text, encoding='utf-8')
810003
function createIssue (client, repo, title, body, labels) {
  return client.createIssue(repo, title, body, labels).then(convertIssue);
}
274512
public static String rewriteMethodSignature(ClassNameRewriter classNameRewriter, String methodSignature) {
        if (classNameRewriter != IdentityClassNameRewriter.instance()) {
            SignatureParser parser = new SignatureParser(methodSignature);

            StringBuilder buf = new StringBuilder();

            buf.append('(');
            for (Iterator<String> i = parser.parameterSignatureIterator(); i.hasNext();) {
                buf.append(rewriteSignature(classNameRewriter, i.next()));
            }

            buf.append(')');
            buf.append(rewriteSignature(classNameRewriter, parser.getReturnTypeSignature()));

            methodSignature = buf.toString();
        }

        return methodSignature;
    }
1153295
def fix_for_specific_versions(self, rdf_data, to_replace):
        

        # Load the graph as is so that we can query
        g = self.parse(rdf_data)

        # Retreive the exporter name and version
        query = """
prefix nidm_spm_results_nidm: <http://purl.org/nidash/nidm#NIDM_0000168>
prefix nidm_nidmfsl: <http://purl.org/nidash/nidm#NIDM_0000167>
prefix nidm_softwareVersion: <http://purl.org/nidash/nidm#NIDM_0000122>

SELECT DISTINCT ?type ?version ?exp_act WHERE {
    {?exporter a nidm_nidmfsl: .} UNION {?exporter a nidm_spm_results_nidm: .}.
    ?exporter a ?type ;
        nidm_softwareVersion: ?version .

    ?exp_act prov:wasAssociatedWith ?exporter .

    FILTER ( ?type NOT IN (prov:SoftwareAgent, prov:Agent))
}
        """

        sd = g.query(query)
        objects = dict()
        if sd:
            for row in sd:
                argums = row.asdict()
                if (argums['type'] == NIDM_SPM_RESULTS_NIDM and
                        (argums['version'].eq('12.6903') or
                         argums['version'].eq('12.575ac2c'))):
                    warnings.warn('Applying fixes for SPM exporter ' +
                                  str(argums['version']))
                    # crypto namespace inconsistent with NIDM-Results spec
                    to_replace[('http://id.loc.gov/vocabulary/preservation/' +
                                'cryptographicHashFunctions/')] = (
                                'http://id.loc.gov/vocabulary/preservation/' +
                                'cryptographicHashFunctions#')
                    # Missing 'activity' attribute in qualified Generation
                    to_replace['a prov:Generation .'] = (
                        'a prov:Generation ; prov:activity <' +
                        str(argums['exp_act']) + '> .')

        # Avoid confusion between attribute and
        # class uncorrected p-value
        # cf. https://github.com/incf-nidash/nidm/issues/421
        to_replace[('@prefix nidm_PValueUncorrected: ' +
                    '<http://purl.org/nidash/nidm#NIDM_0000160>')] = (
                    '@prefix nidm_UncorrectedPValue: ' +
                    '<http://purl.org/nidash/nidm#NIDM_0000160>')
        to_replace['nidm_PValueUncorrected'] = 'nidm_UncorrectedPValue'

        if to_replace is not None:
            for to_rep, replacement in to_replace.items():
                rdf_data = rdf_data.replace(to_rep, replacement)

        return rdf_data
618957
function(mod, modName, rawCode, done) {
  var resolveModule = function(requiredName) {
    return mod.getModuleIDByOrigin(requiredName);
  };
  try {
    var transformedCode = fixReactTransform(transform(rawCode, {harmony: true}));
    var modularizedCode =
      Modularizer.modularize(modName, transformedCode, resolveModule);
    originalSourceCache[modName] = rawCode;
    transformCache[modName] = modularizedCode;
    transformTimes[modName] = Date.now();
    done(null, transformCache[modName]);
  } catch (e) {
    // Original error only includes esprima trace!
    var parseError =
      new Error('Syntax Error: ' + mod.path + ' ' + e.toString());
    done(parseError);
  }
}
903820
private void writeAllEnvelopes(boolean reuse)
    {
        // perform remove of m:n indirection table entries first
        performM2NUnlinkEntries();

        Iterator iter;
        // using clone to avoid ConcurentModificationException
        iter = ((List) mvOrderOfIds.clone()).iterator();
        while(iter.hasNext())
        {
            ObjectEnvelope mod = (ObjectEnvelope) mhtObjectEnvelopes.get(iter.next());
            boolean insert = false;
            if(needsCommit)
            {
                insert = mod.needsInsert();
                mod.getModificationState().commit(mod);
                if(reuse && insert)
                {
                    getTransaction().doSingleLock(mod.getClassDescriptor(), mod.getObject(), mod.getIdentity(), Transaction.WRITE);
                }
            }
            /*
            arminw: important to call this cleanup method for each registered
            ObjectEnvelope, because this method will e.g. remove proxy listener
            objects for registered objects.
            */
            mod.cleanup(reuse, insert);
        }
        // add m:n indirection table entries
        performM2NLinkEntries();
    }
1071080
private Class<?> replaceInterface(Class<?> clazz) {
		if (clazz.equals(List.class)) {
			return ArrayList.class;
		}

		if (clazz.equals(Set.class)) {
			return HashSet.class;
		}
		
		if (clazz.equals(Map.class)) {
			return HashMap.class;
		}

		return clazz;
	}
819206
function interpolation3(prefix, v0, i0, v1, i1, v2, suffix) {
    var different = bindingUpdated2(v0, v1);
    different = bindingUpdated(v2) || different;
    return different ? prefix + stringify$1(v0) + i0 + stringify$1(v1) + i1 + stringify$1(v2) + suffix :
        NO_CHANGE;
}
627033
private void rewriteDefinition(Node definitionSite, String newMethodName) {
    final Node function;
    final Node subtreeToRemove;
    final Node nameSource;

    switch (definitionSite.getToken()) {
      case GETPROP:
        function = definitionSite.getParent().getLastChild();
        nameSource = definitionSite.getLastChild();
        subtreeToRemove = NodeUtil.getEnclosingStatement(definitionSite);
        break;

      case STRING_KEY:
      case MEMBER_FUNCTION_DEF:
        function = definitionSite.getLastChild();
        nameSource = definitionSite;
        subtreeToRemove = definitionSite;
        break;

      default:
        throw new IllegalArgumentException(definitionSite.toString());
    }

    // Define a new variable after the original declaration.
    Node statement = NodeUtil.getEnclosingStatement(definitionSite);
    Node newNameNode = IR.name(newMethodName).useSourceInfoIfMissingFrom(nameSource);
    Node newVarNode = IR.var(newNameNode).useSourceInfoIfMissingFrom(nameSource);
    statement.getParent().addChildBefore(newVarNode, statement);

    // Attatch the function to the new variable.
    function.detach();
    newNameNode.addChildToFront(function);

    // Create the `this` param.
    String selfName = newMethodName + "$self";
    Node paramList = function.getSecondChild();
    paramList.addChildToFront(IR.name(selfName).useSourceInfoIfMissingFrom(function));
    compiler.reportChangeToEnclosingScope(paramList);

    // Eliminate `this`.
    replaceReferencesToThis(function.getSecondChild(), selfName); // In default param values.
    replaceReferencesToThis(function.getLastChild(), selfName); // In function body.

    fixFunctionType(function);

    // Clean up dangling AST.
    NodeUtil.deleteNode(subtreeToRemove, compiler);
    compiler.reportChangeToEnclosingScope(newVarNode);
  }
34200
def method_wrapper(m):
    """"""

    if m.is_simple:
        def simple_method(self):
            """TODO: no docstring!"""
            return apply_transform(
                self.__service__, m.output_transform,
                grpc_call(self.__service__, m, unwrap(self)))

        return simple_method

    elif m.input_transform is not None:
        def transform_method(self, *args, **kwargs):
            """TODO: no docstring!"""
            request = m.input_transform(self, *args, **kwargs)
            return apply_transform(
                self.__service__, m.output_transform,
                grpc_call(self.__service__, m, request))

        return transform_method

    elif m.static:
        def static_method(cls, *args, **kwargs):
            """TODO: no docstring!"""
            request = make_static_request(m, *args, **kwargs)
            return apply_transform(
                cls.__stub__(__server__), m.output_transform,
                grpc_call(cls.__stub__(__server__), m, request))

        return static_method

    else:
        def request_method(self, *args, **kwargs):
            """TODO: no docstring!"""
            request = make_request(self, m, *args, **kwargs)
            return apply_transform(
                self.__service__, m.output_transform,
                grpc_call(self.__service__, m, request))

        return request_method
1043965
def reapply(config):
    """"""
    with open(config, 'r'):
        main.reapply(yaml.load(open(config)))
330080
def recreate(cls, *args, **kwargs):
        """"""
        cls.check_arguments(kwargs)
        first_is_callable = True if any(args) and callable(args[0]) else False
        signature = cls.default_arguments()
        allowed_arguments = {k: v for k, v in kwargs.items() if k in signature}
        if (any(allowed_arguments) or any(args)) and not first_is_callable:
            if any(args) and not first_is_callable:
                return cls(args[0], **allowed_arguments)
            elif any(allowed_arguments):
                return cls(**allowed_arguments)

        return cls.instances[-1] if any(cls.instances) else cls()
990089
function mix(receiver, supplier, overwrite) {
    var key;

    if (!receiver || !supplier) {
        return receiver || {};
    }

    for (key in supplier) {
        if (supplier.hasOwnProperty(key)) {
            if (overwrite || !receiver.hasOwnProperty(key)) {
                receiver[key] = supplier[key];
            }
        }
    }

    return receiver;
}
479241
function replace(obj, prefix) {
    const retObj = {}
    const dot = prefix ? '.' : ''
    for (const key in obj) {
      if (key === 'description') {
        retObj[key] = obj[key]
      } else if (key === 'script') {
        retObj[key] = series(
          `cd ${relativeDir}`,
          `npm start ${prefix}`,
          `cd "${relativeReturn}"`,
        )
      } else if (typeof obj[key] === 'string') {
        retObj[key] = series(
          `cd ${relativeDir}`,
          `npm start ${prefix}${dot}${key}`,
        )
      } else {
        retObj[key] = Object.assign(
          {},
          replace(obj[key], `${prefix}${dot}${key}`, `cd "${startingDir}"`),
        )
      }
    }
    return retObj
  }
100557
def replace(self, uid, ical, filename=None):
        """"""
        return self.replace_vobject(uid, readOne(ical), filename)