Пример #1
0
 def opt_out(cls, tgt: Target) -> bool:
     if tgt.get(SkipPythonTestsField).value:
         return True
     if not tgt.address.is_file_target:
         return False
     file_name = PurePath(tgt.address.filename)
     return file_name.name == "conftest.py" or file_name.suffix == ".pyi"
Пример #2
0
def is_ownable_target(tgt: Target, union_membership: UnionMembership) -> bool:
    return (
        # Note that we check for a PythonProvides field so that a python_distribution
        # target can be owned (by itself). This is so that if there are any 3rdparty
        # requirements directly on the python_distribution target, we apply them to the dist.
        # This isn't particularly useful (3rdparty requirements should be on the python_sources
        # that consumes them)... but users may expect it to work anyway.
        tgt.has_field(PythonProvidesField)
        or tgt.has_field(PythonSourceField)
        or tgt.has_field(ResourceSourceField)
        or tgt.get(SourcesField).can_generate(PythonSourceField, union_membership)
        or tgt.get(SourcesField).can_generate(ResourceSourceField, union_membership)
        # We also check for generating sources so that dependencies on `python_sources(sources=[])`
        # is included. Those won't generate any `python_source` targets, but still can be
        # dependended upon.
        or tgt.has_field(PythonGeneratingSourcesBase)
    )
Пример #3
0
def is_ownable_target(tgt: Target, union_membership: UnionMembership) -> bool:
    return (
        # Note that we check for a PythonProvides field so that a python_distribution
        # target can be owned (by itself). This is so that if there are any 3rdparty
        # requirements directly on the python_distribution target, we apply them to the dist.
        # This isn't particularly useful (3rdparty requirements should be on the python_library
        # that consumes them)... but users may expect it to work anyway.
        tgt.has_field(PythonProvidesField) or tgt.has_field(PythonSources)
        or tgt.has_field(ResourcesSources)
        or tgt.get(Sources).can_generate(PythonSources, union_membership))
Пример #4
0
 def create(cls, tgt: Target) -> "BinaryConfiguration":
     all_expected_fields: Dict[str, Type[Field]] = {
         dataclass_field.name: dataclass_field.type
         for dataclass_field in dataclasses.fields(cls)
         if issubclass(dataclass_field.type, Field)
     }
     return cls(  # type: ignore[call-arg]
         address=tgt.address,
         **{
             dataclass_field_name: (
                 tgt[field_cls] if field_cls in cls.required_fields else tgt.get(field_cls)
             )
             for dataclass_field_name, field_cls in all_expected_fields.items()
         },
     )
Пример #5
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipMyPyField).value and not tgt.address.is_file_target
Пример #6
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipFlake8Field).value
Пример #7
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipBufFormatField).value
Пример #8
0
 def is_applicable(cls, tgt: Target) -> bool:
     return tgt.get(UsesMyPycField).value
Пример #9
0
 def tags_inner_filter(tgt: Target) -> bool:
     return tag in (tgt.get(Tags).value or [])
Пример #10
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipGoogleJavaFormatField).value
Пример #11
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipAutoflakeField).value
Пример #12
0
 def filter_target(tgt: Target) -> bool:
     return tag in (tgt.get(Tags).value or [])
Пример #13
0
def is_ownable_target(tgt: Target, union_membership: UnionMembership) -> bool:
    return (tgt.has_field(PythonSources) or tgt.has_field(ResourcesSources)
            or tgt.get(Sources).can_generate(PythonSources, union_membership))
Пример #14
0
 def is_applicable(cls, target: Target) -> bool:
     return bool(target.get(RuntimePackageDependenciesField).value)
Пример #15
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipPythonTestsField).value
Пример #16
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(OptOutField).value is True
Пример #17
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipShunit2TestsField).value
Пример #18
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipHadolintField).value
Пример #19
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipPyUpgradeField).value
Пример #20
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipShellcheckField).value
Пример #21
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipDocformatterField).value
Пример #22
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipGofmtField).value
Пример #23
0
 def create(cls, tgt: Target) -> "PythonBinaryFields":
     return cls(tgt.address,
                sources=tgt.get(PythonBinarySources),
                entry_point=tgt.get(EntryPoint))