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


Python Shading.create_relocate方法代码示例

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


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

示例1: test_relocate

# 需要导入模块: from pants.backend.jvm.subsystems.shader import Shading [as 别名]
# 或者: from pants.backend.jvm.subsystems.shader.Shading import create_relocate [as 别名]
  def test_relocate(self):
    self.assertEqual(('com.foo.bar.**', '{}[email protected]'.format(Shading.SHADE_PREFIX)),
                     Shading.create_relocate(from_pattern='com.foo.bar.**'))

    self.assertEqual(('com.foo.bar.**', '{}[email protected]'.format('__my_prefix__.')),
                     Shading.create_relocate(from_pattern='com.foo.bar.**',
                                      shade_prefix='__my_prefix__.'))

    self.assertEqual(('com.foo.bar.**', '[email protected]'.format('__my_prefix__.')),
                     Shading.create_relocate(from_pattern='com.foo.bar.**',
                                      shade_prefix='__my_prefix__.',
                                      shade_pattern='[email protected]'))
开发者ID:CaitieM20,项目名称:pants,代码行数:14,代码来源:test_shader.py

示例2: test_relocate

# 需要导入模块: from pants.backend.jvm.subsystems.shader import Shading [as 别名]
# 或者: from pants.backend.jvm.subsystems.shader.Shading import create_relocate [as 别名]
    def test_relocate(self):
        self.assertEqual(
            ("com.foo.bar.**", "{}[email protected]".format(Shading.SHADE_PREFIX)),
            Shading.create_relocate(from_pattern="com.foo.bar.**"),
        )

        self.assertEqual(
            ("com.foo.bar.**", "{}[email protected]".format("__my_prefix__.")),
            Shading.create_relocate(from_pattern="com.foo.bar.**", shade_prefix="__my_prefix__."),
        )

        self.assertEqual(
            ("com.foo.bar.**", "[email protected]".format("__my_prefix__.")),
            Shading.create_relocate(
                from_pattern="com.foo.bar.**", shade_prefix="__my_prefix__.", shade_pattern="[email protected]"
            ),
        )
开发者ID:ahamilton55,项目名称:pants,代码行数:19,代码来源:test_shader.py

示例3: test_assemble_classes_in_meta_inf

# 需要导入模块: from pants.backend.jvm.subsystems.shader import Shading [as 别名]
# 或者: from pants.backend.jvm.subsystems.shader.Shading import create_relocate [as 别名]
  def test_assemble_classes_in_meta_inf(self):
    input_jar = self.populate_input_jar('org/pantsbuild/tools/fake/Main.class',
                                        'META-INF/versions/9/javax/xml/bind/ModuleInfo.class')

    rules = self.shader.assemble_binary_rules('org.pantsbuild.tools.fake.Main', input_jar)

    self.assertEqual(Shader.exclude_package('org.pantsbuild.tools.fake'), rules[0])
    self.assertIn(Shader.exclude_package('javax', recursive=True), rules[1:])
    self.assertNotIn(Shading.create_relocate('META-INF.versions.9.javax.xml.bind.*'), rules[1:])
开发者ID:baroquebobcat,项目名称:pants,代码行数:11,代码来源:test_shader.py

示例4: test_rules_file

# 需要导入模块: from pants.backend.jvm.subsystems.shader import Shading [as 别名]
# 或者: from pants.backend.jvm.subsystems.shader.Shading import create_relocate [as 别名]
 def test_rules_file(self):
   expected = [
     'rule a.b.c.** [email protected]\n',
     'rule a.*.b [email protected]\n',
     'rule x.y.z.** [email protected]\n',
     'zap com.foo.bar.Main\n',
     'zap com.baz.*\n',
     'keep org.foobar.vegetable.Potato\n',
     'keep org.foobar.fruit.**\n',
   ]
   rules = [
     Shading.create_relocate('a.b.c.**', '[email protected]'),
     Shading.create_relocate('a.*.b', shade_prefix='shaded.'),
     Shading.create_relocate_package('x.y.z', shade_prefix='shaded.'),
     Shading.create_zap('com.foo.bar.Main'),
     Shading.create_zap_package('com.baz', recursive=False),
     Shading.create_keep('org.foobar.vegetable.Potato'),
     Shading.create_keep_package('org.foobar.fruit'),
   ]
   with self.shader.temporary_rules_file(rules) as fname:
     with open(fname, 'r') as f:
       received = f.readlines()
       self.assertEqual(received, expected)
开发者ID:CaitieM20,项目名称:pants,代码行数:25,代码来源:test_shader.py

示例5: test_rules_file

# 需要导入模块: from pants.backend.jvm.subsystems.shader import Shading [as 别名]
# 或者: from pants.backend.jvm.subsystems.shader.Shading import create_relocate [as 别名]
 def test_rules_file(self):
     expected = [
         "rule a.b.c.** [email protected]\n",
         "rule a.*.b [email protected]\n",
         "rule x.y.z.** [email protected]\n",
         "zap com.foo.bar.Main\n",
         "zap com.baz.*\n",
         "keep org.foobar.vegetable.Potato\n",
         "keep org.foobar.fruit.**\n",
     ]
     rules = [
         Shading.create_relocate("a.b.c.**", "[email protected]"),
         Shading.create_relocate("a.*.b", shade_prefix="shaded."),
         Shading.create_relocate_package("x.y.z", shade_prefix="shaded."),
         Shading.create_zap("com.foo.bar.Main"),
         Shading.create_zap_package("com.baz", recursive=False),
         Shading.create_keep("org.foobar.vegetable.Potato"),
         Shading.create_keep_package("org.foobar.fruit"),
     ]
     with self.shader.temporary_rules_file(rules) as fname:
         with open(fname, "r") as f:
             received = f.readlines()
             self.assertEqual(received, expected)
开发者ID:ahamilton55,项目名称:pants,代码行数:25,代码来源:test_shader.py


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