Build the 'output' section of the metadata.

        :return: list, Output instances
344721
def get_output(self, buildroot_id):
        

        def add_buildroot_id(output):
            logfile, metadata = output
            metadata.update({'buildroot_id': buildroot_id})
            return Output(file=logfile, metadata=metadata)

        def add_log_type(output, arch):
            logfile, metadata = output
            metadata.update({'type': 'log', 'arch': arch})
            return Output(file=logfile, metadata=metadata)

        arch = os.uname()[4]
        output_files = [add_log_type(add_buildroot_id(metadata), arch)
                        for metadata in self.get_logs()]

        # Parent of squashed built image is base image
        image_id = self.workflow.builder.image_id
        parent_id = None
        if not self.workflow.builder.base_from_scratch:
            parent_id = self.workflow.builder.base_image_inspect['Id']

        # Read config from the registry using v2 schema 2 digest
        registries = self.workflow.push_conf.docker_registries
        if registries:
            config = copy.deepcopy(registries[0].config)
        else:
            config = {}

        # We don't need container_config section
        if config and 'container_config' in config:
            del config['container_config']

        repositories, typed_digests = self.get_repositories_and_digests()
        tags = set(image.tag for image in self.workflow.tag_conf.images)
        metadata, output = self.get_image_output()

        metadata.update({
            'arch': arch,
            'type': 'docker-image',
            'components': self.get_image_components(),
            'extra': {
                'image': {
                    'arch': arch,
                },
                'docker': {
                    'id': image_id,
                    'parent_id': parent_id,
                    'repositories': repositories,
                    'layer_sizes': self.workflow.layer_sizes,
                    'tags': list(tags),
                    'config': config,
                    'digests': typed_digests
                },
            },
        })

        if self.workflow.builder.base_from_scratch:
            del metadata['extra']['docker']['parent_id']
        if not config:
            del metadata['extra']['docker']['config']
        if not typed_digests:
            del metadata['extra']['docker']['digests']

        # Add the 'docker save' image to the output
        image = add_buildroot_id(output)
        output_files.append(image)

        # add operator manifests to output
        operator_manifests_path = (self.workflow.postbuild_results
                                   .get(PLUGIN_EXPORT_OPERATOR_MANIFESTS_KEY))
        if operator_manifests_path:
            operator_manifests_file = open(operator_manifests_path)
            manifests_metadata = self.get_output_metadata(operator_manifests_path,
                                                          OPERATOR_MANIFESTS_ARCHIVE)
            operator_manifests_output = Output(file=operator_manifests_file,
                                               metadata=manifests_metadata)
            # We use log type here until a more appropriate type name is supported by koji
            operator_manifests_output.metadata.update({'arch': arch, 'type': 'log'})
            operator_manifests = add_buildroot_id(operator_manifests_output)
            output_files.append(operator_manifests)

        return output_files
303928
def _output_to_list(cmdoutput):
    '''
    
    '''
    return [item for line in cmdoutput.splitlines() if _safe_output(line) for item in line.split()]
1178001
def config_file_contents
      output = []
      output << HEADING
      output << 'linters:' if linters_with_lints.any?
      linters_with_lints.each do |linter, files|
        output << generate_config_for_linter(linter, files)
      end
      output.join("\n\n")
    end
260355
def FormatArtifacts(self, artifacts):
    
    # TODO: improve output formatting of yaml
    artifact_definitions = [artifact.AsDict() for artifact in artifacts]
    yaml_data = yaml.safe_dump_all(artifact_definitions)
    return yaml_data
869261
def write_metadata res
      File.open(@options[:output_parameters], 'wb') do |f|
        f.write(JSON.pretty_generate(res))
      end
    end
872414
def build_output(self, fout):
        
        fout.write('\n'.join([s for s in self.out]))
1367634
def get_data():
    

    output = []
    tables = get_tables()
    for table in tables:
        columns = get_columns(table)

        for column in columns:
            if column['name'] == 'tenant_id':
                output.append((table, column))

    return output
444645
def GetOutputClasses(cls):
    
    for _, output_class in iter(cls._output_classes.items()):
      yield output_class.NAME, output_class
513259
def _create_raw_data(self):
        
        result = {}
        for section in self.get_sections():
            result[section.get('id')] = 'all'
        return result
17468
def output_extras(self, output_file):
        
        output_directory = dirname(output_file)

        def local_path(name):
            return join(output_directory, self.path_helper.local_name(name))

        files_directory = "%s_files%s" % (basename(output_file)[0:-len(".dat")], self.path_helper.separator)
        names = filter(lambda o: o.startswith(files_directory), self.output_directory_contents)
        return dict(map(lambda name: (local_path(name), name), names))
1209707
def make_output_layers(self):
        
        # TODO
        # use successors == 0 as the criteria for output layer
        # will fail when some intermediate layers also generate output.
        # However, because the possibility of having inserted layers,
        # it's more difficult to tell which layer is the output layer.
        # Once possible way is to keep track of newly added layers...
        self.output_layers = []
        for layer in self.layer_list:
            if len(self.get_successors(layer)) == 0:
                self.output_layers.append(layer)
1320407
def show(self, brief=False):
        
        output = []
        for path in self.options.paths or ["."]:
            if self.options.verbose:
                utils.info("Checking {0} for metadata.".format(path))
            tree = fmf.Tree(path)
            for node in tree.prune(
                    self.options.whole, self.options.keys, self.options.names,
                    self.options.filters):
                if brief:
                    show = node.show(brief=True)
                else:
                    show = node.show(
                        brief=False,
                        formatting=self.options.formatting,
                        values=self.options.values)
                # List source files when in debug mode
                if self.options.debug:
                    for source in node.sources:
                        show += utils.color("{0}\n".format(source), "blue")
                if show is not None:
                    output.append(show)

        # Print output and summary
        if brief or self.options.formatting:
            joined = "".join(output)
        else:
            joined = "\n".join(output)
        try: # pragma: no cover
            print(joined, end="")
        except UnicodeEncodeError: # pragma: no cover
            print(joined.encode('utf-8'), end="")
        if self.options.verbose:
            utils.info("Found {0}.".format(
                utils.listed(len(output), "object")))
        self.output = joined
187124
def output_names(self) -> Iterable[str]:
        """"""
        self._load_models()
        return chain.from_iterable(map(lambda m: m.output_names, self._models))
4559
def create_metadata_file(output_path, data_dir):
    '''
    '''

    # Relative path to all (BASIS).metadata.json files
    meta_filelist, table_filelist, _, _ = get_all_filelist(data_dir)

    metadata = {}
    for meta_file_relpath in meta_filelist:

        # Read in the metadata for a single basis set
        meta_file_path = os.path.join(data_dir, meta_file_relpath)
        bs_metadata = read_json_basis(meta_file_path)

        # Base of the filename for table basis sets
        # Basename is something like '6-31G.', including the last period
        base_relpath, meta_filename = os.path.split(meta_file_relpath)
        base_filename = meta_filename.split('.')[0] + '.'

        # All the table files that correspond to this metadata file
        # (relative to data_dir)

        this_filelist = [
            x for x in table_filelist
            if os.path.dirname(x) == base_relpath and os.path.basename(x).startswith(base_filename)
        ]

        # The 'versions' dict that will go into the metadata
        version_info = {}

        # Make sure function types are the same
        function_types = None

        # For each table basis, compose it
        for table_file in this_filelist:
            # Obtain just the filename of the table basis
            table_filename = os.path.basename(table_file)

            # Obtain the base filename and version from the filename
            # The base filename is the part before the first period
            # (filebase.ver.table.json)
            table_filebase, ver, _, _ = table_filename.split('.')

            # Fully compose the basis set from components
            bs = compose_table_basis(table_file, data_dir)

            # Elements for which this basis is defined
            defined_elements = sorted(list(bs['elements'].keys()), key=lambda x: int(x))

            # Determine the types of functions contained in the basis
            # (gto, ecp, etc)
            if function_types is None:
                function_types = bs['function_types']
            elif function_types != bs['function_types']:
                raise RuntimeError("Differing function types across versions for " + base_filename)

            # Create the metadata for this specific version
            # yapf: disable
            version_info[ver] = { 'file_relpath': table_file,
                                  'revdesc': bs['revision_description'],
                                  'elements': defined_elements
                                }
            # yapf: enable

        # Sort the version dicts
        version_info = dict(sorted(version_info.items()))
        # Find the maximum version for this basis
        latest_ver = max(version_info.keys())

        # Create the common metadata for this basis set
        # display_name and other_names are placeholders to keep order
        # yapf: disable
        common_md = { 'display_name': None,
                      'other_names': None,
                      'description': bs['description'],
                      'latest_version': latest_ver,
                      'basename': base_filename[:-1], # Strip off that trailing period
                      'relpath': base_relpath,
                      'family': bs['family'],
                      'role': bs['role'],
                      'functiontypes': function_types,
                      'auxiliaries': bs['auxiliaries'],
                      'versions': version_info }
        # yapf: enable

        # Loop through all the common names, translate them, and then add the data
        for bs_name in bs_metadata['names']:
            tr_name = transform_basis_name(bs_name)

            if tr_name in metadata:
                raise RuntimeError("Duplicate basis set name: " + tr_name)

            # Create a new entry, with all the common metadata
            # Also, store the other names for this basis
            other_names = bs_metadata['names'].copy()
            other_names.remove(bs_name)
            metadata[tr_name] = common_md.copy()
            metadata[tr_name]['display_name'] = bs_name
            metadata[tr_name]['other_names'] = other_names

    # Write out the metadata
    metadata = dict(sorted(metadata.items()))
    _write_plain_json(output_path, metadata)
871505
def main(output):
    

    client = SubscriptionClient(Session().get_credentials())
    subs = [sub.serialize(True) for sub in client.subscriptions.list()]
    results = []
    for sub in subs:
        sub_info = {
            'subscription_id': sub['subscriptionId'],
            'name': sub['displayName']
        }
        results.append(sub_info)

    print(
        yaml.safe_dump(
            {'subscriptions': results},
            default_flow_style=False),
        file=output)
448429
def get_metadata(self):
        
        try:
            metadata = get_build_json()["metadata"]
            self.build_id = metadata["name"]
        except KeyError:
            self.log.error("No build metadata")
            raise

        for image in self.workflow.tag_conf.unique_images:
            self.pullspec_image = image
            break

        for image in self.workflow.tag_conf.primary_images:
            # dash at first/last postition does not count
            if '-' in image.tag[1:-1]:
                self.pullspec_image = image
                break

        if not self.pullspec_image:
            raise RuntimeError('Unable to determine pullspec_image')

        metadata_version = 0

        buildroot = self.get_buildroot(build_id=self.build_id)
        output_files = self.get_output(buildroot['id'])

        output = [output.metadata for output in output_files]
        koji_metadata = {
            'metadata_version': metadata_version,
            'buildroots': [buildroot],
            'output': output,
        }
        self.update_buildroot_koji(buildroot, output)

        return koji_metadata, output_files
615356
def output(self):
        
        # uses class name as a meta-table
        return RedshiftTarget(
            host=self.host,
            database=self.database,
            user=self.user,
            password=self.password,
            table=self.__class__.__name__,
            update_id=self.update_id)