3f5e994767718a930681d75bd59154525b02cd18,src/python/twitter/pants/targets/python_binary.py,PythonBinary,__init__,#PythonBinary#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#,24

Before Change


          "Can only declare an entry_point if no source binary is specified.")
    if not isinstance(platforms, (list, tuple)) and not isinstance(platforms, Compatibility.string):
      raise TargetDefinitionException("platforms must be a list, tuple or string.")
    if not isinstance(interpreters, (list, tuple)):
      raise TargetDefinitionException("interpreters must be a list or tuple.")

    self._entry_point = entry_point
    self._inherit_path = bool(inherit_path)
    self._zip_safe = bool(zip_safe)
    self._interpreters = interpreters
    self._repositories = repositories or []
    self._indices = indices or []
    self._allow_pypi = bool(allow_pypi)
    self._ignore_errors = bool(ignore_errors)

    if isinstance(platforms, Compatibility.string):
      self._platforms = [platforms]
    else:
      self._platforms = platforms
    self._platforms = tuple(self._platforms)

    PythonTarget.__init__(self, name, [] if source is None else [source],
                          dependencies=dependencies,
                          provides=provides, exclusives=exclusives)

After Change



  // TODO(wickman) Consider splitting pex options out into a separate PexInfo builder that can be
  // attached to the binary target.  Ideally the PythonBinary target is agnostic about pex mechanics
  def __init__(self,
               name,
               source=None,
               dependencies=None,
               entry_point=None,
               inherit_path=False,        // pex option
               zip_safe=True,             // pex option
               always_write_cache=False,  // pex option
               repositories=None,         // pex option
               indices=None,              // pex option
               ignore_errors=False,       // pex option
               allow_pypi=False,          // pex option
               platforms=(),
               compatibility=None,
               exclusives=None):
    
    :param name: target name
    :param source: the python source file that becomes this binary"s __main__.
      If None specified, drops into an interpreter by default.
    :param dependencies: List of :class:`twitter.pants.base.target.Target` instances
      this target depends on.
    :type dependencies: list of targets
    :param entry_point: the default entry point for this binary.  if None, drops into the entry
      point that is defined by source
    :param inherit_path: inherit the sys.path of the environment that this binary runs in
    :param zip_safe: whether or not this binary is safe to run in compacted (zip-file) form
    :param always_write_cache: whether or not the .deps cache of this PEX file should always
      be written to disk.
    :param repositories: a list of repositories to query for dependencies.
    :param indices: a list of indices to use for packages.
    :param platforms: extra platforms to target when building this binary.
    :param compatibility: either a string or list of strings that represents
      interpreter compatibility for this target, using the Requirement-style format,
      e.g. ``"CPython>=3", or just [">=2.7","<3"]`` for requirements agnostic to interpreter class.
    :param dict exclusives: An optional dict of exclusives tags. See CheckExclusives for details.
    

    // TODO(John Sirois): Fixup TargetDefinitionException - it has awkward Target base-class
    // initialization requirements right now requiring this Target.__init__.
    Target.__init__(self, name, exclusives=exclusives)

    if source is None and entry_point is None:
      raise TargetDefinitionException(self,
          "A python binary target must specify either source or entry_point.")

    PythonTarget.__init__(self,
        name,
        [] if source is None else [source],
        compatibility=compatibility,
        dependencies=dependencies,
        exclusives=exclusives,
    )

    if not isinstance(platforms, (list, tuple)) and not isinstance(platforms, Compatibility.string):
      raise TargetDefinitionException(self,
          "platforms must be a list, tuple or string.")

    self._entry_point = entry_point
    self._inherit_path = bool(inherit_path)
    self._zip_safe = bool(zip_safe)
    self._always_write_cache = bool(always_write_cache)
    self._repositories = maybe_list(repositories or [])
    self._indices = maybe_list(indices or [])
    self._ignore_errors = bool(ignore_errors)
    self._platforms = tuple(maybe_list(platforms or []))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 15

Instances


Project Name: pantsbuild/pants
Commit Name: 3f5e994767718a930681d75bd59154525b02cd18
Time: 2014-01-19
Author: benjyw@gmail.com
File Name: src/python/twitter/pants/targets/python_binary.py
Class Name: PythonBinary
Method Name: __init__


Project Name: pliablepixels/zmeventnotification
Commit Name: 5829375ae9e308305983c7b6cb0f626703f38726
Time: 2019-07-11
Author: pliablepixels@gmail.com
File Name: hook/zmes_hook_helpers/alpr.py
Class Name: ALPRPlateRecognizer
Method Name: __init__


Project Name: pantsbuild/pants
Commit Name: 3f5e994767718a930681d75bd59154525b02cd18
Time: 2014-01-19
Author: benjyw@gmail.com
File Name: src/python/twitter/pants/targets/python_binary.py
Class Name: PythonBinary
Method Name: __init__


Project Name: pliablepixels/zmeventnotification
Commit Name: 5829375ae9e308305983c7b6cb0f626703f38726
Time: 2019-07-11
Author: pliablepixels@gmail.com
File Name: hook/zmes_hook_helpers/alpr.py
Class Name: OpenALPR
Method Name: __init__