repo stringlengths 5 67 | path stringlengths 4 218 | func_name stringlengths 0 151 | original_string stringlengths 52 373k | language stringclasses 6
values | code stringlengths 52 373k | code_tokens listlengths 10 512 | docstring stringlengths 3 47.2k | docstring_tokens listlengths 3 234 | sha stringlengths 40 40 | url stringlengths 85 339 | partition stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
containers/image | docker/tarfile/src.go | ensureCachedDataIsPresent | func (s *Source) ensureCachedDataIsPresent() error {
s.cacheDataLock.Do(func() {
// Read and parse manifest.json
tarManifest, err := s.loadTarManifest()
if err != nil {
s.cacheDataResult = err
return
}
// Check to make sure length is 1
if len(tarManifest) != 1 {
s.cacheDataResult = errors.Errorf(... | go | func (s *Source) ensureCachedDataIsPresent() error {
s.cacheDataLock.Do(func() {
// Read and parse manifest.json
tarManifest, err := s.loadTarManifest()
if err != nil {
s.cacheDataResult = err
return
}
// Check to make sure length is 1
if len(tarManifest) != 1 {
s.cacheDataResult = errors.Errorf(... | [
"func",
"(",
"s",
"*",
"Source",
")",
"ensureCachedDataIsPresent",
"(",
")",
"error",
"{",
"s",
".",
"cacheDataLock",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"tarManifest",
",",
"err",
":=",
"s",
".",
"loadTarManifest",
"(",
")",
"\n",
"if",
"err",
"!... | // ensureCachedDataIsPresent loads data necessary for any of the public accessors. | [
"ensureCachedDataIsPresent",
"loads",
"data",
"necessary",
"for",
"any",
"of",
"the",
"public",
"accessors",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/tarfile/src.go#L204-L245 | test |
containers/image | docker/tarfile/src.go | loadTarManifest | func (s *Source) loadTarManifest() ([]ManifestItem, error) {
// FIXME? Do we need to deal with the legacy format?
bytes, err := s.readTarComponent(manifestFileName)
if err != nil {
return nil, err
}
var items []ManifestItem
if err := json.Unmarshal(bytes, &items); err != nil {
return nil, errors.Wrap(err, "Er... | go | func (s *Source) loadTarManifest() ([]ManifestItem, error) {
// FIXME? Do we need to deal with the legacy format?
bytes, err := s.readTarComponent(manifestFileName)
if err != nil {
return nil, err
}
var items []ManifestItem
if err := json.Unmarshal(bytes, &items); err != nil {
return nil, errors.Wrap(err, "Er... | [
"func",
"(",
"s",
"*",
"Source",
")",
"loadTarManifest",
"(",
")",
"(",
"[",
"]",
"ManifestItem",
",",
"error",
")",
"{",
"bytes",
",",
"err",
":=",
"s",
".",
"readTarComponent",
"(",
"manifestFileName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ret... | // loadTarManifest loads and decodes the manifest.json. | [
"loadTarManifest",
"loads",
"and",
"decodes",
"the",
"manifest",
".",
"json",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/tarfile/src.go#L248-L259 | test |
containers/image | docker/tarfile/src.go | Close | func (s *Source) Close() error {
if s.removeTarPathOnClose {
return os.Remove(s.tarPath)
}
return nil
} | go | func (s *Source) Close() error {
if s.removeTarPathOnClose {
return os.Remove(s.tarPath)
}
return nil
} | [
"func",
"(",
"s",
"*",
"Source",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"s",
".",
"removeTarPathOnClose",
"{",
"return",
"os",
".",
"Remove",
"(",
"s",
".",
"tarPath",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // Close removes resources associated with an initialized Source, if any. | [
"Close",
"removes",
"resources",
"associated",
"with",
"an",
"initialized",
"Source",
"if",
"any",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/tarfile/src.go#L262-L267 | test |
containers/image | docker/daemon/daemon_dest.go | newImageDestination | func newImageDestination(ctx context.Context, sys *types.SystemContext, ref daemonReference) (types.ImageDestination, error) {
if ref.ref == nil {
return nil, errors.Errorf("Invalid destination docker-daemon:%s: a destination must be a name:tag", ref.StringWithinTransport())
}
namedTaggedRef, ok := ref.ref.(refere... | go | func newImageDestination(ctx context.Context, sys *types.SystemContext, ref daemonReference) (types.ImageDestination, error) {
if ref.ref == nil {
return nil, errors.Errorf("Invalid destination docker-daemon:%s: a destination must be a name:tag", ref.StringWithinTransport())
}
namedTaggedRef, ok := ref.ref.(refere... | [
"func",
"newImageDestination",
"(",
"ctx",
"context",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"ref",
"daemonReference",
")",
"(",
"types",
".",
"ImageDestination",
",",
"error",
")",
"{",
"if",
"ref",
".",
"ref",
"==",
"nil",
... | // newImageDestination returns a types.ImageDestination for the specified image reference. | [
"newImageDestination",
"returns",
"a",
"types",
".",
"ImageDestination",
"for",
"the",
"specified",
"image",
"reference",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/daemon/daemon_dest.go#L28-L63 | test |
containers/image | docker/daemon/daemon_dest.go | imageLoadGoroutine | func imageLoadGoroutine(ctx context.Context, c *client.Client, reader *io.PipeReader, statusChannel chan<- error) {
err := errors.New("Internal error: unexpected panic in imageLoadGoroutine")
defer func() {
logrus.Debugf("docker-daemon: sending done, status %v", err)
statusChannel <- err
}()
defer func() {
if... | go | func imageLoadGoroutine(ctx context.Context, c *client.Client, reader *io.PipeReader, statusChannel chan<- error) {
err := errors.New("Internal error: unexpected panic in imageLoadGoroutine")
defer func() {
logrus.Debugf("docker-daemon: sending done, status %v", err)
statusChannel <- err
}()
defer func() {
if... | [
"func",
"imageLoadGoroutine",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"client",
".",
"Client",
",",
"reader",
"*",
"io",
".",
"PipeReader",
",",
"statusChannel",
"chan",
"<-",
"error",
")",
"{",
"err",
":=",
"errors",
".",
"New",
"(",
"\"... | // imageLoadGoroutine accepts tar stream on reader, sends it to c, and reports error or success by writing to statusChannel | [
"imageLoadGoroutine",
"accepts",
"tar",
"stream",
"on",
"reader",
"sends",
"it",
"to",
"c",
"and",
"reports",
"error",
"or",
"success",
"by",
"writing",
"to",
"statusChannel"
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/daemon/daemon_dest.go#L66-L86 | test |
containers/image | oci/archive/oci_transport.go | NewReference | func NewReference(file, image string) (types.ImageReference, error) {
resolved, err := explicitfilepath.ResolvePathToFullyExplicit(file)
if err != nil {
return nil, err
}
if err := internal.ValidateOCIPath(file); err != nil {
return nil, err
}
if err := internal.ValidateImageName(image); err != nil {
retu... | go | func NewReference(file, image string) (types.ImageReference, error) {
resolved, err := explicitfilepath.ResolvePathToFullyExplicit(file)
if err != nil {
return nil, err
}
if err := internal.ValidateOCIPath(file); err != nil {
return nil, err
}
if err := internal.ValidateImageName(image); err != nil {
retu... | [
"func",
"NewReference",
"(",
"file",
",",
"image",
"string",
")",
"(",
"types",
".",
"ImageReference",
",",
"error",
")",
"{",
"resolved",
",",
"err",
":=",
"explicitfilepath",
".",
"ResolvePathToFullyExplicit",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"... | // NewReference returns an OCI reference for a file and a image. | [
"NewReference",
"returns",
"an",
"OCI",
"reference",
"for",
"a",
"file",
"and",
"a",
"image",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/archive/oci_transport.go#L62-L77 | test |
containers/image | oci/archive/oci_transport.go | createOCIRef | func createOCIRef(image string) (tempDirOCIRef, error) {
dir, err := ioutil.TempDir(tmpdir.TemporaryDirectoryForBigFiles(), "oci")
if err != nil {
return tempDirOCIRef{}, errors.Wrapf(err, "error creating temp directory")
}
ociRef, err := ocilayout.NewReference(dir, image)
if err != nil {
return tempDirOCIRef{... | go | func createOCIRef(image string) (tempDirOCIRef, error) {
dir, err := ioutil.TempDir(tmpdir.TemporaryDirectoryForBigFiles(), "oci")
if err != nil {
return tempDirOCIRef{}, errors.Wrapf(err, "error creating temp directory")
}
ociRef, err := ocilayout.NewReference(dir, image)
if err != nil {
return tempDirOCIRef{... | [
"func",
"createOCIRef",
"(",
"image",
"string",
")",
"(",
"tempDirOCIRef",
",",
"error",
")",
"{",
"dir",
",",
"err",
":=",
"ioutil",
".",
"TempDir",
"(",
"tmpdir",
".",
"TemporaryDirectoryForBigFiles",
"(",
")",
",",
"\"oci\"",
")",
"\n",
"if",
"err",
"... | // createOCIRef creates the oci reference of the image | [
"createOCIRef",
"creates",
"the",
"oci",
"reference",
"of",
"the",
"image"
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/archive/oci_transport.go#L162-L174 | test |
containers/image | oci/archive/oci_transport.go | createUntarTempDir | func createUntarTempDir(ref ociArchiveReference) (tempDirOCIRef, error) {
tempDirRef, err := createOCIRef(ref.image)
if err != nil {
return tempDirOCIRef{}, errors.Wrap(err, "error creating oci reference")
}
src := ref.resolvedFile
dst := tempDirRef.tempDirectory
// TODO: This can take quite some time, and shou... | go | func createUntarTempDir(ref ociArchiveReference) (tempDirOCIRef, error) {
tempDirRef, err := createOCIRef(ref.image)
if err != nil {
return tempDirOCIRef{}, errors.Wrap(err, "error creating oci reference")
}
src := ref.resolvedFile
dst := tempDirRef.tempDirectory
// TODO: This can take quite some time, and shou... | [
"func",
"createUntarTempDir",
"(",
"ref",
"ociArchiveReference",
")",
"(",
"tempDirOCIRef",
",",
"error",
")",
"{",
"tempDirRef",
",",
"err",
":=",
"createOCIRef",
"(",
"ref",
".",
"image",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"tempDirOCIRef",... | // creates the temporary directory and copies the tarred content to it | [
"creates",
"the",
"temporary",
"directory",
"and",
"copies",
"the",
"tarred",
"content",
"to",
"it"
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/archive/oci_transport.go#L177-L192 | test |
containers/image | pkg/blobinfocache/internal/prioritize/prioritize.go | destructivelyPrioritizeReplacementCandidatesWithMax | func destructivelyPrioritizeReplacementCandidatesWithMax(cs []CandidateWithTime, primaryDigest, uncompressedDigest digest.Digest, maxCandidates int) []types.BICReplacementCandidate {
// We don't need to use sort.Stable() because nanosecond timestamps are (presumably?) unique, so no two elements should
// compare equa... | go | func destructivelyPrioritizeReplacementCandidatesWithMax(cs []CandidateWithTime, primaryDigest, uncompressedDigest digest.Digest, maxCandidates int) []types.BICReplacementCandidate {
// We don't need to use sort.Stable() because nanosecond timestamps are (presumably?) unique, so no two elements should
// compare equa... | [
"func",
"destructivelyPrioritizeReplacementCandidatesWithMax",
"(",
"cs",
"[",
"]",
"CandidateWithTime",
",",
"primaryDigest",
",",
"uncompressedDigest",
"digest",
".",
"Digest",
",",
"maxCandidates",
"int",
")",
"[",
"]",
"types",
".",
"BICReplacementCandidate",
"{",
... | // destructivelyPrioritizeReplacementCandidatesWithMax is destructivelyPrioritizeReplacementCandidates with a parameter for the
// number of entries to limit, only to make testing simpler. | [
"destructivelyPrioritizeReplacementCandidatesWithMax",
"is",
"destructivelyPrioritizeReplacementCandidates",
"with",
"a",
"parameter",
"for",
"the",
"number",
"of",
"entries",
"to",
"limit",
"only",
"to",
"make",
"testing",
"simpler",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/blobinfocache/internal/prioritize/prioritize.go#L82-L100 | test |
containers/image | ostree/ostree_dest.go | newImageDestination | func newImageDestination(ref ostreeReference, tmpDirPath string) (types.ImageDestination, error) {
tmpDirPath = filepath.Join(tmpDirPath, ref.branchName)
if err := ensureDirectoryExists(tmpDirPath); err != nil {
return nil, err
}
return &ostreeImageDestination{ref, "", manifestSchema{}, tmpDirPath, map[string]*bl... | go | func newImageDestination(ref ostreeReference, tmpDirPath string) (types.ImageDestination, error) {
tmpDirPath = filepath.Join(tmpDirPath, ref.branchName)
if err := ensureDirectoryExists(tmpDirPath); err != nil {
return nil, err
}
return &ostreeImageDestination{ref, "", manifestSchema{}, tmpDirPath, map[string]*bl... | [
"func",
"newImageDestination",
"(",
"ref",
"ostreeReference",
",",
"tmpDirPath",
"string",
")",
"(",
"types",
".",
"ImageDestination",
",",
"error",
")",
"{",
"tmpDirPath",
"=",
"filepath",
".",
"Join",
"(",
"tmpDirPath",
",",
"ref",
".",
"branchName",
")",
... | // newImageDestination returns an ImageDestination for writing to an existing ostree. | [
"newImageDestination",
"returns",
"an",
"ImageDestination",
"for",
"writing",
"to",
"an",
"existing",
"ostree",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/ostree/ostree_dest.go#L78-L84 | test |
containers/image | directory/explicitfilepath/path.go | resolveExistingPathToFullyExplicit | func resolveExistingPathToFullyExplicit(path string) (string, error) {
resolved, err := filepath.Abs(path)
if err != nil {
return "", err // Coverage: This can fail only if os.Getwd() fails.
}
resolved, err = filepath.EvalSymlinks(resolved)
if err != nil {
return "", err
}
return filepath.Clean(resolved), ni... | go | func resolveExistingPathToFullyExplicit(path string) (string, error) {
resolved, err := filepath.Abs(path)
if err != nil {
return "", err // Coverage: This can fail only if os.Getwd() fails.
}
resolved, err = filepath.EvalSymlinks(resolved)
if err != nil {
return "", err
}
return filepath.Clean(resolved), ni... | [
"func",
"resolveExistingPathToFullyExplicit",
"(",
"path",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"resolved",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"\"",
",",
"err",
... | // resolveExistingPathToFullyExplicit is the same as ResolvePathToFullyExplicit,
// but without the special case for missing final component. | [
"resolveExistingPathToFullyExplicit",
"is",
"the",
"same",
"as",
"ResolvePathToFullyExplicit",
"but",
"without",
"the",
"special",
"case",
"for",
"missing",
"final",
"component",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/directory/explicitfilepath/path.go#L46-L56 | test |
containers/image | directory/directory_dest.go | newImageDestination | func newImageDestination(ref dirReference, compress bool) (types.ImageDestination, error) {
d := &dirImageDestination{ref: ref, compress: compress}
// If directory exists check if it is empty
// if not empty, check whether the contents match that of a container image directory and overwrite the contents
// if the ... | go | func newImageDestination(ref dirReference, compress bool) (types.ImageDestination, error) {
d := &dirImageDestination{ref: ref, compress: compress}
// If directory exists check if it is empty
// if not empty, check whether the contents match that of a container image directory and overwrite the contents
// if the ... | [
"func",
"newImageDestination",
"(",
"ref",
"dirReference",
",",
"compress",
"bool",
")",
"(",
"types",
".",
"ImageDestination",
",",
"error",
")",
"{",
"d",
":=",
"&",
"dirImageDestination",
"{",
"ref",
":",
"ref",
",",
"compress",
":",
"compress",
"}",
"\... | // newImageDestination returns an ImageDestination for writing to a directory. | [
"newImageDestination",
"returns",
"an",
"ImageDestination",
"for",
"writing",
"to",
"a",
"directory",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/directory/directory_dest.go#L28-L79 | test |
containers/image | directory/directory_dest.go | isDirEmpty | func isDirEmpty(path string) (bool, error) {
files, err := ioutil.ReadDir(path)
if err != nil {
return false, err
}
return len(files) == 0, nil
} | go | func isDirEmpty(path string) (bool, error) {
files, err := ioutil.ReadDir(path)
if err != nil {
return false, err
}
return len(files) == 0, nil
} | [
"func",
"isDirEmpty",
"(",
"path",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"files",
",",
"err",
":=",
"ioutil",
".",
"ReadDir",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"re... | // returns true if directory is empty | [
"returns",
"true",
"if",
"directory",
"is",
"empty"
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/directory/directory_dest.go#L239-L245 | test |
containers/image | directory/directory_dest.go | removeDirContents | func removeDirContents(path string) error {
files, err := ioutil.ReadDir(path)
if err != nil {
return err
}
for _, file := range files {
if err := os.RemoveAll(filepath.Join(path, file.Name())); err != nil {
return err
}
}
return nil
} | go | func removeDirContents(path string) error {
files, err := ioutil.ReadDir(path)
if err != nil {
return err
}
for _, file := range files {
if err := os.RemoveAll(filepath.Join(path, file.Name())); err != nil {
return err
}
}
return nil
} | [
"func",
"removeDirContents",
"(",
"path",
"string",
")",
"error",
"{",
"files",
",",
"err",
":=",
"ioutil",
".",
"ReadDir",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"file",
":=",
"ran... | // deletes the contents of a directory | [
"deletes",
"the",
"contents",
"of",
"a",
"directory"
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/directory/directory_dest.go#L248-L260 | test |
containers/image | docker/docker_image.go | GetRepositoryTags | func GetRepositoryTags(ctx context.Context, sys *types.SystemContext, ref types.ImageReference) ([]string, error) {
dr, ok := ref.(dockerReference)
if !ok {
return nil, errors.Errorf("ref must be a dockerReference")
}
path := fmt.Sprintf(tagsPath, reference.Path(dr.ref))
client, err := newDockerClientFromRef(sy... | go | func GetRepositoryTags(ctx context.Context, sys *types.SystemContext, ref types.ImageReference) ([]string, error) {
dr, ok := ref.(dockerReference)
if !ok {
return nil, errors.Errorf("ref must be a dockerReference")
}
path := fmt.Sprintf(tagsPath, reference.Path(dr.ref))
client, err := newDockerClientFromRef(sy... | [
"func",
"GetRepositoryTags",
"(",
"ctx",
"context",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"ref",
"types",
".",
"ImageReference",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"dr",
",",
"ok",
":=",
"ref",
".",
"... | // GetRepositoryTags list all tags available in the repository. The tag
// provided inside the ImageReference will be ignored. | [
"GetRepositoryTags",
"list",
"all",
"tags",
"available",
"in",
"the",
"repository",
".",
"The",
"tag",
"provided",
"inside",
"the",
"ImageReference",
"will",
"be",
"ignored",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/docker_image.go#L54-L107 | test |
containers/image | pkg/blobinfocache/default.go | DefaultCache | func DefaultCache(sys *types.SystemContext) types.BlobInfoCache {
dir, err := blobInfoCacheDir(sys, getRootlessUID())
if err != nil {
logrus.Debugf("Error determining a location for %s, using a memory-only cache", blobInfoCacheFilename)
return memory.New()
}
path := filepath.Join(dir, blobInfoCacheFilename)
if... | go | func DefaultCache(sys *types.SystemContext) types.BlobInfoCache {
dir, err := blobInfoCacheDir(sys, getRootlessUID())
if err != nil {
logrus.Debugf("Error determining a location for %s, using a memory-only cache", blobInfoCacheFilename)
return memory.New()
}
path := filepath.Join(dir, blobInfoCacheFilename)
if... | [
"func",
"DefaultCache",
"(",
"sys",
"*",
"types",
".",
"SystemContext",
")",
"types",
".",
"BlobInfoCache",
"{",
"dir",
",",
"err",
":=",
"blobInfoCacheDir",
"(",
"sys",
",",
"getRootlessUID",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",... | // DefaultCache returns the default BlobInfoCache implementation appropriate for sys. | [
"DefaultCache",
"returns",
"the",
"default",
"BlobInfoCache",
"implementation",
"appropriate",
"for",
"sys",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/blobinfocache/default.go#L61-L75 | test |
containers/image | pkg/blobinfocache/memory/memory.go | uncompressedDigestLocked | func (mem *cache) uncompressedDigestLocked(anyDigest digest.Digest) digest.Digest {
if d, ok := mem.uncompressedDigests[anyDigest]; ok {
return d
}
// Presence in digestsByUncompressed implies that anyDigest must already refer to an uncompressed digest.
// This way we don't have to waste storage space with trivia... | go | func (mem *cache) uncompressedDigestLocked(anyDigest digest.Digest) digest.Digest {
if d, ok := mem.uncompressedDigests[anyDigest]; ok {
return d
}
// Presence in digestsByUncompressed implies that anyDigest must already refer to an uncompressed digest.
// This way we don't have to waste storage space with trivia... | [
"func",
"(",
"mem",
"*",
"cache",
")",
"uncompressedDigestLocked",
"(",
"anyDigest",
"digest",
".",
"Digest",
")",
"digest",
".",
"Digest",
"{",
"if",
"d",
",",
"ok",
":=",
"mem",
".",
"uncompressedDigests",
"[",
"anyDigest",
"]",
";",
"ok",
"{",
"return... | // uncompressedDigestLocked implements types.BlobInfoCache.UncompressedDigest, but must be called only with mem.mutex held. | [
"uncompressedDigestLocked",
"implements",
"types",
".",
"BlobInfoCache",
".",
"UncompressedDigest",
"but",
"must",
"be",
"called",
"only",
"with",
"mem",
".",
"mutex",
"held",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/pkg/blobinfocache/memory/memory.go#L56-L67 | test |
containers/image | oci/archive/oci_dest.go | Close | func (d *ociArchiveImageDestination) Close() error {
defer d.tempDirRef.deleteTempDir()
return d.unpackedDest.Close()
} | go | func (d *ociArchiveImageDestination) Close() error {
defer d.tempDirRef.deleteTempDir()
return d.unpackedDest.Close()
} | [
"func",
"(",
"d",
"*",
"ociArchiveImageDestination",
")",
"Close",
"(",
")",
"error",
"{",
"defer",
"d",
".",
"tempDirRef",
".",
"deleteTempDir",
"(",
")",
"\n",
"return",
"d",
".",
"unpackedDest",
".",
"Close",
"(",
")",
"\n",
"}"
] | // Close removes resources associated with an initialized ImageDestination, if any
// Close deletes the temp directory of the oci-archive image | [
"Close",
"removes",
"resources",
"associated",
"with",
"an",
"initialized",
"ImageDestination",
"if",
"any",
"Close",
"deletes",
"the",
"temp",
"directory",
"of",
"the",
"oci",
"-",
"archive",
"image"
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/archive/oci_dest.go#L44-L47 | test |
containers/image | oci/archive/oci_dest.go | PutManifest | func (d *ociArchiveImageDestination) PutManifest(ctx context.Context, m []byte) error {
return d.unpackedDest.PutManifest(ctx, m)
} | go | func (d *ociArchiveImageDestination) PutManifest(ctx context.Context, m []byte) error {
return d.unpackedDest.PutManifest(ctx, m)
} | [
"func",
"(",
"d",
"*",
"ociArchiveImageDestination",
")",
"PutManifest",
"(",
"ctx",
"context",
".",
"Context",
",",
"m",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"d",
".",
"unpackedDest",
".",
"PutManifest",
"(",
"ctx",
",",
"m",
")",
"\n",
"}"
... | // PutManifest writes manifest to the destination | [
"PutManifest",
"writes",
"manifest",
"to",
"the",
"destination"
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/archive/oci_dest.go#L109-L111 | test |
containers/image | oci/archive/oci_dest.go | Commit | func (d *ociArchiveImageDestination) Commit(ctx context.Context) error {
if err := d.unpackedDest.Commit(ctx); err != nil {
return errors.Wrapf(err, "error storing image %q", d.ref.image)
}
// path of directory to tar up
src := d.tempDirRef.tempDirectory
// path to save tarred up file
dst := d.ref.resolvedFile... | go | func (d *ociArchiveImageDestination) Commit(ctx context.Context) error {
if err := d.unpackedDest.Commit(ctx); err != nil {
return errors.Wrapf(err, "error storing image %q", d.ref.image)
}
// path of directory to tar up
src := d.tempDirRef.tempDirectory
// path to save tarred up file
dst := d.ref.resolvedFile... | [
"func",
"(",
"d",
"*",
"ociArchiveImageDestination",
")",
"Commit",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"if",
"err",
":=",
"d",
".",
"unpackedDest",
".",
"Commit",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",... | // Commit marks the process of storing the image as successful and asks for the image to be persisted
// after the directory is made, it is tarred up into a file and the directory is deleted | [
"Commit",
"marks",
"the",
"process",
"of",
"storing",
"the",
"image",
"as",
"successful",
"and",
"asks",
"for",
"the",
"image",
"to",
"be",
"persisted",
"after",
"the",
"directory",
"is",
"made",
"it",
"is",
"tarred",
"up",
"into",
"a",
"file",
"and",
"t... | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/archive/oci_dest.go#L119-L129 | test |
containers/image | oci/archive/oci_dest.go | tarDirectory | func tarDirectory(src, dst string) error {
// input is a stream of bytes from the archive of the directory at path
input, err := archive.Tar(src, archive.Uncompressed)
if err != nil {
return errors.Wrapf(err, "error retrieving stream of bytes from %q", src)
}
// creates the tar file
outFile, err := os.Create(d... | go | func tarDirectory(src, dst string) error {
// input is a stream of bytes from the archive of the directory at path
input, err := archive.Tar(src, archive.Uncompressed)
if err != nil {
return errors.Wrapf(err, "error retrieving stream of bytes from %q", src)
}
// creates the tar file
outFile, err := os.Create(d... | [
"func",
"tarDirectory",
"(",
"src",
",",
"dst",
"string",
")",
"error",
"{",
"input",
",",
"err",
":=",
"archive",
".",
"Tar",
"(",
"src",
",",
"archive",
".",
"Uncompressed",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf"... | // tar converts the directory at src and saves it to dst | [
"tar",
"converts",
"the",
"directory",
"at",
"src",
"and",
"saves",
"it",
"to",
"dst"
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/oci/archive/oci_dest.go#L132-L151 | test |
containers/image | storage/storage_transport.go | ParseStoreReference | func (s storageTransport) ParseStoreReference(store storage.Store, ref string) (*storageReference, error) {
if ref == "" {
return nil, errors.Wrapf(ErrInvalidReference, "%q is an empty reference", ref)
}
if ref[0] == '[' {
// Ignore the store specifier.
closeIndex := strings.IndexRune(ref, ']')
if closeIndex... | go | func (s storageTransport) ParseStoreReference(store storage.Store, ref string) (*storageReference, error) {
if ref == "" {
return nil, errors.Wrapf(ErrInvalidReference, "%q is an empty reference", ref)
}
if ref[0] == '[' {
// Ignore the store specifier.
closeIndex := strings.IndexRune(ref, ']')
if closeIndex... | [
"func",
"(",
"s",
"storageTransport",
")",
"ParseStoreReference",
"(",
"store",
"storage",
".",
"Store",
",",
"ref",
"string",
")",
"(",
"*",
"storageReference",
",",
"error",
")",
"{",
"if",
"ref",
"==",
"\"\"",
"{",
"return",
"nil",
",",
"errors",
".",... | // ParseStoreReference takes a name or an ID, tries to figure out which it is
// relative to the given store, and returns it in a reference object. | [
"ParseStoreReference",
"takes",
"a",
"name",
"or",
"an",
"ID",
"tries",
"to",
"figure",
"out",
"which",
"it",
"is",
"relative",
"to",
"the",
"given",
"store",
"and",
"returns",
"it",
"in",
"a",
"reference",
"object",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/storage/storage_transport.go#L108-L177 | test |
containers/image | image/docker_list.go | chooseDigestFromManifestList | func chooseDigestFromManifestList(sys *types.SystemContext, blob []byte) (digest.Digest, error) {
wantedArch := runtime.GOARCH
if sys != nil && sys.ArchitectureChoice != "" {
wantedArch = sys.ArchitectureChoice
}
wantedOS := runtime.GOOS
if sys != nil && sys.OSChoice != "" {
wantedOS = sys.OSChoice
}
list :... | go | func chooseDigestFromManifestList(sys *types.SystemContext, blob []byte) (digest.Digest, error) {
wantedArch := runtime.GOARCH
if sys != nil && sys.ArchitectureChoice != "" {
wantedArch = sys.ArchitectureChoice
}
wantedOS := runtime.GOOS
if sys != nil && sys.OSChoice != "" {
wantedOS = sys.OSChoice
}
list :... | [
"func",
"chooseDigestFromManifestList",
"(",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"blob",
"[",
"]",
"byte",
")",
"(",
"digest",
".",
"Digest",
",",
"error",
")",
"{",
"wantedArch",
":=",
"runtime",
".",
"GOARCH",
"\n",
"if",
"sys",
"!=",
"nil"... | // chooseDigestFromManifestList parses blob as a schema2 manifest list,
// and returns the digest of the image appropriate for the current environment. | [
"chooseDigestFromManifestList",
"parses",
"blob",
"as",
"a",
"schema2",
"manifest",
"list",
"and",
"returns",
"the",
"digest",
"of",
"the",
"image",
"appropriate",
"for",
"the",
"current",
"environment",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/image/docker_list.go#L38-L58 | test |
containers/image | image/docker_list.go | ChooseManifestInstanceFromManifestList | func ChooseManifestInstanceFromManifestList(ctx context.Context, sys *types.SystemContext, src types.UnparsedImage) (digest.Digest, error) {
// For now this only handles manifest.DockerV2ListMediaType; we can generalize it later,
// probably along with manifest list editing.
blob, mt, err := src.Manifest(ctx)
if er... | go | func ChooseManifestInstanceFromManifestList(ctx context.Context, sys *types.SystemContext, src types.UnparsedImage) (digest.Digest, error) {
// For now this only handles manifest.DockerV2ListMediaType; we can generalize it later,
// probably along with manifest list editing.
blob, mt, err := src.Manifest(ctx)
if er... | [
"func",
"ChooseManifestInstanceFromManifestList",
"(",
"ctx",
"context",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"src",
"types",
".",
"UnparsedImage",
")",
"(",
"digest",
".",
"Digest",
",",
"error",
")",
"{",
"blob",
",",
"mt",
... | // ChooseManifestInstanceFromManifestList returns a digest of a manifest appropriate
// for the current system from the manifest available from src. | [
"ChooseManifestInstanceFromManifestList",
"returns",
"a",
"digest",
"of",
"a",
"manifest",
"appropriate",
"for",
"the",
"current",
"system",
"from",
"the",
"manifest",
"available",
"from",
"src",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/image/docker_list.go#L83-L94 | test |
containers/image | image/docker_schema1.go | manifestSchema1FromComponents | func manifestSchema1FromComponents(ref reference.Named, fsLayers []manifest.Schema1FSLayers, history []manifest.Schema1History, architecture string) (genericManifest, error) {
m, err := manifest.Schema1FromComponents(ref, fsLayers, history, architecture)
if err != nil {
return nil, err
}
return &manifestSchema1{m... | go | func manifestSchema1FromComponents(ref reference.Named, fsLayers []manifest.Schema1FSLayers, history []manifest.Schema1History, architecture string) (genericManifest, error) {
m, err := manifest.Schema1FromComponents(ref, fsLayers, history, architecture)
if err != nil {
return nil, err
}
return &manifestSchema1{m... | [
"func",
"manifestSchema1FromComponents",
"(",
"ref",
"reference",
".",
"Named",
",",
"fsLayers",
"[",
"]",
"manifest",
".",
"Schema1FSLayers",
",",
"history",
"[",
"]",
"manifest",
".",
"Schema1History",
",",
"architecture",
"string",
")",
"(",
"genericManifest",
... | // manifestSchema1FromComponents builds a new manifestSchema1 from the supplied data. | [
"manifestSchema1FromComponents",
"builds",
"a",
"new",
"manifestSchema1",
"from",
"the",
"supplied",
"data",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/image/docker_schema1.go#L27-L33 | test |
containers/image | docker/docker_image_src.go | manifestDigest | func (s *dockerImageSource) manifestDigest(ctx context.Context, instanceDigest *digest.Digest) (digest.Digest, error) {
if instanceDigest != nil {
return *instanceDigest, nil
}
if digested, ok := s.ref.ref.(reference.Digested); ok {
d := digested.Digest()
if d.Algorithm() == digest.Canonical {
return d, nil... | go | func (s *dockerImageSource) manifestDigest(ctx context.Context, instanceDigest *digest.Digest) (digest.Digest, error) {
if instanceDigest != nil {
return *instanceDigest, nil
}
if digested, ok := s.ref.ref.(reference.Digested); ok {
d := digested.Digest()
if d.Algorithm() == digest.Canonical {
return d, nil... | [
"func",
"(",
"s",
"*",
"dockerImageSource",
")",
"manifestDigest",
"(",
"ctx",
"context",
".",
"Context",
",",
"instanceDigest",
"*",
"digest",
".",
"Digest",
")",
"(",
"digest",
".",
"Digest",
",",
"error",
")",
"{",
"if",
"instanceDigest",
"!=",
"nil",
... | // manifestDigest returns a digest of the manifest, from instanceDigest if non-nil; or from the supplied reference,
// or finally, from a fetched manifest. | [
"manifestDigest",
"returns",
"a",
"digest",
"of",
"the",
"manifest",
"from",
"instanceDigest",
"if",
"non",
"-",
"nil",
";",
"or",
"from",
"the",
"supplied",
"reference",
"or",
"finally",
"from",
"a",
"fetched",
"manifest",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/docker_image_src.go#L284-L298 | test |
containers/image | docker/docker_image_src.go | deleteImage | func deleteImage(ctx context.Context, sys *types.SystemContext, ref dockerReference) error {
// docker/distribution does not document what action should be used for deleting images.
//
// Current docker/distribution requires "pull" for reading the manifest and "delete" for deleting it.
// quay.io requires "push" (a... | go | func deleteImage(ctx context.Context, sys *types.SystemContext, ref dockerReference) error {
// docker/distribution does not document what action should be used for deleting images.
//
// Current docker/distribution requires "pull" for reading the manifest and "delete" for deleting it.
// quay.io requires "push" (a... | [
"func",
"deleteImage",
"(",
"ctx",
"context",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"ref",
"dockerReference",
")",
"error",
"{",
"c",
",",
"err",
":=",
"newDockerClientFromRef",
"(",
"sys",
",",
"ref",
",",
"true",
",",
"\"... | // deleteImage deletes the named image from the registry, if supported. | [
"deleteImage",
"deletes",
"the",
"named",
"image",
"from",
"the",
"registry",
"if",
"supported",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/docker/docker_image_src.go#L393-L474 | test |
containers/image | manifest/docker_schema1.go | Schema1FromComponents | func Schema1FromComponents(ref reference.Named, fsLayers []Schema1FSLayers, history []Schema1History, architecture string) (*Schema1, error) {
var name, tag string
if ref != nil { // Well, what to do if it _is_ nil? Most consumers actually don't use these fields nowadays, so we might as well try not supplying them.
... | go | func Schema1FromComponents(ref reference.Named, fsLayers []Schema1FSLayers, history []Schema1History, architecture string) (*Schema1, error) {
var name, tag string
if ref != nil { // Well, what to do if it _is_ nil? Most consumers actually don't use these fields nowadays, so we might as well try not supplying them.
... | [
"func",
"Schema1FromComponents",
"(",
"ref",
"reference",
".",
"Named",
",",
"fsLayers",
"[",
"]",
"Schema1FSLayers",
",",
"history",
"[",
"]",
"Schema1History",
",",
"architecture",
"string",
")",
"(",
"*",
"Schema1",
",",
"error",
")",
"{",
"var",
"name",
... | // Schema1FromComponents creates an Schema1 manifest instance from the supplied data. | [
"Schema1FromComponents",
"creates",
"an",
"Schema1",
"manifest",
"instance",
"from",
"the",
"supplied",
"data",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/manifest/docker_schema1.go#L73-L93 | test |
containers/image | manifest/docker_schema1.go | initialize | func (m *Schema1) initialize() error {
if len(m.FSLayers) != len(m.History) {
return errors.New("length of history not equal to number of layers")
}
if len(m.FSLayers) == 0 {
return errors.New("no FSLayers in manifest")
}
m.ExtractedV1Compatibility = make([]Schema1V1Compatibility, len(m.History))
for i, h := ... | go | func (m *Schema1) initialize() error {
if len(m.FSLayers) != len(m.History) {
return errors.New("length of history not equal to number of layers")
}
if len(m.FSLayers) == 0 {
return errors.New("no FSLayers in manifest")
}
m.ExtractedV1Compatibility = make([]Schema1V1Compatibility, len(m.History))
for i, h := ... | [
"func",
"(",
"m",
"*",
"Schema1",
")",
"initialize",
"(",
")",
"error",
"{",
"if",
"len",
"(",
"m",
".",
"FSLayers",
")",
"!=",
"len",
"(",
"m",
".",
"History",
")",
"{",
"return",
"errors",
".",
"New",
"(",
"\"length of history not equal to number of la... | // initialize initializes ExtractedV1Compatibility and verifies invariants, so that the rest of this code can assume a minimally healthy manifest. | [
"initialize",
"initializes",
"ExtractedV1Compatibility",
"and",
"verifies",
"invariants",
"so",
"that",
"the",
"rest",
"of",
"this",
"code",
"can",
"assume",
"a",
"minimally",
"healthy",
"manifest",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/manifest/docker_schema1.go#L102-L116 | test |
containers/image | manifest/docker_schema1.go | ToSchema2Config | func (m *Schema1) ToSchema2Config(diffIDs []digest.Digest) ([]byte, error) {
// Convert the schema 1 compat info into a schema 2 config, constructing some of the fields
// that aren't directly comparable using info from the manifest.
if len(m.History) == 0 {
return nil, errors.New("image has no layers")
}
s1 := ... | go | func (m *Schema1) ToSchema2Config(diffIDs []digest.Digest) ([]byte, error) {
// Convert the schema 1 compat info into a schema 2 config, constructing some of the fields
// that aren't directly comparable using info from the manifest.
if len(m.History) == 0 {
return nil, errors.New("image has no layers")
}
s1 := ... | [
"func",
"(",
"m",
"*",
"Schema1",
")",
"ToSchema2Config",
"(",
"diffIDs",
"[",
"]",
"digest",
".",
"Digest",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"len",
"(",
"m",
".",
"History",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"... | // ToSchema2Config builds a schema2-style configuration blob using the supplied diffIDs. | [
"ToSchema2Config",
"builds",
"a",
"schema2",
"-",
"style",
"configuration",
"blob",
"using",
"the",
"supplied",
"diffIDs",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/manifest/docker_schema1.go#L234-L306 | test |
containers/image | manifest/manifest.go | Digest | func Digest(manifest []byte) (digest.Digest, error) {
if GuessMIMEType(manifest) == DockerV2Schema1SignedMediaType {
sig, err := libtrust.ParsePrettySignature(manifest, "signatures")
if err != nil {
return "", err
}
manifest, err = sig.Payload()
if err != nil {
// Coverage: This should never happen, li... | go | func Digest(manifest []byte) (digest.Digest, error) {
if GuessMIMEType(manifest) == DockerV2Schema1SignedMediaType {
sig, err := libtrust.ParsePrettySignature(manifest, "signatures")
if err != nil {
return "", err
}
manifest, err = sig.Payload()
if err != nil {
// Coverage: This should never happen, li... | [
"func",
"Digest",
"(",
"manifest",
"[",
"]",
"byte",
")",
"(",
"digest",
".",
"Digest",
",",
"error",
")",
"{",
"if",
"GuessMIMEType",
"(",
"manifest",
")",
"==",
"DockerV2Schema1SignedMediaType",
"{",
"sig",
",",
"err",
":=",
"libtrust",
".",
"ParsePretty... | // Digest returns the a digest of a docker manifest, with any necessary implied transformations like stripping v1s1 signatures. | [
"Digest",
"returns",
"the",
"a",
"digest",
"of",
"a",
"docker",
"manifest",
"with",
"any",
"necessary",
"implied",
"transformations",
"like",
"stripping",
"v1s1",
"signatures",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/manifest/manifest.go#L139-L154 | test |
containers/image | manifest/manifest.go | MatchesDigest | func MatchesDigest(manifest []byte, expectedDigest digest.Digest) (bool, error) {
// This should eventually support various digest types.
actualDigest, err := Digest(manifest)
if err != nil {
return false, err
}
return expectedDigest == actualDigest, nil
} | go | func MatchesDigest(manifest []byte, expectedDigest digest.Digest) (bool, error) {
// This should eventually support various digest types.
actualDigest, err := Digest(manifest)
if err != nil {
return false, err
}
return expectedDigest == actualDigest, nil
} | [
"func",
"MatchesDigest",
"(",
"manifest",
"[",
"]",
"byte",
",",
"expectedDigest",
"digest",
".",
"Digest",
")",
"(",
"bool",
",",
"error",
")",
"{",
"actualDigest",
",",
"err",
":=",
"Digest",
"(",
"manifest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",... | // MatchesDigest returns true iff the manifest matches expectedDigest.
// Error may be set if this returns false.
// Note that this is not doing ConstantTimeCompare; by the time we get here, the cryptographic signature must already have been verified,
// or we are not using a cryptographic channel and the attacker can ... | [
"MatchesDigest",
"returns",
"true",
"iff",
"the",
"manifest",
"matches",
"expectedDigest",
".",
"Error",
"may",
"be",
"set",
"if",
"this",
"returns",
"false",
".",
"Note",
"that",
"this",
"is",
"not",
"doing",
"ConstantTimeCompare",
";",
"by",
"the",
"time",
... | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/manifest/manifest.go#L160-L167 | test |
containers/image | manifest/manifest.go | NormalizedMIMEType | func NormalizedMIMEType(input string) string {
switch input {
// "application/json" is a valid v2s1 value per https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-1.md .
// This works for now, when nothing else seems to return "application/json"; if that were not true, the mapping/detection might... | go | func NormalizedMIMEType(input string) string {
switch input {
// "application/json" is a valid v2s1 value per https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-1.md .
// This works for now, when nothing else seems to return "application/json"; if that were not true, the mapping/detection might... | [
"func",
"NormalizedMIMEType",
"(",
"input",
"string",
")",
"string",
"{",
"switch",
"input",
"{",
"case",
"\"application/json\"",
":",
"return",
"DockerV2Schema1SignedMediaType",
"\n",
"case",
"DockerV2Schema1MediaType",
",",
"DockerV2Schema1SignedMediaType",
",",
"imgspe... | // NormalizedMIMEType returns the effective MIME type of a manifest MIME type returned by a server,
// centralizing various workarounds. | [
"NormalizedMIMEType",
"returns",
"the",
"effective",
"MIME",
"type",
"of",
"a",
"manifest",
"MIME",
"type",
"returned",
"by",
"a",
"server",
"centralizing",
"various",
"workarounds",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/manifest/manifest.go#L194-L218 | test |
containers/image | manifest/manifest.go | FromBlob | func FromBlob(manblob []byte, mt string) (Manifest, error) {
switch NormalizedMIMEType(mt) {
case DockerV2Schema1MediaType, DockerV2Schema1SignedMediaType:
return Schema1FromManifest(manblob)
case imgspecv1.MediaTypeImageManifest:
return OCI1FromManifest(manblob)
case DockerV2Schema2MediaType:
return Schema2F... | go | func FromBlob(manblob []byte, mt string) (Manifest, error) {
switch NormalizedMIMEType(mt) {
case DockerV2Schema1MediaType, DockerV2Schema1SignedMediaType:
return Schema1FromManifest(manblob)
case imgspecv1.MediaTypeImageManifest:
return OCI1FromManifest(manblob)
case DockerV2Schema2MediaType:
return Schema2F... | [
"func",
"FromBlob",
"(",
"manblob",
"[",
"]",
"byte",
",",
"mt",
"string",
")",
"(",
"Manifest",
",",
"error",
")",
"{",
"switch",
"NormalizedMIMEType",
"(",
"mt",
")",
"{",
"case",
"DockerV2Schema1MediaType",
",",
"DockerV2Schema1SignedMediaType",
":",
"retur... | // FromBlob returns a Manifest instance for the specified manifest blob and the corresponding MIME type | [
"FromBlob",
"returns",
"a",
"Manifest",
"instance",
"for",
"the",
"specified",
"manifest",
"blob",
"and",
"the",
"corresponding",
"MIME",
"type"
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/manifest/manifest.go#L221-L234 | test |
containers/image | directory/directory_transport.go | NewReference | func NewReference(path string) (types.ImageReference, error) {
resolved, err := explicitfilepath.ResolvePathToFullyExplicit(path)
if err != nil {
return nil, err
}
return dirReference{path: path, resolvedPath: resolved}, nil
} | go | func NewReference(path string) (types.ImageReference, error) {
resolved, err := explicitfilepath.ResolvePathToFullyExplicit(path)
if err != nil {
return nil, err
}
return dirReference{path: path, resolvedPath: resolved}, nil
} | [
"func",
"NewReference",
"(",
"path",
"string",
")",
"(",
"types",
".",
"ImageReference",
",",
"error",
")",
"{",
"resolved",
",",
"err",
":=",
"explicitfilepath",
".",
"ResolvePathToFullyExplicit",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"re... | // There is no directory.ParseReference because it is rather pointless.
// Callers who need a transport-independent interface will go through
// dirTransport.ParseReference; callers who intentionally deal with directories
// can use directory.NewReference.
// NewReference returns a directory reference for a specified p... | [
"There",
"is",
"no",
"directory",
".",
"ParseReference",
"because",
"it",
"is",
"rather",
"pointless",
".",
"Callers",
"who",
"need",
"a",
"transport",
"-",
"independent",
"interface",
"will",
"go",
"through",
"dirTransport",
".",
"ParseReference",
";",
"callers... | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/directory/directory_transport.go#L77-L83 | test |
containers/image | directory/directory_transport.go | layerPath | func (ref dirReference) layerPath(digest digest.Digest) string {
// FIXME: Should we keep the digest identification?
return filepath.Join(ref.path, digest.Hex())
} | go | func (ref dirReference) layerPath(digest digest.Digest) string {
// FIXME: Should we keep the digest identification?
return filepath.Join(ref.path, digest.Hex())
} | [
"func",
"(",
"ref",
"dirReference",
")",
"layerPath",
"(",
"digest",
"digest",
".",
"Digest",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"ref",
".",
"path",
",",
"digest",
".",
"Hex",
"(",
")",
")",
"\n",
"}"
] | // layerPath returns a path for a layer tarball within a directory using our conventions. | [
"layerPath",
"returns",
"a",
"path",
"for",
"a",
"layer",
"tarball",
"within",
"a",
"directory",
"using",
"our",
"conventions",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/directory/directory_transport.go#L174-L177 | test |
containers/image | directory/directory_transport.go | signaturePath | func (ref dirReference) signaturePath(index int) string {
return filepath.Join(ref.path, fmt.Sprintf("signature-%d", index+1))
} | go | func (ref dirReference) signaturePath(index int) string {
return filepath.Join(ref.path, fmt.Sprintf("signature-%d", index+1))
} | [
"func",
"(",
"ref",
"dirReference",
")",
"signaturePath",
"(",
"index",
"int",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"ref",
".",
"path",
",",
"fmt",
".",
"Sprintf",
"(",
"\"signature-%d\"",
",",
"index",
"+",
"1",
")",
")",
"\n",
... | // signaturePath returns a path for a signature within a directory using our conventions. | [
"signaturePath",
"returns",
"a",
"path",
"for",
"a",
"signature",
"within",
"a",
"directory",
"using",
"our",
"conventions",
"."
] | da9ab3561ad2031aeb5e036b7cf2755d4e246fec | https://github.com/containers/image/blob/da9ab3561ad2031aeb5e036b7cf2755d4e246fec/directory/directory_transport.go#L180-L182 | test |
Jeffail/tunny | tunny.go | New | func New(n int, ctor func() Worker) *Pool {
p := &Pool{
ctor: ctor,
reqChan: make(chan workRequest),
}
p.SetSize(n)
return p
} | go | func New(n int, ctor func() Worker) *Pool {
p := &Pool{
ctor: ctor,
reqChan: make(chan workRequest),
}
p.SetSize(n)
return p
} | [
"func",
"New",
"(",
"n",
"int",
",",
"ctor",
"func",
"(",
")",
"Worker",
")",
"*",
"Pool",
"{",
"p",
":=",
"&",
"Pool",
"{",
"ctor",
":",
"ctor",
",",
"reqChan",
":",
"make",
"(",
"chan",
"workRequest",
")",
",",
"}",
"\n",
"p",
".",
"SetSize",... | // New creates a new Pool of workers that starts with n workers. You must
// provide a constructor function that creates new Worker types and when you
// change the size of the pool the constructor will be called to create each new
// Worker. | [
"New",
"creates",
"a",
"new",
"Pool",
"of",
"workers",
"that",
"starts",
"with",
"n",
"workers",
".",
"You",
"must",
"provide",
"a",
"constructor",
"function",
"that",
"creates",
"new",
"Worker",
"types",
"and",
"when",
"you",
"change",
"the",
"size",
"of"... | 4921fff29480bad359ad2fb3271fb461c8ffe1fc | https://github.com/Jeffail/tunny/blob/4921fff29480bad359ad2fb3271fb461c8ffe1fc/tunny.go#L119-L127 | test |
Jeffail/tunny | tunny.go | NewFunc | func NewFunc(n int, f func(interface{}) interface{}) *Pool {
return New(n, func() Worker {
return &closureWorker{
processor: f,
}
})
} | go | func NewFunc(n int, f func(interface{}) interface{}) *Pool {
return New(n, func() Worker {
return &closureWorker{
processor: f,
}
})
} | [
"func",
"NewFunc",
"(",
"n",
"int",
",",
"f",
"func",
"(",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
")",
"*",
"Pool",
"{",
"return",
"New",
"(",
"n",
",",
"func",
"(",
")",
"Worker",
"{",
"return",
"&",
"closureWorker",
"{",
"processor",
... | // NewFunc creates a new Pool of workers where each worker will process using
// the provided func. | [
"NewFunc",
"creates",
"a",
"new",
"Pool",
"of",
"workers",
"where",
"each",
"worker",
"will",
"process",
"using",
"the",
"provided",
"func",
"."
] | 4921fff29480bad359ad2fb3271fb461c8ffe1fc | https://github.com/Jeffail/tunny/blob/4921fff29480bad359ad2fb3271fb461c8ffe1fc/tunny.go#L131-L137 | test |
Jeffail/tunny | tunny.go | ProcessTimed | func (p *Pool) ProcessTimed(
payload interface{},
timeout time.Duration,
) (interface{}, error) {
atomic.AddInt64(&p.queuedJobs, 1)
defer atomic.AddInt64(&p.queuedJobs, -1)
tout := time.NewTimer(timeout)
var request workRequest
var open bool
select {
case request, open = <-p.reqChan:
if !open {
return ... | go | func (p *Pool) ProcessTimed(
payload interface{},
timeout time.Duration,
) (interface{}, error) {
atomic.AddInt64(&p.queuedJobs, 1)
defer atomic.AddInt64(&p.queuedJobs, -1)
tout := time.NewTimer(timeout)
var request workRequest
var open bool
select {
case request, open = <-p.reqChan:
if !open {
return ... | [
"func",
"(",
"p",
"*",
"Pool",
")",
"ProcessTimed",
"(",
"payload",
"interface",
"{",
"}",
",",
"timeout",
"time",
".",
"Duration",
",",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"atomic",
".",
"AddInt64",
"(",
"&",
"p",
".",
"queued... | // ProcessTimed will use the Pool to process a payload and synchronously return
// the result. If the timeout occurs before the job has finished the worker will
// be interrupted and ErrJobTimedOut will be returned. ProcessTimed can be
// called safely by any goroutines. | [
"ProcessTimed",
"will",
"use",
"the",
"Pool",
"to",
"process",
"a",
"payload",
"and",
"synchronously",
"return",
"the",
"result",
".",
"If",
"the",
"timeout",
"occurs",
"before",
"the",
"job",
"has",
"finished",
"the",
"worker",
"will",
"be",
"interrupted",
... | 4921fff29480bad359ad2fb3271fb461c8ffe1fc | https://github.com/Jeffail/tunny/blob/4921fff29480bad359ad2fb3271fb461c8ffe1fc/tunny.go#L175-L215 | test |
Jeffail/tunny | tunny.go | SetSize | func (p *Pool) SetSize(n int) {
p.workerMut.Lock()
defer p.workerMut.Unlock()
lWorkers := len(p.workers)
if lWorkers == n {
return
}
// Add extra workers if N > len(workers)
for i := lWorkers; i < n; i++ {
p.workers = append(p.workers, newWorkerWrapper(p.reqChan, p.ctor()))
}
// Asynchronously stop all ... | go | func (p *Pool) SetSize(n int) {
p.workerMut.Lock()
defer p.workerMut.Unlock()
lWorkers := len(p.workers)
if lWorkers == n {
return
}
// Add extra workers if N > len(workers)
for i := lWorkers; i < n; i++ {
p.workers = append(p.workers, newWorkerWrapper(p.reqChan, p.ctor()))
}
// Asynchronously stop all ... | [
"func",
"(",
"p",
"*",
"Pool",
")",
"SetSize",
"(",
"n",
"int",
")",
"{",
"p",
".",
"workerMut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"workerMut",
".",
"Unlock",
"(",
")",
"\n",
"lWorkers",
":=",
"len",
"(",
"p",
".",
"workers",
")",... | // SetSize changes the total number of workers in the Pool. This can be called
// by any goroutine at any time unless the Pool has been stopped, in which case
// a panic will occur. | [
"SetSize",
"changes",
"the",
"total",
"number",
"of",
"workers",
"in",
"the",
"Pool",
".",
"This",
"can",
"be",
"called",
"by",
"any",
"goroutine",
"at",
"any",
"time",
"unless",
"the",
"Pool",
"has",
"been",
"stopped",
"in",
"which",
"case",
"a",
"panic... | 4921fff29480bad359ad2fb3271fb461c8ffe1fc | https://github.com/Jeffail/tunny/blob/4921fff29480bad359ad2fb3271fb461c8ffe1fc/tunny.go#L225-L251 | test |
Jeffail/tunny | tunny.go | GetSize | func (p *Pool) GetSize() int {
p.workerMut.Lock()
defer p.workerMut.Unlock()
return len(p.workers)
} | go | func (p *Pool) GetSize() int {
p.workerMut.Lock()
defer p.workerMut.Unlock()
return len(p.workers)
} | [
"func",
"(",
"p",
"*",
"Pool",
")",
"GetSize",
"(",
")",
"int",
"{",
"p",
".",
"workerMut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"workerMut",
".",
"Unlock",
"(",
")",
"\n",
"return",
"len",
"(",
"p",
".",
"workers",
")",
"\n",
"}"
] | // GetSize returns the current size of the pool. | [
"GetSize",
"returns",
"the",
"current",
"size",
"of",
"the",
"pool",
"."
] | 4921fff29480bad359ad2fb3271fb461c8ffe1fc | https://github.com/Jeffail/tunny/blob/4921fff29480bad359ad2fb3271fb461c8ffe1fc/tunny.go#L254-L259 | test |
go-opencv/go-opencv | opencv/cxtype.go | TL | func (r *Rect) TL() Point {
return Point{int(r.x), int(r.y)}
} | go | func (r *Rect) TL() Point {
return Point{int(r.x), int(r.y)}
} | [
"func",
"(",
"r",
"*",
"Rect",
")",
"TL",
"(",
")",
"Point",
"{",
"return",
"Point",
"{",
"int",
"(",
"r",
".",
"x",
")",
",",
"int",
"(",
"r",
".",
"y",
")",
"}",
"\n",
"}"
] | // Returns the Top-Left Point of the rectangle | [
"Returns",
"the",
"Top",
"-",
"Left",
"Point",
"of",
"the",
"rectangle"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxtype.go#L526-L528 | test |
go-opencv/go-opencv | opencv/cxtype.go | BR | func (r *Rect) BR() Point {
return Point{int(r.x) + int(r.width), int(r.y) + int(r.height)}
} | go | func (r *Rect) BR() Point {
return Point{int(r.x) + int(r.width), int(r.y) + int(r.height)}
} | [
"func",
"(",
"r",
"*",
"Rect",
")",
"BR",
"(",
")",
"Point",
"{",
"return",
"Point",
"{",
"int",
"(",
"r",
".",
"x",
")",
"+",
"int",
"(",
"r",
".",
"width",
")",
",",
"int",
"(",
"r",
".",
"y",
")",
"+",
"int",
"(",
"r",
".",
"height",
... | // Returns the Bottom-Right Point of the rectangle | [
"Returns",
"the",
"Bottom",
"-",
"Right",
"Point",
"of",
"the",
"rectangle"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxtype.go#L531-L533 | test |
go-opencv/go-opencv | opencv/cxtype.go | CVBox | func (box *Box2D) CVBox() C.CvBox2D {
var cvBox C.CvBox2D
cvBox.angle = C.float(box.angle)
cvBox.center.x = C.float(box.center.X)
cvBox.center.y = C.float(box.center.Y)
cvBox.size.width = C.float(box.size.Width)
cvBox.size.height = C.float(box.size.Height)
return cvBox
} | go | func (box *Box2D) CVBox() C.CvBox2D {
var cvBox C.CvBox2D
cvBox.angle = C.float(box.angle)
cvBox.center.x = C.float(box.center.X)
cvBox.center.y = C.float(box.center.Y)
cvBox.size.width = C.float(box.size.Width)
cvBox.size.height = C.float(box.size.Height)
return cvBox
} | [
"func",
"(",
"box",
"*",
"Box2D",
")",
"CVBox",
"(",
")",
"C",
".",
"CvBox2D",
"{",
"var",
"cvBox",
"C",
".",
"CvBox2D",
"\n",
"cvBox",
".",
"angle",
"=",
"C",
".",
"float",
"(",
"box",
".",
"angle",
")",
"\n",
"cvBox",
".",
"center",
".",
"x",... | // Returns a CvBox2D | [
"Returns",
"a",
"CvBox2D"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxtype.go#L833-L841 | test |
go-opencv/go-opencv | opencv/cxtype.go | Points | func (box *Box2D) Points() []Point2D32f {
var pts [4]C.CvPoint2D32f
C.cvBoxPoints(
box.CVBox(),
(*C.CvPoint2D32f)(unsafe.Pointer(&pts[0])),
)
outPts := make([]Point2D32f, 4)
for i, p := range pts {
outPts[i].X = float32(p.x)
outPts[i].Y = float32(p.y)
}
return outPts
} | go | func (box *Box2D) Points() []Point2D32f {
var pts [4]C.CvPoint2D32f
C.cvBoxPoints(
box.CVBox(),
(*C.CvPoint2D32f)(unsafe.Pointer(&pts[0])),
)
outPts := make([]Point2D32f, 4)
for i, p := range pts {
outPts[i].X = float32(p.x)
outPts[i].Y = float32(p.y)
}
return outPts
} | [
"func",
"(",
"box",
"*",
"Box2D",
")",
"Points",
"(",
")",
"[",
"]",
"Point2D32f",
"{",
"var",
"pts",
"[",
"4",
"]",
"C",
".",
"CvPoint2D32f",
"\n",
"C",
".",
"cvBoxPoints",
"(",
"box",
".",
"CVBox",
"(",
")",
",",
"(",
"*",
"C",
".",
"CvPoint2... | // Finds box vertices | [
"Finds",
"box",
"vertices"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxtype.go#L844-L856 | test |
go-opencv/go-opencv | opencv/highgui.go | FOURCC | func FOURCC(c1, c2, c3, c4 int8) uint32 {
rv := C.GoOpenCV_FOURCC_(C.int(c1), C.int(c2), C.int(c3), C.int(c4))
return uint32(rv)
} | go | func FOURCC(c1, c2, c3, c4 int8) uint32 {
rv := C.GoOpenCV_FOURCC_(C.int(c1), C.int(c2), C.int(c3), C.int(c4))
return uint32(rv)
} | [
"func",
"FOURCC",
"(",
"c1",
",",
"c2",
",",
"c3",
",",
"c4",
"int8",
")",
"uint32",
"{",
"rv",
":=",
"C",
".",
"GoOpenCV_FOURCC_",
"(",
"C",
".",
"int",
"(",
"c1",
")",
",",
"C",
".",
"int",
"(",
"c2",
")",
",",
"C",
".",
"int",
"(",
"c3",... | // Prototype for CV_FOURCC so that swig can generate wrapper without mixing up the define | [
"Prototype",
"for",
"CV_FOURCC",
"so",
"that",
"swig",
"can",
"generate",
"wrapper",
"without",
"mixing",
"up",
"the",
"define"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/highgui.go#L574-L577 | test |
go-opencv/go-opencv | opencv/cxcore.go | Merge | func Merge(imgBlue, imgGreen, imgRed, imgAlpha, dst *IplImage) {
C.cvMerge(
unsafe.Pointer(imgBlue),
unsafe.Pointer(imgGreen),
unsafe.Pointer(imgRed),
unsafe.Pointer(imgAlpha),
unsafe.Pointer(dst),
)
} | go | func Merge(imgBlue, imgGreen, imgRed, imgAlpha, dst *IplImage) {
C.cvMerge(
unsafe.Pointer(imgBlue),
unsafe.Pointer(imgGreen),
unsafe.Pointer(imgRed),
unsafe.Pointer(imgAlpha),
unsafe.Pointer(dst),
)
} | [
"func",
"Merge",
"(",
"imgBlue",
",",
"imgGreen",
",",
"imgRed",
",",
"imgAlpha",
",",
"dst",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvMerge",
"(",
"unsafe",
".",
"Pointer",
"(",
"imgBlue",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"imgGreen",
")",
","... | // Merge creates one multichannel array out of several single-channel ones. | [
"Merge",
"creates",
"one",
"multichannel",
"array",
"out",
"of",
"several",
"single",
"-",
"channel",
"ones",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L58-L66 | test |
go-opencv/go-opencv | opencv/cxcore.go | Split | func Split(src, imgBlue, imgGreen, imgRed, imgAlpha *IplImage) {
C.cvSplit(
unsafe.Pointer(src),
unsafe.Pointer(imgBlue),
unsafe.Pointer(imgGreen),
unsafe.Pointer(imgRed),
unsafe.Pointer(imgAlpha),
)
} | go | func Split(src, imgBlue, imgGreen, imgRed, imgAlpha *IplImage) {
C.cvSplit(
unsafe.Pointer(src),
unsafe.Pointer(imgBlue),
unsafe.Pointer(imgGreen),
unsafe.Pointer(imgRed),
unsafe.Pointer(imgAlpha),
)
} | [
"func",
"Split",
"(",
"src",
",",
"imgBlue",
",",
"imgGreen",
",",
"imgRed",
",",
"imgAlpha",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvSplit",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"imgBlue",
")",
",",
"... | // Split divides a multi-channel array into several single-channel arrays. | [
"Split",
"divides",
"a",
"multi",
"-",
"channel",
"array",
"into",
"several",
"single",
"-",
"channel",
"arrays",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L69-L77 | test |
go-opencv/go-opencv | opencv/cxcore.go | AddWeighted | func AddWeighted(src1 *IplImage, alpha float64, src2 *IplImage, beta float64, gamma float64, dst *IplImage) {
C.cvAddWeighted(
unsafe.Pointer(src1),
C.double(alpha),
unsafe.Pointer(src2),
C.double(beta),
C.double(gamma),
unsafe.Pointer(dst),
)
} | go | func AddWeighted(src1 *IplImage, alpha float64, src2 *IplImage, beta float64, gamma float64, dst *IplImage) {
C.cvAddWeighted(
unsafe.Pointer(src1),
C.double(alpha),
unsafe.Pointer(src2),
C.double(beta),
C.double(gamma),
unsafe.Pointer(dst),
)
} | [
"func",
"AddWeighted",
"(",
"src1",
"*",
"IplImage",
",",
"alpha",
"float64",
",",
"src2",
"*",
"IplImage",
",",
"beta",
"float64",
",",
"gamma",
"float64",
",",
"dst",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvAddWeighted",
"(",
"unsafe",
".",
"Pointer",
... | // AddWeighted calculates the weighted sum of two images. | [
"AddWeighted",
"calculates",
"the",
"weighted",
"sum",
"of",
"two",
"images",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L80-L89 | test |
go-opencv/go-opencv | opencv/cxcore.go | And | func And(src1, src2, dst *IplImage) {
AndWithMask(src1, src2, dst, nil)
} | go | func And(src1, src2, dst *IplImage) {
AndWithMask(src1, src2, dst, nil)
} | [
"func",
"And",
"(",
"src1",
",",
"src2",
",",
"dst",
"*",
"IplImage",
")",
"{",
"AndWithMask",
"(",
"src1",
",",
"src2",
",",
"dst",
",",
"nil",
")",
"\n",
"}"
] | // Calculates the per-element bit-wise conjunction of two arrays. | [
"Calculates",
"the",
"per",
"-",
"element",
"bit",
"-",
"wise",
"conjunction",
"of",
"two",
"arrays",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L556-L558 | test |
go-opencv/go-opencv | opencv/cxcore.go | AndWithMask | func AndWithMask(src1, src2, dst, mask *IplImage) {
C.cvAnd(
unsafe.Pointer(src1),
unsafe.Pointer(src2),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | go | func AndWithMask(src1, src2, dst, mask *IplImage) {
C.cvAnd(
unsafe.Pointer(src1),
unsafe.Pointer(src2),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | [
"func",
"AndWithMask",
"(",
"src1",
",",
"src2",
",",
"dst",
",",
"mask",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvAnd",
"(",
"unsafe",
".",
"Pointer",
"(",
"src1",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"src2",
")",
",",
"unsafe",
".",
"Pointer",... | // Calculates the per-element bit-wise conjunction of two arrays with a mask. | [
"Calculates",
"the",
"per",
"-",
"element",
"bit",
"-",
"wise",
"conjunction",
"of",
"two",
"arrays",
"with",
"a",
"mask",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L561-L568 | test |
go-opencv/go-opencv | opencv/cxcore.go | AndScalar | func AndScalar(src *IplImage, value Scalar, dst *IplImage) {
AndScalarWithMask(src, value, dst, nil)
} | go | func AndScalar(src *IplImage, value Scalar, dst *IplImage) {
AndScalarWithMask(src, value, dst, nil)
} | [
"func",
"AndScalar",
"(",
"src",
"*",
"IplImage",
",",
"value",
"Scalar",
",",
"dst",
"*",
"IplImage",
")",
"{",
"AndScalarWithMask",
"(",
"src",
",",
"value",
",",
"dst",
",",
"nil",
")",
"\n",
"}"
] | // Calculates the per-element bit-wise conjunction of an array and a scalar. | [
"Calculates",
"the",
"per",
"-",
"element",
"bit",
"-",
"wise",
"conjunction",
"of",
"an",
"array",
"and",
"a",
"scalar",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L571-L573 | test |
go-opencv/go-opencv | opencv/cxcore.go | AndScalarWithMask | func AndScalarWithMask(src *IplImage, value Scalar, dst, mask *IplImage) {
C.cvAndS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | go | func AndScalarWithMask(src *IplImage, value Scalar, dst, mask *IplImage) {
C.cvAndS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | [
"func",
"AndScalarWithMask",
"(",
"src",
"*",
"IplImage",
",",
"value",
"Scalar",
",",
"dst",
",",
"mask",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvAndS",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"(",
"C",
".",
"CvScalar",
")",
"(",
"val... | // Calculates the per-element bit-wise conjunction of an array and a scalar with a mask. | [
"Calculates",
"the",
"per",
"-",
"element",
"bit",
"-",
"wise",
"conjunction",
"of",
"an",
"array",
"and",
"a",
"scalar",
"with",
"a",
"mask",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L576-L583 | test |
go-opencv/go-opencv | opencv/cxcore.go | Or | func Or(src1, src2, dst *IplImage) {
OrWithMask(src1, src2, dst, nil)
} | go | func Or(src1, src2, dst *IplImage) {
OrWithMask(src1, src2, dst, nil)
} | [
"func",
"Or",
"(",
"src1",
",",
"src2",
",",
"dst",
"*",
"IplImage",
")",
"{",
"OrWithMask",
"(",
"src1",
",",
"src2",
",",
"dst",
",",
"nil",
")",
"\n",
"}"
] | // Calculates the per-element bit-wise disjunction of two arrays. | [
"Calculates",
"the",
"per",
"-",
"element",
"bit",
"-",
"wise",
"disjunction",
"of",
"two",
"arrays",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L586-L588 | test |
go-opencv/go-opencv | opencv/cxcore.go | OrWithMask | func OrWithMask(src1, src2, dst, mask *IplImage) {
C.cvOr(
unsafe.Pointer(src1),
unsafe.Pointer(src2),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | go | func OrWithMask(src1, src2, dst, mask *IplImage) {
C.cvOr(
unsafe.Pointer(src1),
unsafe.Pointer(src2),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | [
"func",
"OrWithMask",
"(",
"src1",
",",
"src2",
",",
"dst",
",",
"mask",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvOr",
"(",
"unsafe",
".",
"Pointer",
"(",
"src1",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"src2",
")",
",",
"unsafe",
".",
"Pointer",
... | // Calculates the per-element bit-wise disjunction of two arrays with a mask. | [
"Calculates",
"the",
"per",
"-",
"element",
"bit",
"-",
"wise",
"disjunction",
"of",
"two",
"arrays",
"with",
"a",
"mask",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L591-L598 | test |
go-opencv/go-opencv | opencv/cxcore.go | OrScalar | func OrScalar(src *IplImage, value Scalar, dst *IplImage) {
OrScalarWithMask(src, value, dst, nil)
} | go | func OrScalar(src *IplImage, value Scalar, dst *IplImage) {
OrScalarWithMask(src, value, dst, nil)
} | [
"func",
"OrScalar",
"(",
"src",
"*",
"IplImage",
",",
"value",
"Scalar",
",",
"dst",
"*",
"IplImage",
")",
"{",
"OrScalarWithMask",
"(",
"src",
",",
"value",
",",
"dst",
",",
"nil",
")",
"\n",
"}"
] | // Calculates the per-element bit-wise disjunction of an array and a scalar. | [
"Calculates",
"the",
"per",
"-",
"element",
"bit",
"-",
"wise",
"disjunction",
"of",
"an",
"array",
"and",
"a",
"scalar",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L601-L603 | test |
go-opencv/go-opencv | opencv/cxcore.go | OrScalarWithMask | func OrScalarWithMask(src *IplImage, value Scalar, dst, mask *IplImage) {
C.cvOrS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | go | func OrScalarWithMask(src *IplImage, value Scalar, dst, mask *IplImage) {
C.cvOrS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | [
"func",
"OrScalarWithMask",
"(",
"src",
"*",
"IplImage",
",",
"value",
"Scalar",
",",
"dst",
",",
"mask",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvOrS",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"(",
"C",
".",
"CvScalar",
")",
"(",
"value... | // Calculates the per-element bit-wise disjunction of an array and a scalar with a mask. | [
"Calculates",
"the",
"per",
"-",
"element",
"bit",
"-",
"wise",
"disjunction",
"of",
"an",
"array",
"and",
"a",
"scalar",
"with",
"a",
"mask",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L606-L613 | test |
go-opencv/go-opencv | opencv/cxcore.go | AddWithMask | func AddWithMask(src1, src2, dst, mask *IplImage) {
C.cvAdd(
unsafe.Pointer(src1),
unsafe.Pointer(src2),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | go | func AddWithMask(src1, src2, dst, mask *IplImage) {
C.cvAdd(
unsafe.Pointer(src1),
unsafe.Pointer(src2),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | [
"func",
"AddWithMask",
"(",
"src1",
",",
"src2",
",",
"dst",
",",
"mask",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvAdd",
"(",
"unsafe",
".",
"Pointer",
"(",
"src1",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"src2",
")",
",",
"unsafe",
".",
"Pointer",... | // Calculates the per-element sum of two arrays with a mask.
// dst = src1 + src2 | [
"Calculates",
"the",
"per",
"-",
"element",
"sum",
"of",
"two",
"arrays",
"with",
"a",
"mask",
".",
"dst",
"=",
"src1",
"+",
"src2"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L657-L664 | test |
go-opencv/go-opencv | opencv/cxcore.go | AddScalar | func AddScalar(src *IplImage, value Scalar, dst *IplImage) {
AddScalarWithMask(src, value, dst, nil)
} | go | func AddScalar(src *IplImage, value Scalar, dst *IplImage) {
AddScalarWithMask(src, value, dst, nil)
} | [
"func",
"AddScalar",
"(",
"src",
"*",
"IplImage",
",",
"value",
"Scalar",
",",
"dst",
"*",
"IplImage",
")",
"{",
"AddScalarWithMask",
"(",
"src",
",",
"value",
",",
"dst",
",",
"nil",
")",
"\n",
"}"
] | // Calculates the per-element sum of an array and a scalar.
// dst = src + value | [
"Calculates",
"the",
"per",
"-",
"element",
"sum",
"of",
"an",
"array",
"and",
"a",
"scalar",
".",
"dst",
"=",
"src",
"+",
"value"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L668-L670 | test |
go-opencv/go-opencv | opencv/cxcore.go | AddScalarWithMask | func AddScalarWithMask(src *IplImage, value Scalar, dst, mask *IplImage) {
C.cvAddS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | go | func AddScalarWithMask(src *IplImage, value Scalar, dst, mask *IplImage) {
C.cvAddS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | [
"func",
"AddScalarWithMask",
"(",
"src",
"*",
"IplImage",
",",
"value",
"Scalar",
",",
"dst",
",",
"mask",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvAddS",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"(",
"C",
".",
"CvScalar",
")",
"(",
"val... | // Calculates the per-element sum of an array and a scalar with a mask.
// dst = src + value | [
"Calculates",
"the",
"per",
"-",
"element",
"sum",
"of",
"an",
"array",
"and",
"a",
"scalar",
"with",
"a",
"mask",
".",
"dst",
"=",
"src",
"+",
"value"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L674-L681 | test |
go-opencv/go-opencv | opencv/cxcore.go | Subtract | func Subtract(src1, src2, dst *IplImage) {
SubtractWithMask(src1, src2, dst, nil)
} | go | func Subtract(src1, src2, dst *IplImage) {
SubtractWithMask(src1, src2, dst, nil)
} | [
"func",
"Subtract",
"(",
"src1",
",",
"src2",
",",
"dst",
"*",
"IplImage",
")",
"{",
"SubtractWithMask",
"(",
"src1",
",",
"src2",
",",
"dst",
",",
"nil",
")",
"\n",
"}"
] | // Calculates the per-element difference between two arrays.
// dst = src1 - src2 | [
"Calculates",
"the",
"per",
"-",
"element",
"difference",
"between",
"two",
"arrays",
".",
"dst",
"=",
"src1",
"-",
"src2"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L685-L687 | test |
go-opencv/go-opencv | opencv/cxcore.go | SubtractWithMask | func SubtractWithMask(src1, src2, dst, mask *IplImage) {
C.cvSub(
unsafe.Pointer(src1),
unsafe.Pointer(src2),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | go | func SubtractWithMask(src1, src2, dst, mask *IplImage) {
C.cvSub(
unsafe.Pointer(src1),
unsafe.Pointer(src2),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | [
"func",
"SubtractWithMask",
"(",
"src1",
",",
"src2",
",",
"dst",
",",
"mask",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvSub",
"(",
"unsafe",
".",
"Pointer",
"(",
"src1",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"src2",
")",
",",
"unsafe",
".",
"Poin... | // Calculates the per-element difference between two arrays with a mask.
// dst = src1 - src2 | [
"Calculates",
"the",
"per",
"-",
"element",
"difference",
"between",
"two",
"arrays",
"with",
"a",
"mask",
".",
"dst",
"=",
"src1",
"-",
"src2"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L691-L698 | test |
go-opencv/go-opencv | opencv/cxcore.go | SubScalar | func SubScalar(src *IplImage, value Scalar, dst *IplImage) {
SubScalarWithMask(src, value, dst, nil)
} | go | func SubScalar(src *IplImage, value Scalar, dst *IplImage) {
SubScalarWithMask(src, value, dst, nil)
} | [
"func",
"SubScalar",
"(",
"src",
"*",
"IplImage",
",",
"value",
"Scalar",
",",
"dst",
"*",
"IplImage",
")",
"{",
"SubScalarWithMask",
"(",
"src",
",",
"value",
",",
"dst",
",",
"nil",
")",
"\n",
"}"
] | // Calculates the per-element difference between an array and a scalar.
// dst = src - value | [
"Calculates",
"the",
"per",
"-",
"element",
"difference",
"between",
"an",
"array",
"and",
"a",
"scalar",
".",
"dst",
"=",
"src",
"-",
"value"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L702-L704 | test |
go-opencv/go-opencv | opencv/cxcore.go | SubScalarWithMask | func SubScalarWithMask(src *IplImage, value Scalar, dst, mask *IplImage) {
C.cvSubS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | go | func SubScalarWithMask(src *IplImage, value Scalar, dst, mask *IplImage) {
C.cvSubS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | [
"func",
"SubScalarWithMask",
"(",
"src",
"*",
"IplImage",
",",
"value",
"Scalar",
",",
"dst",
",",
"mask",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvSubS",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"(",
"C",
".",
"CvScalar",
")",
"(",
"val... | // Calculates the per-element difference between an array and a scalar with a mask.
// dst = src - value | [
"Calculates",
"the",
"per",
"-",
"element",
"difference",
"between",
"an",
"array",
"and",
"a",
"scalar",
"with",
"a",
"mask",
".",
"dst",
"=",
"src",
"-",
"value"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L708-L715 | test |
go-opencv/go-opencv | opencv/cxcore.go | SubScalarRev | func SubScalarRev(value Scalar, src, dst *IplImage) {
SubScalarWithMaskRev(value, src, dst, nil)
} | go | func SubScalarRev(value Scalar, src, dst *IplImage) {
SubScalarWithMaskRev(value, src, dst, nil)
} | [
"func",
"SubScalarRev",
"(",
"value",
"Scalar",
",",
"src",
",",
"dst",
"*",
"IplImage",
")",
"{",
"SubScalarWithMaskRev",
"(",
"value",
",",
"src",
",",
"dst",
",",
"nil",
")",
"\n",
"}"
] | // Calculates the per-element difference between a scalar and an array.
// dst = value - src | [
"Calculates",
"the",
"per",
"-",
"element",
"difference",
"between",
"a",
"scalar",
"and",
"an",
"array",
".",
"dst",
"=",
"value",
"-",
"src"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L719-L721 | test |
go-opencv/go-opencv | opencv/cxcore.go | SubScalarWithMaskRev | func SubScalarWithMaskRev(value Scalar, src, dst, mask *IplImage) {
C.cvSubRS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | go | func SubScalarWithMaskRev(value Scalar, src, dst, mask *IplImage) {
C.cvSubRS(
unsafe.Pointer(src),
(C.CvScalar)(value),
unsafe.Pointer(dst),
unsafe.Pointer(mask),
)
} | [
"func",
"SubScalarWithMaskRev",
"(",
"value",
"Scalar",
",",
"src",
",",
"dst",
",",
"mask",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvSubRS",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"(",
"C",
".",
"CvScalar",
")",
"(",
"value",
")",
","... | // Calculates the per-element difference between a scalar and an array with a mask.
// dst = value - src | [
"Calculates",
"the",
"per",
"-",
"element",
"difference",
"between",
"a",
"scalar",
"and",
"an",
"array",
"with",
"a",
"mask",
".",
"dst",
"=",
"value",
"-",
"src"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L725-L732 | test |
go-opencv/go-opencv | opencv/cxcore.go | AbsDiff | func AbsDiff(src1, src2, dst *IplImage) {
C.cvAbsDiff(
unsafe.Pointer(src1),
unsafe.Pointer(src2),
unsafe.Pointer(dst),
)
} | go | func AbsDiff(src1, src2, dst *IplImage) {
C.cvAbsDiff(
unsafe.Pointer(src1),
unsafe.Pointer(src2),
unsafe.Pointer(dst),
)
} | [
"func",
"AbsDiff",
"(",
"src1",
",",
"src2",
",",
"dst",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvAbsDiff",
"(",
"unsafe",
".",
"Pointer",
"(",
"src1",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"src2",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"dst",
... | // Calculates the per-element absolute difference between two arrays. | [
"Calculates",
"the",
"per",
"-",
"element",
"absolute",
"difference",
"between",
"two",
"arrays",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L735-L741 | test |
go-opencv/go-opencv | opencv/cxcore.go | AbsDiffScalar | func AbsDiffScalar(src *IplImage, value Scalar, dst *IplImage) {
C.cvAbsDiffS(
unsafe.Pointer(src),
unsafe.Pointer(dst),
(C.CvScalar)(value),
)
} | go | func AbsDiffScalar(src *IplImage, value Scalar, dst *IplImage) {
C.cvAbsDiffS(
unsafe.Pointer(src),
unsafe.Pointer(dst),
(C.CvScalar)(value),
)
} | [
"func",
"AbsDiffScalar",
"(",
"src",
"*",
"IplImage",
",",
"value",
"Scalar",
",",
"dst",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvAbsDiffS",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"dst",
")",
",",
"(",
"... | // Calculates the per-element absolute difference between an array and a scalar. | [
"Calculates",
"the",
"per",
"-",
"element",
"absolute",
"difference",
"between",
"an",
"array",
"and",
"a",
"scalar",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L744-L750 | test |
go-opencv/go-opencv | opencv/cxcore.go | MeanStdDevWithMask | func MeanStdDevWithMask(src, mask *IplImage) (Scalar, Scalar) {
var mean, stdDev Scalar
C.cvAvgSdv(
unsafe.Pointer(src),
(*C.CvScalar)(&mean),
(*C.CvScalar)(&stdDev),
unsafe.Pointer(mask),
)
return mean, stdDev
} | go | func MeanStdDevWithMask(src, mask *IplImage) (Scalar, Scalar) {
var mean, stdDev Scalar
C.cvAvgSdv(
unsafe.Pointer(src),
(*C.CvScalar)(&mean),
(*C.CvScalar)(&stdDev),
unsafe.Pointer(mask),
)
return mean, stdDev
} | [
"func",
"MeanStdDevWithMask",
"(",
"src",
",",
"mask",
"*",
"IplImage",
")",
"(",
"Scalar",
",",
"Scalar",
")",
"{",
"var",
"mean",
",",
"stdDev",
"Scalar",
"\n",
"C",
".",
"cvAvgSdv",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"(",
"*",
... | // MeanStdDevWithMask calculates mean and standard deviation of pixel values with mask | [
"MeanStdDevWithMask",
"calculates",
"mean",
"and",
"standard",
"deviation",
"of",
"pixel",
"values",
"with",
"mask"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L775-L785 | test |
go-opencv/go-opencv | opencv/cxcore.go | CreateSeq | func CreateSeq(seq_flags, elem_size int) *Seq {
return (*Seq)(C.cvCreateSeq(
C.int(seq_flags),
C.size_t(unsafe.Sizeof(Seq{})),
C.size_t(elem_size),
C.cvCreateMemStorage(C.int(0)),
))
} | go | func CreateSeq(seq_flags, elem_size int) *Seq {
return (*Seq)(C.cvCreateSeq(
C.int(seq_flags),
C.size_t(unsafe.Sizeof(Seq{})),
C.size_t(elem_size),
C.cvCreateMemStorage(C.int(0)),
))
} | [
"func",
"CreateSeq",
"(",
"seq_flags",
",",
"elem_size",
"int",
")",
"*",
"Seq",
"{",
"return",
"(",
"*",
"Seq",
")",
"(",
"C",
".",
"cvCreateSeq",
"(",
"C",
".",
"int",
"(",
"seq_flags",
")",
",",
"C",
".",
"size_t",
"(",
"unsafe",
".",
"Sizeof",
... | // Creates a new sequence. | [
"Creates",
"a",
"new",
"sequence",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L803-L810 | test |
go-opencv/go-opencv | opencv/cxcore.go | Push | func (seq *Seq) Push(element unsafe.Pointer) unsafe.Pointer {
return unsafe.Pointer(C.cvSeqPush((*C.struct_CvSeq)(seq), element))
} | go | func (seq *Seq) Push(element unsafe.Pointer) unsafe.Pointer {
return unsafe.Pointer(C.cvSeqPush((*C.struct_CvSeq)(seq), element))
} | [
"func",
"(",
"seq",
"*",
"Seq",
")",
"Push",
"(",
"element",
"unsafe",
".",
"Pointer",
")",
"unsafe",
".",
"Pointer",
"{",
"return",
"unsafe",
".",
"Pointer",
"(",
"C",
".",
"cvSeqPush",
"(",
"(",
"*",
"C",
".",
"struct_CvSeq",
")",
"(",
"seq",
")"... | // Adds an element to the sequence end.
// Returns a pointer to the element added. | [
"Adds",
"an",
"element",
"to",
"the",
"sequence",
"end",
".",
"Returns",
"a",
"pointer",
"to",
"the",
"element",
"added",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L814-L816 | test |
go-opencv/go-opencv | opencv/cxcore.go | Pop | func (seq *Seq) Pop(element unsafe.Pointer) {
C.cvSeqPop((*C.struct_CvSeq)(seq), element)
} | go | func (seq *Seq) Pop(element unsafe.Pointer) {
C.cvSeqPop((*C.struct_CvSeq)(seq), element)
} | [
"func",
"(",
"seq",
"*",
"Seq",
")",
"Pop",
"(",
"element",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"cvSeqPop",
"(",
"(",
"*",
"C",
".",
"struct_CvSeq",
")",
"(",
"seq",
")",
",",
"element",
")",
"\n",
"}"
] | // Removes element from the sequence end.
// Copies the element into the paramter element. | [
"Removes",
"element",
"from",
"the",
"sequence",
"end",
".",
"Copies",
"the",
"element",
"into",
"the",
"paramter",
"element",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L820-L822 | test |
go-opencv/go-opencv | opencv/cxcore.go | PushFront | func (seq *Seq) PushFront(element unsafe.Pointer) unsafe.Pointer {
return unsafe.Pointer((C.cvSeqPushFront((*C.struct_CvSeq)(seq), element)))
} | go | func (seq *Seq) PushFront(element unsafe.Pointer) unsafe.Pointer {
return unsafe.Pointer((C.cvSeqPushFront((*C.struct_CvSeq)(seq), element)))
} | [
"func",
"(",
"seq",
"*",
"Seq",
")",
"PushFront",
"(",
"element",
"unsafe",
".",
"Pointer",
")",
"unsafe",
".",
"Pointer",
"{",
"return",
"unsafe",
".",
"Pointer",
"(",
"(",
"C",
".",
"cvSeqPushFront",
"(",
"(",
"*",
"C",
".",
"struct_CvSeq",
")",
"(... | // Adds an element to the sequence beginning.
// Returns a pointer to the element added. | [
"Adds",
"an",
"element",
"to",
"the",
"sequence",
"beginning",
".",
"Returns",
"a",
"pointer",
"to",
"the",
"element",
"added",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L826-L828 | test |
go-opencv/go-opencv | opencv/cxcore.go | PopFront | func (seq *Seq) PopFront(element unsafe.Pointer) {
C.cvSeqPopFront((*C.struct_CvSeq)(seq), element)
} | go | func (seq *Seq) PopFront(element unsafe.Pointer) {
C.cvSeqPopFront((*C.struct_CvSeq)(seq), element)
} | [
"func",
"(",
"seq",
"*",
"Seq",
")",
"PopFront",
"(",
"element",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"cvSeqPopFront",
"(",
"(",
"*",
"C",
".",
"struct_CvSeq",
")",
"(",
"seq",
")",
",",
"element",
")",
"\n",
"}"
] | // Removes element from the sequence beginning.
// Copies the element into the paramter element. | [
"Removes",
"element",
"from",
"the",
"sequence",
"beginning",
".",
"Copies",
"the",
"element",
"into",
"the",
"paramter",
"element",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L832-L834 | test |
go-opencv/go-opencv | opencv/cxcore.go | GetElemAt | func (seq *Seq) GetElemAt(index int) unsafe.Pointer {
return (unsafe.Pointer)(C.cvGetSeqElem(
(*C.struct_CvSeq)(seq),
C.int(index),
))
} | go | func (seq *Seq) GetElemAt(index int) unsafe.Pointer {
return (unsafe.Pointer)(C.cvGetSeqElem(
(*C.struct_CvSeq)(seq),
C.int(index),
))
} | [
"func",
"(",
"seq",
"*",
"Seq",
")",
"GetElemAt",
"(",
"index",
"int",
")",
"unsafe",
".",
"Pointer",
"{",
"return",
"(",
"unsafe",
".",
"Pointer",
")",
"(",
"C",
".",
"cvGetSeqElem",
"(",
"(",
"*",
"C",
".",
"struct_CvSeq",
")",
"(",
"seq",
")",
... | // Gets a pointer to the element at the index | [
"Gets",
"a",
"pointer",
"to",
"the",
"element",
"at",
"the",
"index"
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L867-L872 | test |
go-opencv/go-opencv | opencv/cxcore.go | RemoveAt | func (seq *Seq) RemoveAt(index int) {
C.cvSeqRemove((*C.struct_CvSeq)(seq), C.int(index))
} | go | func (seq *Seq) RemoveAt(index int) {
C.cvSeqRemove((*C.struct_CvSeq)(seq), C.int(index))
} | [
"func",
"(",
"seq",
"*",
"Seq",
")",
"RemoveAt",
"(",
"index",
"int",
")",
"{",
"C",
".",
"cvSeqRemove",
"(",
"(",
"*",
"C",
".",
"struct_CvSeq",
")",
"(",
"seq",
")",
",",
"C",
".",
"int",
"(",
"index",
")",
")",
"\n",
"}"
] | // Removes an element from the middle of a sequence. | [
"Removes",
"an",
"element",
"from",
"the",
"middle",
"of",
"a",
"sequence",
"."
] | a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db | https://github.com/go-opencv/go-opencv/blob/a4fe8ec027ccc9eb8b7d0797db7c76e61083f1db/opencv/cxcore.go#L875-L877 | test |
avast/retry-go | options.go | Delay | func Delay(delay time.Duration) Option {
return func(c *Config) {
c.delay = delay
}
} | go | func Delay(delay time.Duration) Option {
return func(c *Config) {
c.delay = delay
}
} | [
"func",
"Delay",
"(",
"delay",
"time",
".",
"Duration",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Config",
")",
"{",
"c",
".",
"delay",
"=",
"delay",
"\n",
"}",
"\n",
"}"
] | // Delay set delay between retry
// default is 100ms | [
"Delay",
"set",
"delay",
"between",
"retry",
"default",
"is",
"100ms"
] | 88ef2130df9642aa2849152b2985af9ba3676ee9 | https://github.com/avast/retry-go/blob/88ef2130df9642aa2849152b2985af9ba3676ee9/options.go#L46-L50 | test |
avast/retry-go | options.go | BackOffDelay | func BackOffDelay(n uint, config *Config) time.Duration {
return config.delay * (1 << (n - 1))
} | go | func BackOffDelay(n uint, config *Config) time.Duration {
return config.delay * (1 << (n - 1))
} | [
"func",
"BackOffDelay",
"(",
"n",
"uint",
",",
"config",
"*",
"Config",
")",
"time",
".",
"Duration",
"{",
"return",
"config",
".",
"delay",
"*",
"(",
"1",
"<<",
"(",
"n",
"-",
"1",
")",
")",
"\n",
"}"
] | // BackOffDelay is a DelayType which increases delay between consecutive retries | [
"BackOffDelay",
"is",
"a",
"DelayType",
"which",
"increases",
"delay",
"between",
"consecutive",
"retries"
] | 88ef2130df9642aa2849152b2985af9ba3676ee9 | https://github.com/avast/retry-go/blob/88ef2130df9642aa2849152b2985af9ba3676ee9/options.go#L61-L63 | test |
avast/retry-go | retry.go | Error | func (e Error) Error() string {
logWithNumber := make([]string, lenWithoutNil(e))
for i, l := range e {
if l != nil {
logWithNumber[i] = fmt.Sprintf("#%d: %s", i+1, l.Error())
}
}
return fmt.Sprintf("All attempts fail:\n%s", strings.Join(logWithNumber, "\n"))
} | go | func (e Error) Error() string {
logWithNumber := make([]string, lenWithoutNil(e))
for i, l := range e {
if l != nil {
logWithNumber[i] = fmt.Sprintf("#%d: %s", i+1, l.Error())
}
}
return fmt.Sprintf("All attempts fail:\n%s", strings.Join(logWithNumber, "\n"))
} | [
"func",
"(",
"e",
"Error",
")",
"Error",
"(",
")",
"string",
"{",
"logWithNumber",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"lenWithoutNil",
"(",
"e",
")",
")",
"\n",
"for",
"i",
",",
"l",
":=",
"range",
"e",
"{",
"if",
"l",
"!=",
"nil",
"{"... | // Error method return string representation of Error
// It is an implementation of error interface | [
"Error",
"method",
"return",
"string",
"representation",
"of",
"Error",
"It",
"is",
"an",
"implementation",
"of",
"error",
"interface"
] | 88ef2130df9642aa2849152b2985af9ba3676ee9 | https://github.com/avast/retry-go/blob/88ef2130df9642aa2849152b2985af9ba3676ee9/retry.go#L132-L141 | test |
ipfs/go-ipfs-api | requestbuilder.go | Arguments | func (r *RequestBuilder) Arguments(args ...string) *RequestBuilder {
r.args = append(r.args, args...)
return r
} | go | func (r *RequestBuilder) Arguments(args ...string) *RequestBuilder {
r.args = append(r.args, args...)
return r
} | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"Arguments",
"(",
"args",
"...",
"string",
")",
"*",
"RequestBuilder",
"{",
"r",
".",
"args",
"=",
"append",
"(",
"r",
".",
"args",
",",
"args",
"...",
")",
"\n",
"return",
"r",
"\n",
"}"
] | // Arguments adds the arguments to the args. | [
"Arguments",
"adds",
"the",
"arguments",
"to",
"the",
"args",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/requestbuilder.go#L24-L27 | test |
ipfs/go-ipfs-api | requestbuilder.go | BodyString | func (r *RequestBuilder) BodyString(body string) *RequestBuilder {
return r.Body(strings.NewReader(body))
} | go | func (r *RequestBuilder) BodyString(body string) *RequestBuilder {
return r.Body(strings.NewReader(body))
} | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"BodyString",
"(",
"body",
"string",
")",
"*",
"RequestBuilder",
"{",
"return",
"r",
".",
"Body",
"(",
"strings",
".",
"NewReader",
"(",
"body",
")",
")",
"\n",
"}"
] | // BodyString sets the request body to the given string. | [
"BodyString",
"sets",
"the",
"request",
"body",
"to",
"the",
"given",
"string",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/requestbuilder.go#L30-L32 | test |
ipfs/go-ipfs-api | requestbuilder.go | BodyBytes | func (r *RequestBuilder) BodyBytes(body []byte) *RequestBuilder {
return r.Body(bytes.NewReader(body))
} | go | func (r *RequestBuilder) BodyBytes(body []byte) *RequestBuilder {
return r.Body(bytes.NewReader(body))
} | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"BodyBytes",
"(",
"body",
"[",
"]",
"byte",
")",
"*",
"RequestBuilder",
"{",
"return",
"r",
".",
"Body",
"(",
"bytes",
".",
"NewReader",
"(",
"body",
")",
")",
"\n",
"}"
] | // BodyBytes sets the request body to the given buffer. | [
"BodyBytes",
"sets",
"the",
"request",
"body",
"to",
"the",
"given",
"buffer",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/requestbuilder.go#L35-L37 | test |
ipfs/go-ipfs-api | requestbuilder.go | Body | func (r *RequestBuilder) Body(body io.Reader) *RequestBuilder {
r.body = body
return r
} | go | func (r *RequestBuilder) Body(body io.Reader) *RequestBuilder {
r.body = body
return r
} | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"Body",
"(",
"body",
"io",
".",
"Reader",
")",
"*",
"RequestBuilder",
"{",
"r",
".",
"body",
"=",
"body",
"\n",
"return",
"r",
"\n",
"}"
] | // Body sets the request body to the given reader. | [
"Body",
"sets",
"the",
"request",
"body",
"to",
"the",
"given",
"reader",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/requestbuilder.go#L40-L43 | test |
ipfs/go-ipfs-api | requestbuilder.go | Option | func (r *RequestBuilder) Option(key string, value interface{}) *RequestBuilder {
var s string
switch v := value.(type) {
case bool:
s = strconv.FormatBool(v)
case string:
s = v
case []byte:
s = string(v)
default:
// slow case.
s = fmt.Sprint(value)
}
if r.opts == nil {
r.opts = make(map[string]strin... | go | func (r *RequestBuilder) Option(key string, value interface{}) *RequestBuilder {
var s string
switch v := value.(type) {
case bool:
s = strconv.FormatBool(v)
case string:
s = v
case []byte:
s = string(v)
default:
// slow case.
s = fmt.Sprint(value)
}
if r.opts == nil {
r.opts = make(map[string]strin... | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"Option",
"(",
"key",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"*",
"RequestBuilder",
"{",
"var",
"s",
"string",
"\n",
"switch",
"v",
":=",
"value",
".",
"(",
"type",
")",
"{",
"case",
"bool",
... | // Option sets the given option. | [
"Option",
"sets",
"the",
"given",
"option",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/requestbuilder.go#L46-L64 | test |
ipfs/go-ipfs-api | requestbuilder.go | Header | func (r *RequestBuilder) Header(name, value string) *RequestBuilder {
if r.headers == nil {
r.headers = make(map[string]string, 1)
}
r.headers[name] = value
return r
} | go | func (r *RequestBuilder) Header(name, value string) *RequestBuilder {
if r.headers == nil {
r.headers = make(map[string]string, 1)
}
r.headers[name] = value
return r
} | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"Header",
"(",
"name",
",",
"value",
"string",
")",
"*",
"RequestBuilder",
"{",
"if",
"r",
".",
"headers",
"==",
"nil",
"{",
"r",
".",
"headers",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
"... | // Header sets the given header. | [
"Header",
"sets",
"the",
"given",
"header",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/requestbuilder.go#L67-L73 | test |
ipfs/go-ipfs-api | requestbuilder.go | Send | func (r *RequestBuilder) Send(ctx context.Context) (*Response, error) {
req := NewRequest(ctx, r.shell.url, r.command, r.args...)
req.Opts = r.opts
req.Headers = r.headers
req.Body = r.body
return req.Send(&r.shell.httpcli)
} | go | func (r *RequestBuilder) Send(ctx context.Context) (*Response, error) {
req := NewRequest(ctx, r.shell.url, r.command, r.args...)
req.Opts = r.opts
req.Headers = r.headers
req.Body = r.body
return req.Send(&r.shell.httpcli)
} | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"Send",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"Response",
",",
"error",
")",
"{",
"req",
":=",
"NewRequest",
"(",
"ctx",
",",
"r",
".",
"shell",
".",
"url",
",",
"r",
".",
"command",
"... | // Send sends the request and return the response. | [
"Send",
"sends",
"the",
"request",
"and",
"return",
"the",
"response",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/requestbuilder.go#L76-L82 | test |
ipfs/go-ipfs-api | requestbuilder.go | Exec | func (r *RequestBuilder) Exec(ctx context.Context, res interface{}) error {
httpRes, err := r.Send(ctx)
if err != nil {
return err
}
if res == nil {
lateErr := httpRes.Close()
if httpRes.Error != nil {
return httpRes.Error
}
return lateErr
}
return httpRes.Decode(res)
} | go | func (r *RequestBuilder) Exec(ctx context.Context, res interface{}) error {
httpRes, err := r.Send(ctx)
if err != nil {
return err
}
if res == nil {
lateErr := httpRes.Close()
if httpRes.Error != nil {
return httpRes.Error
}
return lateErr
}
return httpRes.Decode(res)
} | [
"func",
"(",
"r",
"*",
"RequestBuilder",
")",
"Exec",
"(",
"ctx",
"context",
".",
"Context",
",",
"res",
"interface",
"{",
"}",
")",
"error",
"{",
"httpRes",
",",
"err",
":=",
"r",
".",
"Send",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{"... | // Exec sends the request a request and decodes the response. | [
"Exec",
"sends",
"the",
"request",
"a",
"request",
"and",
"decodes",
"the",
"response",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/requestbuilder.go#L85-L100 | test |
ipfs/go-ipfs-api | pubsub.go | Next | func (s *PubSubSubscription) Next() (*Message, error) {
if s.resp.Error != nil {
return nil, s.resp.Error
}
d := json.NewDecoder(s.resp.Output)
var r struct {
From []byte `json:"from,omitempty"`
Data []byte `json:"data,omitempty"`
Seqno []byte `json:"seqno,omitempty"`
TopicIDs []string ... | go | func (s *PubSubSubscription) Next() (*Message, error) {
if s.resp.Error != nil {
return nil, s.resp.Error
}
d := json.NewDecoder(s.resp.Output)
var r struct {
From []byte `json:"from,omitempty"`
Data []byte `json:"data,omitempty"`
Seqno []byte `json:"seqno,omitempty"`
TopicIDs []string ... | [
"func",
"(",
"s",
"*",
"PubSubSubscription",
")",
"Next",
"(",
")",
"(",
"*",
"Message",
",",
"error",
")",
"{",
"if",
"s",
".",
"resp",
".",
"Error",
"!=",
"nil",
"{",
"return",
"nil",
",",
"s",
".",
"resp",
".",
"Error",
"\n",
"}",
"\n",
"d",... | // Next waits for the next record and returns that. | [
"Next",
"waits",
"for",
"the",
"next",
"record",
"and",
"returns",
"that",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/pubsub.go#L31-L60 | test |
ipfs/go-ipfs-api | pubsub.go | Cancel | func (s *PubSubSubscription) Cancel() error {
if s.resp.Output == nil {
return nil
}
return s.resp.Output.Close()
} | go | func (s *PubSubSubscription) Cancel() error {
if s.resp.Output == nil {
return nil
}
return s.resp.Output.Close()
} | [
"func",
"(",
"s",
"*",
"PubSubSubscription",
")",
"Cancel",
"(",
")",
"error",
"{",
"if",
"s",
".",
"resp",
".",
"Output",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"s",
".",
"resp",
".",
"Output",
".",
"Close",
"(",
")",
"\n"... | // Cancel cancels the given subscription. | [
"Cancel",
"cancels",
"the",
"given",
"subscription",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/pubsub.go#L63-L69 | test |
ipfs/go-ipfs-api | unixfs.go | FileList | func (s *Shell) FileList(path string) (*UnixLsObject, error) {
var out lsOutput
if err := s.Request("file/ls", path).Exec(context.Background(), &out); err != nil {
return nil, err
}
for _, object := range out.Objects {
return object, nil
}
return nil, fmt.Errorf("no object in results")
} | go | func (s *Shell) FileList(path string) (*UnixLsObject, error) {
var out lsOutput
if err := s.Request("file/ls", path).Exec(context.Background(), &out); err != nil {
return nil, err
}
for _, object := range out.Objects {
return object, nil
}
return nil, fmt.Errorf("no object in results")
} | [
"func",
"(",
"s",
"*",
"Shell",
")",
"FileList",
"(",
"path",
"string",
")",
"(",
"*",
"UnixLsObject",
",",
"error",
")",
"{",
"var",
"out",
"lsOutput",
"\n",
"if",
"err",
":=",
"s",
".",
"Request",
"(",
"\"file/ls\"",
",",
"path",
")",
".",
"Exec"... | // FileList entries at the given path using the UnixFS commands | [
"FileList",
"entries",
"at",
"the",
"given",
"path",
"using",
"the",
"UnixFS",
"commands"
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/unixfs.go#L27-L38 | test |
ipfs/go-ipfs-api | shell.go | Cat | func (s *Shell) Cat(path string) (io.ReadCloser, error) {
resp, err := s.Request("cat", path).Send(context.Background())
if err != nil {
return nil, err
}
if resp.Error != nil {
return nil, resp.Error
}
return resp.Output, nil
} | go | func (s *Shell) Cat(path string) (io.ReadCloser, error) {
resp, err := s.Request("cat", path).Send(context.Background())
if err != nil {
return nil, err
}
if resp.Error != nil {
return nil, resp.Error
}
return resp.Output, nil
} | [
"func",
"(",
"s",
"*",
"Shell",
")",
"Cat",
"(",
"path",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"s",
".",
"Request",
"(",
"\"cat\"",
",",
"path",
")",
".",
"Send",
"(",
"context",
".",
"Ba... | // Cat the content at the given path. Callers need to drain and close the returned reader after usage. | [
"Cat",
"the",
"content",
"at",
"the",
"given",
"path",
".",
"Callers",
"need",
"to",
"drain",
"and",
"close",
"the",
"returned",
"reader",
"after",
"usage",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/shell.go#L129-L139 | test |
ipfs/go-ipfs-api | shell.go | List | func (s *Shell) List(path string) ([]*LsLink, error) {
var out struct{ Objects []LsObject }
err := s.Request("ls", path).Exec(context.Background(), &out)
if err != nil {
return nil, err
}
if len(out.Objects) != 1 {
return nil, errors.New("bad response from server")
}
return out.Objects[0].Links, nil
} | go | func (s *Shell) List(path string) ([]*LsLink, error) {
var out struct{ Objects []LsObject }
err := s.Request("ls", path).Exec(context.Background(), &out)
if err != nil {
return nil, err
}
if len(out.Objects) != 1 {
return nil, errors.New("bad response from server")
}
return out.Objects[0].Links, nil
} | [
"func",
"(",
"s",
"*",
"Shell",
")",
"List",
"(",
"path",
"string",
")",
"(",
"[",
"]",
"*",
"LsLink",
",",
"error",
")",
"{",
"var",
"out",
"struct",
"{",
"Objects",
"[",
"]",
"LsObject",
"}",
"\n",
"err",
":=",
"s",
".",
"Request",
"(",
"\"ls... | // List entries at the given path | [
"List",
"entries",
"at",
"the",
"given",
"path"
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/shell.go#L150-L160 | test |
ipfs/go-ipfs-api | shell.go | Pin | func (s *Shell) Pin(path string) error {
return s.Request("pin/add", path).
Option("recursive", true).
Exec(context.Background(), nil)
} | go | func (s *Shell) Pin(path string) error {
return s.Request("pin/add", path).
Option("recursive", true).
Exec(context.Background(), nil)
} | [
"func",
"(",
"s",
"*",
"Shell",
")",
"Pin",
"(",
"path",
"string",
")",
"error",
"{",
"return",
"s",
".",
"Request",
"(",
"\"pin/add\"",
",",
"path",
")",
".",
"Option",
"(",
"\"recursive\"",
",",
"true",
")",
".",
"Exec",
"(",
"context",
".",
"Bac... | // Pin the given path | [
"Pin",
"the",
"given",
"path"
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/shell.go#L175-L179 | test |
ipfs/go-ipfs-api | shell.go | Pins | func (s *Shell) Pins() (map[string]PinInfo, error) {
var raw struct{ Keys map[string]PinInfo }
return raw.Keys, s.Request("pin/ls").Exec(context.Background(), &raw)
} | go | func (s *Shell) Pins() (map[string]PinInfo, error) {
var raw struct{ Keys map[string]PinInfo }
return raw.Keys, s.Request("pin/ls").Exec(context.Background(), &raw)
} | [
"func",
"(",
"s",
"*",
"Shell",
")",
"Pins",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"PinInfo",
",",
"error",
")",
"{",
"var",
"raw",
"struct",
"{",
"Keys",
"map",
"[",
"string",
"]",
"PinInfo",
"}",
"\n",
"return",
"raw",
".",
"Keys",
",",
"... | // Pins returns a map of the pin hashes to their info (currently just the
// pin type, one of DirectPin, RecursivePin, or IndirectPin. A map is returned
// instead of a slice because it is easier to do existence lookup by map key
// than unordered array searching. The map is likely to be more useful to a
// client than... | [
"Pins",
"returns",
"a",
"map",
"of",
"the",
"pin",
"hashes",
"to",
"their",
"info",
"(",
"currently",
"just",
"the",
"pin",
"type",
"one",
"of",
"DirectPin",
"RecursivePin",
"or",
"IndirectPin",
".",
"A",
"map",
"is",
"returned",
"instead",
"of",
"a",
"s... | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/shell.go#L203-L206 | test |
ipfs/go-ipfs-api | shell.go | Version | func (s *Shell) Version() (string, string, error) {
ver := struct {
Version string
Commit string
}{}
if err := s.Request("version").Exec(context.Background(), &ver); err != nil {
return "", "", err
}
return ver.Version, ver.Commit, nil
} | go | func (s *Shell) Version() (string, string, error) {
ver := struct {
Version string
Commit string
}{}
if err := s.Request("version").Exec(context.Background(), &ver); err != nil {
return "", "", err
}
return ver.Version, ver.Commit, nil
} | [
"func",
"(",
"s",
"*",
"Shell",
")",
"Version",
"(",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"ver",
":=",
"struct",
"{",
"Version",
"string",
"\n",
"Commit",
"string",
"\n",
"}",
"{",
"}",
"\n",
"if",
"err",
":=",
"s",
".",
"... | // returns ipfs version and commit sha | [
"returns",
"ipfs",
"version",
"and",
"commit",
"sha"
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/shell.go#L339-L349 | test |
ipfs/go-ipfs-api | shell.go | SwarmPeers | func (s *Shell) SwarmPeers(ctx context.Context) (*SwarmConnInfos, error) {
v := &SwarmConnInfos{}
err := s.Request("swarm/peers").Exec(ctx, &v)
return v, err
} | go | func (s *Shell) SwarmPeers(ctx context.Context) (*SwarmConnInfos, error) {
v := &SwarmConnInfos{}
err := s.Request("swarm/peers").Exec(ctx, &v)
return v, err
} | [
"func",
"(",
"s",
"*",
"Shell",
")",
"SwarmPeers",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"SwarmConnInfos",
",",
"error",
")",
"{",
"v",
":=",
"&",
"SwarmConnInfos",
"{",
"}",
"\n",
"err",
":=",
"s",
".",
"Request",
"(",
"\"swarm/peers... | // SwarmPeers gets all the swarm peers | [
"SwarmPeers",
"gets",
"all",
"the",
"swarm",
"peers"
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/shell.go#L500-L504 | test |
ipfs/go-ipfs-api | shell.go | SwarmConnect | func (s *Shell) SwarmConnect(ctx context.Context, addr ...string) error {
var conn *swarmConnection
err := s.Request("swarm/connect").
Arguments(addr...).
Exec(ctx, &conn)
return err
} | go | func (s *Shell) SwarmConnect(ctx context.Context, addr ...string) error {
var conn *swarmConnection
err := s.Request("swarm/connect").
Arguments(addr...).
Exec(ctx, &conn)
return err
} | [
"func",
"(",
"s",
"*",
"Shell",
")",
"SwarmConnect",
"(",
"ctx",
"context",
".",
"Context",
",",
"addr",
"...",
"string",
")",
"error",
"{",
"var",
"conn",
"*",
"swarmConnection",
"\n",
"err",
":=",
"s",
".",
"Request",
"(",
"\"swarm/connect\"",
")",
"... | // SwarmConnect opens a swarm connection to a specific address. | [
"SwarmConnect",
"opens",
"a",
"swarm",
"connection",
"to",
"a",
"specific",
"address",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/shell.go#L511-L517 | test |
ipfs/go-ipfs-api | options/dag.go | DagPutOptions | func DagPutOptions(opts ...DagPutOption) (*DagPutSettings, error) {
options := &DagPutSettings{
InputEnc: "json",
Kind: "cbor",
Pin: "false",
Hash: "sha2-256",
}
for _, opt := range opts {
err := opt(options)
if err != nil {
return nil, err
}
}
return options, nil
} | go | func DagPutOptions(opts ...DagPutOption) (*DagPutSettings, error) {
options := &DagPutSettings{
InputEnc: "json",
Kind: "cbor",
Pin: "false",
Hash: "sha2-256",
}
for _, opt := range opts {
err := opt(options)
if err != nil {
return nil, err
}
}
return options, nil
} | [
"func",
"DagPutOptions",
"(",
"opts",
"...",
"DagPutOption",
")",
"(",
"*",
"DagPutSettings",
",",
"error",
")",
"{",
"options",
":=",
"&",
"DagPutSettings",
"{",
"InputEnc",
":",
"\"json\"",
",",
"Kind",
":",
"\"cbor\"",
",",
"Pin",
":",
"\"false\"",
",",... | // DagPutOptions applies the given options to a DagPutSettings instance. | [
"DagPutOptions",
"applies",
"the",
"given",
"options",
"to",
"a",
"DagPutSettings",
"instance",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/options/dag.go#L15-L30 | test |
ipfs/go-ipfs-api | options/dag.go | Pin | func (dagOpts) Pin(pin string) DagPutOption {
return func(opts *DagPutSettings) error {
opts.Pin = pin
return nil
}
} | go | func (dagOpts) Pin(pin string) DagPutOption {
return func(opts *DagPutSettings) error {
opts.Pin = pin
return nil
}
} | [
"func",
"(",
"dagOpts",
")",
"Pin",
"(",
"pin",
"string",
")",
"DagPutOption",
"{",
"return",
"func",
"(",
"opts",
"*",
"DagPutSettings",
")",
"error",
"{",
"opts",
".",
"Pin",
"=",
"pin",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] | // Pin is an option for Dag.Put which specifies whether to pin the added
// dags. Default is "false". | [
"Pin",
"is",
"an",
"option",
"for",
"Dag",
".",
"Put",
"which",
"specifies",
"whether",
"to",
"pin",
"the",
"added",
"dags",
".",
"Default",
"is",
"false",
"."
] | a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32 | https://github.com/ipfs/go-ipfs-api/blob/a1b28da48b3763f67654ec4cfcba5fcbfb3dfb32/options/dag.go#L38-L43 | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.