本文整理汇总了Python中pants.backend.jvm.subsystems.shader.Shading类的典型用法代码示例。如果您正苦于以下问题:Python Shading类的具体用法?Python Shading怎么用?Python Shading使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Shading类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_relocate_package
def test_relocate_package(self):
self.assertEqual(('com.foo.bar.**', '{}[email protected]'.format(Shading.SHADE_PREFIX)),
Shading.create_relocate_package('com.foo.bar'))
self.assertEqual(('com.foo.bar.*', '{}[email protected]'.format(Shading.SHADE_PREFIX)),
Shading.create_relocate_package('com.foo.bar', recursive=False))
self.assertEqual(('com.foo.bar.**', '[email protected]'),
Shading.create_relocate_package('com.foo.bar', shade_prefix='__p__.'))
示例2: test_relocate
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]'))
示例3: test_relocate_package
def test_relocate_package(self):
self.assertEqual(
("com.foo.bar.**", "{}[email protected]".format(Shading.SHADE_PREFIX)),
Shading.create_relocate_package("com.foo.bar"),
)
self.assertEqual(
("com.foo.bar.*", "{}[email protected]".format(Shading.SHADE_PREFIX)),
Shading.create_relocate_package("com.foo.bar", recursive=False),
)
self.assertEqual(
("com.foo.bar.**", "[email protected]"),
Shading.create_relocate_package("com.foo.bar", shade_prefix="__p__."),
)
示例4: register_options
def register_options(cls, register):
super(ErrorProne, cls).register_options(register)
register('--skip', type=bool, help='Skip Error Prone.')
register('--transitive', default=False, type=bool,
help='Run Error Prone against transitive dependencies of targets '
'specified on the command line.')
register('--command-line-options', type=list, default=[], fingerprint=True,
help='Command line options passed to Error Prone')
register('--exclude-patterns', type=list, default=[], fingerprint=True,
help='Patterns for targets to be excluded from analysis.')
cls.register_jvm_tool(register,
'errorprone',
classpath=[
JarDependency(org='com.google.errorprone',
name='error_prone_core',
rev='2.0.17'),
],
main=cls._ERRORPRONE_MAIN,
custom_rules=[
Shader.exclude_package('com.google.errorprone', recursive=True),
Shading.create_exclude('*'), # https://github.com/pantsbuild/pants/issues/4288
]
)
示例5: test_relocate
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]"
),
)
示例6: test_assemble_classes_in_meta_inf
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:])
示例7: test_rules_file
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)
示例8: test_rules_file
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)
示例9: test_keep_package
def test_keep_package(self):
self.assertEqual(('keep', 'com.foo.bar.**'), Shading.create_keep_package('com.foo.bar', True))
self.assertEqual(('keep', 'com.foo.bar.*'), Shading.create_keep_package('com.foo.bar', False))
示例10: test_shading_exclude_package
def test_shading_exclude_package(self):
self.assertEqual(('com.foo.bar.**', '[email protected]'),
Shading.create_exclude_package('com.foo.bar'))
self.assertEqual(('com.foo.bar.*', '[email protected]'),
Shading.create_exclude_package('com.foo.bar', recursive=False))
示例11: assert_exclude
def assert_exclude(from_pattern, to_pattern):
self.assertEqual((from_pattern, to_pattern), Shading.create_exclude(from_pattern))
示例12: test_keep_package
def test_keep_package(self):
self.assertEqual(("keep", "com.foo.bar.**"), Shading.create_keep_package("com.foo.bar", True))
self.assertEqual(("keep", "com.foo.bar.*"), Shading.create_keep_package("com.foo.bar", False))
示例13: test_shading_exclude_package
def test_shading_exclude_package(self):
self.assertEqual(("com.foo.bar.**", "[email protected]"), Shading.create_exclude_package("com.foo.bar"))
self.assertEqual(
("com.foo.bar.*", "[email protected]"), Shading.create_exclude_package("com.foo.bar", recursive=False)
)