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"
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) )
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))
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() }, )
def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipMyPyField).value and not tgt.address.is_file_target
def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipFlake8Field).value
def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipBufFormatField).value
def is_applicable(cls, tgt: Target) -> bool: return tgt.get(UsesMyPycField).value
def tags_inner_filter(tgt: Target) -> bool: return tag in (tgt.get(Tags).value or [])
def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipGoogleJavaFormatField).value
def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipAutoflakeField).value
def filter_target(tgt: Target) -> bool: return tag in (tgt.get(Tags).value or [])
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))
def is_applicable(cls, target: Target) -> bool: return bool(target.get(RuntimePackageDependenciesField).value)
def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipPythonTestsField).value
def opt_out(cls, tgt: Target) -> bool: return tgt.get(OptOutField).value is True
def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipShunit2TestsField).value
def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipHadolintField).value
def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipPyUpgradeField).value
def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipShellcheckField).value
def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipDocformatterField).value
def opt_out(cls, tgt: Target) -> bool: return tgt.get(SkipGofmtField).value
def create(cls, tgt: Target) -> "PythonBinaryFields": return cls(tgt.address, sources=tgt.get(PythonBinarySources), entry_point=tgt.get(EntryPoint))