Esempio n. 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"
Esempio n. 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)
    )
Esempio n. 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))
Esempio n. 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()
         },
     )
Esempio n. 5
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipMyPyField).value and not tgt.address.is_file_target
Esempio n. 6
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipFlake8Field).value
Esempio n. 7
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipBufFormatField).value
Esempio n. 8
0
 def is_applicable(cls, tgt: Target) -> bool:
     return tgt.get(UsesMyPycField).value
Esempio n. 9
0
 def tags_inner_filter(tgt: Target) -> bool:
     return tag in (tgt.get(Tags).value or [])
Esempio n. 10
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipGoogleJavaFormatField).value
Esempio n. 11
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipAutoflakeField).value
Esempio n. 12
0
 def filter_target(tgt: Target) -> bool:
     return tag in (tgt.get(Tags).value or [])
Esempio n. 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))
Esempio n. 14
0
 def is_applicable(cls, target: Target) -> bool:
     return bool(target.get(RuntimePackageDependenciesField).value)
Esempio n. 15
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipPythonTestsField).value
Esempio n. 16
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(OptOutField).value is True
Esempio n. 17
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipShunit2TestsField).value
Esempio n. 18
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipHadolintField).value
Esempio n. 19
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipPyUpgradeField).value
Esempio n. 20
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipShellcheckField).value
Esempio n. 21
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipDocformatterField).value
Esempio n. 22
0
 def opt_out(cls, tgt: Target) -> bool:
     return tgt.get(SkipGofmtField).value
Esempio n. 23
0
 def create(cls, tgt: Target) -> "PythonBinaryFields":
     return cls(tgt.address,
                sources=tgt.get(PythonBinarySources),
                entry_point=tgt.get(EntryPoint))