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


Python Payload.freeze方法代码示例

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


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

示例1: test_fingerprint

# 需要导入模块: from pants.base.payload import Payload [as 别名]
# 或者: from pants.base.payload.Payload import freeze [as 别名]
 def test_fingerprint(self):
   payload = Payload()
   payload.add_field('foo', PrimitiveField())
   fingerprint1 = payload.fingerprint()
   self.assertEqual(fingerprint1, payload.fingerprint())
   payload.add_field('bar', PrimitiveField())
   fingerprint2 = payload.fingerprint()
   self.assertNotEqual(fingerprint1, fingerprint2)
   self.assertEqual(fingerprint2, payload.fingerprint())
   payload.freeze()
   self.assertEqual(fingerprint2, payload.fingerprint())
开发者ID:pcurry,项目名称:pants,代码行数:13,代码来源:test_payload.py

示例2: payload_for_scope

# 需要导入模块: from pants.base.payload import Payload [as 别名]
# 或者: from pants.base.payload.Payload import freeze [as 别名]
 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,代码行数:19,代码来源:options.py

示例3: test_field_duplication

# 需要导入模块: from pants.base.payload import Payload [as 别名]
# 或者: from pants.base.payload.Payload import freeze [as 别名]
 def test_field_duplication(self):
   payload = Payload()
   payload.add_field('foo', PrimitiveField())
   payload.freeze()
   with self.assertRaises(PayloadFieldAlreadyDefinedError):
     payload.add_field('foo', PrimitiveField())
开发者ID:pcurry,项目名称:pants,代码行数:8,代码来源:test_payload.py

示例4: test_freeze

# 需要导入模块: from pants.base.payload import Payload [as 别名]
# 或者: from pants.base.payload.Payload import freeze [as 别名]
 def test_freeze(self):
   payload = Payload()
   payload.add_field('foo', PrimitiveField())
   payload.freeze()
   with self.assertRaises(PayloadFrozenError):
     payload.add_field('bar', PrimitiveField())
开发者ID:pcurry,项目名称:pants,代码行数:8,代码来源:test_payload.py

示例5: _make_payload_from_sources

# 需要导入模块: from pants.base.payload import Payload [as 别名]
# 或者: from pants.base.payload.Payload import freeze [as 别名]
 def _make_payload_from_sources(self, sources):
   p = Payload()
   p.add_field('sources', SourcesField('', sources))
   p.freeze()
   return p
开发者ID:Gabriel439,项目名称:pants,代码行数:7,代码来源:test_jvm_dependency_usage.py


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