Split markers from a dependency
346349
def split_markers_from_line(line):
    # type: (AnyStr) -> Tuple[AnyStr, Optional[AnyStr]]
    """"""
    if not any(line.startswith(uri_prefix) for uri_prefix in SCHEME_LIST):
        marker_sep = ";"
    else:
        marker_sep = "; "
    markers = None
    if marker_sep in line:
        line, markers = line.split(marker_sep, 1)
        markers = markers.strip() if markers else None
    return line, markers
979333
function splitIntoPres( preBlock )
	{
		// Exclude the ones at header OR at tail,
		// and ignore bookmark content between them.
		var duoBrRegex = /(\S\s*)\n(?:\s|(<span[^>]+data-cke-bookmark.*?\/span>))*\n(?!$)/gi,
			blockName = preBlock.getName(),
			splitedHtml = replace( preBlock.getOuterHtml(),
				duoBrRegex,
				function( match, charBefore, bookmark )
				{
				  return charBefore + '</pre>' + bookmark + '<pre>';
				} );

		var pres = [];
		splitedHtml.replace( /<pre\b.*?>([\s\S]*?)<\/pre>/gi, function( match, preContent ){
			pres.push( preContent );
		} );
		return pres;
	}
832425
private int getDependencies(JSONObject npmLsJson, List<String> linesOfNpmLs, int currentLineNumber, Collection<DependencyInfo> dependencies) {
        if (npmLsJson.has(Constants.DEPENDENCIES)) {
            JSONObject dependenciesJsonObject = npmLsJson.getJSONObject(Constants.DEPENDENCIES);
            if (dependenciesJsonObject != null) {
                for (int i = 0; i < dependenciesJsonObject.keySet().size(); i++) {
                    String currentLine = linesOfNpmLs.get(currentLineNumber);
                    // Examples:
                    // +-- UNMET DEPENDENCY @material-ui/core@1.5.0
                    // | +-- UNMET DEPENDENCY @babel/runtime@7.0.0-beta.42
                    // | | `-- UNMET DEPENDENCY regenerator-runtime@0.11.1
                    // |   | +-- UNMET OPTIONAL DEPENDENCY are-we-there-yet@1.1.4
                    // |   | | +-- UNMET OPTIONAL DEPENDENCY delegates@1.0.0
                    // |   | | `-- UNMET OPTIONAL DEPENDENCY readable-stream@2.3.6
                    if (currentLine.endsWith(DEDUPED) || currentLine.contains(UNMET_DEPENDENCY)) {
                        currentLineNumber++;
                        continue;
                    }
                    String dependencyAlias = getTheNextPackageNameFromNpmLs(currentLine);
                    try {
                        JSONObject dependencyJsonObject = dependenciesJsonObject.getJSONObject(dependencyAlias);
                        DependencyInfo dependency = getDependency(dependencyAlias, dependencyJsonObject);
                        if (dependency != null) {
                            dependencies.add(dependency);
                            logger.debug("Collect child dependencies of {}", dependencyAlias);
                            // collect child dependencies
                            Collection<DependencyInfo> childDependencies = new ArrayList<>();
                            currentLineNumber = getDependencies(dependencyJsonObject, linesOfNpmLs, currentLineNumber + 1, childDependencies);
                            dependency.getChildren().addAll(childDependencies);
                        } else {
                            // it can be only if was an error in 'npm ls'
                            if (dependencyJsonObject.has(REQUIRED)) {
                                Object requiredObject = dependencyJsonObject.get(REQUIRED);
                                if (requiredObject instanceof JSONObject) {
                                    currentLineNumber = getDependencies((JSONObject) requiredObject, linesOfNpmLs, currentLineNumber + 1, new ArrayList<>());
                                } else {
                                    currentLineNumber++;
                                }
                            } else {
                                currentLineNumber++;
                            }
                        }
                    } catch (JSONException e){
                        if (ignoreNpmLsErrors) {
                            logger.error(e.getMessage());
                            logger.debug("{}", e.getStackTrace());
                            currentLineNumber++;
                        } else {
                            throw e;
                        }
                    }
                }
            }
        }
        return currentLineNumber;
    }
1109387
def _split_generators(self, dl_manager):
    """"""
    root_url = "http://images.cocodataset.org/"
    urls = {
        # Train/validation set
        "train_images": "zips/train2014.zip",
        "val_images": "zips/val2014.zip",
        "trainval_annotations": "annotations/annotations_trainval2014.zip",
        # Testing set (no annotations) (2014)
        "test_images": "zips/test2014.zip",
        "test_annotations": "annotations/image_info_test2014.zip",
        # Testing set (no annotations) (2015)
        "test2015_images": "zips/test2015.zip",
        "test2015_annotations": "annotations/image_info_test2015.zip",
    }
    extracted_paths = dl_manager.download_and_extract({
        key: root_url + url for key, url in urls.items()
    })

    return [
        tfds.core.SplitGenerator(
            name=tfds.Split.TRAIN,
            num_shards=10,
            gen_kwargs=dict(
                image_dir=extracted_paths["train_images"],
                annotation_dir=extracted_paths["trainval_annotations"],
                split_type="train2014",
            )),
        tfds.core.SplitGenerator(
            name=tfds.Split.VALIDATION,
            num_shards=10,
            gen_kwargs=dict(
                image_dir=extracted_paths["val_images"],
                annotation_dir=extracted_paths["trainval_annotations"],
                split_type="val2014",
            )),
        # Warning: Testing split only contains the images without any annotation
        tfds.core.SplitGenerator(
            name=tfds.Split.TEST,
            num_shards=10,
            gen_kwargs=dict(
                image_dir=extracted_paths["test_images"],
                annotation_dir=extracted_paths["test_annotations"],
                split_type="test2014",
                has_annotation=False,
            )),
        tfds.core.SplitGenerator(
            name="test2015",
            num_shards=10,
            gen_kwargs=dict(
                image_dir=extracted_paths["test2015_images"],
                annotation_dir=extracted_paths["test2015_annotations"],
                split_type="test2015",
                has_annotation=False,
            )),
    ]
1191651
function extractDependencyIds(options) {
  const dependencies = [];

  function extract(items) {
    // Invalid if not Array
    if (Array.isArray(items)) {
      items.reduce((dependencies, item) => {
        // Items can be Array with depedency as first param
        const dep = Array.isArray(item) ? item[0] : item;

        // Only gather string references, not functions/modules
        if ('string' == typeof dep) dependencies.push(dep);
        return dependencies;
      }, dependencies);
    }
  }

  if (options.plugins) extract(options.plugins);
  if (options.presets) extract(options.presets);

  return dependencies;
}
1360564
private void split(Suffix<T, S> suffix, ActivePoint<T, S> activePoint) {
        Node<T, S> breakNode = new Node<>(this, sequence, tree);
        Edge<T, S> newEdge = new Edge<>(suffix.getEndPosition() - 1, breakNode,
                sequence, tree);
        breakNode.insert(newEdge);
        Edge<T, S> oldEdge = new Edge<>(start + activePoint.getLength(),
                breakNode, sequence, tree);
        oldEdge.end = end;
        oldEdge.terminal = this.terminal;
        breakNode.insert(oldEdge);
        this.terminal = breakNode;
        end = start + activePoint.getLength();
        tree.setSuffixLink(breakNode);
        tree.incrementInsertCount();
    }
1292602
def get_contained_pyversions(marker):
    

    collection = []
    if not marker:
        return set()
    marker = _ensure_marker(marker)
    # Collect the (Variable, Op, Value) tuples and string joiners from the marker
    _markers_collect_pyversions(marker._markers, collection)
    marker_str = " and ".join(sorted(collection))
    if not marker_str:
        return set()
    # Use the distlib dictionary parser to create a dictionary 'trie' which is a bit
    # easier to reason about
    marker_dict = distlib.markers.parse_marker(marker_str)[0]
    version_set = set()
    pyversions, _ = parse_marker_dict(marker_dict)
    if isinstance(pyversions, set):
        version_set.update(pyversions)
    elif pyversions is not None:
        version_set.add(pyversions)
    # Each distinct element in the set was separated by an "and" operator in the marker
    # So we will need to reduce them with an intersection here rather than a union
    # in order to find the boundaries
    versions = set()
    if version_set:
        versions = reduce(lambda x, y: x & y, version_set)
    return versions
325396
def get_contained_extras(marker):
    
    if not marker:
        return set()
    marker = Marker(str(marker))
    extras = set()
    _markers_collect_extras(marker._markers, extras)
    return extras
812787
function extractLiterals(stats, args) {
    if (stats.getType() != null && (stats.getType() === "installed" || stats.getType() === "builtin")) {
        extractLiteralFromInstalled(stats, args);
    }

    if (stats.getType() != null && stats.getType() === "def") {
        extractLiteralFromDef(stats, args[0]);
    }

    if (stats.getType() != null && (stats.getType() === "main" || stats.getType() === "remap")) {
        extractLiteralFromMain(stats, args[0]);
    }
}
748124
def split(self, decl_string):
        """"""
        assert self.has_pattern(decl_string)
        return self.name(decl_string), self.args(decl_string)
576391
def split(attrs, inputs, proto_obj):
    """"""
    split_list = attrs.get('split') if 'split' in attrs else []
    new_attrs = translation_utils._fix_attribute_names(attrs,
                                                       {'split' : 'num_outputs'})
    if 'axis' not in attrs:
        new_attrs = translation_utils._add_extra_attributes(new_attrs, {'axis': 0})

    if not split_list:
        num_outputs = len(proto_obj.model_metadata.get('output_tensor_data'))
    else:
        if len(set(split_list)) == 1:
            num_outputs = len(split_list)
        else:
            raise NotImplementedError("Operator {} in MXNet does not support variable splits."
                                      "Tracking the issue to support variable split here: "
                                      "https://github.com/apache/incubator-mxnet/issues/11594"
                                      .format('split'))

    new_attrs['num_outputs'] = num_outputs
    return 'split', new_attrs, inputs
86414
def split(path, marker=nil)
      marker ||= SPLIT_MARKER
      content = File.read(path)
      filename = File.basename(path, '.*')
      yfm, content = retrieveYFM(content)
      contents = [filename] + content.split(marker)
      prev_name = filename
      contents.each_slice(2).with({}) do |(fname, text), h|
        fname = prev_name = create_filename(prev_name) if fname.strip.empty?
        h[fname.strip] = yfm + text
      end
    end
1053663
function split (matcher, mapper, options) {
  var decoder = new Decoder()
  var soFar = ''
  var maxLength = options && options.maxLength;
  var trailing = options && options.trailing === false ? false : true
  if('function' === typeof matcher)
    mapper = matcher, matcher = null
  if (!matcher)
    matcher = /\r?\n/

  function emit(stream, piece) {
    if(mapper) {
      try {
        piece = mapper(piece)
      }
      catch (err) {
        return stream.emit('error', err)
      }
      if('undefined' !== typeof piece)
        stream.queue(piece)
    }
    else
      stream.queue(piece)
  }

  function next (stream, buffer) {
    var pieces = ((soFar != null ? soFar : '') + buffer).split(matcher)
    soFar = pieces.pop()

    if (maxLength && soFar.length > maxLength)
      return stream.emit('error', new Error('maximum buffer reached'))

    for (var i = 0; i < pieces.length; i++) {
      var piece = pieces[i]
      emit(stream, piece)
    }
  }

  return through(function (b) {
    next(this, decoder.write(b))
  },
  function () {
    if(decoder.end)
      next(this, decoder.end())
    if(trailing && soFar != null)
      emit(this, soFar)
    this.queue(null)
  })
}
1002649
function (out) {
            var tplParam = out.templateParam;
            out.addDependencies(tplParam.$dependencies);
            out.addDependencies(tplParam.$templates, ".tpl");
            if (tplParam.$macrolibs) {
                out.addDependencies(ariaUtilsArray.extractValuesFromMap(tplParam.$macrolibs), ".tml");
            }
            if (tplParam.$csslibs) {
                out.addDependencies(ariaUtilsArray.extractValuesFromMap(tplParam.$csslibs), ".cml");
            }
        }
71252
function(source) {
      var result = [];

      while(source.length > 0) {
        if(result.length > 0) {
          var nextTarget = source.pop();

          for(var i=0; i<result.length; i++) {
            var targetFile = result[i];

            var dependencies = dependenciesMap[targetFile].dependencies;

            var dependencyMatch = matchPatternFromArray(dependencies, dependenciesMap[nextTarget].dependencyPath.pattern);

            if(dependencyMatch) {
              break;
            }
          }

          // move dependent file to front
          result.splice(i, 0, nextTarget);

        } else {
          result.push(source.pop());
        }
      }

      return result;
    }
903515
private static Set<DependencyDescriptor> getDependenciesTransitively(String scope, ResolvedDependency parent) {
        Stack<ResolvedDependency> stack = new Stack<>();
        stack.push(parent);
        Set<DependencyDescriptor> dependencies = new HashSet<>();
        while (!stack.empty()) {
            ResolvedDependency rd = stack.pop();
            // Skip the parent's artifacts.
            if (rd != parent) {
                rd.getModuleArtifacts().forEach(a -> dependencies.add(asDescriptor(scope, a)));
            }
            rd.getChildren().forEach(d -> {
                if (!stack.contains(d)) {
                    stack.add(d);
                }
            });
        }
        return dependencies;
    }
256817
function getMarkerLines(
  loc: NodeLocation,
  source: Array<string>,
  opts: Object,
): { start: number, end: number, markerLines: Object }