<commit_before>package main

import (
	"fmt"

	"github.com/fsouza/go-dockerclient"

	weavenet "github.com/weaveworks/weave/net"
)

func containerAddrs(args []string) error {
	if len(args) < 1 {
		cmdUsage("container-addrs", "<bridgeName> [containerID ...]")
	}
	bridgeName := args[0]

	client, err := docker.NewVersionedClientFromEnv("1.18")
	if err != nil {
		return err
	}

	peerIDs, err := weavenet.ConnectedToBridgeVethPeerIds(bridgeName)
	if err != nil {
		if err == weavenet.ErrLinkNotFound {
			return nil
		}
		return err
	}

	containerArgs := []string{}
	for _, cid := range args[1:] {
		if cid == "weave:allids" { // expand to all container IDs
			all, err := client.ListContainers(docker.ListContainersOptions{All: true})
			if err != nil {
				return err
			}
			for _, c := range all {
				containerArgs = append(containerArgs, c.ID)
			}
		} else {
			containerArgs = append(containerArgs, cid)
		}
	}

	var containerIDs []string
	containers := make(map[string]*docker.Container)

	for _, cid := range containerArgs {
		if cid == "weave:expose" {
			netDev, err := weavenet.GetBridgeNetDev(bridgeName)
			if err != nil {
				return err<commit_msg>Only list active containers.<commit_after>package main

import (
	"fmt"

	"github.com/fsouza/go-dockerclient"

	weavenet "github.com/weaveworks/weave/net"
)

func containerAddrs(args []string) error {
	if len(args) < 1 {
		cmdUsage("container-addrs", "<bridgeName> [containerID ...]")
	}
	bridgeName := args[0]

	client, err := docker.NewVersionedClientFromEnv("1.18")
	if err != nil {
		return err
	}

	peerIDs, err := weavenet.ConnectedToBridgeVethPeerIds(bridgeName)
	if err != nil {
		if err == weavenet.ErrLinkNotFound {
			return nil
		}
		return err
	}

	containerArgs := []string{}
	for _, cid := range args[1:] {
		if cid == "weave:allids" { // expand to all container IDs
			all, err := client.ListContainers(docker.ListContainersOptions{})
			if err != nil {
				return err
			}
			for _, c := range all {
				containerArgs = append(containerArgs, c.ID)
			}
		} else {
			containerArgs = append(containerArgs, cid)
		}
	}

	var containerIDs []string
	containers := make(map[string]*docker.Container)

	for _, cid := range containerArgs {
		if cid == "weave:expose" {
			netDev, err := weavenet.GetBridgeNetDev(bridgeName)
			if err != nil {
				return err
{'fraction_non_alphanumeric': 0.13573883161512026, 'fraction_numerical': 0.005154639175257732, 'mean_word_length': 3.639442231075697, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3914089', 'n_tokens_mistral': 918, 'n_tokens_neox': 811, 'n_words': 189}