repository_name stringlengths 7 48 | func_path_in_repository stringlengths 5 155 | func_name stringlengths 0 100 | whole_func_string stringlengths 71 27.8k | language stringclasses 6
values | func_code_string stringlengths 71 27.8k | func_code_tokens sequencelengths 22 3.12k | func_documentation_string stringlengths 1 9.31k | func_documentation_tokens sequencelengths 1 1.37k | split_name stringclasses 1
value | func_code_url stringlengths 90 255 | formatted_text stringlengths 188 27.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|
boltdb/bolt | cmd/bolt/main.go | leafPageElement | func (p *page) leafPageElement(index uint16) *leafPageElement {
n := &((*[0x7FFFFFF]leafPageElement)(unsafe.Pointer(&p.ptr)))[index]
return n
} | go | func (p *page) leafPageElement(index uint16) *leafPageElement {
n := &((*[0x7FFFFFF]leafPageElement)(unsafe.Pointer(&p.ptr)))[index]
return n
} | [
"func",
"(",
"p",
"*",
"page",
")",
"leafPageElement",
"(",
"index",
"uint16",
")",
"*",
"leafPageElement",
"{",
"n",
":=",
"&",
"(",
"(",
"*",
"[",
"0x7FFFFFF",
"]",
"leafPageElement",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"p",
".",
"ptr",
... | // DO NOT EDIT. Copied from the "bolt" package. | [
"DO",
"NOT",
"EDIT",
".",
"Copied",
"from",
"the",
"bolt",
"package",
"."
] | train | https://github.com/boltdb/bolt/blob/fd01fc79c553a8e99d512a07e8e0c63d4a3ccfc5/cmd/bolt/main.go#L1494-L1497 | <s>[INST] Here is the documentation: // DO NOT EDIT. Copied from the "bolt" package.
What code implements this? [/INST] func (p *page) leafPageElement(index uint16) *leafPageElement {
n := &((*[0x7FFFFFF]leafPageElement)(unsafe.Pointer(&p.ptr)))[index]
return n
} </s> |
garfunkel/go-tvdb | tvdb.go | GetDetail | func (seriesList *SeriesList) GetDetail() (err error) {
for seriesIndex := range seriesList.Series {
if err = seriesList.Series[seriesIndex].GetDetail(); err != nil {
return
}
}
return
} | go | func (seriesList *SeriesList) GetDetail() (err error) {
for seriesIndex := range seriesList.Series {
if err = seriesList.Series[seriesIndex].GetDetail(); err != nil {
return
}
}
return
} | [
"func",
"(",
"seriesList",
"*",
"SeriesList",
")",
"GetDetail",
"(",
")",
"(",
"err",
"error",
")",
"{",
"for",
"seriesIndex",
":=",
"range",
"seriesList",
".",
"Series",
"{",
"if",
"err",
"=",
"seriesList",
".",
"Series",
"[",
"seriesIndex",
"]",
".",
... | // GetDetail gets more detail for all TV shows in a list. | [
"GetDetail",
"gets",
"more",
"detail",
"for",
"all",
"TV",
"shows",
"in",
"a",
"list",
"."
] | train | https://github.com/garfunkel/go-tvdb/blob/59b4220a6dad5aa6d153d3b373a8020de417b9d7/tvdb.go#L132-L140 | <s>[INST] Here is the documentation: // GetDetail gets more detail for all TV shows in a list.
What code implements this? [/INST] func (seriesList *SeriesList) GetDetail() (err error) {
for seriesIndex := range seriesList.Series {
if err = seriesList.Series[seriesIndex].GetDetail(); err != nil {
return
}
}
r... |
crazedsanity/core | src/core/ToolBox.class.php | ToolBox.string_from_array | static public function string_from_array($array,$style=NULL,$separator=NULL, $cleanString=NULL, $removeEmptyVals=FALSE) {
$retval = NULL;
//precheck... if it's not an array, kill it.
if(!is_array($array)) {
return(NULL);
}
//make sure $style is valid.
$style = strtolower($style);
if(is_array($... | php | static public function string_from_array($array,$style=NULL,$separator=NULL, $cleanString=NULL, $removeEmptyVals=FALSE) {
$retval = NULL;
//precheck... if it's not an array, kill it.
if(!is_array($array)) {
return(NULL);
}
//make sure $style is valid.
$style = strtolower($style);
if(is_array($... | [
"static",
"public",
"function",
"string_from_array",
"(",
"$",
"array",
",",
"$",
"style",
"=",
"NULL",
",",
"$",
"separator",
"=",
"NULL",
",",
"$",
"cleanString",
"=",
"NULL",
",",
"$",
"removeEmptyVals",
"=",
"FALSE",
")",
"{",
"$",
"retval",
"=",
"... | Basically, just a wrapper for create_list(), which returns a list or
an array of lists, depending upon what was requested.
@param $array <array> list for the array...
@param $style <str,optional> what "style" it should be returned
as (select, update, etc).
@param $separator <str,optional> what separattes key from va... | [
"Basically",
"just",
"a",
"wrapper",
"for",
"create_list",
"()",
"which",
"returns",
"a",
"list",
"or",
"an",
"array",
"of",
"lists",
"depending",
"upon",
"what",
"was",
"requested",
"."
] | train | https://github.com/crazedsanity/core/blob/f3053467edc6d105ebdaca146325b79329aa1d63/src/core/ToolBox.class.php#L92-L302 | <s>[INST] Here is the documentation: Basically, just a wrapper for create_list(), which returns a list or
an array of lists, depending upon what was requested.
@param $array <array> list for the array...
@param $style <str,optional> what "style" it should be returned
as (select, update, etc).
@param $separator <str,... |
wiredrive/wtframework | wtframework/wtf/assets.py | AssetManager.get_asset_path | def get_asset_path(self, filename):
"""
Get the full system path of a given asset if it exists. Otherwise it throws
an error.
Args:
filename (str) - File name of a file in /assets folder to fetch the path for.
Returns:
str - path to the target file.
... | python | def get_asset_path(self, filename):
"""
Get the full system path of a given asset if it exists. Otherwise it throws
an error.
Args:
filename (str) - File name of a file in /assets folder to fetch the path for.
Returns:
str - path to the target file.
... | [
"def",
"get_asset_path",
"(",
"self",
",",
"filename",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_asset_path",
",",
"filename",
")",
")",
":",
"return",
"os",
".",
"path",
".",
"join",... | Get the full system path of a given asset if it exists. Otherwise it throws
an error.
Args:
filename (str) - File name of a file in /assets folder to fetch the path for.
Returns:
str - path to the target file.
Raises:
AssetNotFoundError - if asset... | [
"Get",
"the",
"full",
"system",
"path",
"of",
"a",
"given",
"asset",
"if",
"it",
"exists",
".",
"Otherwise",
"it",
"throws",
"an",
"error",
"."
] | train | https://github.com/wiredrive/wtframework/blob/ef7f86c4d4cf7fb17745fd627b3cc4a41f4c0216/wtframework/wtf/assets.py#L47-L70 | <s>[INST] Here is the documentation: Get the full system path of a given asset if it exists. Otherwise it throws
an error.
Args:
filename (str) - File name of a file in /assets folder to fetch the path for.
Returns:
str - path to the target file.
Raises:
... |
sbunce/bson | decode.go | readInt64 | func readInt64(rd io.Reader) (int64, error) {
var i int64
if err := binary.Read(rd, binary.LittleEndian, &i); err != nil {
return 0, err
}
return i, nil
} | go | func readInt64(rd io.Reader) (int64, error) {
var i int64
if err := binary.Read(rd, binary.LittleEndian, &i); err != nil {
return 0, err
}
return i, nil
} | [
"func",
"readInt64",
"(",
"rd",
"io",
".",
"Reader",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"i",
"int64",
"\n",
"if",
"err",
":=",
"binary",
".",
"Read",
"(",
"rd",
",",
"binary",
".",
"LittleEndian",
",",
"&",
"i",
")",
";",
"err",
... | // readInt64 reads one int64. This is not a BSON element. | [
"readInt64",
"reads",
"one",
"int64",
".",
"This",
"is",
"not",
"a",
"BSON",
"element",
"."
] | train | https://github.com/sbunce/bson/blob/2aa5ebe749b24e053f742541fe8242e80f40c4a0/decode.go#L776-L782 | <s>[INST] Here is the documentation: // readInt64 reads one int64. This is not a BSON element.
What code implements this? [/INST] func readInt64(rd io.Reader) (int64, error) {
var i int64
if err := binary.Read(rd, binary.LittleEndian, &i); err != nil {
return 0, err
}
return i, nil
} </s> |
greggman/twgl.js | src/primitives.js | createCubeVertices | function createCubeVertices(size) {
size = size || 1;
const k = size / 2;
const cornerVertices = [
[-k, -k, -k],
[+k, -k, -k],
[-k, +k, -k],
[+k, +k, -k],
[-k, -k, +k],
[+k, -k, +k],
[-k, +k, +k],
[+k, +k, +k],
];
const faceNormals = [
[+1, +0, +0],
[-1, +0, +0],
... | javascript | function createCubeVertices(size) {
size = size || 1;
const k = size / 2;
const cornerVertices = [
[-k, -k, -k],
[+k, -k, -k],
[-k, +k, -k],
[+k, +k, -k],
[-k, -k, +k],
[+k, -k, +k],
[-k, +k, +k],
[+k, +k, +k],
];
const faceNormals = [
[+1, +0, +0],
[-1, +0, +0],
... | [
"function",
"createCubeVertices",
"(",
"size",
")",
"{",
"size",
"=",
"size",
"||",
"1",
";",
"const",
"k",
"=",
"size",
"/",
"2",
";",
"const",
"cornerVertices",
"=",
"[",
"[",
"-",
"k",
",",
"-",
"k",
",",
"-",
"k",
"]",
",",
"[",
"+",
"k",
... | Creates the buffers and indices for a cube.
The cube is created around the origin. (-size / 2, size / 2).
@param {WebGLRenderingContext} gl The WebGLRenderingContext.
@param {number} [size] width, height and depth of the cube.
@return {Object.<string, WebGLBuffer>} The created buffers.
@memberOf module:twgl/primitive... | [
"Creates",
"the",
"buffers",
"and",
"indices",
"for",
"a",
"cube",
"."
] | train | https://github.com/greggman/twgl.js/blob/ae88dfe4d7a7d44a5b739fcbe50bccccd0e1a1fd/src/primitives.js#L689-L752 | <s>[INST] Here is the documentation: Creates the buffers and indices for a cube.
The cube is created around the origin. (-size / 2, size / 2).
@param {WebGLRenderingContext} gl The WebGLRenderingContext.
@param {number} [size] width, height and depth of the cube.
@return {Object.<string, WebGLBuffer>} The created buf... |
glycerine/go-unsnap-stream | snap.go | Write | func (sf *SnappyFile) Write(p []byte) (n int, err error) {
if sf.SnappyEncodeDecodeOff {
return sf.Writer.Write(p)
}
if !sf.Writing {
panic("Writing on a read-only SnappyFile")
}
// encoding in snappy can apparently go beyond the original size, beware.
// so our buffers must be sized 2*max snappy chunk => ... | go | func (sf *SnappyFile) Write(p []byte) (n int, err error) {
if sf.SnappyEncodeDecodeOff {
return sf.Writer.Write(p)
}
if !sf.Writing {
panic("Writing on a read-only SnappyFile")
}
// encoding in snappy can apparently go beyond the original size, beware.
// so our buffers must be sized 2*max snappy chunk => ... | [
"func",
"(",
"sf",
"*",
"SnappyFile",
")",
"Write",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"if",
"sf",
".",
"SnappyEncodeDecodeOff",
"{",
"return",
"sf",
".",
"Writer",
".",
"Write",
"(",
"p",
")",
"\n",
... | // add Write() method for SnappyFile (see unsnap.go)
// reference for snappy framing/streaming format:
// http://code.google.com/p/snappy/source/browse/trunk/framing_format.txt
// ?spec=svn68&r=71
//
// Write writes len(p) bytes from p to the underlying data stream.
// It returns the number of bytes... | [
"add",
"Write",
"()",
"method",
"for",
"SnappyFile",
"(",
"see",
"unsnap",
".",
"go",
")",
"reference",
"for",
"snappy",
"framing",
"/",
"streaming",
"format",
":",
"http",
":",
"//",
"code",
".",
"google",
".",
"com",
"/",
"p",
"/",
"snappy",
"/",
"... | train | https://github.com/glycerine/go-unsnap-stream/blob/f9677308dec2b35e76737f9713df328ad11b1fea/snap.go#L24-L93 | <s>[INST] Here is the documentation: // add Write() method for SnappyFile (see unsnap.go)
// reference for snappy framing/streaming format:
// http://code.google.com/p/snappy/source/browse/trunk/framing_format.txt
// ?spec=svn68&r=71
//
// Write writes len(p) bytes from p to the underlying data stre... |
AtteqCom/zsl | src/zsl/resource/model_resource.py | ModelResource.read | def read(self, params=None, args=None, data=None):
# type: (str, dict, dict) -> Union[List[AppModel], AppModel]
"""
GET /resource/model_cls/[params:id]?[args:{limit,offset,page,per_page,filter_by,order_by,related,fields}]
Get resource/s
:param params
:type params list
... | python | def read(self, params=None, args=None, data=None):
# type: (str, dict, dict) -> Union[List[AppModel], AppModel]
"""
GET /resource/model_cls/[params:id]?[args:{limit,offset,page,per_page,filter_by,order_by,related,fields}]
Get resource/s
:param params
:type params list
... | [
"def",
"read",
"(",
"self",
",",
"params",
"=",
"None",
",",
"args",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"# type: (str, dict, dict) -> Union[List[AppModel], AppModel]",
"if",
"params",
"is",
"None",
":",
"params",
"=",
"[",
"]",
"if",
"args",
... | GET /resource/model_cls/[params:id]?[args:{limit,offset,page,per_page,filter_by,order_by,related,fields}]
Get resource/s
:param params
:type params list
:param args
:type args dict
:param data
:type data: dict | [
"GET",
"/",
"resource",
"/",
"model_cls",
"/",
"[",
"params",
":",
"id",
"]",
"?",
"[",
"args",
":",
"{",
"limit",
"offset",
"page",
"per_page",
"filter_by",
"order_by",
"related",
"fields",
"}",
"]"
] | train | https://github.com/AtteqCom/zsl/blob/ab51a96da1780ff642912396d4b85bdcb72560c1/src/zsl/resource/model_resource.py#L215-L250 | <s>[INST] Here is the documentation: GET /resource/model_cls/[params:id]?[args:{limit,offset,page,per_page,filter_by,order_by,related,fields}]
Get resource/s
:param params
:type params list
:param args
:type args dict
:param data
:type data: dict
What code imple... |
openpermissions/koi | koi/utils.py | add_path_part | def add_path_part(url, regex=PATH_PART):
"""
replace the variables in a url template with regex named groups
:param url: string of a url template
:param regex: regex of the named group
:returns: regex
"""
formatter = string.Formatter()
url_var_template = "(?P<{var_name}>{regex})"
fo... | python | def add_path_part(url, regex=PATH_PART):
"""
replace the variables in a url template with regex named groups
:param url: string of a url template
:param regex: regex of the named group
:returns: regex
"""
formatter = string.Formatter()
url_var_template = "(?P<{var_name}>{regex})"
fo... | [
"def",
"add_path_part",
"(",
"url",
",",
"regex",
"=",
"PATH_PART",
")",
":",
"formatter",
"=",
"string",
".",
"Formatter",
"(",
")",
"url_var_template",
"=",
"\"(?P<{var_name}>{regex})\"",
"for",
"part",
"in",
"formatter",
".",
"parse",
"(",
"url",
")",
":"... | replace the variables in a url template with regex named groups
:param url: string of a url template
:param regex: regex of the named group
:returns: regex | [
"replace",
"the",
"variables",
"in",
"a",
"url",
"template",
"with",
"regex",
"named",
"groups",
":",
"param",
"url",
":",
"string",
"of",
"a",
"url",
"template",
":",
"param",
"regex",
":",
"regex",
"of",
"the",
"named",
"group",
":",
"returns",
":",
... | train | https://github.com/openpermissions/koi/blob/d721f8e1dfa8f07ad265d9dec32e8aaf80a9f281/koi/utils.py#L85-L100 | <s>[INST] Here is the documentation: replace the variables in a url template with regex named groups
:param url: string of a url template
:param regex: regex of the named group
:returns: regex
What code implements this? [/INST] def add_path_part(url, regex=PATH_PART):
"""
replace the variables in a ... |
aws/aws-sdk-go | service/swf/api.go | SetStatus | func (s *ActivityTypeInfo) SetStatus(v string) *ActivityTypeInfo {
s.Status = &v
return s
} | go | func (s *ActivityTypeInfo) SetStatus(v string) *ActivityTypeInfo {
s.Status = &v
return s
} | [
"func",
"(",
"s",
"*",
"ActivityTypeInfo",
")",
"SetStatus",
"(",
"v",
"string",
")",
"*",
"ActivityTypeInfo",
"{",
"s",
".",
"Status",
"=",
"&",
"v",
"\n",
"return",
"s",
"\n",
"}"
] | // SetStatus sets the Status field's value. | [
"SetStatus",
"sets",
"the",
"Status",
"field",
"s",
"value",
"."
] | train | https://github.com/aws/aws-sdk-go/blob/6c4060605190fc6f00d63cd4e5572faa9f07345d/service/swf/api.go#L4594-L4597 | <s>[INST] Here is the documentation: // SetStatus sets the Status field's value.
What code implements this? [/INST] func (s *ActivityTypeInfo) SetStatus(v string) *ActivityTypeInfo {
s.Status = &v
return s
} </s> |
lcobucci/content-negotiation-middleware | src/Formatter/StringCast.php | StringCast.format | public function format($content, array $attributes = []): string
{
if (is_object($content) && ! method_exists($content, '__toString')) {
throw new ContentCouldNotBeFormatted('Given data could not be cast to string');
}
return (string) $content;
} | php | public function format($content, array $attributes = []): string
{
if (is_object($content) && ! method_exists($content, '__toString')) {
throw new ContentCouldNotBeFormatted('Given data could not be cast to string');
}
return (string) $content;
} | [
"public",
"function",
"format",
"(",
"$",
"content",
",",
"array",
"$",
"attributes",
"=",
"[",
"]",
")",
":",
"string",
"{",
"if",
"(",
"is_object",
"(",
"$",
"content",
")",
"&&",
"!",
"method_exists",
"(",
"$",
"content",
",",
"'__toString'",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/lcobucci/content-negotiation-middleware/blob/fdbe268786af4c59bbf82de92eab87a69855715b/src/Formatter/StringCast.php#L16-L23 | <s>[INST] Here is the documentation: {@inheritdoc}
What code implements this? [/INST] public function format($content, array $attributes = []): string
{
if (is_object($content) && ! method_exists($content, '__toString')) {
throw new ContentCouldNotBeFormatted('Given data could not be cast to str... |
markstory/asset_compress | src/View/Helper/AssetCompressHelper.php | AssetCompressHelper.url | public function url($file = null, $full = false)
{
$collection = $this->collection();
if (!$collection->contains($file)) {
throw new RuntimeException('Cannot get URL for build file that does not exist.');
}
$options = $full;
if (!is_array($full)) {
$o... | php | public function url($file = null, $full = false)
{
$collection = $this->collection();
if (!$collection->contains($file)) {
throw new RuntimeException('Cannot get URL for build file that does not exist.');
}
$options = $full;
if (!is_array($full)) {
$o... | [
"public",
"function",
"url",
"(",
"$",
"file",
"=",
"null",
",",
"$",
"full",
"=",
"false",
")",
"{",
"$",
"collection",
"=",
"$",
"this",
"->",
"collection",
"(",
")",
";",
"if",
"(",
"!",
"$",
"collection",
"->",
"contains",
"(",
"$",
"file",
"... | Get the URL for a given asset name.
Takes an build filename, and returns the URL
to that build file.
@param string $file The build file that you want a URL for.
@param bool|array $full Whether or not the URL should have the full base path.
@return string The generated URL.
@throws RuntimeException when the build file... | [
"Get",
"the",
"URL",
"for",
"a",
"given",
"asset",
"name",
"."
] | train | https://github.com/markstory/asset_compress/blob/81851833233ad05a283d36c5564d1cc13d297af6/src/View/Helper/AssetCompressHelper.php#L274-L323 | <s>[INST] Here is the documentation: Get the URL for a given asset name.
Takes an build filename, and returns the URL
to that build file.
@param string $file The build file that you want a URL for.
@param bool|array $full Whether or not the URL should have the full base path.
@return string The generated URL.
@throws... |
metadelta/metadelta | packages/solver/lib/simplifyExpression/collectAndCombineSearch/addLikeTerms.js | addPositiveOneCoefficient | function addPositiveOneCoefficient(node) {
const newNode = clone(node, false);
let change = false;
let changeGroup = 1;
newNode.args.forEach((child, i) => {
const polyTerm = new Node.PolynomialTerm(child);
if (polyTerm.getCoeffValue() === 1) {
newNode.args[i] = Node.Creator.polynomialTerm(
... | javascript | function addPositiveOneCoefficient(node) {
const newNode = clone(node, false);
let change = false;
let changeGroup = 1;
newNode.args.forEach((child, i) => {
const polyTerm = new Node.PolynomialTerm(child);
if (polyTerm.getCoeffValue() === 1) {
newNode.args[i] = Node.Creator.polynomialTerm(
... | [
"function",
"addPositiveOneCoefficient",
"(",
"node",
")",
"{",
"const",
"newNode",
"=",
"clone",
"(",
"node",
",",
"false",
")",
";",
"let",
"change",
"=",
"false",
";",
"let",
"changeGroup",
"=",
"1",
";",
"newNode",
".",
"args",
".",
"forEach",
"(",
... | Given a sum of like polynomial terms, changes any term with no coefficient into a term with an explicit coefficient of 1. This is for pedagogy, and makes the adding coefficients step clearer. e.g. 2x + x -> 2x + 1x Returns a Node.Status object. | [
"Given",
"a",
"sum",
"of",
"like",
"polynomial",
"terms",
"changes",
"any",
"term",
"with",
"no",
"coefficient",
"into",
"a",
"term",
"with",
"an",
"explicit",
"coefficient",
"of",
"1",
".",
"This",
"is",
"for",
"pedagogy",
"and",
"makes",
"the",
"adding",... | train | https://github.com/metadelta/metadelta/blob/ce0de09f5ab9b82da62f09f7807320a6989b9070/packages/solver/lib/simplifyExpression/collectAndCombineSearch/addLikeTerms.js#L77-L105 | <s>[INST] Here is the documentation: Given a sum of like polynomial terms, changes any term with no coefficient into a term with an explicit coefficient of 1. This is for pedagogy, and makes the adding coefficients step clearer. e.g. 2x + x -> 2x + 1x Returns a Node.Status object.
What code implements this? [/INST] fun... |
lanthaler/JsonLD | Processor.php | Processor.objectToJsonLd | private static function objectToJsonLd($object, $useNativeTypes = true)
{
if ($object instanceof IRI) {
$result = new JsonObject();
$result->{'@id'} = (string) $object;
return $result;
} elseif ($object instanceof Value) {
return $object->toJsonLd($us... | php | private static function objectToJsonLd($object, $useNativeTypes = true)
{
if ($object instanceof IRI) {
$result = new JsonObject();
$result->{'@id'} = (string) $object;
return $result;
} elseif ($object instanceof Value) {
return $object->toJsonLd($us... | [
"private",
"static",
"function",
"objectToJsonLd",
"(",
"$",
"object",
",",
"$",
"useNativeTypes",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"object",
"instanceof",
"IRI",
")",
"{",
"$",
"result",
"=",
"new",
"JsonObject",
"(",
")",
";",
"$",
"result",
"-... | Converts an object to a JSON-LD representation
Only {@link IRI IRIs}, {@link LanguageTaggedString language-tagged strings},
and {@link TypedValue typed values} are converted by this method. All
other objects are returned as-is.
@param JsonObject $object The object to convert.
@param boolean $useNativeTyp... | [
"Converts",
"an",
"object",
"to",
"a",
"JSON",
"-",
"LD",
"representation"
] | train | https://github.com/lanthaler/JsonLD/blob/b5f82820c255cb64067b1c7adbb819cad4afa70a/Processor.php#L2944-L2956 | <s>[INST] Here is the documentation: Converts an object to a JSON-LD representation
Only {@link IRI IRIs}, {@link LanguageTaggedString language-tagged strings},
and {@link TypedValue typed values} are converted by this method. All
other objects are returned as-is.
@param JsonObject $object The object to conv... |
zeaphoo/reston | reston/core/zipfile.py | ZipFile.close | def close(self):
"""Close the file, and for mode "w" and "a" write the ending
records."""
if self.fp is None:
return
if self.mode in ("w", "a") and self._didModify: # write ending records
count = 0
pos1 = self.fp.tell()
for zinfo in self.f... | python | def close(self):
"""Close the file, and for mode "w" and "a" write the ending
records."""
if self.fp is None:
return
if self.mode in ("w", "a") and self._didModify: # write ending records
count = 0
pos1 = self.fp.tell()
for zinfo in self.f... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"fp",
"is",
"None",
":",
"return",
"if",
"self",
".",
"mode",
"in",
"(",
"\"w\"",
",",
"\"a\"",
")",
"and",
"self",
".",
"_didModify",
":",
"# write ending records",
"count",
"=",
"0",
"pos1",... | Close the file, and for mode "w" and "a" write the ending
records. | [
"Close",
"the",
"file",
"and",
"for",
"mode",
"w",
"and",
"a",
"write",
"the",
"ending",
"records",
"."
] | train | https://github.com/zeaphoo/reston/blob/96502487b2259572df55237c9526f92627465088/reston/core/zipfile.py#L1153-L1261 | <s>[INST] Here is the documentation: Close the file, and for mode "w" and "a" write the ending
records.
What code implements this? [/INST] def close(self):
"""Close the file, and for mode "w" and "a" write the ending
records."""
if self.fp is None:
return
if self.mod... |
google/dotty | efilter/parsers/common/tokenizer.py | LazyTokenizer.next_token | def next_token(self):
"""Returns the next logical token, advancing the tokenizer."""
if self.lookahead:
self.current_token = self.lookahead.popleft()
return self.current_token
self.current_token = self._parse_next_token()
return self.current_token | python | def next_token(self):
"""Returns the next logical token, advancing the tokenizer."""
if self.lookahead:
self.current_token = self.lookahead.popleft()
return self.current_token
self.current_token = self._parse_next_token()
return self.current_token | [
"def",
"next_token",
"(",
"self",
")",
":",
"if",
"self",
".",
"lookahead",
":",
"self",
".",
"current_token",
"=",
"self",
".",
"lookahead",
".",
"popleft",
"(",
")",
"return",
"self",
".",
"current_token",
"self",
".",
"current_token",
"=",
"self",
"."... | Returns the next logical token, advancing the tokenizer. | [
"Returns",
"the",
"next",
"logical",
"token",
"advancing",
"the",
"tokenizer",
"."
] | train | https://github.com/google/dotty/blob/b145131499be0c4b755fc2e2ac19be11a50bce6a/efilter/parsers/common/tokenizer.py#L242-L249 | <s>[INST] Here is the documentation: Returns the next logical token, advancing the tokenizer.
What code implements this? [/INST] def next_token(self):
"""Returns the next logical token, advancing the tokenizer."""
if self.lookahead:
self.current_token = self.lookahead.popleft()
r... |
bearded-web/bearded | pkg/manager/manager.go | New | func New(db *mgo.Database, cfg ...ManagerConfig) *Manager {
m := &Manager{
db: db,
managers: []ManagerInterface{},
}
if len(cfg) > 0 {
m.Cfg = cfg[0]
}
// initialize different managers
m.Users = &UserManager{manager: m, col: db.C("users")}
m.Plugins = &PluginManager{manager: m, col: db.C("plugins")}... | go | func New(db *mgo.Database, cfg ...ManagerConfig) *Manager {
m := &Manager{
db: db,
managers: []ManagerInterface{},
}
if len(cfg) > 0 {
m.Cfg = cfg[0]
}
// initialize different managers
m.Users = &UserManager{manager: m, col: db.C("users")}
m.Plugins = &PluginManager{manager: m, col: db.C("plugins")}... | [
"func",
"New",
"(",
"db",
"*",
"mgo",
".",
"Database",
",",
"cfg",
"...",
"ManagerConfig",
")",
"*",
"Manager",
"{",
"m",
":=",
"&",
"Manager",
"{",
"db",
":",
"db",
",",
"managers",
":",
"[",
"]",
"ManagerInterface",
"{",
"}",
",",
"}",
"\n",
"i... | // Manager contains all available managers for different models
// and hidden all db related operations | [
"Manager",
"contains",
"all",
"available",
"managers",
"for",
"different",
"models",
"and",
"hidden",
"all",
"db",
"related",
"operations"
] | train | https://github.com/bearded-web/bearded/blob/c937b9e05d299400e95143a433836214a6ffa649/pkg/manager/manager.go#L52-L101 | <s>[INST] Here is the documentation: // Manager contains all available managers for different models
// and hidden all db related operations
What code implements this? [/INST] func New(db *mgo.Database, cfg ...ManagerConfig) *Manager {
m := &Manager{
db: db,
managers: []ManagerInterface{},
}
if len(cfg) > ... |
mssola/user_agent | user_agent.go | Parse | func (p *UserAgent) Parse(ua string) {
var sections []section
p.initialize()
p.ua = ua
for index, limit := 0, len(ua); index < limit; {
s := parseSection(ua, &index)
if !p.mobile && s.name == "Mobile" {
p.mobile = true
}
sections = append(sections, s)
}
if len(sections) > 0 {
if sections[0].name ==... | go | func (p *UserAgent) Parse(ua string) {
var sections []section
p.initialize()
p.ua = ua
for index, limit := 0, len(ua); index < limit; {
s := parseSection(ua, &index)
if !p.mobile && s.name == "Mobile" {
p.mobile = true
}
sections = append(sections, s)
}
if len(sections) > 0 {
if sections[0].name ==... | [
"func",
"(",
"p",
"*",
"UserAgent",
")",
"Parse",
"(",
"ua",
"string",
")",
"{",
"var",
"sections",
"[",
"]",
"section",
"\n\n",
"p",
".",
"initialize",
"(",
")",
"\n",
"p",
".",
"ua",
"=",
"ua",
"\n",
"for",
"index",
",",
"limit",
":=",
"0",
"... | // Parse the given User-Agent string. After calling this function, the
// receiver will be setted up with all the information that we've extracted. | [
"Parse",
"the",
"given",
"User",
"-",
"Agent",
"string",
".",
"After",
"calling",
"this",
"function",
"the",
"receiver",
"will",
"be",
"setted",
"up",
"with",
"all",
"the",
"information",
"that",
"we",
"ve",
"extracted",
"."
] | train | https://github.com/mssola/user_agent/blob/74451004a1beb37221bccd8a3931c6acf4a2e80e/user_agent.go#L140-L165 | <s>[INST] Here is the documentation: // Parse the given User-Agent string. After calling this function, the
// receiver will be setted up with all the information that we've extracted.
What code implements this? [/INST] func (p *UserAgent) Parse(ua string) {
var sections []section
p.initialize()
p.ua = ua
for inde... |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslpolicy_csvserver_binding.java | sslpolicy_csvserver_binding.get | public static sslpolicy_csvserver_binding[] get(nitro_service service, String name) throws Exception{
sslpolicy_csvserver_binding obj = new sslpolicy_csvserver_binding();
obj.set_name(name);
sslpolicy_csvserver_binding response[] = (sslpolicy_csvserver_binding[]) obj.get_resources(service);
return response;
} | java | public static sslpolicy_csvserver_binding[] get(nitro_service service, String name) throws Exception{
sslpolicy_csvserver_binding obj = new sslpolicy_csvserver_binding();
obj.set_name(name);
sslpolicy_csvserver_binding response[] = (sslpolicy_csvserver_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"sslpolicy_csvserver_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"sslpolicy_csvserver_binding",
"obj",
"=",
"new",
"sslpolicy_csvserver_binding",
"(",
")",
";",
"obj",
".",
... | Use this API to fetch sslpolicy_csvserver_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"sslpolicy_csvserver_binding",
"resources",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslpolicy_csvserver_binding.java#L162-L167 | <s>[INST] Here is the documentation: Use this API to fetch sslpolicy_csvserver_binding resources of given name .
What code implements this? [/INST] public static sslpolicy_csvserver_binding[] get(nitro_service service, String name) throws Exception{
sslpolicy_csvserver_binding obj = new sslpolicy_csvserver_binding();... |
vijayvarma392/surfinBH | surfinBH/surfinBH.py | SurFinBH._evaluate_fits | def _evaluate_fits(self, x, fit_key):
""" Evaluates a particular fit by passing fit_key to self.fits.
Assumes self._get_fit_params() has been overriden.
"""
fit = self.fits[fit_key]
fit_params = self._get_fit_params(np.copy(x), fit_key)
if type(fit) == list:
... | python | def _evaluate_fits(self, x, fit_key):
""" Evaluates a particular fit by passing fit_key to self.fits.
Assumes self._get_fit_params() has been overriden.
"""
fit = self.fits[fit_key]
fit_params = self._get_fit_params(np.copy(x), fit_key)
if type(fit) == list:
... | [
"def",
"_evaluate_fits",
"(",
"self",
",",
"x",
",",
"fit_key",
")",
":",
"fit",
"=",
"self",
".",
"fits",
"[",
"fit_key",
"]",
"fit_params",
"=",
"self",
".",
"_get_fit_params",
"(",
"np",
".",
"copy",
"(",
"x",
")",
",",
"fit_key",
")",
"if",
"ty... | Evaluates a particular fit by passing fit_key to self.fits.
Assumes self._get_fit_params() has been overriden. | [
"Evaluates",
"a",
"particular",
"fit",
"by",
"passing",
"fit_key",
"to",
"self",
".",
"fits",
".",
"Assumes",
"self",
".",
"_get_fit_params",
"()",
"has",
"been",
"overriden",
"."
] | train | https://github.com/vijayvarma392/surfinBH/blob/9f2d25d00f894ee2ce9ffbb02f4e4a41fa7989eb/surfinBH/surfinBH.py#L134-L146 | <s>[INST] Here is the documentation: Evaluates a particular fit by passing fit_key to self.fits.
Assumes self._get_fit_params() has been overriden.
What code implements this? [/INST] def _evaluate_fits(self, x, fit_key):
""" Evaluates a particular fit by passing fit_key to self.fits.
Ass... |
benhoff/vexbot | vexbot/adapters/shell/interfaces.py | _add_word | def _add_word(completer):
"""
Used to add words to the completors
"""
def inner(word: str):
completer.words.add(word)
return inner | python | def _add_word(completer):
"""
Used to add words to the completors
"""
def inner(word: str):
completer.words.add(word)
return inner | [
"def",
"_add_word",
"(",
"completer",
")",
":",
"def",
"inner",
"(",
"word",
":",
"str",
")",
":",
"completer",
".",
"words",
".",
"add",
"(",
"word",
")",
"return",
"inner"
] | Used to add words to the completors | [
"Used",
"to",
"add",
"words",
"to",
"the",
"completors"
] | train | https://github.com/benhoff/vexbot/blob/9b844eb20e84eea92a0e7db7d86a90094956c38f/vexbot/adapters/shell/interfaces.py#L8-L14 | <s>[INST] Here is the documentation: Used to add words to the completors
What code implements this? [/INST] def _add_word(completer):
"""
Used to add words to the completors
"""
def inner(word: str):
completer.words.add(word)
return inner </s> |
bbangert/lettuce_webdriver | lettuce_webdriver/webdriver.py | element_not_focused | def element_not_focused(step, id):
"""
Check if the element is not focused
"""
elem = world.browser.find_element_by_xpath(str('id("{id}")'.format(id=id)))
focused = world.browser.switch_to_active_element()
assert_false(step, elem == focused) | python | def element_not_focused(step, id):
"""
Check if the element is not focused
"""
elem = world.browser.find_element_by_xpath(str('id("{id}")'.format(id=id)))
focused = world.browser.switch_to_active_element()
assert_false(step, elem == focused) | [
"def",
"element_not_focused",
"(",
"step",
",",
"id",
")",
":",
"elem",
"=",
"world",
".",
"browser",
".",
"find_element_by_xpath",
"(",
"str",
"(",
"'id(\"{id}\")'",
".",
"format",
"(",
"id",
"=",
"id",
")",
")",
")",
"focused",
"=",
"world",
".",
"br... | Check if the element is not focused | [
"Check",
"if",
"the",
"element",
"is",
"not",
"focused"
] | train | https://github.com/bbangert/lettuce_webdriver/blob/d11f8531c43bb7150c316e0dc4ccd083617becf7/lettuce_webdriver/webdriver.py#L282-L290 | <s>[INST] Here is the documentation: Check if the element is not focused
What code implements this? [/INST] def element_not_focused(step, id):
"""
Check if the element is not focused
"""
elem = world.browser.find_element_by_xpath(str('id("{id}")'.format(id=id)))
focused = world.browser.switch_to_ac... |
LAS-IT/open_directory_utils | lib/open_directory_utils/commands_groups.rb | OpenDirectoryUtils.CommandsGroups.user_in_group? | def user_in_group?(attribs, dir_info)
temp = user_record_name_alternatives(attribs)
username = temp[:record_name]
# pp username
# pp attribs
attribs = group_record_name_alternatives(attribs)
# groupname = attribs[:record_name]
attribs[:value] = username
# pp ... | ruby | def user_in_group?(attribs, dir_info)
temp = user_record_name_alternatives(attribs)
username = temp[:record_name]
# pp username
# pp attribs
attribs = group_record_name_alternatives(attribs)
# groupname = attribs[:record_name]
attribs[:value] = username
# pp ... | [
"def",
"user_in_group?",
"(",
"attribs",
",",
"dir_info",
")",
"temp",
"=",
"user_record_name_alternatives",
"(",
"attribs",
")",
"username",
"=",
"temp",
"[",
":record_name",
"]",
"# pp username",
"# pp attribs",
"attribs",
"=",
"group_record_name_alternatives",
"(",... | dscl . -read /Groups/ladmins
TODO: switch to dseditgroup -o checkmember -m username groupname
dseditgroup -o checkmember -m btihen employee
yes btihen is a member of employee
dseditgroup -o checkmember -m btihen student
no btihen is NOT a member of student | [
"dscl",
".",
"-",
"read",
"/",
"Groups",
"/",
"ladmins",
"TODO",
":",
"switch",
"to",
"dseditgroup",
"-",
"o",
"checkmember",
"-",
"m",
"username",
"groupname",
"dseditgroup",
"-",
"o",
"checkmember",
"-",
"m",
"btihen",
"employee",
"yes",
"btihen",
"is",
... | train | https://github.com/LAS-IT/open_directory_utils/blob/dd29b04728fa261c755577af066c9f817642998a/lib/open_directory_utils/commands_groups.rb#L40-L59 | <s>[INST] Here is the documentation: dscl . -read /Groups/ladmins
TODO: switch to dseditgroup -o checkmember -m username groupname
dseditgroup -o checkmember -m btihen employee
yes btihen is a member of employee
dseditgroup -o checkmember -m btihen student
no btihen is NOT a member of student
What code impleme... |
hyperledger-archives/indy-ledger | ledger/compact_merkle_tree.py | CompactMerkleTree._push_subtree | def _push_subtree(self, leaves: List[bytes]):
"""Extend with a full subtree <= the current minimum subtree.
The leaves must form a full subtree, i.e. of size 2^k for some k. If
there is a minimum subtree (i.e. __mintree_height > 0), then the input
subtree must be smaller or of equal siz... | python | def _push_subtree(self, leaves: List[bytes]):
"""Extend with a full subtree <= the current minimum subtree.
The leaves must form a full subtree, i.e. of size 2^k for some k. If
there is a minimum subtree (i.e. __mintree_height > 0), then the input
subtree must be smaller or of equal siz... | [
"def",
"_push_subtree",
"(",
"self",
",",
"leaves",
":",
"List",
"[",
"bytes",
"]",
")",
":",
"size",
"=",
"len",
"(",
"leaves",
")",
"if",
"count_bits_set",
"(",
"size",
")",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"\"invalid subtree with size != 2^k:... | Extend with a full subtree <= the current minimum subtree.
The leaves must form a full subtree, i.e. of size 2^k for some k. If
there is a minimum subtree (i.e. __mintree_height > 0), then the input
subtree must be smaller or of equal size to the minimum subtree.
If the subtree is smal... | [
"Extend",
"with",
"a",
"full",
"subtree",
"<",
"=",
"the",
"current",
"minimum",
"subtree",
"."
] | train | https://github.com/hyperledger-archives/indy-ledger/blob/7210c3b288e07f940eddad09b1dfc6a56be846df/ledger/compact_merkle_tree.py#L91-L132 | <s>[INST] Here is the documentation: Extend with a full subtree <= the current minimum subtree.
The leaves must form a full subtree, i.e. of size 2^k for some k. If
there is a minimum subtree (i.e. __mintree_height > 0), then the input
subtree must be smaller or of equal size to the minimum sub... |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/Header.java | Header.getAuthors | public AuthorInfo getAuthors(int i) {
if (Header_Type.featOkTst && ((Header_Type)jcasType).casFeat_authors == null)
jcasType.jcas.throwFeatMissing("authors", "de.julielab.jules.types.Header");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Header_Type)jcasType).casFeatCode_authors),... | java | public AuthorInfo getAuthors(int i) {
if (Header_Type.featOkTst && ((Header_Type)jcasType).casFeat_authors == null)
jcasType.jcas.throwFeatMissing("authors", "de.julielab.jules.types.Header");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Header_Type)jcasType).casFeatCode_authors),... | [
"public",
"AuthorInfo",
"getAuthors",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"Header_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"Header_Type",
")",
"jcasType",
")",
".",
"casFeat_authors",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"... | indexed getter for authors - gets an indexed value - The authors of the document, O
@generated
@param i index in the array to get
@return value of the element at index i | [
"indexed",
"getter",
"for",
"authors",
"-",
"gets",
"an",
"indexed",
"value",
"-",
"The",
"authors",
"of",
"the",
"document",
"O"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/Header.java#L215-L219 | <s>[INST] Here is the documentation: indexed getter for authors - gets an indexed value - The authors of the document, O
@generated
@param i index in the array to get
@return value of the element at index i
What code implements this? [/INST] public AuthorInfo getAuthors(int i) {
if (Header_Type.featOkTst && ((Heade... |
cykl/infoqscraper | infoqscraper/convert.py | Converter.download_video | def download_video(self):
"""Downloads the video.
If self.client.cache_enabled is True, then the disk cache is used.
Returns:
The path where the video has been saved.
Raises:
DownloadError: If the video cannot be downloaded.
"""
rvideo_path = se... | python | def download_video(self):
"""Downloads the video.
If self.client.cache_enabled is True, then the disk cache is used.
Returns:
The path where the video has been saved.
Raises:
DownloadError: If the video cannot be downloaded.
"""
rvideo_path = se... | [
"def",
"download_video",
"(",
"self",
")",
":",
"rvideo_path",
"=",
"self",
".",
"presentation",
".",
"metadata",
"[",
"'video_path'",
"]",
"if",
"self",
".",
"presentation",
".",
"client",
".",
"cache",
":",
"video_path",
"=",
"self",
".",
"presentation",
... | Downloads the video.
If self.client.cache_enabled is True, then the disk cache is used.
Returns:
The path where the video has been saved.
Raises:
DownloadError: If the video cannot be downloaded. | [
"Downloads",
"the",
"video",
"."
] | train | https://github.com/cykl/infoqscraper/blob/4fc026b994f98a0a7fe8578e0c9a3a9664982b2e/infoqscraper/convert.py#L92-L113 | <s>[INST] Here is the documentation: Downloads the video.
If self.client.cache_enabled is True, then the disk cache is used.
Returns:
The path where the video has been saved.
Raises:
DownloadError: If the video cannot be downloaded.
What code implements this? [/INST] d... |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/LinkedList.java | LinkedList.linkFirst | private void linkFirst(E e) {
final Node<E> f = first;
final Node<E> newNode = new Node<>(null, e, f);
first = newNode;
if (f == null)
last = newNode;
else
f.prev = newNode;
size++;
modCount++;
} | java | private void linkFirst(E e) {
final Node<E> f = first;
final Node<E> newNode = new Node<>(null, e, f);
first = newNode;
if (f == null)
last = newNode;
else
f.prev = newNode;
size++;
modCount++;
} | [
"private",
"void",
"linkFirst",
"(",
"E",
"e",
")",
"{",
"final",
"Node",
"<",
"E",
">",
"f",
"=",
"first",
";",
"final",
"Node",
"<",
"E",
">",
"newNode",
"=",
"new",
"Node",
"<>",
"(",
"null",
",",
"e",
",",
"f",
")",
";",
"first",
"=",
"ne... | Links e as first element. | [
"Links",
"e",
"as",
"first",
"element",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/LinkedList.java#L127-L137 | <s>[INST] Here is the documentation: Links e as first element.
What code implements this? [/INST] private void linkFirst(E e) {
final Node<E> f = first;
final Node<E> newNode = new Node<>(null, e, f);
first = newNode;
if (f == null)
last = newNode;
else
f.... |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/client/gui/component/interaction/UITextField.java | UITextField.deleteSelectedText | public void deleteSelectedText()
{
if (!selectingText)
return;
int start = Math.min(selectionCursor.index, cursor.index);
int end = Math.max(selectionCursor.index, cursor.index);
String oldValue = this.text.toString();
String newValue = new StringBuilder(oldValue).delete(start, end).toString();
if (!... | java | public void deleteSelectedText()
{
if (!selectingText)
return;
int start = Math.min(selectionCursor.index, cursor.index);
int end = Math.max(selectionCursor.index, cursor.index);
String oldValue = this.text.toString();
String newValue = new StringBuilder(oldValue).delete(start, end).toString();
if (!... | [
"public",
"void",
"deleteSelectedText",
"(",
")",
"{",
"if",
"(",
"!",
"selectingText",
")",
"return",
";",
"int",
"start",
"=",
"Math",
".",
"min",
"(",
"selectionCursor",
".",
"index",
",",
"cursor",
".",
"index",
")",
";",
"int",
"end",
"=",
"Math",... | Deletes the text currently selected. | [
"Deletes",
"the",
"text",
"currently",
"selected",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/component/interaction/UITextField.java#L437-L455 | <s>[INST] Here is the documentation: Deletes the text currently selected.
What code implements this? [/INST] public void deleteSelectedText()
{
if (!selectingText)
return;
int start = Math.min(selectionCursor.index, cursor.index);
int end = Math.max(selectionCursor.index, cursor.index);
String oldValue = ... |
hyperledger/fabric-sdk-go | pkg/fab/channel/ledger.go | NewLedger | func NewLedger(chName string) (*Ledger, error) {
l := Ledger{
chName: chName,
}
return &l, nil
} | go | func NewLedger(chName string) (*Ledger, error) {
l := Ledger{
chName: chName,
}
return &l, nil
} | [
"func",
"NewLedger",
"(",
"chName",
"string",
")",
"(",
"*",
"Ledger",
",",
"error",
")",
"{",
"l",
":=",
"Ledger",
"{",
"chName",
":",
"chName",
",",
"}",
"\n",
"return",
"&",
"l",
",",
"nil",
"\n",
"}"
] | // NewLedger constructs a Ledger client for the current context and named channel. | [
"NewLedger",
"constructs",
"a",
"Ledger",
"client",
"for",
"the",
"current",
"context",
"and",
"named",
"channel",
"."
] | train | https://github.com/hyperledger/fabric-sdk-go/blob/48bb0d199e2cee03ad3af0a413bdfc064fc69bfe/pkg/fab/channel/ledger.go#L45-L50 | <s>[INST] Here is the documentation: // NewLedger constructs a Ledger client for the current context and named channel.
What code implements this? [/INST] func NewLedger(chName string) (*Ledger, error) {
l := Ledger{
chName: chName,
}
return &l, nil
} </s> |
bdurand/seamless_database_pool | lib/seamless_database_pool/controller_filter.rb | SeamlessDatabasePool.ControllerFilter.set_read_only_connection_for_block | def set_read_only_connection_for_block(action)
read_pool_method = nil
if session
read_pool_method = session[:next_request_db_connection]
session.delete(:next_request_db_connection) if session[:next_request_db_connection]
end
read_pool_method ||= seamless_database_pool_options[ac... | ruby | def set_read_only_connection_for_block(action)
read_pool_method = nil
if session
read_pool_method = session[:next_request_db_connection]
session.delete(:next_request_db_connection) if session[:next_request_db_connection]
end
read_pool_method ||= seamless_database_pool_options[ac... | [
"def",
"set_read_only_connection_for_block",
"(",
"action",
")",
"read_pool_method",
"=",
"nil",
"if",
"session",
"read_pool_method",
"=",
"session",
"[",
":next_request_db_connection",
"]",
"session",
".",
"delete",
"(",
":next_request_db_connection",
")",
"if",
"sessi... | Set the read only connection for a block. Used to set the connection for a controller action. | [
"Set",
"the",
"read",
"only",
"connection",
"for",
"a",
"block",
".",
"Used",
"to",
"set",
"the",
"connection",
"for",
"a",
"controller",
"action",
"."
] | train | https://github.com/bdurand/seamless_database_pool/blob/529c1d49b2c6029de7444830bce72917de79ebff/lib/seamless_database_pool/controller_filter.rb#L72-L87 | <s>[INST] Here is the documentation: Set the read only connection for a block. Used to set the connection for a controller action.
What code implements this? [/INST] def set_read_only_connection_for_block(action)
read_pool_method = nil
if session
read_pool_method = session[:next_request_db_connectio... |
google/seesaw | common/conn/rpc.go | Backends | func (c *engineRPC) Backends() (map[string]*seesaw.Backend, error) {
var bm seesaw.BackendMap
if err := c.client.Call("SeesawECU.Backends", c.ctx, &bm); err != nil {
return nil, err
}
return bm.Backends, nil
} | go | func (c *engineRPC) Backends() (map[string]*seesaw.Backend, error) {
var bm seesaw.BackendMap
if err := c.client.Call("SeesawECU.Backends", c.ctx, &bm); err != nil {
return nil, err
}
return bm.Backends, nil
} | [
"func",
"(",
"c",
"*",
"engineRPC",
")",
"Backends",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"*",
"seesaw",
".",
"Backend",
",",
"error",
")",
"{",
"var",
"bm",
"seesaw",
".",
"BackendMap",
"\n",
"if",
"err",
":=",
"c",
".",
"client",
".",
"Cal... | // Backends requests a list of all backends that are configured on the cluster. | [
"Backends",
"requests",
"a",
"list",
"of",
"all",
"backends",
"that",
"are",
"configured",
"on",
"the",
"cluster",
"."
] | train | https://github.com/google/seesaw/blob/34716af0775ecb1fad239a726390d63d6b0742dd/common/conn/rpc.go#L148-L154 | <s>[INST] Here is the documentation: // Backends requests a list of all backends that are configured on the cluster.
What code implements this? [/INST] func (c *engineRPC) Backends() (map[string]*seesaw.Backend, error) {
var bm seesaw.BackendMap
if err := c.client.Call("SeesawECU.Backends", c.ctx, &bm); err != nil {
... |
ezsystems/ezpublish-kernel | eZ/Publish/Core/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php | DoctrineDatabase.loadAutogeneratedEntry | public function loadAutogeneratedEntry($action, $parentId = null)
{
/** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
$query = $this->dbHandler->createSelectQuery();
$query->select(
'*'
)->from(
$this->dbHandler->quoteTable($this->table)
... | php | public function loadAutogeneratedEntry($action, $parentId = null)
{
/** @var $query \eZ\Publish\Core\Persistence\Database\SelectQuery */
$query = $this->dbHandler->createSelectQuery();
$query->select(
'*'
)->from(
$this->dbHandler->quoteTable($this->table)
... | [
"public",
"function",
"loadAutogeneratedEntry",
"(",
"$",
"action",
",",
"$",
"parentId",
"=",
"null",
")",
"{",
"/** @var $query \\eZ\\Publish\\Core\\Persistence\\Database\\SelectQuery */",
"$",
"query",
"=",
"$",
"this",
"->",
"dbHandler",
"->",
"createSelectQuery",
"... | Loads autogenerated entry id by given $action and optionally $parentId.
@param string $action
@param mixed|null $parentId
@return array | [
"Loads",
"autogenerated",
"entry",
"id",
"by",
"given",
"$action",
"and",
"optionally",
"$parentId",
"."
] | train | https://github.com/ezsystems/ezpublish-kernel/blob/ef2ae730a46e9718ebd80f1047c0f8b866209ce9/eZ/Publish/Core/Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php#L832-L870 | <s>[INST] Here is the documentation: Loads autogenerated entry id by given $action and optionally $parentId.
@param string $action
@param mixed|null $parentId
@return array
What code implements this? [/INST] public function loadAutogeneratedEntry($action, $parentId = null)
{
/** @var $query \eZ\Publish\Co... |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.listVnets | public List<VnetInfoInner> listVnets(String resourceGroupName, String name) {
return listVnetsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | java | public List<VnetInfoInner> listVnets(String resourceGroupName, String name) {
return listVnetsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | [
"public",
"List",
"<",
"VnetInfoInner",
">",
"listVnets",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"listVnetsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
... | Get all Virtual Networks associated with an App Service plan.
Get all Virtual Networks associated with an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@throws IllegalArgumentException thrown if parameters fail the validat... | [
"Get",
"all",
"Virtual",
"Networks",
"associated",
"with",
"an",
"App",
"Service",
"plan",
".",
"Get",
"all",
"Virtual",
"Networks",
"associated",
"with",
"an",
"App",
"Service",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L2984-L2986 | <s>[INST] Here is the documentation: Get all Virtual Networks associated with an App Service plan.
Get all Virtual Networks associated with an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@throws IllegalArgumentException ... |
neonbug/meexo-common | src/Helpers/CroppaHelpers.php | CroppaHelpers.url | public function url($url, $width = null, $height = null, $options = null) {
$config_ignore = Config::get('croppa.ignore');
return (($width == null && $height == null) || preg_match('#'.$config_ignore.'#', $url) ?
$this->rawUrl($url) :
parent::url($url, $width, $height, $options));
} | php | public function url($url, $width = null, $height = null, $options = null) {
$config_ignore = Config::get('croppa.ignore');
return (($width == null && $height == null) || preg_match('#'.$config_ignore.'#', $url) ?
$this->rawUrl($url) :
parent::url($url, $width, $height, $options));
} | [
"public",
"function",
"url",
"(",
"$",
"url",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"config_ignore",
"=",
"Config",
"::",
"get",
"(",
"'croppa.ignore'",
")",
";",
"return",
... | Pass through URL requrests to URL->generate().
@param string $url URL of an image that should be cropped
@param integer $width Target width
@param integer $height Target height
@param array $options Addtional Croppa options, passed as key/value pairs. Like array('resize')
@return string The new path to your thumbnail... | [
"Pass",
"through",
"URL",
"requrests",
"to",
"URL",
"-",
">",
"generate",
"()",
"."
] | train | https://github.com/neonbug/meexo-common/blob/8fe9a5d1b73311c65a7c5a0ce8a4e859d39351c6/src/Helpers/CroppaHelpers.php#L21-L27 | <s>[INST] Here is the documentation: Pass through URL requrests to URL->generate().
@param string $url URL of an image that should be cropped
@param integer $width Target width
@param integer $height Target height
@param array $options Addtional Croppa options, passed as key/value pairs. Like array('resize')
@return ... |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/RestUtils.java | RestUtils.createErrorResponse | private static Response createErrorResponse(Exception e, AlluxioConfiguration alluxioConf) {
AlluxioStatusException se = AlluxioStatusException.fromThrowable(e);
ErrorResponse response = new ErrorResponse(se.getStatus().getCode(), se.getMessage());
Response.ResponseBuilder rb = Response.serverError().entit... | java | private static Response createErrorResponse(Exception e, AlluxioConfiguration alluxioConf) {
AlluxioStatusException se = AlluxioStatusException.fromThrowable(e);
ErrorResponse response = new ErrorResponse(se.getStatus().getCode(), se.getMessage());
Response.ResponseBuilder rb = Response.serverError().entit... | [
"private",
"static",
"Response",
"createErrorResponse",
"(",
"Exception",
"e",
",",
"AlluxioConfiguration",
"alluxioConf",
")",
"{",
"AlluxioStatusException",
"se",
"=",
"AlluxioStatusException",
".",
"fromThrowable",
"(",
"e",
")",
";",
"ErrorResponse",
"response",
"... | Creates an error response using the given exception.
@param e the exception to be converted into {@link ErrorResponse} and encoded into json
@return the response | [
"Creates",
"an",
"error",
"response",
"using",
"the",
"given",
"exception",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/RestUtils.java#L174-L184 | <s>[INST] Here is the documentation: Creates an error response using the given exception.
@param e the exception to be converted into {@link ErrorResponse} and encoded into json
@return the response
What code implements this? [/INST] private static Response createErrorResponse(Exception e, AlluxioConfiguration alluxio... |
asticode/go-astilectron | astilectron.go | Start | func (a *Astilectron) Start() (err error) {
// Log
astilog.Debug("Starting...")
// Provision
if err = a.provision(); err != nil {
return errors.Wrap(err, "provisioning failed")
}
// Unfortunately communicating with Electron through stdin/stdout doesn't work on Windows so all communications
// will be done th... | go | func (a *Astilectron) Start() (err error) {
// Log
astilog.Debug("Starting...")
// Provision
if err = a.provision(); err != nil {
return errors.Wrap(err, "provisioning failed")
}
// Unfortunately communicating with Electron through stdin/stdout doesn't work on Windows so all communications
// will be done th... | [
"func",
"(",
"a",
"*",
"Astilectron",
")",
"Start",
"(",
")",
"(",
"err",
"error",
")",
"{",
"// Log",
"astilog",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"// Provision",
"if",
"err",
"=",
"a",
".",
"provision",
"(",
")",
";",
"err",
"!=",
"ni... | // Start starts Astilectron | [
"Start",
"starts",
"Astilectron"
] | train | https://github.com/asticode/go-astilectron/blob/5d5f1436743467b9a7cd9e9c90dc4ab47b96be90/astilectron.go#L155-L176 | <s>[INST] Here is the documentation: // Start starts Astilectron
What code implements this? [/INST] func (a *Astilectron) Start() (err error) {
// Log
astilog.Debug("Starting...")
// Provision
if err = a.provision(); err != nil {
return errors.Wrap(err, "provisioning failed")
}
// Unfortunately communicating ... |
lessthanoptimal/ddogleg | src/org/ddogleg/combinatorics/Permute.java | Permute.previous | public boolean previous()
{
if( indexes.length <= 1 || permutation <= 0 )
return false;
int N = indexes.length-2;
int k = N;
while( counters[k] <= k ) {
k--;
}
swap(counters[k], k);
counters[k]--;
swap(k, counters[k]);
int foo = k+1;
while( counters[k+1] == k+1 && k < indexes.length-2) {
... | java | public boolean previous()
{
if( indexes.length <= 1 || permutation <= 0 )
return false;
int N = indexes.length-2;
int k = N;
while( counters[k] <= k ) {
k--;
}
swap(counters[k], k);
counters[k]--;
swap(k, counters[k]);
int foo = k+1;
while( counters[k+1] == k+1 && k < indexes.length-2) {
... | [
"public",
"boolean",
"previous",
"(",
")",
"{",
"if",
"(",
"indexes",
".",
"length",
"<=",
"1",
"||",
"permutation",
"<=",
"0",
")",
"return",
"false",
";",
"int",
"N",
"=",
"indexes",
".",
"length",
"-",
"2",
";",
"int",
"k",
"=",
"N",
";",
"whi... | This will undo a permutation. | [
"This",
"will",
"undo",
"a",
"permutation",
"."
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/combinatorics/Permute.java#L141-L168 | <s>[INST] Here is the documentation: This will undo a permutation.
What code implements this? [/INST] public boolean previous()
{
if( indexes.length <= 1 || permutation <= 0 )
return false;
int N = indexes.length-2;
int k = N;
while( counters[k] <= k ) {
k--;
}
swap(counters[k], k);
counters[k]-... |
istresearch/scrapy-cluster | redis-monitor/redis_monitor.py | RedisMonitor._dump_crawl_stats | def _dump_crawl_stats(self):
'''
Dumps flattened crawling stats so the spiders do not have to
'''
extras = {}
spiders = {}
spider_set = set()
total_spider_count = 0
keys = self.redis_conn.keys('stats:crawler:*:*:*')
for key in keys:
#... | python | def _dump_crawl_stats(self):
'''
Dumps flattened crawling stats so the spiders do not have to
'''
extras = {}
spiders = {}
spider_set = set()
total_spider_count = 0
keys = self.redis_conn.keys('stats:crawler:*:*:*')
for key in keys:
#... | [
"def",
"_dump_crawl_stats",
"(",
"self",
")",
":",
"extras",
"=",
"{",
"}",
"spiders",
"=",
"{",
"}",
"spider_set",
"=",
"set",
"(",
")",
"total_spider_count",
"=",
"0",
"keys",
"=",
"self",
".",
"redis_conn",
".",
"keys",
"(",
"'stats:crawler:*:*:*'",
"... | Dumps flattened crawling stats so the spiders do not have to | [
"Dumps",
"flattened",
"crawling",
"stats",
"so",
"the",
"spiders",
"do",
"not",
"have",
"to"
] | train | https://github.com/istresearch/scrapy-cluster/blob/13aaed2349af5d792d6bcbfcadc5563158aeb599/redis-monitor/redis_monitor.py#L398-L451 | <s>[INST] Here is the documentation: Dumps flattened crawling stats so the spiders do not have to
What code implements this? [/INST] def _dump_crawl_stats(self):
'''
Dumps flattened crawling stats so the spiders do not have to
'''
extras = {}
spiders = {}
spider_set = se... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 4