fea0351e92bf4f060371ad62907d26ef25c25a50,src/python/pants/option/arg_splitter.py,ArgSplitter,__init__,#ArgSplitter#Any#,31

Before Change


    // For historical reasons we allow --leaf-scope-flag-name anywhere on the cmd line,
    // as an alternative to ... leaf.scope --flag-name. This makes the transition to
    // the new options system easier, as old-style flags will still work.
    self._known_scoping_prefixes = {}

    // Note: This algorithm for finding the lead scopes relies on the fact that enclosing
    // scopes are earlier than enclosed scopes in the list.
    leaf_scopes = set()
    for scope in known_scopes:
      if scope:
        outer_scope, _, _ = scope.rpartition(".")
        if outer_scope in leaf_scopes:
          leaf_scopes.discard(outer_scope)
        leaf_scopes.add(scope)
    for scope in leaf_scopes:
      self._known_scoping_prefixes["{0}-".format(scope.replace(".", "-"))] = scope

  @property
  def is_help(self):
    return self._is_help

After Change


    // the new options system easier, as old-style flags will still work.

    // Check for prefixes in reverse order, so we match the longest prefix first.
    self._known_scoping_prefixes = [("{0}-".format(scope.replace(".", "-")), scope)
                                    for scope in filter(None, sorted(self._known_scopes, reverse=True))]

  @property
  def is_help(self):
    return self._is_help
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: pantsbuild/pants
Commit Name: fea0351e92bf4f060371ad62907d26ef25c25a50
Time: 2014-10-10
Author: benjy@foursquare.com
File Name: src/python/pants/option/arg_splitter.py
Class Name: ArgSplitter
Method Name: __init__


Project Name: dmnfarrell/pandastable
Commit Name: 6516a69369c9b6f3e6cb1021573decf219a8c6ef
Time: 2014-02-21
Author: farrell.damien@gmail.com@c7c09e87-b3be-f776-313c-63292bcc8aec
File Name: plotting.py
Class Name: MPLoptions
Method Name: __init__


Project Name: tensorflow/datasets
Commit Name: c28a63fa9d9fb9ba3cced7052ea243e8884f9bf1
Time: 2019-11-21
Author: supertux90@googlemail.com
File Name: tensorflow_datasets/image/deep_weeds.py
Class Name: DeepWeeds
Method Name: _generate_examples