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


Python payload.Payload类代码示例

本文整理汇总了Python中pants.base.payload.Payload的典型用法代码示例。如果您正苦于以下问题:Python Payload类的具体用法?Python Payload怎么用?Python Payload使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ManifestEntries

class ManifestEntries(FingerprintedMixin):
  """Describes additional items to add to the app manifest."""

  class ExpectedDictionaryError(Exception):
    pass

  def __init__(self, entries=None):
    """
    :param entries: Additional headers, value pairs to add to the MANIFEST.MF.
      You can just add fixed string header / value pairs.
    :type entries: dictionary of string : string
    """
    self.payload = Payload()
    if entries:
      if not isinstance(entries, dict):
        raise self.ExpectedDictionaryError("entries must be a dictionary of strings.")
      for key in entries.keys():
        if not isinstance(key, string_types):
          raise self.ExpectedDictionaryError(
            "entries must be dictionary of strings, got key {} type {}"
            .format(key, type(key).__name__))
    self.payload.add_fields({
      'entries' : PrimitiveField(entries or {}),
      })

  def fingerprint(self):
    return self.payload.fingerprint()

  @property
  def entries(self):
    return self.payload.entries
开发者ID:MathewJennings,项目名称:pants,代码行数:31,代码来源:jvm_binary.py

示例2: __init__

 def __init__(self, sources, address=None, exports=None, **kwargs):
   payload = Payload()
   payload.add_field('sources', self.create_sources_field(sources,
                                                          sources_rel_path=address.spec_path,
                                                          key_arg='sources'))
   payload.add_field('exports', PrimitivesSetField(exports or []))
   super(SourcesTarget, self).__init__(address=address, payload=payload, **kwargs)
开发者ID:foursquare,项目名称:pants,代码行数:7,代码来源:test_target.py

示例3: __init__

 def __init__(self, zip_url, rev='', **kwargs):
   """
   :param str zip_url:
     - Any URL from which a zipfile can be downloaded containing the source code of the
       remote library.
     - Can be a template string using variables {host}, {id}, {rev}.
       Example: "{host}/{id}/{rev}.zip"
         - {host} The host address to download zip files from. Specified by an option to
                  GoFetch, '--remote-lib-host'.
         - {id} The global import identifier of the library, which is specified by the path to
                the BUILD file relative to the source root of all 3rd party Go libraries.
                For example, If the 3rd party source root is "3rdparty/go", a target at
                "3rdparty/go/github.com/user/lib" would have an {id} of "github.com/user/lib".
         - {rev} See :param rev:
     - The zip file is expected to have zipped the library directory itself, and NOT the
       direct contents of the library.
         Expected: `zip -r mylib.zip mylib/`
              Not: `zip -r mylib.zip mylib/*`
   :param str rev: Identifies which version of the remote library to download.
                   This could be a commit SHA (git), node id (hg), etc.
   """
   payload = Payload()
   payload.add_fields({
     'rev': PrimitiveField(rev),
     'zip_url': PrimitiveField(zip_url)
   })
   super(GoRemoteLibrary, self).__init__(payload=payload, **kwargs)
开发者ID:TansyArron,项目名称:pants,代码行数:27,代码来源:go_remote_library.py

示例4: __init__

 def __init__(self, prefixes=None, provides=None, *args, **kwargs):
   payload = Payload()
   payload.add_fields({
     'prefixes': prefixes,
     'provides': provides,
   })
   super(PomTarget, self).__init__(payload=payload, *args, **kwargs)
开发者ID:boriskozak,项目名称:fsqio,代码行数:7,代码来源:pom_publish.py

示例5: __init__

 def __init__(self, address, sources, copied=None, **kwargs):
   self.copied = copied
   payload = Payload()
   payload.add_fields({
     'sources': self.create_sources_field(sources, address.spec_path, key_arg='sources'),
   })
   super(DummyTargetBase, self).__init__(address=address, payload=payload, **kwargs)
开发者ID:benjyw,项目名称:pants,代码行数:7,代码来源:test_simple_codegen_task.py

示例6: __init__

 def __init__(self, distribution_fingerprint=None, *args, **kwargs):
  """Synthetic target that represents a resolved webpack distribution."""
  # Creating the synthetic target lets us avoid any special casing in regards to build order or cache invalidation.
  payload = Payload()
  payload.add_fields({
    'distribution_fingerprint': PrimitiveField(distribution_fingerprint),
  })
  super(WebPackDistribution, self).__init__(payload=payload, *args, **kwargs)
开发者ID:mateor,项目名称:fsqio,代码行数:8,代码来源:webpack_resolve.py

示例7: __init__

  def __init__(self, resolver, **kwargs):
    """
    :param str resolver: The `stack` resolver (i.e. "lts-3.1" or "nightly-2015-08-29")
    """

    self.resolver = resolver

    payload = Payload()
    payload.add_fields({
      'resolver': PrimitiveField(self.resolver),
    })
    super(HaskellProject, self).__init__(payload = payload, **kwargs)
开发者ID:jduan,项目名称:pants,代码行数:12,代码来源:haskell_project.py

示例8: __init__

    def __init__(self, apply_pattern, action):
        """Creates a rule for handling duplicate jar entries.

    :param string apply_pattern: A regular expression that matches duplicate jar entries this rule
      applies to.
    :param action: An action to take to handle one or more duplicate entries.  Must be one of:
      ``Duplicate.SKIP``, ``Duplicate.REPLACE``, ``Duplicate.CONCAT``, ``Duplicate.CONCAT_TEXT``,
      or ``Duplicate.FAIL``.
    """
        payload = Payload()
        payload.add_fields({"action": PrimitiveField(self.validate_action(action))})
        super(Duplicate, self).__init__(apply_pattern, payload=payload)
开发者ID:leloulight,项目名称:pants,代码行数:12,代码来源:jvm_binary.py

示例9: __init__

  def __init__(self, package=None, **kwargs):
    """
    :param str package: Optional name of the package (i.e. "network" or "containers").  Defaults to `name` if omitted
    """

    self.package  = package or kwargs['name']

    payload = Payload()
    payload.add_fields({
      'package': PrimitiveField(self.package),
    })
    super(HaskellStackagePackage, self).__init__(payload = payload, **kwargs)
开发者ID:cheister,项目名称:pants,代码行数:12,代码来源:haskell_stackage_package.py

示例10: __init__

  def __init__(self, version, package=None, **kwargs):
    """
    :param str version: The package version string (i.e. "0.4.3.0" or "1.0.0")
    :param str package: Optional name of the package (i.e. "network" or "containers").  Defaults to `name` if omitted
    """
    self.version = version
    self.package  = package or kwargs['name']

    payload = Payload()
    payload.add_fields({
      'version': PrimitiveField(self.version),
      'package': PrimitiveField(self.package),
    })
    super(HaskellHackagePackage, self).__init__(**kwargs)
开发者ID:cheister,项目名称:pants,代码行数:14,代码来源:haskell_hackage_package.py

示例11: __init__

 def __init__(self,
              libraries=None,
              *args,
              **kwargs):
   """
   :param libraries: Libraries that this target depends on that are not pants targets.
   For example, 'm' or 'rt' that are expected to be installed on the local system.
   :type libraries: List of libraries to link against.
   """
   payload = Payload()
   payload.add_fields({
     'libraries': PrimitiveField(libraries)
   })
   super(CppBinary, self).__init__(payload=payload, **kwargs)
开发者ID:MathewJennings,项目名称:pants,代码行数:14,代码来源:cpp_binary.py

示例12: __init__

 def __init__(self,
              binary=None,
              handler=None,
              **kwargs):
   """
   :param string binary: Target spec of the ``python_binary`` that contains the handler.
   :param string handler: Lambda handler entrypoint (module.dotted.name:handler_func).
   """
   payload = Payload()
   payload.add_fields({
     'binary': PrimitiveField(binary),
     'handler': PrimitiveField(handler),
   })
   super(PythonAWSLambda, self).__init__(payload=payload, **kwargs)
开发者ID:cosmicexplorer,项目名称:pants,代码行数:14,代码来源:python_awslambda.py

示例13: __init__

  def __init__(self, package=None, path=None, **kwargs):
    """
    :param str package: Optional name of the package (i.e. "network" or "containers").  Defaults to `name` if omitted
    :param str path: Optional path to a remote source archive in TAR or ZIP format.
    """

    self.package = package or kwargs['name']
    self.path = path

    payload = Payload()
    payload.add_fields({
      'package': PrimitiveField(self.package),
      'path': PrimitiveField(self.path),
    })
    super(HaskellSourcePackage, self).__init__(payload = payload, **kwargs)
开发者ID:cheister,项目名称:pants,代码行数:15,代码来源:haskell_source_package.py

示例14: payload_for_scope

 def payload_for_scope(self, scope):
   """Returns a payload representing the options for the given scope."""
   payload = Payload()
   for (name, _, kwargs) in self.registration_args_iter_for_scope(scope):
     if not kwargs.get('fingerprint', False):
       continue
     val = self.for_scope(scope)[name]
     val_type = kwargs.get('type', '')
     if val_type == Options.file:
       field = FileField(val)
     elif val_type == Options.target_list:
       field = TargetListField(val)
     else:
       field = PrimitiveField(val)
     payload.add_field(name, field)
   payload.freeze()
   return payload
开发者ID:digwanderlust,项目名称:pants,代码行数:17,代码来源:options.py

示例15: __init__

  def __init__(self, address, payload=None, sources=None, ctypes_native_library=None,
               strict_deps=None, fatal_warnings=None, **kwargs):

    if not payload:
      payload = Payload()
    sources_field = self.create_sources_field(sources, address.spec_path, key_arg='sources')
    payload.add_fields({
      'sources': sources_field,
      'ctypes_native_library': ctypes_native_library,
      'strict_deps': PrimitiveField(strict_deps),
      'fatal_warnings': PrimitiveField(fatal_warnings),
    })

    if ctypes_native_library and not isinstance(ctypes_native_library, NativeArtifact):
      raise TargetDefinitionException(
        "Target must provide a valid pants '{}' object. Received an object with type '{}' "
        "and value: {}."
        .format(NativeArtifact.alias(), type(ctypes_native_library).__name__, ctypes_native_library))

    super(NativeLibrary, self).__init__(address=address, payload=payload, **kwargs)
开发者ID:foursquare,项目名称:pants,代码行数:20,代码来源:native_library.py


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