当前位置: 首页>>代码示例>>Python>>正文


Python Target.__init__方法代码示例

本文整理汇总了Python中twitter.pants.base.target.Target.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Target.__init__方法的具体用法?Python Target.__init__怎么用?Python Target.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twitter.pants.base.target.Target的用法示例。


在下文中一共展示了Target.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from twitter.pants.base.target import Target [as 别名]
# 或者: from twitter.pants.base.target.Target import __init__ [as 别名]
  def __init__(self, name, sources=None, exclusives=None):
    Target.__init__(self, name, exclusives=exclusives)

    self.add_labels('sources')
    self.target_base = SourceRoot.find(self)
    self._unresolved_sources = sources or []
    self._resolved_sources = None
开发者ID:CodeWarltz,项目名称:commons,代码行数:9,代码来源:with_sources.py

示例2: __init__

# 需要导入模块: from twitter.pants.base.target import Target [as 别名]
# 或者: from twitter.pants.base.target.Target import __init__ [as 别名]
 def __init__(self, name, url_builder, exclusives=None):
   """
   :param string name: The name of this target, which combined with this
     build file defines the target :class:`twitter.pants.base.address.Address`.
   :param url_builder: Function that accepts a page target and an optional wiki config dict.
   :returns: A tuple of (alias, fully qualified url).
   """
   Target.__init__(self, name, exclusives=exclusives)
   self.url_builder = url_builder
开发者ID:FernandoG26,项目名称:commons,代码行数:11,代码来源:doc.py

示例3: __init__

# 需要导入模块: from twitter.pants.base.target import Target [as 别名]
# 或者: from twitter.pants.base.target.Target import __init__ [as 别名]
 def __init__(self, requirement, name=None, repository=None, version_filter=None, use_2to3=False,
              compatibility=None, exclusives=None):
   # TODO(wickman) Allow PythonRequirements to be specified using pip-style vcs or url identifiers,
   # e.g. git+https or just http://...
   self._requirement = Requirement.parse(requirement)
   self._repository = repository
   self._name = name or self._requirement.project_name
   self._use_2to3 = use_2to3
   self._version_filter = version_filter or (lambda py, pl: True)
   # TODO(wickman) Unify this with PythonTarget .compatibility
   self.compatibility = compatibility or ['']
   Target.__init__(self, self._name, exclusives=exclusives)
开发者ID:FernandoG26,项目名称:commons,代码行数:14,代码来源:python_requirement.py

示例4: __init__

# 需要导入模块: from twitter.pants.base.target import Target [as 别名]
# 或者: from twitter.pants.base.target.Target import __init__ [as 别名]
 def __init__(self, name, username=None, password=None,
              exclusives=None):
   """
   :param string name: The name of these credentials.
   :param username: Either a constant username value or else a callable that can fetch one.
   :type username: string or callable
   :param password: Either a constant password value or else a callable that can fetch one.
   :type password: string or callable
   """
   Target.__init__(self, name, exclusives=exclusives)
   self._username = username if callable(username) else lambda: username
   self._password = password if callable(password) else lambda: password
开发者ID:CodeWarltz,项目名称:commons,代码行数:14,代码来源:credentials.py

示例5: __init__

# 需要导入模块: from twitter.pants.base.target import Target [as 别名]
# 或者: from twitter.pants.base.target.Target import __init__ [as 别名]
  def __init__(self, name, dependencies, exclusives=None):
    """
    :param string name: The name of this module target, addressable via pants via the
      portion of the spec following the colon.
    :param dependencies: List of :class:`twitter.pants.base.target.Target` instances
      this target depends on.
    :type dependencies: list of targets
    """
    Target.__init__(self, name, exclusives=exclusives)
    self._injected_deps = []
    self._processed_dependencies = resolve(dependencies)

    self.add_labels('internal')
    self.dependency_addresses = OrderedSet()

    self._dependencies = OrderedSet()
    self._internal_dependencies = OrderedSet()
    self._jar_dependencies = OrderedSet()

    if dependencies:
      maybe_list(self._processed_dependencies,
                 expected_type=(ExternalDependency, AnonymousDeps, Target),
                 raise_type=partial(TargetDefinitionException, self))
开发者ID:CodeWarltz,项目名称:commons,代码行数:25,代码来源:internal.py

示例6: __init__

# 需要导入模块: from twitter.pants.base.target import Target [as 别名]
# 或者: from twitter.pants.base.target.Target import __init__ [as 别名]
 def __init__(self, name, dependencies=None, exclusives=None):
   Target.__init__(self, name, exclusives=exclusives)
   self.dependencies = OrderedSet(resolve(dependencies)) if dependencies else OrderedSet()
开发者ID:CodeWarltz,项目名称:commons,代码行数:5,代码来源:with_dependencies.py

示例7: __init__

# 需要导入模块: from twitter.pants.base.target import Target [as 别名]
# 或者: from twitter.pants.base.target.Target import __init__ [as 别名]
 def __init__(self, name, foo=None):
   """
   :param name: The name of this target.
   :param string foo: Another argument.
   """
   Target.__init__(self, name)
开发者ID:FernandoG26,项目名称:commons,代码行数:8,代码来源:test_targets_help.py

示例8: __init__

# 需要导入模块: from twitter.pants.base.target import Target [as 别名]
# 或者: from twitter.pants.base.target.Target import __init__ [as 别名]
  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 []))

    if source and entry_point:
      entry_point_module = entry_point.split(':', 1)[0]
      source_entry_point = self._translate_to_entry_point(self.sources[0])
      if entry_point_module != source_entry_point:
        raise TargetDefinitionException(self,
            'Specified both source and entry_point but they do not agree: %s vs %s' % (
            source_entry_point, entry_point_module))
开发者ID:alandge,项目名称:twitter-commons,代码行数:74,代码来源:python_binary.py


注:本文中的twitter.pants.base.target.Target.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。