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


Python Target.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from twitter.pants.base import Target [as 别名]
# 或者: from twitter.pants.base.Target import __init__ [as 别名]
 def __init__(self, requirement, dynamic=False, repository=None, name=None, version_filter=None):
   self._requirement = Requirement.parse(requirement)
   self._name = name or self._requirement.project_name
   self._dynamic = dynamic
   self._repository = repository
   self._version_filter = version_filter or (lambda: True)
   Target.__init__(self, self._name, False)
开发者ID:JoeEnnever,项目名称:commons,代码行数:9,代码来源:python_requirement.py

示例2: __init__

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

    self._injected_deps = []
    self.processed_dependencies = resolve(dependencies)

    self.add_label('internal')
    self.dependency_addresses = OrderedSet()
    self.dependencies = OrderedSet()
    self.internal_dependencies = OrderedSet()
    self.jar_dependencies = OrderedSet()

    # TODO(John Sirois): if meta targets were truly built outside parse contexts - we could instead
    # just use the more general check: if parsing: delay(doit) else: doit()
    # Fix how target _ids are built / addresses to not require a BUILD file - ie: support anonymous,
    # non-addressable targets - which is what meta-targets really are once created.
    if is_meta:
      # Meta targets are built outside any parse context - so update dependencies immediately
      self.update_dependencies(self.processed_dependencies)
    else:
      # Defer dependency resolution after parsing the current BUILD file to allow for forward
      # references
      self._post_construct(self.update_dependencies, self.processed_dependencies)

    self._post_construct(self.inject_dependencies)
开发者ID:ewhauser,项目名称:commons,代码行数:27,代码来源:internal.py

示例3: __init__

# 需要导入模块: from twitter.pants.base import Target [as 别名]
# 或者: from twitter.pants.base.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.sources = None
        self._sources = sources or []
开发者ID:dynamicguy,项目名称:commons,代码行数:9,代码来源:with_sources.py

示例4: __init__

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

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

示例5: __init__

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

        self.resolved_dependencies = OrderedSet()
        self.internal_dependencies = OrderedSet()
        self.jar_dependencies = OrderedSet()

        self.update_dependencies(dependencies)
开发者ID:DikangGu,项目名称:commons,代码行数:10,代码来源:internal.py

示例6: __init__

# 需要导入模块: from twitter.pants.base import Target [as 别名]
# 或者: from twitter.pants.base.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:CodeWarltz,项目名称:commons,代码行数:11,代码来源:doc.py

示例7: __init__

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

示例8: __init__

# 需要导入模块: from twitter.pants.base import Target [as 别名]
# 或者: from twitter.pants.base.Target import __init__ [as 别名]
  def __init__(self, name, url, push_db, exclusives=None):
    """name: an identifier for the repo
    url: the url used to access the repo and retrieve artifacts or artifact metadata
    push_db: the data file associated with this repo that records artifact push history"""

    Target.__init__(self, name, exclusives=exclusives)

    self.name = name
    self.url = url
    self.push_db = push_db
开发者ID:BabyDuncan,项目名称:commons,代码行数:12,代码来源:repository.py

示例9: __init__

# 需要导入模块: from twitter.pants.base import Target [as 别名]
# 或者: from twitter.pants.base.Target import __init__ [as 别名]
  def __init__(self, name, dependencies):
    """name: The name of this module target, addressable via pants via the portion of the spec
        following the colon
    dependencies: one or more JarDependencies this JarLibrary bundles or Pants pointing to other
        JarLibraries or JavaTargets"""

    assert len(dependencies) > 0, "At least one dependency must be specified"
    Target.__init__(self, name, False)

    self.dependencies = dependencies
开发者ID:adamsxu,项目名称:commons,代码行数:12,代码来源:jar_library.py

示例10: __init__

# 需要导入模块: from twitter.pants.base import Target [as 别名]
# 或者: from twitter.pants.base.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:alfss,项目名称:commons,代码行数:14,代码来源:python_requirement.py

示例11: __init__

# 需要导入模块: from twitter.pants.base import Target [as 别名]
# 或者: from twitter.pants.base.Target import __init__ [as 别名]
  def __init__(self, name, dependencies):
    """name: The name of this module target, addressable via pants via the portion of the spec
        following the colon
    dependencies: one or more JarDependencies this JarLibrary bundles or Pants pointing to other
        JarLibraries or JavaTargets"""

    assert len(dependencies) > 0, "At least one dependency must be specified"
    Target.__init__(self, name, False)
    self.add_label('jars')
    self.dependencies = resolve(dependencies)
    self.dependency_addresses = set()
    for dependency in self.dependencies:
      if hasattr(dependency, 'address'):
        self.dependency_addresses.add(dependency.address)
开发者ID:ewhauser,项目名称:commons,代码行数:16,代码来源:jar_library.py

示例12: __init__

# 需要导入模块: from twitter.pants.base import Target [as 别名]
# 或者: from twitter.pants.base.Target import __init__ [as 别名]
  def __init__(self, spec):
    # it's critical the spec is parsed 1st, the results are needed elsewhere in constructor flow
    parse_context = ParseContext.locate()

    def parse_address():
      if spec.startswith(':'):
        # the :[target] could be in a sibling BUILD - so parse using the canonical address
        pathish = "%s:%s" % (parse_context.buildfile.canonical_relpath, spec[1:])
        return Address.parse(parse_context.buildfile.root_dir, pathish, False)
      else:
        return Address.parse(parse_context.buildfile.root_dir, spec, False)

    self.address = parse_address()

    Target.__init__(self, self.address.target_name, False)
开发者ID:DikangGu,项目名称:commons,代码行数:17,代码来源:pants_target.py

示例13: __init__

# 需要导入模块: from twitter.pants.base import Target [as 别名]
# 或者: from twitter.pants.base.Target import __init__ [as 别名]
  def __init__(self, spec):
    # it's critical the spec is parsed 1st, the results are needed elsewhere in constructor flow
    parse_context = ParseContext.locate()

    def parse_address():
      if spec.startswith(':'):
        # the :[target] could be in a sibling BUILD - so parse using the canonical address
        pathish = "%s:%s" % (parse_context.buildfile.canonical_relpath, spec[1:])
        return Address.parse(parse_context.buildfile.root_dir, pathish, False)
      else:
        return Address.parse(parse_context.buildfile.root_dir, spec, False)

    self.address = parse_address()
    # We must disable the re-init check, because our funky __getattr__ breaks it.
    # We're not involved in any multiple inheritance, so it's OK to disable it here.
    Target.__init__(self, self.address.target_name, False, reinit_check=False)
开发者ID:JoeEnnever,项目名称:commons,代码行数:18,代码来源:pants_target.py

示例14: __init__

# 需要导入模块: from twitter.pants.base import Target [as 别名]
# 或者: from twitter.pants.base.Target import __init__ [as 别名]
  def __init__(self, name, dependencies):
    """name: The name of this module target, addressable via pants via the portion of the spec
        following the colon
    dependencies: one or more JarDependencies this JarLibrary bundles or Pants pointing to other
        JarLibraries or JavaTargets
    """

    Target.__init__(self, name)

    if dependencies is None:
      raise TargetDefinitionException(self, "A dependencies list must be supplied even if empty.")

    self.add_labels('jars')
    self.dependencies = resolve(dependencies)
    self.dependency_addresses = set()
    for dependency in self.dependencies:
      if hasattr(dependency, 'address'):
        self.dependency_addresses.add(dependency.address)
开发者ID:jalons,项目名称:commons,代码行数:20,代码来源:jar_library.py

示例15: __init__

# 需要导入模块: from twitter.pants.base import Target [as 别名]
# 或者: from twitter.pants.base.Target import __init__ [as 别名]
  def __init__(self, name, dependencies, exclusives=None):
    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()

    # TODO(John Sirois): just use the more general check: if parsing: delay(doit) else: doit()
    # Fix how target _ids are built / addresses to not require a BUILD file - ie: support anonymous,
    # non-addressable targets - which is what meta-targets really are once created.

    # Defer dependency resolution after parsing the current BUILD file to allow for forward
    # references
    self._post_construct(self.update_dependencies, self.processed_dependencies)

    self._post_construct(self.inject_dependencies)
开发者ID:BabyDuncan,项目名称:commons,代码行数:22,代码来源:internal.py


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