Rewrites the file passed to 'this' constructor so that the actual line numbers match the recipe passed to 'this'
constructor.
507549
public void reformatFile() throws IOException
    {
        List<LineNumberPosition> lineBrokenPositions = new ArrayList<>();
        List<String> brokenLines = breakLines(lineBrokenPositions);
        emitFormatted(brokenLines, lineBrokenPositions);
    }
1338646
function nextCreate(
  filesPromise,
  serveStaticFile,
  serveFile,
  injector,
  basePath,
  urlRoot,
  upstreamProxy
) {
  var prevMiddleware = prevCreate(
    filesPromise,
    serveStaticFile,
    serveFile,
    injector,
    basePath,
    urlRoot,
    upstreamProxy
  );
  return function nextMiddleware(request, response, next) {
    var requestUrl = request.normalizedUrl.replace(/\?.*/, '');
    var prevWrite;
    var prevEnd;
    requestUrl = requestUrl.substr(urlRoot.length - 1);
    if (requestUrl === '/context.html' &&
        toplevelScriptIntegrity &&
        toplevelScriptIntegrity.startsWith('sha') &&
        stylesheetIntegrity &&
        stylesheetIntegrity.startsWith('sha')) {
      prevWrite = response.write;
      prevEnd = response.end;
      // eslint-disable-next-line no-param-reassign
      response.write = function nextWrite(chunk, encoding, callback) {
        prevWrite.call(response, addIntegrityTags(chunk), encoding, callback);
      };
      response.end = function nextEnd(chunk, encoding, callback) {
        prevEnd.call(response, addIntegrityTags(chunk), encoding, callback);
      };
    }
    return prevMiddleware(request, response, next);
  };
}
127217
function onWritten(writeErr) {
      var flags = fo.getFlags({
        overwrite: optResolver.resolve('overwrite', file),
        append: optResolver.resolve('append', file),
      });
      if (fo.isFatalOverwriteError(writeErr, flags)) {
        return callback(writeErr);
      }

      callback(null, file);
    }
624023
static Pattern createIncludedFilesPattern() {
		String messagesFilesRegex = LocaleUtils.createResourceFilesRegex(Constant.MESSAGES_PREFIX, Constant.MESSAGES_EXTENSION);
		String vulnerabilitiesFilesRegex = LocaleUtils.createResourceFilesRegex(
				Constant.VULNERABILITIES_PREFIX,
				Constant.VULNERABILITIES_EXTENSION);
		StringBuilder strBuilder = new StringBuilder(messagesFilesRegex.length() + vulnerabilitiesFilesRegex.length() + 1);
		strBuilder.append(messagesFilesRegex).append('|').append(vulnerabilitiesFilesRegex);
		return Pattern.compile(strBuilder.toString());
	}
1200592
private void replaceArrayPattern(
      NodeTraversal t, Node arrayPattern, Node rhs, Node parent, Node nodeToDetach) {

    if (rewriteMode == ObjectDestructuringRewriteMode.REWRITE_OBJECT_REST) {
      if (patternNestingStack.isEmpty() || !patternNestingStack.peekLast().hasNestedObjectRest) {
        return;
      }
    }

    String tempVarName = getTempVariableName();
    Node makeIteratorCall = astFactory.createJSCompMakeIteratorCall(rhs.detach(), t.getScope());
    Node tempVarModel = astFactory.createName(tempVarName, makeIteratorCall.getJSType());
    Node tempDecl = IR.var(tempVarModel.cloneNode(), makeIteratorCall);
    tempDecl.useSourceInfoIfMissingFromForTree(arrayPattern);
    nodeToDetach.getParent().addChildBefore(tempDecl, nodeToDetach);

    for (Node child = arrayPattern.getFirstChild(), next; child != null; child = next) {
      next = child.getNext();
      if (child.isEmpty()) {
        // Just call the next() method to advance the iterator, but throw away the value.
        Node nextCall =
            IR.exprResult(
                astFactory.createCall(astFactory.createGetProp(tempVarModel.cloneNode(), "next")));
        nextCall.useSourceInfoIfMissingFromForTree(child);
        nodeToDetach.getParent().addChildBefore(nextCall, nodeToDetach);
        continue;
      }

      Node newLHS;
      Node newRHS;
      if (child.isDefaultValue()) {
        //   [x = defaultValue] = rhs;
        // becomes
        //   var temp0 = $jscomp.makeIterator(rhs);
        //   var temp1 = temp.next().value
        //   x = (temp1 === undefined) ? defaultValue : temp1;
        String nextVarName = getTempVariableName();
        // `temp.next().value`
        Node nextCallDotValue =
            astFactory.createGetProp(
                astFactory.createCall(astFactory.createGetProp(tempVarModel.cloneNode(), "next")),
                "value");
        JSType nextVarType = nextCallDotValue.getJSType();
        // `var temp1 = temp.next().value`
        Node var = IR.var(astFactory.createName(nextVarName, nextVarType), nextCallDotValue);
        var.useSourceInfoIfMissingFromForTree(child);
        nodeToDetach.getParent().addChildBefore(var, nodeToDetach);

        // `x`
        newLHS = child.getFirstChild().detach();
        // `(temp1 === undefined) ? defaultValue : temp1;
        newRHS =
            defaultValueHook(
                astFactory.createName(nextVarName, nextVarType), child.getLastChild().detach());
      } else if (child.isRest()) {
        //   [...x] = rhs;
        // becomes
        //   var temp = $jscomp.makeIterator(rhs);
        //   x = $jscomp.arrayFromIterator(temp);
        newLHS = child.getFirstChild().detach();
        newRHS =
            astFactory.createJscompArrayFromIteratorCall(tempVarModel.cloneNode(), t.getScope());
      } else {
        // LHS is just a name (or a nested pattern).
        //   var [x] = rhs;
        // becomes
        //   var temp = $jscomp.makeIterator(rhs);
        //   var x = temp.next().value;
        newLHS = child.detach();
        newRHS =
            astFactory.createGetProp(
                astFactory.createCall(astFactory.createGetProp(tempVarModel.cloneNode(), "next")),
                "value");
      }
      Node newNode;
      if (parent.isAssign()) {
        Node assignment = astFactory.createAssign(newLHS, newRHS);
        newNode = IR.exprResult(assignment);
      } else {
        newNode = IR.declaration(newLHS, newRHS, parent.getToken());
      }
      newNode.useSourceInfoIfMissingFromForTree(arrayPattern);

      nodeToDetach.getParent().addChildBefore(newNode, nodeToDetach);
      // Explicitly visit the LHS of the new node since it may be a nested
      // destructuring pattern.
      visit(t, newLHS, newLHS.getParent());
    }

    nodeToDetach.detach();
    t.reportCodeChange();
  }
531999
def patch_constructor(model):
    
    old_init = model.__init__

    def new_init(self, *args, **kwargs):
        self._mt_init = True
        populate_translation_fields(self.__class__, kwargs)
        for key, val in list(kwargs.items()):
            new_key = rewrite_lookup_key(model, key)
            # Old key is intentionally left in case old_init wants to play with it
            kwargs.setdefault(new_key, val)
        old_init(self, *args, **kwargs)
    model.__init__ = new_init
1217840
def _compile(cls, lines):
        ''''''
        m = cls.RE_EXTEND.match(lines.current)
        if m is None:
            raise DefineBlockError('''Incorrect block definition at line {}, {}
Should be something like: #extend path/foo.html:'''.format(
                lines.pos, lines.current))
        return m.group(1)
699917
def _realign(seq, precursor, start):
    
    error = set()
    pattern_addition = [[1, 1, 0], [1, 0, 1], [0, 1, 0], [0, 1, 1], [0, 0, 1], [1, 1, 1]]
    for pos in range(0, len(seq)):
        if seq[pos] != precursor[(start + pos)]:
            error.add(pos)

    subs, add = [], []
    for e in error:
        if e < len(seq) - 3:
            subs.append([e, seq[e], precursor[start + e]])

    pattern, error_add = [], []
    for e in range(len(seq) - 3, len(seq)):
        if e in error:
            pattern.append(1)
            error_add.append(e)
        else:
            pattern.append(0)
    for p in pattern_addition:
        if pattern == p:
            add = seq[error_add[0]:]
            break
    if not add and error_add:
        for e in error_add:
            subs.append([e, seq[e], precursor[start + e]])

    return subs, add
493565
public function rewriteMouf() {
		//require_once('MoufPackageManager.php');

		if ((file_exists(dirname(__FILE__)."/".$this->componentsFileName) && !is_writable(dirname(__FILE__)."/".$this->componentsFileName)) || (!file_exists(dirname(__FILE__)."/".$this->componentsFileName) && !is_writable(dirname(dirname(__FILE__)."/".$this->componentsFileName)))) {
			$dirname = realpath(dirname(dirname(__FILE__)."/".$this->componentsFileName));
			$filename = basename(dirname(__FILE__)."/".$this->componentsFileName);
			throw new MoufContainerException("Error, unable to write file ".$dirname."/".$filename);
		}

		// Let's start by garbage collecting weak instances.
		$this->purgeUnreachableWeakInstances();

		$fp = fopen(dirname(__FILE__)."/".$this->componentsFileName, "w");
		fwrite($fp, "<?php\n");
		fwrite($fp, "/**\n");
		fwrite($fp, " * This is a file automatically generated by the Mouf framework. Do not modify it, as it could be overwritten.\n");
		fwrite($fp, " */\n");
		fwrite($fp, "use Mouf\MoufManager;\n");
		fwrite($fp, "use Interop\Container\ContainerInterface;\n");
		fwrite($fp, "MoufManager::initMoufManager();\n");
		fwrite($fp, "\$moufManager = MoufManager::getMoufManager();\n");
		fwrite($fp, "\n");
		fwrite($fp, "\$moufManager->getConfigManager()->setConstantsDefinitionArray(".var_export($this->getConfigManager()->getConstantsDefinitionArray(), true).");\n");
		fwrite($fp, "\n");

		// Import all variables
		fwrite($fp, "\$moufManager->setAllVariables(".var_export($this->variables, true).");\n");
		fwrite($fp, "\n");

		// Sort all instances by key. This way, new instances are not added at the end of the array,
		// and this reduces the number of conflicts when working in team with a version control system.
		ksort($this->declaredInstances);

		// Declare all components in one instruction
		$internalDeclaredInstances = array();
		foreach ($this->declaredInstances as $name=>$declaredInstance) {
			if (!isset($declaredInstance["external"]) || !$declaredInstance["external"]) {
				$internalDeclaredInstances[$name] = $declaredInstance;
			}
		}

		fwrite($fp, "\$moufManager->addComponentInstances(".var_export($internalDeclaredInstances, true).");\n");
		fwrite($fp, "\n");

		fwrite($fp, "\n");

		fwrite($fp, "unset(\$moufManager);\n");
		fwrite($fp, "\n");

		fwrite($fp, "/**\n");
		fwrite($fp, " * This is the base class of the Manage Object User Friendly or Modular object user framework (MOUF) framework.\n");
		fwrite($fp, " * This object can be used to get the objects manage by MOUF.\n");
		fwrite($fp, " *\n");
		fwrite($fp, " */\n");
		fwrite($fp, "class $this->mainClassName {\n");
		fwrite($fp, "	");
		
		// Now, let's export the closures!
		/***** closures Start ******/
		fwrite($fp, "public function getClosures() {\n");
		fwrite($fp, "		return [\n");
		
		$targetArray = [];
		foreach ($internalDeclaredInstances as $instanceName=>$instanceDesc) {
			if (isset($instanceDesc['constructor'])) {
				foreach ($instanceDesc['constructor'] as $key=>$param) {
					if ($param['type'] == 'php') {
						try {
							CodeValidatorService::validateCode($param['value']);
							$targetArray[$instanceName]['constructor'][$key] = $param['value'];
						} catch (\PhpParser\Error $ex) {
							error_log("Error in callback declared code for instance '$instanceName', constructor argument '$key': ".$ex->getMessage());
							$targetArray[$instanceName]['constructor'][$key] = $ex;
						}
					}
				}
			}
			if (isset($instanceDesc['fieldProperties'])) {
				foreach ($instanceDesc['fieldProperties'] as $key=>$param) {
					if ($param['type'] == 'php') {
						try {
							CodeValidatorService::validateCode($param['value']);
							$targetArray[$instanceName]['fieldProperties'][$key] = $param['value'];
						} catch (\PhpParser\Error $ex) {
							error_log("Error in callback declared code for instance '$instanceName', public property '$key': ".$ex->getMessage());
							$targetArray[$instanceName]['fieldProperties'][$key] = $ex;
						}
					}
				}
			}
			if (isset($instanceDesc['setterProperties'])) {
				foreach ($instanceDesc['setterProperties'] as $key=>$param) {
					if ($param['type'] == 'php') {
						try {
							CodeValidatorService::validateCode($param['value']);
							$targetArray[$instanceName]['setterProperties'][$key] = $param['value'];
						} catch (\PhpParser\Error $ex) {
							error_log("Error in callback declared code for instance '$instanceName', setter '$key': ".$ex->getMessage());
							$targetArray[$instanceName]['fieldProperties'][$key] = $ex;
						}
					}
				}
			}
			if (isset($instanceDesc['code']) && !isset($instanceDesc['error'])) {
				$targetArray[$instanceName] = $instanceDesc['code'];
			}
		}
		foreach ($targetArray as $instanceName=>$instanceDesc) {
			// If the whole instance is a PHP declaration
			if (is_string($instanceDesc)) {
				fwrite($fp, "			".var_export($instanceName, true)." => function(ContainerInterface \$container) {\n				");
				fwrite($fp, $instanceDesc);
				fwrite($fp, "\n			},\n");
			} else {
				// If properties are a PHP declaration
				fwrite($fp, "			".var_export($instanceName, true)." => [\n");
				if (isset($instanceDesc['constructor'])) {
					fwrite($fp, "				'constructor' => [\n");
					foreach ($instanceDesc['constructor'] as $key=>$code) {
						fwrite($fp, "					".var_export($key, true)." => ");
						if (!$code instanceof \PhpParser\Error) {
							fwrite($fp, "function(ContainerInterface \$container) {\n						");
							fwrite($fp, $code);
							fwrite($fp, "\n					},\n");
						} else {
							// If the code is an exception we put the error message instead of a callback in the closures array
							fwrite($fp, var_export($code->getMessage(), true).",\n");
						}
					}
					fwrite($fp, "				],\n");
				}
				if (isset($instanceDesc['fieldProperties'])) {
					fwrite($fp, "				'fieldProperties' => [\n");
					foreach ($instanceDesc['fieldProperties'] as $key=>$code) {
						fwrite($fp, "					".var_export($key, true)." => ");
						if (!$code instanceof \PhpParser\Error) {
							fwrite($fp, "function(ContainerInterface \$container) {\n						");
							fwrite($fp, $code);
							fwrite($fp, "\n					},\n");
						} else {
							// If the code is an exception we put the error message instead of a callback in the closures array
							fwrite($fp, var_export($code->getMessage(), true).",\n");
						}
					}
					fwrite($fp, "				],\n");
				}
				if (isset($instanceDesc['setterProperties'])) {
					fwrite($fp, "				'setterProperties' => [\n");
					foreach ($instanceDesc['setterProperties'] as $key=>$code) {
						fwrite($fp, "					".var_export($key, true)." => ");
						if (!$code instanceof \PhpParser\Error) {
							fwrite($fp, "function(ContainerInterface \$container) {\n						");
							fwrite($fp, $code);
							fwrite($fp, "\n					},\n");
						} else {
							// If the code is an exception we put the error message instead of a callback in the closures array
							fwrite($fp, var_export($code->getMessage(), true).",\n");
						}
					}
					fwrite($fp, "				],\n");
				}
				fwrite($fp, "			],\n");
			}
		}
		
		fwrite($fp, "		];\n");
		fwrite($fp, "	}\n");
		/***** closures end ******/
		
		
		$getters = array();
		foreach ($this->declaredInstances as $name=>$classDesc) {
			if (!isset($classDesc['class'])) {
				if (isset($classDesc['code'])) {
					continue;
				}
				throw new MoufContainerException("No class for instance '$name'");
			}
			if (isset($classDesc['anonymous']) && $classDesc['anonymous']) {
				continue;
			}
			$className = $classDesc['class'];
			$getter = self::generateGetterString($name);
			if (isset($getters[strtolower($getter)])){
				$i = 0;
				while (isset($getters[strtolower($getter."_$i")])) {
					$i++;
				}
				$getter = $getter."_$i";
			}
			$getters[strtolower($getter)] = true;
			fwrite($fp, "	/**\n");
			fwrite($fp, "	 * @return $className\n");
			fwrite($fp, "	 */\n");
			fwrite($fp, "	 public static function ".$getter."() {\n");
			fwrite($fp, "	 	return MoufManager::getMoufManager()->get(".var_export($name,true).");\n");
			fwrite($fp, "	 }\n\n");
		}
		fwrite($fp, "}\n");


		fclose($fp);
		if (function_exists("opcache_invalidate")) {
			opcache_invalidate(dirname(__FILE__)."/".$this->componentsFileName);
		}

		// Note: rewriting MoufUI here is useless, since it is only modified on update or install of packages.
		$selfEdit = ($this->scope == MoufManager::SCOPE_ADMIN);
		$composerService = new ComposerService($selfEdit);
		$composerService->rewriteMoufUi();

	}
513046
private List<Content> rewriteAnchor(Element element) {

    // detect empty anchor elements and insert at least an empty string to avoid "self-closing" elements
    // that are not handled correctly by most browsers
    if (element.getContent().isEmpty()) {
      element.setText("");
    }

    // resolve link metadata from DOM element
    Link link = getAnchorLink(element);

    // build anchor for link metadata
    Element anchorElement = buildAnchorElement(link, element);

    // Replace anchor tag or remove anchor tag if invalid - add any sub-content in every case
    List<Content> content = new ArrayList<Content>();
    if (anchorElement != null) {
      anchorElement.addContent(element.cloneContent());
      content.add(anchorElement);
    }
    else {
      content.addAll(element.getContent());
    }
    return content;
  }
63738
@Override
	public StringBuffer rewriteUrl(String originalCssPath, String newCssPath, String originalCssContent)
			throws IOException {

		// Rewrite each css image url path
		Matcher matcher = URL_WITH_ANNOTATION_PATTERN.matcher(originalCssContent);
		StringBuffer sb = new StringBuffer();

		while (matcher.find()) {

			String annotation = matcher.group(ANNOTATION_GROUP);
			if (StringUtils.isNotEmpty(annotation)) {
				Matcher annotationMatcher = ANNOTATION_BASE64_PATTERN.matcher(annotation);
				if (annotationMatcher.find()) {
					skipBase64Encoding = annotationMatcher.group(2) != null;
				} else {
					annotationMatcher = ANNOTATION_SPRITE_PATTERN.matcher(annotation);
					if (annotationMatcher.find()) { // Encode sprite depending
													// on jawr configuration
						skipBase64Encoding = !encodeSprite;
					}
				}
			} else {
				// If no annotation use the default encoding mode
				skipBase64Encoding = !encodeByDefault;
			}

			StringBuffer sbUrl = new StringBuffer();
			Matcher urlMatcher = URL_PATTERN.matcher(matcher.group());
			while (urlMatcher.find()) {

				String url = urlMatcher.group();

				// Skip sprite encoding if it is configured so
				if (!encodeSprite && url
						.contains(GeneratorRegistry.SPRITE_GENERATOR_PREFIX + GeneratorRegistry.PREFIX_SEPARATOR)) {
					skipBase64Encoding = true;
				}

				if (LOGGER.isDebugEnabled() && skipBase64Encoding) {
					LOGGER.debug("Skip encoding image resource : " + url);
				}

				url = getUrlPath(url, originalCssPath, newCssPath);

				urlMatcher.appendReplacement(sbUrl, RegexUtil.adaptReplacementToMatcher(url));
			}
			urlMatcher.appendTail(sbUrl);
			matcher.appendReplacement(sb, RegexUtil.adaptReplacementToMatcher(sbUrl.toString()));

		}
		matcher.appendTail(sb);

		return sb;
	}
152625
@Override
  public Map<String, Object> rewrite(boolean showDebugInfo) throws IOException {
    Map<String, Object> response = new HashMap<>();
    for (String statsItem : getStatsItems()) {
      if (statsItem.equals(CodecUtil.STATS_TYPE_SUM)) {
        response.put(statsItem, valueSum);
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_N)) {
        response.put(statsItem, valueN);
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_MAX)) {
        response.put(statsItem, valueMax);
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_MIN)) {
        response.put(statsItem, valueMin);
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_SUMSQ)) {
        response.put(statsItem, valueSumOfSquares);
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_SUMOFLOGS)) {
        response.put(statsItem, valueSumOfLogs);
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_MEAN)) {
        response.put(statsItem, getValue(statsItem));
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_GEOMETRICMEAN)) {
        response.put(statsItem, getValue(statsItem));
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_STANDARDDEVIATION)) {
        response.put(statsItem, getValue(statsItem));
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_VARIANCE)) {
        response.put(statsItem, getValue(statsItem));
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_POPULATIONVARIANCE)) {
        response.put(statsItem, getValue(statsItem));
      } else if (statsItem.equals(CodecUtil.STATS_TYPE_QUADRATICMEAN)) {
        response.put(statsItem, getValue(statsItem));
      } else {
        response.put(statsItem, null);
      }
    }
    if (errorNumber > 0) {
      Map<String, Object> errorResponse = new HashMap<>();
      for (Entry<String, Integer> entry : getErrorList().entrySet()) {
        errorResponse.put(entry.getKey(), entry.getValue());
      }
      response.put("errorNumber", errorNumber);
      response.put("errorList", errorResponse);
    }
    if (showDebugInfo) {
      response.put("sourceNumber", sourceNumber);
      response.put("stats", "advanced");
    }
    return response;
  }
1158755
function replaceFilePlaceholders(oFile, aReplacementRules) {
  // parse file
  const sRaw = oFile.contents.toString('utf8')
  const sUpdatedFile = aReplacementRules.reduce((oResult, oRule) => {
    return oResult.replace(oRule.identifier, oRule.content)
  }, sRaw)

  // update new raw content
  oFile.contents = new Buffer(sUpdatedFile)

  // return updated file
  return oFile
}
986614
def v1_0to1_1_0dev1(doc, loader, baseuri):  # pylint: disable=unused-argument
    # type: (Any, Loader, Text) -> Tuple[Any, Text]
    """"""

    doc = copy.deepcopy(doc)

    rewrite = {
        "http://commonwl.org/cwltool#WorkReuse": "WorkReuse",
        "http://commonwl.org/cwltool#TimeLimit": "ToolTimeLimit",
        "http://commonwl.org/cwltool#NetworkAccess": "NetworkAccess",
        "http://commonwl.org/cwltool#InplaceUpdateRequirement": "InplaceUpdateRequirement",
        "http://commonwl.org/cwltool#LoadListingRequirement": "LoadListingRequirement",
        "http://commonwl.org/cwltool#WorkReuse": "WorkReuse",
    }
    def rewrite_requirements(t):
        if "requirements" in t:
            for r in t["requirements"]:
                if r["class"] in rewrite:
                    r["class"] = rewrite[r["class"]]
        if "hints" in t:
            for r in t["hints"]:
                if r["class"] in rewrite:
                    r["class"] = rewrite[r["class"]]
        if "steps" in t:
            for s in t["steps"]:
                rewrite_requirements(s)

    def update_secondaryFiles(t):
        if isinstance(t, MutableSequence):
            return [{"pattern": p} for p in t]
        else:
            return t

    def fix_inputBinding(t):
        for i in t["inputs"]:
            if "inputBinding" in i:
                ib = i["inputBinding"]
                for k in list(ib.keys()):
                    if k != "loadContents":
                        _logger.warning(SourceLine(ib, k).makeError("Will ignore field '%s' which is not valid in %s inputBinding" %
                                                                    (k, t["class"])))
                        del ib[k]

    visit_class(doc, ("CommandLineTool","Workflow"), rewrite_requirements)
    visit_class(doc, ("ExpressionTool","Workflow"), fix_inputBinding)
    visit_field(doc, "secondaryFiles", update_secondaryFiles)

    upd = doc
    if isinstance(upd, MutableMapping) and "$graph" in upd:
        upd = upd["$graph"]
    for proc in aslist(upd):
        proc.setdefault("hints", [])
        proc["hints"].insert(0, {"class": "NetworkAccess", "networkAccess": True})
        proc["hints"].insert(0, {"class": "LoadListingRequirement", "loadListing": "deep_listing"})

    return (doc, "v1.1.0-dev1")
1072946
private function initialiseForWriting()
    {
        // move to the end of the file to always append
        fseek($this->stream, 0, SEEK_END);

        if (ftell($this->stream) === 0) {
            fwrite($this->stream, $this->formatter->getInitialBlock());
        } elseif (strlen($this->formatter->getClosingBlock()) > 0) {
            $endBlock = $this->formatter->getClosingBlock();
            fseek($this->stream, strlen($endBlock) * -1, SEEK_CUR);
            fwrite($this->stream, $this->formatter->getRowSeparator());
        } elseif (strlen($this->formatter->getRowSeparator()) > 0) {
            fwrite($this->stream, $this->formatter->getRowSeparator());
        }
    }
166708
def each_line
      original_line_number = @original_line_number
      modified_line_number = @modified_line_number

      @lines.each do |line|
        if line.addition?
          yield line, nil, modified_line_number
          modified_line_number += 1
        elsif line.deletion?
          yield line, original_line_number, nil
          original_line_number += 1
        elsif line.unchanged?
          yield line, original_line_number, modified_line_number
          original_line_number += 1
          modified_line_number += 1
        else
          yield line
        end
      end
    end
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')