def get_only(self, product_type, target):
    """If there is exactly one product for the given product type and target, returns the
    full filepath of said product.

    Otherwise, raises a ProductError.

    Useful for retrieving the filepath for the executable of a binary target.

    :API: public
    """
    product_mapping = self.get(product_type).get(target)
    if len(product_mapping) != 1:
      raise ProductError('{} directories in product mapping: requires exactly 1.'
                         .format(len(product_mapping)))

    for _, files in product_mapping.items():
      if len(files) != 1:
        raise ProductError('{} files in target directory: requires exactly 1.'
                           .format(len(files)))

      return files[0]
def get_only ( self , product_type , target ) : product_mapping = self . get ( product_type ) . get ( target ) if len ( product_mapping ) != 1 : raise ProductError ( '{} directories in product mapping: requires exactly 1.' . format ( len ( product_mapping ) ) ) for _ , files in product_mapping . items ( ) : if len ( files ) != 1 : raise ProductError ( '{} files in target directory: requires exactly 1.' . format ( len ( files ) ) ) return files [ 0 ]
If there is exactly one product for the given product type and target, returns the
    full filepath of said product.

    Otherwise, raises a ProductError.

    Useful for retrieving the filepath for the executable of a binary target.

    :API: public