Пример #1
0
def find_valid_field_sets(
        request: FieldSetsPerTargetRequest,
        union_membership: UnionMembership) -> FieldSetsPerTarget:
    field_set_types = union_membership.get(request.field_set_superclass)
    return FieldSetsPerTarget((field_set_type.create(target)
                               for field_set_type in field_set_types
                               if field_set_type.is_applicable(target))
                              for target in request.targets)
Пример #2
0
def find_valid_field_sets(
    request: FieldSetsPerTargetRequest,
    union_membership: UnionMembership,
) -> FieldSetsPerTarget:
    field_set_types: Iterable[Type[FieldSet]] = union_membership.union_rules[
        request.field_set_superclass]
    return FieldSetsPerTarget((field_set_type.create(target)
                               for field_set_type in field_set_types
                               if field_set_type.is_applicable(target))
                              for target in request.targets)