id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
135,600 | qlik-oss/enigma-go | qix_generated.go | GetCardinal | func (obj *Field) GetCardinal(ctx context.Context) (int, error) {
result := &struct {
Return int `json:"qReturn"`
} {}
err := obj.rpc(ctx, "GetCardinal", result)
return result.Return, err
} | go | func (obj *Field) GetCardinal(ctx context.Context) (int, error) {
result := &struct {
Return int `json:"qReturn"`
} {}
err := obj.rpc(ctx, "GetCardinal", result)
return result.Return, err
} | [
"func",
"(",
"obj",
"*",
"Field",
")",
"GetCardinal",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"int",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"Return",
"int",
"`json:\"qReturn\"`",
"\n",
"}",
"{",
"}",
"\n",
"err",
":=",
... | // Retrieves the number of distinct values in a field. | [
"Retrieves",
"the",
"number",
"of",
"distinct",
"values",
"in",
"a",
"field",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L8009-L8015 |
135,601 | qlik-oss/enigma-go | qix_generated.go | GetNxProperties | func (obj *Field) GetNxProperties(ctx context.Context) (*NxFieldProperties, error) {
result := &struct {
Properties *NxFieldProperties `json:"qProperties"`
} {}
err := obj.rpc(ctx, "GetNxProperties", result)
return result.Properties, err
} | go | func (obj *Field) GetNxProperties(ctx context.Context) (*NxFieldProperties, error) {
result := &struct {
Properties *NxFieldProperties `json:"qProperties"`
} {}
err := obj.rpc(ctx, "GetNxProperties", result)
return result.Properties, err
} | [
"func",
"(",
"obj",
"*",
"Field",
")",
"GetNxProperties",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"NxFieldProperties",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"Properties",
"*",
"NxFieldProperties",
"`json:\"qProperties\"`",
... | // Gets the properties of a field.
//
// The property OneAndOnlyOne is set to true if one and only value has been selected in the field prior setting the property. | [
"Gets",
"the",
"properties",
"of",
"a",
"field",
".",
"The",
"property",
"OneAndOnlyOne",
"is",
"set",
"to",
"true",
"if",
"one",
"and",
"only",
"value",
"has",
"been",
"selected",
"in",
"the",
"field",
"prior",
"setting",
"the",
"property",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L8020-L8026 |
135,602 | qlik-oss/enigma-go | qix_generated.go | Apply | func (obj *GenericBookmark) Apply(ctx context.Context) (bool, error) {
result := &struct {
Success bool `json:"qSuccess"`
} {}
err := obj.rpc(ctx, "Apply", result)
return result.Success, err
} | go | func (obj *GenericBookmark) Apply(ctx context.Context) (bool, error) {
result := &struct {
Success bool `json:"qSuccess"`
} {}
err := obj.rpc(ctx, "Apply", result)
return result.Success, err
} | [
"func",
"(",
"obj",
"*",
"GenericBookmark",
")",
"Apply",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"bool",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"Success",
"bool",
"`json:\"qSuccess\"`",
"\n",
"}",
"{",
"}",
"\n",
"err",
... | // Applies a bookmark.
//
// The operation is successful if qSuccess is set to true. | [
"Applies",
"a",
"bookmark",
".",
"The",
"operation",
"is",
"successful",
"if",
"qSuccess",
"is",
"set",
"to",
"true",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L8258-L8264 |
135,603 | qlik-oss/enigma-go | qix_generated.go | GetLayout | func (obj *GenericDimension) GetLayout(ctx context.Context) (*GenericDimensionLayout, error) {
result := &struct {
Layout *GenericDimensionLayout `json:"qLayout"`
} {}
err := obj.rpc(ctx, "GetLayout", result)
return result.Layout, err
} | go | func (obj *GenericDimension) GetLayout(ctx context.Context) (*GenericDimensionLayout, error) {
result := &struct {
Layout *GenericDimensionLayout `json:"qLayout"`
} {}
err := obj.rpc(ctx, "GetLayout", result)
return result.Layout, err
} | [
"func",
"(",
"obj",
"*",
"GenericDimension",
")",
"GetLayout",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"GenericDimensionLayout",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"Layout",
"*",
"GenericDimensionLayout",
"`json:\"qLayout... | // Evaluates a dimension and displays its properties, including the dynamic properties. | [
"Evaluates",
"a",
"dimension",
"and",
"displays",
"its",
"properties",
"including",
"the",
"dynamic",
"properties",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L8551-L8557 |
135,604 | qlik-oss/enigma-go | qix_generated.go | GetProperties | func (obj *GenericDimension) GetProperties(ctx context.Context) (*GenericDimensionProperties, error) {
result := &struct {
Prop *GenericDimensionProperties `json:"qProp"`
} {}
err := obj.rpc(ctx, "GetProperties", result)
return result.Prop, err
} | go | func (obj *GenericDimension) GetProperties(ctx context.Context) (*GenericDimensionProperties, error) {
result := &struct {
Prop *GenericDimensionProperties `json:"qProp"`
} {}
err := obj.rpc(ctx, "GetProperties", result)
return result.Prop, err
} | [
"func",
"(",
"obj",
"*",
"GenericDimension",
")",
"GetProperties",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"GenericDimensionProperties",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"Prop",
"*",
"GenericDimensionProperties",
"`json... | // Shows the properties of an object.
// Returns the identifier and the definition of the dimension.
// If the member delta is set to true in the request object, only the delta is retrieved. | [
"Shows",
"the",
"properties",
"of",
"an",
"object",
".",
"Returns",
"the",
"identifier",
"and",
"the",
"definition",
"of",
"the",
"dimension",
".",
"If",
"the",
"member",
"delta",
"is",
"set",
"to",
"true",
"in",
"the",
"request",
"object",
"only",
"the",
... | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L8589-L8595 |
135,605 | qlik-oss/enigma-go | qix_generated.go | UnApprove | func (obj *GenericDimension) UnApprove(ctx context.Context) error {
err := obj.rpc(ctx, "UnApprove", nil)
return err
} | go | func (obj *GenericDimension) UnApprove(ctx context.Context) error {
err := obj.rpc(ctx, "UnApprove", nil)
return err
} | [
"func",
"(",
"obj",
"*",
"GenericDimension",
")",
"UnApprove",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"err",
":=",
"obj",
".",
"rpc",
"(",
"ctx",
",",
"\"",
"\"",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] | // Removes the generic dimension from the list of approved objects
// This operation is possible only in Qlik Sense Enterprise. | [
"Removes",
"the",
"generic",
"dimension",
"from",
"the",
"list",
"of",
"approved",
"objects",
"This",
"operation",
"is",
"possible",
"only",
"in",
"Qlik",
"Sense",
"Enterprise",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L8639-L8642 |
135,606 | qlik-oss/enigma-go | qix_generated.go | GetLayout | func (obj *GenericMeasure) GetLayout(ctx context.Context) (*GenericMeasureLayout, error) {
result := &struct {
Layout *GenericMeasureLayout `json:"qLayout"`
} {}
err := obj.rpc(ctx, "GetLayout", result)
return result.Layout, err
} | go | func (obj *GenericMeasure) GetLayout(ctx context.Context) (*GenericMeasureLayout, error) {
result := &struct {
Layout *GenericMeasureLayout `json:"qLayout"`
} {}
err := obj.rpc(ctx, "GetLayout", result)
return result.Layout, err
} | [
"func",
"(",
"obj",
"*",
"GenericMeasure",
")",
"GetLayout",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"GenericMeasureLayout",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"Layout",
"*",
"GenericMeasureLayout",
"`json:\"qLayout\"`",
... | // Evaluates a measure and displays its properties, including the dynamic properties. | [
"Evaluates",
"a",
"measure",
"and",
"displays",
"its",
"properties",
"including",
"the",
"dynamic",
"properties",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L8706-L8712 |
135,607 | qlik-oss/enigma-go | qix_generated.go | GetEffectiveProperties | func (obj *GenericObject) GetEffectiveProperties(ctx context.Context) (*GenericObjectProperties, error) {
result := &struct {
Prop *GenericObjectProperties `json:"qProp"`
} {}
err := obj.rpc(ctx, "GetEffectiveProperties", result)
return result.Prop, err
} | go | func (obj *GenericObject) GetEffectiveProperties(ctx context.Context) (*GenericObjectProperties, error) {
result := &struct {
Prop *GenericObjectProperties `json:"qProp"`
} {}
err := obj.rpc(ctx, "GetEffectiveProperties", result)
return result.Prop, err
} | [
"func",
"(",
"obj",
"*",
"GenericObject",
")",
"GetEffectiveProperties",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"GenericObjectProperties",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"Prop",
"*",
"GenericObjectProperties",
"`json... | // Returns the identifier, the type and the properties of the object.
// If the object contains some soft properties, the soft properties are returned.
// If the object is linked to another object, the properties of the linking object are returned.
// GetEffectiveProperties method
// Returns the identifier, the type an... | [
"Returns",
"the",
"identifier",
"the",
"type",
"and",
"the",
"properties",
"of",
"the",
"object",
".",
"If",
"the",
"object",
"contains",
"some",
"soft",
"properties",
"the",
"soft",
"properties",
"are",
"returned",
".",
"If",
"the",
"object",
"is",
"linked"... | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L9331-L9337 |
135,608 | qlik-oss/enigma-go | qix_generated.go | GetParent | func (obj *GenericObject) GetParent(ctx context.Context) (*GenericObject, error) {
result := &struct {
Return *ObjectInterface `json:"qReturn"`
} {}
err := obj.rpc(ctx, "GetParent", result)
if err != nil {
return nil, err
}
return &GenericObject{obj.session.getRemoteObject(result.Return)}, err
} | go | func (obj *GenericObject) GetParent(ctx context.Context) (*GenericObject, error) {
result := &struct {
Return *ObjectInterface `json:"qReturn"`
} {}
err := obj.rpc(ctx, "GetParent", result)
if err != nil {
return nil, err
}
return &GenericObject{obj.session.getRemoteObject(result.Return)}, err
} | [
"func",
"(",
"obj",
"*",
"GenericObject",
")",
"GetParent",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"GenericObject",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"Return",
"*",
"ObjectInterface",
"`json:\"qReturn\"`",
"\n",
"}"... | // Returns the type of the object and the corresponding handle to the parent object in the hiearchy. | [
"Returns",
"the",
"type",
"of",
"the",
"object",
"and",
"the",
"corresponding",
"handle",
"to",
"the",
"parent",
"object",
"in",
"the",
"hiearchy",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L10113-L10122 |
135,609 | qlik-oss/enigma-go | qix_generated.go | GetActiveDoc | func (obj *Global) GetActiveDoc(ctx context.Context) (*Doc, error) {
result := &struct {
Return *ObjectInterface `json:"qReturn"`
} {}
err := obj.rpc(ctx, "GetActiveDoc", result)
if err != nil {
return nil, err
}
return &Doc{obj.session.getRemoteObject(result.Return)}, err
} | go | func (obj *Global) GetActiveDoc(ctx context.Context) (*Doc, error) {
result := &struct {
Return *ObjectInterface `json:"qReturn"`
} {}
err := obj.rpc(ctx, "GetActiveDoc", result)
if err != nil {
return nil, err
}
return &Doc{obj.session.getRemoteObject(result.Return)}, err
} | [
"func",
"(",
"obj",
"*",
"Global",
")",
"GetActiveDoc",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"Doc",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"Return",
"*",
"ObjectInterface",
"`json:\"qReturn\"`",
"\n",
"}",
"{",
"}"... | // Returns the handle of the current app. | [
"Returns",
"the",
"handle",
"of",
"the",
"current",
"app",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L11419-L11428 |
135,610 | qlik-oss/enigma-go | qix_generated.go | GetAuthenticatedUser | func (obj *Global) GetAuthenticatedUser(ctx context.Context) (string, error) {
result := &struct {
Return string `json:"qReturn"`
} {}
err := obj.rpc(ctx, "GetAuthenticatedUser", result)
return result.Return, err
} | go | func (obj *Global) GetAuthenticatedUser(ctx context.Context) (string, error) {
result := &struct {
Return string `json:"qReturn"`
} {}
err := obj.rpc(ctx, "GetAuthenticatedUser", result)
return result.Return, err
} | [
"func",
"(",
"obj",
"*",
"Global",
")",
"GetAuthenticatedUser",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"string",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"Return",
"string",
"`json:\"qReturn\"`",
"\n",
"}",
"{",
"}",
"\n",
... | // Retrieves information about the authenticated user. | [
"Retrieves",
"information",
"about",
"the",
"authenticated",
"user",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L11469-L11475 |
135,611 | qlik-oss/enigma-go | qix_generated.go | GetDefaultAppFolder | func (obj *Global) GetDefaultAppFolder(ctx context.Context) (string, error) {
result := &struct {
Path string `json:"qPath"`
} {}
err := obj.rpc(ctx, "GetDefaultAppFolder", result)
return result.Path, err
} | go | func (obj *Global) GetDefaultAppFolder(ctx context.Context) (string, error) {
result := &struct {
Path string `json:"qPath"`
} {}
err := obj.rpc(ctx, "GetDefaultAppFolder", result)
return result.Path, err
} | [
"func",
"(",
"obj",
"*",
"Global",
")",
"GetDefaultAppFolder",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"string",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"Path",
"string",
"`json:\"qPath\"`",
"\n",
"}",
"{",
"}",
"\n",
"err"... | // Returns the folder where the apps are stored.
// This method applies only if running Qlik Sense Desktop. | [
"Returns",
"the",
"folder",
"where",
"the",
"apps",
"are",
"stored",
".",
"This",
"method",
"applies",
"only",
"if",
"running",
"Qlik",
"Sense",
"Desktop",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L11693-L11699 |
135,612 | qlik-oss/enigma-go | qix_generated.go | GetUniqueID | func (obj *Global) GetUniqueID(ctx context.Context) (string, error) {
result := &struct {
UniqueID string `json:"qUniqueID"`
} {}
err := obj.rpc(ctx, "GetUniqueID", result)
return result.UniqueID, err
} | go | func (obj *Global) GetUniqueID(ctx context.Context) (string, error) {
result := &struct {
UniqueID string `json:"qUniqueID"`
} {}
err := obj.rpc(ctx, "GetUniqueID", result)
return result.UniqueID, err
} | [
"func",
"(",
"obj",
"*",
"Global",
")",
"GetUniqueID",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"string",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"UniqueID",
"string",
"`json:\"qUniqueID\"`",
"\n",
"}",
"{",
"}",
"\n",
"err"... | // Returns the unique identifier of the endpoint for the current user in the current app.
// This unique identifier can be used for logging purposes. | [
"Returns",
"the",
"unique",
"identifier",
"of",
"the",
"endpoint",
"for",
"the",
"current",
"user",
"in",
"the",
"current",
"app",
".",
"This",
"unique",
"identifier",
"can",
"be",
"used",
"for",
"logging",
"purposes",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L12115-L12121 |
135,613 | qlik-oss/enigma-go | qix_generated.go | GetRawContent | func (obj *Variable) GetRawContent(ctx context.Context) (string, error) {
result := &struct {
Return string `json:"qReturn"`
} {}
err := obj.rpc(ctx, "GetRawContent", result)
return result.Return, err
} | go | func (obj *Variable) GetRawContent(ctx context.Context) (string, error) {
result := &struct {
Return string `json:"qReturn"`
} {}
err := obj.rpc(ctx, "GetRawContent", result)
return result.Return, err
} | [
"func",
"(",
"obj",
"*",
"Variable",
")",
"GetRawContent",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"string",
",",
"error",
")",
"{",
"result",
":=",
"&",
"struct",
"{",
"Return",
"string",
"`json:\"qReturn\"`",
"\n",
"}",
"{",
"}",
"\n",
"err"... | // Returns the raw value of a variable. | [
"Returns",
"the",
"raw",
"value",
"of",
"a",
"variable",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/qix_generated.go#L12401-L12407 |
135,614 | qlik-oss/enigma-go | websocket_traffic_log.go | Sent | func (t *fileTrafficLog) Sent(message []byte) {
t.mutex.Lock()
defer t.mutex.Unlock()
t.Messages = append(t.Messages, trafficLogRow{Sent: message})
} | go | func (t *fileTrafficLog) Sent(message []byte) {
t.mutex.Lock()
defer t.mutex.Unlock()
t.Messages = append(t.Messages, trafficLogRow{Sent: message})
} | [
"func",
"(",
"t",
"*",
"fileTrafficLog",
")",
"Sent",
"(",
"message",
"[",
"]",
"byte",
")",
"{",
"t",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"t",
".",
"Messages",
"=",
"append",
"(... | // Sent implements the TrafficLogger interface | [
"Sent",
"implements",
"the",
"TrafficLogger",
"interface"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/websocket_traffic_log.go#L28-L32 |
135,615 | qlik-oss/enigma-go | websocket_traffic_log.go | Closed | func (t *fileTrafficLog) Closed() {
bytes, _ := json.MarshalIndent(t.Messages, "", "\t")
ioutil.WriteFile(t.FileName, bytes, 0644)
} | go | func (t *fileTrafficLog) Closed() {
bytes, _ := json.MarshalIndent(t.Messages, "", "\t")
ioutil.WriteFile(t.FileName, bytes, 0644)
} | [
"func",
"(",
"t",
"*",
"fileTrafficLog",
")",
"Closed",
"(",
")",
"{",
"bytes",
",",
"_",
":=",
"json",
".",
"MarshalIndent",
"(",
"t",
".",
"Messages",
",",
"\"",
"\"",
",",
"\"",
"\\t",
"\"",
")",
"\n",
"ioutil",
".",
"WriteFile",
"(",
"t",
"."... | // Closed implements the TrafficLogger interface | [
"Closed",
"implements",
"the",
"TrafficLogger",
"interface"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/websocket_traffic_log.go#L42-L45 |
135,616 | qlik-oss/enigma-go | pending_call_registry.go | WithReservedRequestID | func (q *pendingCallRegistry) WithReservedRequestID(ctx context.Context) (context.Context, int) {
q.mutex.Lock()
defer q.mutex.Unlock()
q.callIDSeq++
id := q.callIDSeq
newContext := context.WithValue(ctx, reservedRequestIDKey{}, id)
return newContext, id
} | go | func (q *pendingCallRegistry) WithReservedRequestID(ctx context.Context) (context.Context, int) {
q.mutex.Lock()
defer q.mutex.Unlock()
q.callIDSeq++
id := q.callIDSeq
newContext := context.WithValue(ctx, reservedRequestIDKey{}, id)
return newContext, id
} | [
"func",
"(",
"q",
"*",
"pendingCallRegistry",
")",
"WithReservedRequestID",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"context",
".",
"Context",
",",
"int",
")",
"{",
"q",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"q",
".",
"mutex",
... | // Creates a new context that contains a reserved JSON RPC protocol level request id.
// It can be for instance be useful when the request id used for upcoming call needs to be known. | [
"Creates",
"a",
"new",
"context",
"that",
"contains",
"a",
"reserved",
"JSON",
"RPC",
"protocol",
"level",
"request",
"id",
".",
"It",
"can",
"be",
"for",
"instance",
"be",
"useful",
"when",
"the",
"request",
"id",
"used",
"for",
"upcoming",
"call",
"needs... | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/pending_call_registry.go#L65-L72 |
135,617 | qlik-oss/enigma-go | remote_object.go | ChangedChannel | func (r *RemoteObject) ChangedChannel() chan struct{} {
channel := make(chan struct{}, 16)
r.changedChannels[channel] = true
return channel
} | go | func (r *RemoteObject) ChangedChannel() chan struct{} {
channel := make(chan struct{}, 16)
r.changedChannels[channel] = true
return channel
} | [
"func",
"(",
"r",
"*",
"RemoteObject",
")",
"ChangedChannel",
"(",
")",
"chan",
"struct",
"{",
"}",
"{",
"channel",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"16",
")",
"\n",
"r",
".",
"changedChannels",
"[",
"channel",
"]",
"=",
"true",
... | // ChangedChannel returns a channel that will receive changes when the underlying object is invalidated. | [
"ChangedChannel",
"returns",
"a",
"channel",
"that",
"will",
"receive",
"changes",
"when",
"the",
"underlying",
"object",
"is",
"invalidated",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/remote_object.go#L21-L25 |
135,618 | qlik-oss/enigma-go | remote_object.go | RemoveChangeChannel | func (r *RemoteObject) RemoveChangeChannel(channel chan struct{}) {
r.mutex.Lock()
if r.changedChannels[channel] != false {
delete(r.changedChannels, channel)
close(channel)
}
r.mutex.Unlock()
} | go | func (r *RemoteObject) RemoveChangeChannel(channel chan struct{}) {
r.mutex.Lock()
if r.changedChannels[channel] != false {
delete(r.changedChannels, channel)
close(channel)
}
r.mutex.Unlock()
} | [
"func",
"(",
"r",
"*",
"RemoteObject",
")",
"RemoveChangeChannel",
"(",
"channel",
"chan",
"struct",
"{",
"}",
")",
"{",
"r",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"if",
"r",
".",
"changedChannels",
"[",
"channel",
"]",
"!=",
"false",
"{",
"dele... | // RemoveChangeChannel unregisters a channel from further events. | [
"RemoveChangeChannel",
"unregisters",
"a",
"channel",
"from",
"further",
"events",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/remote_object.go#L28-L35 |
135,619 | qlik-oss/enigma-go | remote_object.go | rpc | func (r *RemoteObject) rpc(ctx context.Context, method string, apiResponse interface{}, params ...interface{}) error {
invocationResponse := r.interceptorChain(ctx, &Invocation{RemoteObject: r, Method: method, Params: params})
if invocationResponse.Error != nil {
return invocationResponse.Error
}
if apiResponse !... | go | func (r *RemoteObject) rpc(ctx context.Context, method string, apiResponse interface{}, params ...interface{}) error {
invocationResponse := r.interceptorChain(ctx, &Invocation{RemoteObject: r, Method: method, Params: params})
if invocationResponse.Error != nil {
return invocationResponse.Error
}
if apiResponse !... | [
"func",
"(",
"r",
"*",
"RemoteObject",
")",
"rpc",
"(",
"ctx",
"context",
".",
"Context",
",",
"method",
"string",
",",
"apiResponse",
"interface",
"{",
"}",
",",
"params",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"invocationResponse",
":=",
"r",... | // Invokes a method on the remote object | [
"Invokes",
"a",
"method",
"on",
"the",
"remote",
"object"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/remote_object.go#L65-L77 |
135,620 | qlik-oss/enigma-go | remote_object.go | newRemoteObject | func newRemoteObject(session *session, objectInterface *ObjectInterface) *RemoteObject {
remoteObject := &RemoteObject{
session: session,
ObjectInterface: objectInterface,
changedChannels: make(map[chan struct{}]bool),
mutex: sync.Mutex{},
closedCh: make(chan struct{}),
}
// Signal... | go | func newRemoteObject(session *session, objectInterface *ObjectInterface) *RemoteObject {
remoteObject := &RemoteObject{
session: session,
ObjectInterface: objectInterface,
changedChannels: make(map[chan struct{}]bool),
mutex: sync.Mutex{},
closedCh: make(chan struct{}),
}
// Signal... | [
"func",
"newRemoteObject",
"(",
"session",
"*",
"session",
",",
"objectInterface",
"*",
"ObjectInterface",
")",
"*",
"RemoteObject",
"{",
"remoteObject",
":=",
"&",
"RemoteObject",
"{",
"session",
":",
"session",
",",
"ObjectInterface",
":",
"objectInterface",
","... | // newRemoteObject creates a new RemoteObject instance | [
"newRemoteObject",
"creates",
"a",
"new",
"RemoteObject",
"instance"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/remote_object.go#L80-L90 |
135,621 | qlik-oss/enigma-go | schema/generate.go | UnmarshalText | func (k *OrderAwareKey) UnmarshalText(text []byte) error {
i := atomic.AddUint64(&keyOrderCounter, 1)
k.Order = i
k.Key = string(text)
return nil
} | go | func (k *OrderAwareKey) UnmarshalText(text []byte) error {
i := atomic.AddUint64(&keyOrderCounter, 1)
k.Order = i
k.Key = string(text)
return nil
} | [
"func",
"(",
"k",
"*",
"OrderAwareKey",
")",
"UnmarshalText",
"(",
"text",
"[",
"]",
"byte",
")",
"error",
"{",
"i",
":=",
"atomic",
".",
"AddUint64",
"(",
"&",
"keyOrderCounter",
",",
"1",
")",
"\n",
"k",
".",
"Order",
"=",
"i",
"\n",
"k",
".",
... | // UnmarshalText allows OrderAwareKey to be used as a json map key | [
"UnmarshalText",
"allows",
"OrderAwareKey",
"to",
"be",
"used",
"as",
"a",
"json",
"map",
"key"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/schema/generate.go#L111-L116 |
135,622 | qlik-oss/enigma-go | schema/generate.go | printMethod | func printMethod(method *Methodx, out *os.File, serviceName string, methodName string, objectFuncToObject map[string]string) {
actualResponses := filterResponses(method.Responses, methodName)
// Generate Description
if method.Description != "" {
fmt.Fprintln(out, formatComment("", method.Description, method.Param... | go | func printMethod(method *Methodx, out *os.File, serviceName string, methodName string, objectFuncToObject map[string]string) {
actualResponses := filterResponses(method.Responses, methodName)
// Generate Description
if method.Description != "" {
fmt.Fprintln(out, formatComment("", method.Description, method.Param... | [
"func",
"printMethod",
"(",
"method",
"*",
"Methodx",
",",
"out",
"*",
"os",
".",
"File",
",",
"serviceName",
"string",
",",
"methodName",
"string",
",",
"objectFuncToObject",
"map",
"[",
"string",
"]",
"string",
")",
"{",
"actualResponses",
":=",
"filterRes... | // Generate an ordinary fully typed method | [
"Generate",
"an",
"ordinary",
"fully",
"typed",
"method"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/schema/generate.go#L445-L533 |
135,623 | qlik-oss/enigma-go | float.go | UnmarshalJSON | func (value *Float64) UnmarshalJSON(arg []byte) error {
err := json.Unmarshal(arg, (*float64)(value))
if err != nil {
str := string(arg)
switch str {
case `"NaN"`:
*value = Float64(math.NaN())
case `"Infinity"`:
*value = Float64(math.Inf(1))
case `"-Infinity"`:
*value = Float64(math.Inf(-1))
defa... | go | func (value *Float64) UnmarshalJSON(arg []byte) error {
err := json.Unmarshal(arg, (*float64)(value))
if err != nil {
str := string(arg)
switch str {
case `"NaN"`:
*value = Float64(math.NaN())
case `"Infinity"`:
*value = Float64(math.Inf(1))
case `"-Infinity"`:
*value = Float64(math.Inf(-1))
defa... | [
"func",
"(",
"value",
"*",
"Float64",
")",
"UnmarshalJSON",
"(",
"arg",
"[",
"]",
"byte",
")",
"error",
"{",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"arg",
",",
"(",
"*",
"float64",
")",
"(",
"value",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",... | // UnmarshalJSON implements the Unmarshaler interface for custom unmarshalling. | [
"UnmarshalJSON",
"implements",
"the",
"Unmarshaler",
"interface",
"for",
"custom",
"unmarshalling",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/float.go#L13-L29 |
135,624 | qlik-oss/enigma-go | float.go | MarshalJSON | func (value *Float64) MarshalJSON() ([]byte, error) {
val := float64(*value)
if math.IsNaN(val) {
return []byte(`"NaN"`), nil
} else if math.IsInf(val, 1) {
return []byte(`"Infinity"`), nil
} else if math.IsInf(val, -1) {
return []byte(`"-Infinity"`), nil
}
return json.Marshal(float64(*value))
} | go | func (value *Float64) MarshalJSON() ([]byte, error) {
val := float64(*value)
if math.IsNaN(val) {
return []byte(`"NaN"`), nil
} else if math.IsInf(val, 1) {
return []byte(`"Infinity"`), nil
} else if math.IsInf(val, -1) {
return []byte(`"-Infinity"`), nil
}
return json.Marshal(float64(*value))
} | [
"func",
"(",
"value",
"*",
"Float64",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"val",
":=",
"float64",
"(",
"*",
"value",
")",
"\n",
"if",
"math",
".",
"IsNaN",
"(",
"val",
")",
"{",
"return",
"[",
"]",
"byte... | // MarshalJSON implements the Marshaler interface for custom marshalling. | [
"MarshalJSON",
"implements",
"the",
"Marshaler",
"interface",
"for",
"custom",
"marshalling",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/float.go#L32-L42 |
135,625 | qlik-oss/enigma-go | dialer.go | Dial | func (dialer Dialer) Dial(ctx context.Context, url string, httpHeader http.Header) (*Global, error) {
// Set empty http header if omitted
if httpHeader == nil {
httpHeader = make(http.Header, 0)
}
if dialer.MockMode {
dialer.CreateSocket = func(ctx context.Context, url string, httpHeader http.Header) (Socket, ... | go | func (dialer Dialer) Dial(ctx context.Context, url string, httpHeader http.Header) (*Global, error) {
// Set empty http header if omitted
if httpHeader == nil {
httpHeader = make(http.Header, 0)
}
if dialer.MockMode {
dialer.CreateSocket = func(ctx context.Context, url string, httpHeader http.Header) (Socket, ... | [
"func",
"(",
"dialer",
"Dialer",
")",
"Dial",
"(",
"ctx",
"context",
".",
"Context",
",",
"url",
"string",
",",
"httpHeader",
"http",
".",
"Header",
")",
"(",
"*",
"Global",
",",
"error",
")",
"{",
"// Set empty http header if omitted",
"if",
"httpHeader",
... | // Dial establishes a connection to Qlik Associative Engine using the settings set in the Dialer. It takes two parameter | [
"Dial",
"establishes",
"a",
"connection",
"to",
"Qlik",
"Associative",
"Engine",
"using",
"the",
"settings",
"set",
"in",
"the",
"Dialer",
".",
"It",
"takes",
"two",
"parameter"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/dialer.go#L85-L148 |
135,626 | qlik-oss/enigma-go | metrics_collector.go | ToString | func (m *InvocationMetrics) ToString() string {
return fmt.Sprintf("On air time: %v, Total time: %v", m.SocketReadTimestamp.Sub(m.SocketWriteTimestamp), m.InvocationResponseTimestamp.Sub(m.InvocationRequestTimestamp))
} | go | func (m *InvocationMetrics) ToString() string {
return fmt.Sprintf("On air time: %v, Total time: %v", m.SocketReadTimestamp.Sub(m.SocketWriteTimestamp), m.InvocationResponseTimestamp.Sub(m.InvocationRequestTimestamp))
} | [
"func",
"(",
"m",
"*",
"InvocationMetrics",
")",
"ToString",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"m",
".",
"SocketReadTimestamp",
".",
"Sub",
"(",
"m",
".",
"SocketWriteTimestamp",
")",
",",
"m",
".",
"Invoca... | // ToString returns a human-friendly string representation of elapsed times | [
"ToString",
"returns",
"a",
"human",
"-",
"friendly",
"string",
"representation",
"of",
"elapsed",
"times"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/metrics_collector.go#L31-L33 |
135,627 | qlik-oss/enigma-go | metrics_collector.go | Metrics | func (c *MetricsCollector) Metrics() *InvocationMetrics {
c.Lock()
defer c.Unlock()
return c.metrics
} | go | func (c *MetricsCollector) Metrics() *InvocationMetrics {
c.Lock()
defer c.Unlock()
return c.metrics
} | [
"func",
"(",
"c",
"*",
"MetricsCollector",
")",
"Metrics",
"(",
")",
"*",
"InvocationMetrics",
"{",
"c",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"Unlock",
"(",
")",
"\n",
"return",
"c",
".",
"metrics",
"\n",
"}"
] | // Metrics extracts performance information | [
"Metrics",
"extracts",
"performance",
"information"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/metrics_collector.go#L36-L40 |
135,628 | qlik-oss/enigma-go | metrics_collector.go | WithMetricsCollector | func WithMetricsCollector(ctx context.Context) (context.Context, *MetricsCollector) {
metricsCollector := &MetricsCollector{metrics: &InvocationMetrics{}}
ctxWithMetrics := context.WithValue(ctx, metricsCollectorID{}, metricsCollector)
return ctxWithMetrics, metricsCollector
} | go | func WithMetricsCollector(ctx context.Context) (context.Context, *MetricsCollector) {
metricsCollector := &MetricsCollector{metrics: &InvocationMetrics{}}
ctxWithMetrics := context.WithValue(ctx, metricsCollectorID{}, metricsCollector)
return ctxWithMetrics, metricsCollector
} | [
"func",
"WithMetricsCollector",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"context",
".",
"Context",
",",
"*",
"MetricsCollector",
")",
"{",
"metricsCollector",
":=",
"&",
"MetricsCollector",
"{",
"metrics",
":",
"&",
"InvocationMetrics",
"{",
"}",
"}",... | // WithMetricsCollector provides a new context with the a MetricsCollector that records performance metrics for invocations | [
"WithMetricsCollector",
"provides",
"a",
"new",
"context",
"with",
"the",
"a",
"MetricsCollector",
"that",
"records",
"performance",
"metrics",
"for",
"invocations"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/metrics_collector.go#L51-L55 |
135,629 | qlik-oss/enigma-go | examples/interceptors/metrics/metrics.go | metricsInterceptor | func metricsInterceptor(ctx context.Context, invocation *enigma.Invocation, proceed enigma.InterceptorContinuation) *enigma.InvocationResponse {
ctxWithMetrics, metricsCollector := enigma.WithMetricsCollector(ctx)
response := proceed(ctxWithMetrics, invocation)
metrics := metricsCollector.Metrics()
fmt.Println(re... | go | func metricsInterceptor(ctx context.Context, invocation *enigma.Invocation, proceed enigma.InterceptorContinuation) *enigma.InvocationResponse {
ctxWithMetrics, metricsCollector := enigma.WithMetricsCollector(ctx)
response := proceed(ctxWithMetrics, invocation)
metrics := metricsCollector.Metrics()
fmt.Println(re... | [
"func",
"metricsInterceptor",
"(",
"ctx",
"context",
".",
"Context",
",",
"invocation",
"*",
"enigma",
".",
"Invocation",
",",
"proceed",
"enigma",
".",
"InterceptorContinuation",
")",
"*",
"enigma",
".",
"InvocationResponse",
"{",
"ctxWithMetrics",
",",
"metricsC... | // MetricsInterceptor shows how to an interceptor that collects metrics data can be written. | [
"MetricsInterceptor",
"shows",
"how",
"to",
"an",
"interceptor",
"that",
"collects",
"metrics",
"data",
"can",
"be",
"written",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/examples/interceptors/metrics/metrics.go#L38-L46 |
135,630 | qlik-oss/enigma-go | websocket_mock.go | ExpectCall | func (t *MockSocket) ExpectCall(request string, response string) {
t.expectedRequests <- &mocksocketRequest{sentMessage: json.RawMessage(request), responses: []json.RawMessage{json.RawMessage(response)}}
} | go | func (t *MockSocket) ExpectCall(request string, response string) {
t.expectedRequests <- &mocksocketRequest{sentMessage: json.RawMessage(request), responses: []json.RawMessage{json.RawMessage(response)}}
} | [
"func",
"(",
"t",
"*",
"MockSocket",
")",
"ExpectCall",
"(",
"request",
"string",
",",
"response",
"string",
")",
"{",
"t",
".",
"expectedRequests",
"<-",
"&",
"mocksocketRequest",
"{",
"sentMessage",
":",
"json",
".",
"RawMessage",
"(",
"request",
")",
",... | // ExpectCall sets a response message given a request message. | [
"ExpectCall",
"sets",
"a",
"response",
"message",
"given",
"a",
"request",
"message",
"."
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/websocket_mock.go#L33-L35 |
135,631 | qlik-oss/enigma-go | websocket_mock.go | AddReceivedMessage | func (t *MockSocket) AddReceivedMessage(response string) {
t.receivedMessages <- json.RawMessage(response)
} | go | func (t *MockSocket) AddReceivedMessage(response string) {
t.receivedMessages <- json.RawMessage(response)
} | [
"func",
"(",
"t",
"*",
"MockSocket",
")",
"AddReceivedMessage",
"(",
"response",
"string",
")",
"{",
"t",
".",
"receivedMessages",
"<-",
"json",
".",
"RawMessage",
"(",
"response",
")",
"\n",
"}"
] | // AddReceivedMessage adds a message to the received message queue immediately | [
"AddReceivedMessage",
"adds",
"a",
"message",
"to",
"the",
"received",
"message",
"queue",
"immediately"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/websocket_mock.go#L38-L40 |
135,632 | qlik-oss/enigma-go | websocket_mock.go | WriteMessage | func (t *MockSocket) WriteMessage(messageType int, message []byte) error {
select {
case expectedMessage := <-t.expectedRequests:
if asCanonicalString(expectedMessage.sentMessage) == asCanonicalString(message) {
// Transfer the response into the received messages channel
for _, response := range expectedMessa... | go | func (t *MockSocket) WriteMessage(messageType int, message []byte) error {
select {
case expectedMessage := <-t.expectedRequests:
if asCanonicalString(expectedMessage.sentMessage) == asCanonicalString(message) {
// Transfer the response into the received messages channel
for _, response := range expectedMessa... | [
"func",
"(",
"t",
"*",
"MockSocket",
")",
"WriteMessage",
"(",
"messageType",
"int",
",",
"message",
"[",
"]",
"byte",
")",
"error",
"{",
"select",
"{",
"case",
"expectedMessage",
":=",
"<-",
"t",
".",
"expectedRequests",
":",
"if",
"asCanonicalString",
"(... | // WriteMessage implements the Socket interface | [
"WriteMessage",
"implements",
"the",
"Socket",
"interface"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/websocket_mock.go#L43-L60 |
135,633 | qlik-oss/enigma-go | websocket_mock.go | ReadMessage | func (t *MockSocket) ReadMessage() (int, []byte, error) {
message, isOpen := <-t.receivedMessages
if !isOpen {
return 0, nil, errors.New("socket closed by test case")
}
return 1, message, nil
} | go | func (t *MockSocket) ReadMessage() (int, []byte, error) {
message, isOpen := <-t.receivedMessages
if !isOpen {
return 0, nil, errors.New("socket closed by test case")
}
return 1, message, nil
} | [
"func",
"(",
"t",
"*",
"MockSocket",
")",
"ReadMessage",
"(",
")",
"(",
"int",
",",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"message",
",",
"isOpen",
":=",
"<-",
"t",
".",
"receivedMessages",
"\n",
"if",
"!",
"isOpen",
"{",
"return",
"0",
",",
... | // ReadMessage implements the Socket interface | [
"ReadMessage",
"implements",
"the",
"Socket",
"interface"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/websocket_mock.go#L63-L69 |
135,634 | qlik-oss/enigma-go | websocket_mock.go | Close | func (t *MockSocket) Close() error {
select {
case <-t.closed:
// Do nothing
default:
close(t.closed)
close(t.expectedRequests)
close(t.receivedMessages)
}
return nil
} | go | func (t *MockSocket) Close() error {
select {
case <-t.closed:
// Do nothing
default:
close(t.closed)
close(t.expectedRequests)
close(t.receivedMessages)
}
return nil
} | [
"func",
"(",
"t",
"*",
"MockSocket",
")",
"Close",
"(",
")",
"error",
"{",
"select",
"{",
"case",
"<-",
"t",
".",
"closed",
":",
"// Do nothing",
"default",
":",
"close",
"(",
"t",
".",
"closed",
")",
"\n",
"close",
"(",
"t",
".",
"expectedRequests",... | // Close implements the Socket interface | [
"Close",
"implements",
"the",
"Socket",
"interface"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/websocket_mock.go#L72-L82 |
135,635 | qlik-oss/enigma-go | websocket_mock.go | NewMockSocket | func NewMockSocket(fileName string) (*MockSocket, error) {
socket := &MockSocket{receivedMessages: make(chan json.RawMessage, 100), expectedRequests: make(chan *mocksocketRequest, 10000), closed: make(chan struct{})}
if fileName != "" {
var lastRequest *mocksocketRequest
messages := readTrafficLog(fileName)
for... | go | func NewMockSocket(fileName string) (*MockSocket, error) {
socket := &MockSocket{receivedMessages: make(chan json.RawMessage, 100), expectedRequests: make(chan *mocksocketRequest, 10000), closed: make(chan struct{})}
if fileName != "" {
var lastRequest *mocksocketRequest
messages := readTrafficLog(fileName)
for... | [
"func",
"NewMockSocket",
"(",
"fileName",
"string",
")",
"(",
"*",
"MockSocket",
",",
"error",
")",
"{",
"socket",
":=",
"&",
"MockSocket",
"{",
"receivedMessages",
":",
"make",
"(",
"chan",
"json",
".",
"RawMessage",
",",
"100",
")",
",",
"expectedRequest... | // NewMockSocket creates a new MockSocket instance | [
"NewMockSocket",
"creates",
"a",
"new",
"MockSocket",
"instance"
] | 7fdea27298e888663c973c15dbbfba2c0a1ec085 | https://github.com/qlik-oss/enigma-go/blob/7fdea27298e888663c973c15dbbfba2c0a1ec085/websocket_mock.go#L85-L107 |
135,636 | kolo/xmlrpc | client.go | NewClient | func NewClient(requrl string, transport http.RoundTripper) (*Client, error) {
if transport == nil {
transport = http.DefaultTransport
}
httpClient := &http.Client{Transport: transport}
jar, err := cookiejar.New(nil)
if err != nil {
return nil, err
}
u, err := url.Parse(requrl)
if err != nil {
return ... | go | func NewClient(requrl string, transport http.RoundTripper) (*Client, error) {
if transport == nil {
transport = http.DefaultTransport
}
httpClient := &http.Client{Transport: transport}
jar, err := cookiejar.New(nil)
if err != nil {
return nil, err
}
u, err := url.Parse(requrl)
if err != nil {
return ... | [
"func",
"NewClient",
"(",
"requrl",
"string",
",",
"transport",
"http",
".",
"RoundTripper",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"if",
"transport",
"==",
"nil",
"{",
"transport",
"=",
"http",
".",
"DefaultTransport",
"\n",
"}",
"\n\n",
"http... | // NewClient returns instance of rpc.Client object, that is used to send request to xmlrpc service. | [
"NewClient",
"returns",
"instance",
"of",
"rpc",
".",
"Client",
"object",
"that",
"is",
"used",
"to",
"send",
"request",
"to",
"xmlrpc",
"service",
"."
] | de6d879202d7d642e74d3a70d4e9d560f252cb22 | https://github.com/kolo/xmlrpc/blob/de6d879202d7d642e74d3a70d4e9d560f252cb22/client.go#L141-L170 |
135,637 | zach-klippenstein/goadb | dir_entries.go | ReadAll | func (entries *DirEntries) ReadAll() (result []*DirEntry, err error) {
defer entries.Close()
for entries.Next() {
result = append(result, entries.Entry())
}
err = entries.Err()
return
} | go | func (entries *DirEntries) ReadAll() (result []*DirEntry, err error) {
defer entries.Close()
for entries.Next() {
result = append(result, entries.Entry())
}
err = entries.Err()
return
} | [
"func",
"(",
"entries",
"*",
"DirEntries",
")",
"ReadAll",
"(",
")",
"(",
"result",
"[",
"]",
"*",
"DirEntry",
",",
"err",
"error",
")",
"{",
"defer",
"entries",
".",
"Close",
"(",
")",
"\n\n",
"for",
"entries",
".",
"Next",
"(",
")",
"{",
"result"... | // ReadAllDirEntries reads all the remaining directory entries into a slice,
// closes self, and returns any error.
// If err is non-nil, result will contain any entries read until the error occurred. | [
"ReadAllDirEntries",
"reads",
"all",
"the",
"remaining",
"directory",
"entries",
"into",
"a",
"slice",
"closes",
"self",
"and",
"returns",
"any",
"error",
".",
"If",
"err",
"is",
"non",
"-",
"nil",
"result",
"will",
"contain",
"any",
"entries",
"read",
"unti... | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/dir_entries.go#L30-L39 |
135,638 | zach-klippenstein/goadb | wire/sync_conn.go | Close | func (c SyncConn) Close() error {
return errors.CombineErrs("error closing SyncConn", errors.NetworkError,
c.SyncScanner.Close(), c.SyncSender.Close())
} | go | func (c SyncConn) Close() error {
return errors.CombineErrs("error closing SyncConn", errors.NetworkError,
c.SyncScanner.Close(), c.SyncSender.Close())
} | [
"func",
"(",
"c",
"SyncConn",
")",
"Close",
"(",
")",
"error",
"{",
"return",
"errors",
".",
"CombineErrs",
"(",
"\"",
"\"",
",",
"errors",
".",
"NetworkError",
",",
"c",
".",
"SyncScanner",
".",
"Close",
"(",
")",
",",
"c",
".",
"SyncSender",
".",
... | // Close closes both the sender and the scanner, and returns any errors. | [
"Close",
"closes",
"both",
"the",
"sender",
"and",
"the",
"scanner",
"and",
"returns",
"any",
"errors",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/wire/sync_conn.go#L34-L37 |
135,639 | zach-klippenstein/goadb | wire/conn.go | RoundTripSingleResponse | func (conn *Conn) RoundTripSingleResponse(req []byte) (resp []byte, err error) {
if err = conn.SendMessage(req); err != nil {
return nil, err
}
if _, err = conn.ReadStatus(string(req)); err != nil {
return nil, err
}
return conn.ReadMessage()
} | go | func (conn *Conn) RoundTripSingleResponse(req []byte) (resp []byte, err error) {
if err = conn.SendMessage(req); err != nil {
return nil, err
}
if _, err = conn.ReadStatus(string(req)); err != nil {
return nil, err
}
return conn.ReadMessage()
} | [
"func",
"(",
"conn",
"*",
"Conn",
")",
"RoundTripSingleResponse",
"(",
"req",
"[",
"]",
"byte",
")",
"(",
"resp",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"if",
"err",
"=",
"conn",
".",
"SendMessage",
"(",
"req",
")",
";",
"err",
"!=",
"n... | // RoundTripSingleResponse sends a message to the server, and reads a single
// message response. If the reponse has a failure status code, returns it as an error. | [
"RoundTripSingleResponse",
"sends",
"a",
"message",
"to",
"the",
"server",
"and",
"reads",
"a",
"single",
"message",
"response",
".",
"If",
"the",
"reponse",
"has",
"a",
"failure",
"status",
"code",
"returns",
"it",
"as",
"an",
"error",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/wire/conn.go#L53-L63 |
135,640 | zach-klippenstein/goadb | device_watcher.go | CameOnline | func (s DeviceStateChangedEvent) CameOnline() bool {
return s.OldState != StateOnline && s.NewState == StateOnline
} | go | func (s DeviceStateChangedEvent) CameOnline() bool {
return s.OldState != StateOnline && s.NewState == StateOnline
} | [
"func",
"(",
"s",
"DeviceStateChangedEvent",
")",
"CameOnline",
"(",
")",
"bool",
"{",
"return",
"s",
".",
"OldState",
"!=",
"StateOnline",
"&&",
"s",
".",
"NewState",
"==",
"StateOnline",
"\n",
"}"
] | // CameOnline returns true if this event represents a device coming online. | [
"CameOnline",
"returns",
"true",
"if",
"this",
"event",
"represents",
"a",
"device",
"coming",
"online",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/device_watcher.go#L33-L35 |
135,641 | zach-klippenstein/goadb | device_watcher.go | WentOffline | func (s DeviceStateChangedEvent) WentOffline() bool {
return s.OldState == StateOnline && s.NewState != StateOnline
} | go | func (s DeviceStateChangedEvent) WentOffline() bool {
return s.OldState == StateOnline && s.NewState != StateOnline
} | [
"func",
"(",
"s",
"DeviceStateChangedEvent",
")",
"WentOffline",
"(",
")",
"bool",
"{",
"return",
"s",
".",
"OldState",
"==",
"StateOnline",
"&&",
"s",
".",
"NewState",
"!=",
"StateOnline",
"\n",
"}"
] | // WentOffline returns true if this event represents a device going offline. | [
"WentOffline",
"returns",
"true",
"if",
"this",
"event",
"represents",
"a",
"device",
"going",
"offline",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/device_watcher.go#L38-L40 |
135,642 | zach-klippenstein/goadb | device_watcher.go | Err | func (w *DeviceWatcher) Err() error {
if err, ok := w.err.Load().(error); ok {
return err
}
return nil
} | go | func (w *DeviceWatcher) Err() error {
if err, ok := w.err.Load().(error); ok {
return err
}
return nil
} | [
"func",
"(",
"w",
"*",
"DeviceWatcher",
")",
"Err",
"(",
")",
"error",
"{",
"if",
"err",
",",
"ok",
":=",
"w",
".",
"err",
".",
"Load",
"(",
")",
".",
"(",
"error",
")",
";",
"ok",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",... | // Err returns the error that caused the channel returned by C to be closed, if C is closed.
// If C is not closed, its return value is undefined. | [
"Err",
"returns",
"the",
"error",
"that",
"caused",
"the",
"channel",
"returned",
"by",
"C",
"to",
"be",
"closed",
"if",
"C",
"is",
"closed",
".",
"If",
"C",
"is",
"not",
"closed",
"its",
"return",
"value",
"is",
"undefined",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/device_watcher.go#L76-L81 |
135,643 | zach-klippenstein/goadb | adb.go | ServerVersion | func (c *Adb) ServerVersion() (int, error) {
resp, err := roundTripSingleResponse(c.server, "host:version")
if err != nil {
return 0, wrapClientError(err, c, "GetServerVersion")
}
version, err := c.parseServerVersion(resp)
if err != nil {
return 0, wrapClientError(err, c, "GetServerVersion")
}
return versio... | go | func (c *Adb) ServerVersion() (int, error) {
resp, err := roundTripSingleResponse(c.server, "host:version")
if err != nil {
return 0, wrapClientError(err, c, "GetServerVersion")
}
version, err := c.parseServerVersion(resp)
if err != nil {
return 0, wrapClientError(err, c, "GetServerVersion")
}
return versio... | [
"func",
"(",
"c",
"*",
"Adb",
")",
"ServerVersion",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"roundTripSingleResponse",
"(",
"c",
".",
"server",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"... | // ServerVersion asks the ADB server for its internal version number. | [
"ServerVersion",
"asks",
"the",
"ADB",
"server",
"for",
"its",
"internal",
"version",
"number",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/adb.go#L60-L71 |
135,644 | zach-klippenstein/goadb | wire/scanner.go | readStatusFailureAsError | func readStatusFailureAsError(r io.Reader, req string, messageLengthReader lengthReader) (string, error) {
status, err := readOctetString(req, r)
if err != nil {
return "", errors.WrapErrorf(err, errors.NetworkError, "error reading status for %s", req)
}
if isFailureStatus(status) {
msg, err := readMessage(r, ... | go | func readStatusFailureAsError(r io.Reader, req string, messageLengthReader lengthReader) (string, error) {
status, err := readOctetString(req, r)
if err != nil {
return "", errors.WrapErrorf(err, errors.NetworkError, "error reading status for %s", req)
}
if isFailureStatus(status) {
msg, err := readMessage(r, ... | [
"func",
"readStatusFailureAsError",
"(",
"r",
"io",
".",
"Reader",
",",
"req",
"string",
",",
"messageLengthReader",
"lengthReader",
")",
"(",
"string",
",",
"error",
")",
"{",
"status",
",",
"err",
":=",
"readOctetString",
"(",
"req",
",",
"r",
")",
"\n",... | // Reads the status, and if failure, reads the message and returns it as an error.
// If the status is success, doesn't read the message.
// req is just used to populate the AdbError, and can be nil.
// messageLengthReader is the function passed to readMessage if the status is failure. | [
"Reads",
"the",
"status",
"and",
"if",
"failure",
"reads",
"the",
"message",
"and",
"returns",
"it",
"as",
"an",
"error",
".",
"If",
"the",
"status",
"is",
"success",
"doesn",
"t",
"read",
"the",
"message",
".",
"req",
"is",
"just",
"used",
"to",
"popu... | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/wire/scanner.go#L98-L115 |
135,645 | zach-klippenstein/goadb | wire/scanner.go | readHexLength | func readHexLength(r io.Reader) (int, error) {
lengthHex := make([]byte, 4)
n, err := io.ReadFull(r, lengthHex)
if err != nil {
return 0, errIncompleteMessage("length", n, 4)
}
length, err := strconv.ParseInt(string(lengthHex), 16, 64)
if err != nil {
return 0, errors.WrapErrorf(err, errors.NetworkError, "co... | go | func readHexLength(r io.Reader) (int, error) {
lengthHex := make([]byte, 4)
n, err := io.ReadFull(r, lengthHex)
if err != nil {
return 0, errIncompleteMessage("length", n, 4)
}
length, err := strconv.ParseInt(string(lengthHex), 16, 64)
if err != nil {
return 0, errors.WrapErrorf(err, errors.NetworkError, "co... | [
"func",
"readHexLength",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int",
",",
"error",
")",
"{",
"lengthHex",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"4",
")",
"\n",
"n",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"r",
",",
"lengthHex",
")... | // readHexLength reads the next 4 bytes from r as an ASCII hex-encoded length and parses them into an int. | [
"readHexLength",
"reads",
"the",
"next",
"4",
"bytes",
"from",
"r",
"as",
"an",
"ASCII",
"hex",
"-",
"encoded",
"length",
"and",
"parses",
"them",
"into",
"an",
"int",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/wire/scanner.go#L154-L172 |
135,646 | zach-klippenstein/goadb | wire/scanner.go | readInt32 | func readInt32(r io.Reader) (int, error) {
var value int32
err := binary.Read(r, binary.LittleEndian, &value)
return int(value), err
} | go | func readInt32(r io.Reader) (int, error) {
var value int32
err := binary.Read(r, binary.LittleEndian, &value)
return int(value), err
} | [
"func",
"readInt32",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"int",
",",
"error",
")",
"{",
"var",
"value",
"int32",
"\n",
"err",
":=",
"binary",
".",
"Read",
"(",
"r",
",",
"binary",
".",
"LittleEndian",
",",
"&",
"value",
")",
"\n",
"return",
... | // readInt32 reads the next 4 bytes from r as a little-endian integer.
// Returns an int instead of an int32 to match the lengthReader type. | [
"readInt32",
"reads",
"the",
"next",
"4",
"bytes",
"from",
"r",
"as",
"a",
"little",
"-",
"endian",
"integer",
".",
"Returns",
"an",
"int",
"instead",
"of",
"an",
"int32",
"to",
"match",
"the",
"lengthReader",
"type",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/wire/scanner.go#L176-L180 |
135,647 | zach-klippenstein/goadb | server.go | Dial | func (s *realServer) Dial() (*wire.Conn, error) {
conn, err := s.config.Dial(s.address)
if err != nil {
// Attempt to start the server and try again.
if err = s.Start(); err != nil {
return nil, errors.WrapErrorf(err, errors.ServerNotAvailable, "error starting server for dial")
}
conn, err = s.config.Dial... | go | func (s *realServer) Dial() (*wire.Conn, error) {
conn, err := s.config.Dial(s.address)
if err != nil {
// Attempt to start the server and try again.
if err = s.Start(); err != nil {
return nil, errors.WrapErrorf(err, errors.ServerNotAvailable, "error starting server for dial")
}
conn, err = s.config.Dial... | [
"func",
"(",
"s",
"*",
"realServer",
")",
"Dial",
"(",
")",
"(",
"*",
"wire",
".",
"Conn",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"s",
".",
"config",
".",
"Dial",
"(",
"s",
".",
"address",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // Dial tries to connect to the server. If the first attempt fails, tries starting the server before
// retrying. If the second attempt fails, returns the error. | [
"Dial",
"tries",
"to",
"connect",
"to",
"the",
"server",
".",
"If",
"the",
"first",
"attempt",
"fails",
"tries",
"starting",
"the",
"server",
"before",
"retrying",
".",
"If",
"the",
"second",
"attempt",
"fails",
"returns",
"the",
"error",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/server.go#L94-L108 |
135,648 | zach-klippenstein/goadb | server.go | Start | func (s *realServer) Start() error {
output, err := s.config.fs.CmdCombinedOutput(s.config.PathToAdb, "-L", fmt.Sprintf("tcp:%s", s.address), "start-server")
outputStr := strings.TrimSpace(string(output))
return errors.WrapErrorf(err, errors.ServerNotAvailable, "error starting server: %s\noutput:\n%s", err, outputSt... | go | func (s *realServer) Start() error {
output, err := s.config.fs.CmdCombinedOutput(s.config.PathToAdb, "-L", fmt.Sprintf("tcp:%s", s.address), "start-server")
outputStr := strings.TrimSpace(string(output))
return errors.WrapErrorf(err, errors.ServerNotAvailable, "error starting server: %s\noutput:\n%s", err, outputSt... | [
"func",
"(",
"s",
"*",
"realServer",
")",
"Start",
"(",
")",
"error",
"{",
"output",
",",
"err",
":=",
"s",
".",
"config",
".",
"fs",
".",
"CmdCombinedOutput",
"(",
"s",
".",
"config",
".",
"PathToAdb",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
... | // StartServer ensures there is a server running. | [
"StartServer",
"ensures",
"there",
"is",
"a",
"server",
"running",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/server.go#L111-L115 |
135,649 | zach-klippenstein/goadb | sync_file_reader.go | readNextChunk | func readNextChunk(r wire.SyncScanner) (io.Reader, error) {
status, err := r.ReadStatus("read-chunk")
if err != nil {
if wire.IsAdbServerErrorMatching(err, readFileNotFoundPredicate) {
return nil, errors.Errorf(errors.FileNoExistError, "no such file or directory")
}
return nil, err
}
switch status {
case... | go | func readNextChunk(r wire.SyncScanner) (io.Reader, error) {
status, err := r.ReadStatus("read-chunk")
if err != nil {
if wire.IsAdbServerErrorMatching(err, readFileNotFoundPredicate) {
return nil, errors.Errorf(errors.FileNoExistError, "no such file or directory")
}
return nil, err
}
switch status {
case... | [
"func",
"readNextChunk",
"(",
"r",
"wire",
".",
"SyncScanner",
")",
"(",
"io",
".",
"Reader",
",",
"error",
")",
"{",
"status",
",",
"err",
":=",
"r",
".",
"ReadStatus",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"wire",
"."... | // readNextChunk creates an io.LimitedReader for the next chunk of data,
// and returns io.EOF if the last chunk has been read. | [
"readNextChunk",
"creates",
"an",
"io",
".",
"LimitedReader",
"for",
"the",
"next",
"chunk",
"of",
"data",
"and",
"returns",
"io",
".",
"EOF",
"if",
"the",
"last",
"chunk",
"has",
"been",
"read",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/sync_file_reader.go#L84-L102 |
135,650 | zach-klippenstein/goadb | cmd/adb/main.go | copyWithProgressAndStats | func copyWithProgressAndStats(dst io.Writer, src io.Reader, size int, showProgress bool) error {
var progress *pb.ProgressBar
if showProgress && size > 0 {
progress = pb.New(size)
// Write to stderr in case dst is stdout.
progress.Output = os.Stderr
progress.ShowSpeed = true
progress.ShowPercent = true
pr... | go | func copyWithProgressAndStats(dst io.Writer, src io.Reader, size int, showProgress bool) error {
var progress *pb.ProgressBar
if showProgress && size > 0 {
progress = pb.New(size)
// Write to stderr in case dst is stdout.
progress.Output = os.Stderr
progress.ShowSpeed = true
progress.ShowPercent = true
pr... | [
"func",
"copyWithProgressAndStats",
"(",
"dst",
"io",
".",
"Writer",
",",
"src",
"io",
".",
"Reader",
",",
"size",
"int",
",",
"showProgress",
"bool",
")",
"error",
"{",
"var",
"progress",
"*",
"pb",
".",
"ProgressBar",
"\n",
"if",
"showProgress",
"&&",
... | // copyWithProgressAndStats copies src to dst.
// If showProgress is true and size is positive, a progress bar is shown.
// After copying, final stats about the transfer speed and size are shown.
// Progress and stats are printed to stderr. | [
"copyWithProgressAndStats",
"copies",
"src",
"to",
"dst",
".",
"If",
"showProgress",
"is",
"true",
"and",
"size",
"is",
"positive",
"a",
"progress",
"bar",
"is",
"shown",
".",
"After",
"copying",
"final",
"stats",
"about",
"the",
"transfer",
"speed",
"and",
... | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/cmd/adb/main.go#L253-L289 |
135,651 | zach-klippenstein/goadb | device.go | OpenWrite | func (c *Device) OpenWrite(path string, perms os.FileMode, mtime time.Time) (io.WriteCloser, error) {
conn, err := c.getSyncConn()
if err != nil {
return nil, wrapClientError(err, c, "OpenWrite(%s)", path)
}
writer, err := sendFile(conn, path, perms, mtime)
return writer, wrapClientError(err, c, "OpenWrite(%s)"... | go | func (c *Device) OpenWrite(path string, perms os.FileMode, mtime time.Time) (io.WriteCloser, error) {
conn, err := c.getSyncConn()
if err != nil {
return nil, wrapClientError(err, c, "OpenWrite(%s)", path)
}
writer, err := sendFile(conn, path, perms, mtime)
return writer, wrapClientError(err, c, "OpenWrite(%s)"... | [
"func",
"(",
"c",
"*",
"Device",
")",
"OpenWrite",
"(",
"path",
"string",
",",
"perms",
"os",
".",
"FileMode",
",",
"mtime",
"time",
".",
"Time",
")",
"(",
"io",
".",
"WriteCloser",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"c",
".",
"get... | // OpenWrite opens the file at path on the device, creating it with the permissions specified
// by perms if necessary, and returns a writer that writes to the file.
// The files modification time will be set to mtime when the WriterCloser is closed. The zero value
// is TimeOfClose, which will use the time the Close m... | [
"OpenWrite",
"opens",
"the",
"file",
"at",
"path",
"on",
"the",
"device",
"creating",
"it",
"with",
"the",
"permissions",
"specified",
"by",
"perms",
"if",
"necessary",
"and",
"returns",
"a",
"writer",
"that",
"writes",
"to",
"the",
"file",
".",
"The",
"fi... | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/device.go#L178-L186 |
135,652 | zach-klippenstein/goadb | device.go | dialDevice | func (c *Device) dialDevice() (*wire.Conn, error) {
conn, err := c.server.Dial()
if err != nil {
return nil, err
}
req := fmt.Sprintf("host:%s", c.descriptor.getTransportDescriptor())
if err = wire.SendMessageString(conn, req); err != nil {
conn.Close()
return nil, errors.WrapErrf(err, "error connecting to ... | go | func (c *Device) dialDevice() (*wire.Conn, error) {
conn, err := c.server.Dial()
if err != nil {
return nil, err
}
req := fmt.Sprintf("host:%s", c.descriptor.getTransportDescriptor())
if err = wire.SendMessageString(conn, req); err != nil {
conn.Close()
return nil, errors.WrapErrf(err, "error connecting to ... | [
"func",
"(",
"c",
"*",
"Device",
")",
"dialDevice",
"(",
")",
"(",
"*",
"wire",
".",
"Conn",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"c",
".",
"server",
".",
"Dial",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",... | // dialDevice switches the connection to communicate directly with the device
// by requesting the transport defined by the DeviceDescriptor. | [
"dialDevice",
"switches",
"the",
"connection",
"to",
"communicate",
"directly",
"with",
"the",
"device",
"by",
"requesting",
"the",
"transport",
"defined",
"by",
"the",
"DeviceDescriptor",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/device.go#L218-L236 |
135,653 | zach-klippenstein/goadb | device.go | prepareCommandLine | func prepareCommandLine(cmd string, args ...string) (string, error) {
if isBlank(cmd) {
return "", errors.AssertionErrorf("command cannot be empty")
}
for i, arg := range args {
if strings.ContainsRune(arg, '"') {
return "", errors.Errorf(errors.ParseError, "arg at index %d contains an invalid double quote: ... | go | func prepareCommandLine(cmd string, args ...string) (string, error) {
if isBlank(cmd) {
return "", errors.AssertionErrorf("command cannot be empty")
}
for i, arg := range args {
if strings.ContainsRune(arg, '"') {
return "", errors.Errorf(errors.ParseError, "arg at index %d contains an invalid double quote: ... | [
"func",
"prepareCommandLine",
"(",
"cmd",
"string",
",",
"args",
"...",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"isBlank",
"(",
"cmd",
")",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"AssertionErrorf",
"(",
"\"",
"\"",
")",
"\... | // prepareCommandLine validates the command and argument strings, quotes
// arguments if required, and joins them into a valid adb command string. | [
"prepareCommandLine",
"validates",
"the",
"command",
"and",
"argument",
"strings",
"quotes",
"arguments",
"if",
"required",
"and",
"joins",
"them",
"into",
"a",
"valid",
"adb",
"command",
"string",
"."
] | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/device.go#L240-L260 |
135,654 | zach-klippenstein/goadb | sync_client.go | sendFile | func sendFile(conn *wire.SyncConn, path string, mode os.FileMode, mtime time.Time) (io.WriteCloser, error) {
if err := conn.SendOctetString("SEND"); err != nil {
return nil, err
}
pathAndMode := encodePathAndMode(path, mode)
if err := conn.SendBytes(pathAndMode); err != nil {
return nil, err
}
return newSyn... | go | func sendFile(conn *wire.SyncConn, path string, mode os.FileMode, mtime time.Time) (io.WriteCloser, error) {
if err := conn.SendOctetString("SEND"); err != nil {
return nil, err
}
pathAndMode := encodePathAndMode(path, mode)
if err := conn.SendBytes(pathAndMode); err != nil {
return nil, err
}
return newSyn... | [
"func",
"sendFile",
"(",
"conn",
"*",
"wire",
".",
"SyncConn",
",",
"path",
"string",
",",
"mode",
"os",
".",
"FileMode",
",",
"mtime",
"time",
".",
"Time",
")",
"(",
"io",
".",
"WriteCloser",
",",
"error",
")",
"{",
"if",
"err",
":=",
"conn",
".",... | // sendFile returns a WriteCloser than will write to the file at path on device.
// The file will be created with permissions specified by mode.
// The file's modified time will be set to mtime, unless mtime is 0, in which case the time the writer is
// closed will be used. | [
"sendFile",
"returns",
"a",
"WriteCloser",
"than",
"will",
"write",
"to",
"the",
"file",
"at",
"path",
"on",
"device",
".",
"The",
"file",
"will",
"be",
"created",
"with",
"permissions",
"specified",
"by",
"mode",
".",
"The",
"file",
"s",
"modified",
"time... | 029cc6bee4812bf83c5d5fa58c49a82ff000d02c | https://github.com/zach-klippenstein/goadb/blob/029cc6bee4812bf83c5d5fa58c49a82ff000d02c/sync_client.go#L58-L69 |
135,655 | BurntSushi/graphics-go | graphics/detect/integral.go | newIntegrals | func newIntegrals(src image.Image) (*integral, *integral) {
b := src.Bounds()
srcg, ok := src.(*image.Gray)
if !ok {
srcg = image.NewGray(b)
draw.Draw(srcg, b, src, b.Min, draw.Src)
}
m := integral{
pix: make([]uint64, b.Max.Y*b.Max.X),
stride: b.Max.X,
rect: b,
}
mSq := integral{
pix: make(... | go | func newIntegrals(src image.Image) (*integral, *integral) {
b := src.Bounds()
srcg, ok := src.(*image.Gray)
if !ok {
srcg = image.NewGray(b)
draw.Draw(srcg, b, src, b.Min, draw.Src)
}
m := integral{
pix: make([]uint64, b.Max.Y*b.Max.X),
stride: b.Max.X,
rect: b,
}
mSq := integral{
pix: make(... | [
"func",
"newIntegrals",
"(",
"src",
"image",
".",
"Image",
")",
"(",
"*",
"integral",
",",
"*",
"integral",
")",
"{",
"b",
":=",
"src",
".",
"Bounds",
"(",
")",
"\n",
"srcg",
",",
"ok",
":=",
"src",
".",
"(",
"*",
"image",
".",
"Gray",
")",
"\n... | // newIntegrals returns the integral and the squared integral. | [
"newIntegrals",
"returns",
"the",
"integral",
"and",
"the",
"squared",
"integral",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/detect/integral.go#L63-L93 |
135,656 | BurntSushi/graphics-go | graphics/rotate.go | Rotate | func Rotate(dst draw.Image, src image.Image, opt *RotateOptions) error {
if dst == nil {
return errors.New("graphics: dst is nil")
}
if src == nil {
return errors.New("graphics: src is nil")
}
angle := 0.0
if opt != nil {
angle = opt.Angle
}
return I.Rotate(angle).TransformCenter(dst, src, interp.Biline... | go | func Rotate(dst draw.Image, src image.Image, opt *RotateOptions) error {
if dst == nil {
return errors.New("graphics: dst is nil")
}
if src == nil {
return errors.New("graphics: src is nil")
}
angle := 0.0
if opt != nil {
angle = opt.Angle
}
return I.Rotate(angle).TransformCenter(dst, src, interp.Biline... | [
"func",
"Rotate",
"(",
"dst",
"draw",
".",
"Image",
",",
"src",
"image",
".",
"Image",
",",
"opt",
"*",
"RotateOptions",
")",
"error",
"{",
"if",
"dst",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if"... | // Rotate produces a rotated version of src, drawn onto dst. | [
"Rotate",
"produces",
"a",
"rotated",
"version",
"of",
"src",
"drawn",
"onto",
"dst",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/rotate.go#L21-L35 |
135,657 | BurntSushi/graphics-go | graphics/affine.go | Mul | func (a Affine) Mul(b Affine) Affine {
return Affine{
a[0]*b[0] + a[1]*b[3] + a[2]*b[6],
a[0]*b[1] + a[1]*b[4] + a[2]*b[7],
a[0]*b[2] + a[1]*b[5] + a[2]*b[8],
a[3]*b[0] + a[4]*b[3] + a[5]*b[6],
a[3]*b[1] + a[4]*b[4] + a[5]*b[7],
a[3]*b[2] + a[4]*b[5] + a[5]*b[8],
a[6]*b[0] + a[7]*b[3] + a[8]*b[6],
a[6]... | go | func (a Affine) Mul(b Affine) Affine {
return Affine{
a[0]*b[0] + a[1]*b[3] + a[2]*b[6],
a[0]*b[1] + a[1]*b[4] + a[2]*b[7],
a[0]*b[2] + a[1]*b[5] + a[2]*b[8],
a[3]*b[0] + a[4]*b[3] + a[5]*b[6],
a[3]*b[1] + a[4]*b[4] + a[5]*b[7],
a[3]*b[2] + a[4]*b[5] + a[5]*b[8],
a[6]*b[0] + a[7]*b[3] + a[8]*b[6],
a[6]... | [
"func",
"(",
"a",
"Affine",
")",
"Mul",
"(",
"b",
"Affine",
")",
"Affine",
"{",
"return",
"Affine",
"{",
"a",
"[",
"0",
"]",
"*",
"b",
"[",
"0",
"]",
"+",
"a",
"[",
"1",
"]",
"*",
"b",
"[",
"3",
"]",
"+",
"a",
"[",
"2",
"]",
"*",
"b",
... | // Mul returns the multiplication of two affine transform matrices. | [
"Mul",
"returns",
"the",
"multiplication",
"of",
"two",
"affine",
"transform",
"matrices",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/affine.go#L27-L39 |
135,658 | BurntSushi/graphics-go | graphics/affine.go | Transform | func (a Affine) Transform(dst draw.Image, src image.Image, i interp.Interp) error {
if dst == nil {
return errors.New("graphics: dst is nil")
}
if src == nil {
return errors.New("graphics: src is nil")
}
// RGBA fast path.
dstRGBA, dstOk := dst.(*image.RGBA)
srcRGBA, srcOk := src.(*image.RGBA)
interpRGBA, ... | go | func (a Affine) Transform(dst draw.Image, src image.Image, i interp.Interp) error {
if dst == nil {
return errors.New("graphics: dst is nil")
}
if src == nil {
return errors.New("graphics: src is nil")
}
// RGBA fast path.
dstRGBA, dstOk := dst.(*image.RGBA)
srcRGBA, srcOk := src.(*image.RGBA)
interpRGBA, ... | [
"func",
"(",
"a",
"Affine",
")",
"Transform",
"(",
"dst",
"draw",
".",
"Image",
",",
"src",
"image",
".",
"Image",
",",
"i",
"interp",
".",
"Interp",
")",
"error",
"{",
"if",
"dst",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"... | // Transform applies the affine transform to src and produces dst. | [
"Transform",
"applies",
"the",
"affine",
"transform",
"to",
"src",
"and",
"produces",
"dst",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/affine.go#L61-L88 |
135,659 | BurntSushi/graphics-go | graphics/affine.go | Scale | func (a Affine) Scale(x, y float64) Affine {
return a.Mul(Affine{
1 / x, 0, 0,
0, 1 / y, 0,
0, 0, 1,
})
} | go | func (a Affine) Scale(x, y float64) Affine {
return a.Mul(Affine{
1 / x, 0, 0,
0, 1 / y, 0,
0, 0, 1,
})
} | [
"func",
"(",
"a",
"Affine",
")",
"Scale",
"(",
"x",
",",
"y",
"float64",
")",
"Affine",
"{",
"return",
"a",
".",
"Mul",
"(",
"Affine",
"{",
"1",
"/",
"x",
",",
"0",
",",
"0",
",",
"0",
",",
"1",
"/",
"y",
",",
"0",
",",
"0",
",",
"0",
"... | // Scale produces a scaling transform of factors x and y. | [
"Scale",
"produces",
"a",
"scaling",
"transform",
"of",
"factors",
"x",
"and",
"y",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/affine.go#L123-L129 |
135,660 | BurntSushi/graphics-go | graphics/affine.go | Rotate | func (a Affine) Rotate(angle float64) Affine {
s, c := math.Sincos(angle)
return a.Mul(Affine{
+c, +s, +0,
-s, +c, +0,
+0, +0, +1,
})
} | go | func (a Affine) Rotate(angle float64) Affine {
s, c := math.Sincos(angle)
return a.Mul(Affine{
+c, +s, +0,
-s, +c, +0,
+0, +0, +1,
})
} | [
"func",
"(",
"a",
"Affine",
")",
"Rotate",
"(",
"angle",
"float64",
")",
"Affine",
"{",
"s",
",",
"c",
":=",
"math",
".",
"Sincos",
"(",
"angle",
")",
"\n",
"return",
"a",
".",
"Mul",
"(",
"Affine",
"{",
"+",
"c",
",",
"+",
"s",
",",
"+",
"0"... | // Rotate produces a clockwise rotation transform of angle, in radians. | [
"Rotate",
"produces",
"a",
"clockwise",
"rotation",
"transform",
"of",
"angle",
"in",
"radians",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/affine.go#L132-L139 |
135,661 | BurntSushi/graphics-go | graphics/affine.go | Shear | func (a Affine) Shear(x, y float64) Affine {
d := 1 - x*y
return a.Mul(Affine{
+1 / d, -x / d, 0,
-y / d, +1 / d, 0,
0, 0, 1,
})
} | go | func (a Affine) Shear(x, y float64) Affine {
d := 1 - x*y
return a.Mul(Affine{
+1 / d, -x / d, 0,
-y / d, +1 / d, 0,
0, 0, 1,
})
} | [
"func",
"(",
"a",
"Affine",
")",
"Shear",
"(",
"x",
",",
"y",
"float64",
")",
"Affine",
"{",
"d",
":=",
"1",
"-",
"x",
"*",
"y",
"\n",
"return",
"a",
".",
"Mul",
"(",
"Affine",
"{",
"+",
"1",
"/",
"d",
",",
"-",
"x",
"/",
"d",
",",
"0",
... | // Shear produces a shear transform by the slopes x and y. | [
"Shear",
"produces",
"a",
"shear",
"transform",
"by",
"the",
"slopes",
"x",
"and",
"y",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/affine.go#L142-L149 |
135,662 | BurntSushi/graphics-go | graphics/affine.go | Translate | func (a Affine) Translate(x, y float64) Affine {
return a.Mul(Affine{
1, 0, -x,
0, 1, -y,
0, 0, +1,
})
} | go | func (a Affine) Translate(x, y float64) Affine {
return a.Mul(Affine{
1, 0, -x,
0, 1, -y,
0, 0, +1,
})
} | [
"func",
"(",
"a",
"Affine",
")",
"Translate",
"(",
"x",
",",
"y",
"float64",
")",
"Affine",
"{",
"return",
"a",
".",
"Mul",
"(",
"Affine",
"{",
"1",
",",
"0",
",",
"-",
"x",
",",
"0",
",",
"1",
",",
"-",
"y",
",",
"0",
",",
"0",
",",
"+",... | // Translate produces a translation transform with pixel distances x and y. | [
"Translate",
"produces",
"a",
"translation",
"transform",
"with",
"pixel",
"distances",
"x",
"and",
"y",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/affine.go#L152-L158 |
135,663 | BurntSushi/graphics-go | graphics/affine.go | Center | func (a Affine) Center(x, y float64) Affine {
return I.Translate(-x, -y).Mul(a).Translate(x, y)
} | go | func (a Affine) Center(x, y float64) Affine {
return I.Translate(-x, -y).Mul(a).Translate(x, y)
} | [
"func",
"(",
"a",
"Affine",
")",
"Center",
"(",
"x",
",",
"y",
"float64",
")",
"Affine",
"{",
"return",
"I",
".",
"Translate",
"(",
"-",
"x",
",",
"-",
"y",
")",
".",
"Mul",
"(",
"a",
")",
".",
"Translate",
"(",
"x",
",",
"y",
")",
"\n",
"}... | // Center produces the affine transform, centered around the provided point. | [
"Center",
"produces",
"the",
"affine",
"transform",
"centered",
"around",
"the",
"provided",
"point",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/affine.go#L161-L163 |
135,664 | BurntSushi/graphics-go | graphics/convolve/convolve.go | NewKernel | func NewKernel(w []float64) (Kernel, error) {
if _, err := kernelSize(w); err != nil {
return nil, err
}
return fullKernel(w), nil
} | go | func NewKernel(w []float64) (Kernel, error) {
if _, err := kernelSize(w); err != nil {
return nil, err
}
return fullKernel(w), nil
} | [
"func",
"NewKernel",
"(",
"w",
"[",
"]",
"float64",
")",
"(",
"Kernel",
",",
"error",
")",
"{",
"if",
"_",
",",
"err",
":=",
"kernelSize",
"(",
"w",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"ful... | // NewKernel returns a square convolution kernel. | [
"NewKernel",
"returns",
"a",
"square",
"convolution",
"kernel",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/convolve/convolve.go#L72-L77 |
135,665 | BurntSushi/graphics-go | graphics/convolve/convolve.go | Convolve | func Convolve(dst draw.Image, src image.Image, k Kernel) (err error) {
if dst == nil || src == nil || k == nil {
return nil
}
b := dst.Bounds()
dstRgba, ok := dst.(*image.RGBA)
if !ok {
dstRgba = image.NewRGBA(b)
}
switch k := k.(type) {
case *SeparableKernel:
err = convolveRGBASep(dstRgba, src, k)
def... | go | func Convolve(dst draw.Image, src image.Image, k Kernel) (err error) {
if dst == nil || src == nil || k == nil {
return nil
}
b := dst.Bounds()
dstRgba, ok := dst.(*image.RGBA)
if !ok {
dstRgba = image.NewRGBA(b)
}
switch k := k.(type) {
case *SeparableKernel:
err = convolveRGBASep(dstRgba, src, k)
def... | [
"func",
"Convolve",
"(",
"dst",
"draw",
".",
"Image",
",",
"src",
"image",
".",
"Image",
",",
"k",
"Kernel",
")",
"(",
"err",
"error",
")",
"{",
"if",
"dst",
"==",
"nil",
"||",
"src",
"==",
"nil",
"||",
"k",
"==",
"nil",
"{",
"return",
"nil",
"... | // Convolve produces dst by applying the convolution kernel k to src. | [
"Convolve",
"produces",
"dst",
"by",
"applying",
"the",
"convolution",
"kernel",
"k",
"to",
"src",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/convolve/convolve.go#L248-L274 |
135,666 | BurntSushi/graphics-go | graphics/scale.go | Scale | func Scale(dst draw.Image, src image.Image) error {
if dst == nil {
return errors.New("graphics: dst is nil")
}
if src == nil {
return errors.New("graphics: src is nil")
}
b := dst.Bounds()
srcb := src.Bounds()
if b.Empty() || srcb.Empty() {
return nil
}
sx := float64(b.Dx()) / float64(srcb.Dx())
sy :=... | go | func Scale(dst draw.Image, src image.Image) error {
if dst == nil {
return errors.New("graphics: dst is nil")
}
if src == nil {
return errors.New("graphics: src is nil")
}
b := dst.Bounds()
srcb := src.Bounds()
if b.Empty() || srcb.Empty() {
return nil
}
sx := float64(b.Dx()) / float64(srcb.Dx())
sy :=... | [
"func",
"Scale",
"(",
"dst",
"draw",
".",
"Image",
",",
"src",
"image",
".",
"Image",
")",
"error",
"{",
"if",
"dst",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"src",
"==",
"nil",
"{",
"retur... | // Scale produces a scaled version of the image using bilinear interpolation. | [
"Scale",
"produces",
"a",
"scaled",
"version",
"of",
"the",
"image",
"using",
"bilinear",
"interpolation",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/scale.go#L15-L31 |
135,667 | BurntSushi/graphics-go | graphics/detect/detect.go | Match | func (c *Cascade) Match(m image.Image) bool {
return c.classify(newWindow(m))
} | go | func (c *Cascade) Match(m image.Image) bool {
return c.classify(newWindow(m))
} | [
"func",
"(",
"c",
"*",
"Cascade",
")",
"Match",
"(",
"m",
"image",
".",
"Image",
")",
"bool",
"{",
"return",
"c",
".",
"classify",
"(",
"newWindow",
"(",
"m",
")",
")",
"\n",
"}"
] | // Match returns true if the full image is classified as an object. | [
"Match",
"returns",
"true",
"if",
"the",
"full",
"image",
"is",
"classified",
"as",
"an",
"object",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/detect/detect.go#L39-L41 |
135,668 | BurntSushi/graphics-go | graphics/detect/detect.go | Find | func (c *Cascade) Find(m image.Image) []image.Rectangle {
// TODO(crawshaw): Consider de-duping strategies.
matches := []image.Rectangle{}
w := newWindow(m)
b := m.Bounds()
origScale := c.Size
for s := origScale; s.X < b.Dx() && s.Y < b.Dy(); s = s.Add(s.Div(10)) {
// translate region and classify
tx := imag... | go | func (c *Cascade) Find(m image.Image) []image.Rectangle {
// TODO(crawshaw): Consider de-duping strategies.
matches := []image.Rectangle{}
w := newWindow(m)
b := m.Bounds()
origScale := c.Size
for s := origScale; s.X < b.Dx() && s.Y < b.Dy(); s = s.Add(s.Div(10)) {
// translate region and classify
tx := imag... | [
"func",
"(",
"c",
"*",
"Cascade",
")",
"Find",
"(",
"m",
"image",
".",
"Image",
")",
"[",
"]",
"image",
".",
"Rectangle",
"{",
"// TODO(crawshaw): Consider de-duping strategies.",
"matches",
":=",
"[",
"]",
"image",
".",
"Rectangle",
"{",
"}",
"\n",
"w",
... | // Find returns a set of areas of m that match the feature cascade c. | [
"Find",
"returns",
"a",
"set",
"of",
"areas",
"of",
"m",
"that",
"match",
"the",
"feature",
"cascade",
"c",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/detect/detect.go#L44-L64 |
135,669 | BurntSushi/graphics-go | graphics/detect/opencv_parser.go | ParseOpenCV | func ParseOpenCV(r io.Reader) (cascade *Cascade, name string, err error) {
// BUG(crawshaw): tag-based parsing doesn't seem to work with <_>
buf, err := ioutil.ReadAll(r)
if err != nil {
return
}
buf = bytes.Replace(buf, []byte("<_>"), []byte("<grp>"), -1)
buf = bytes.Replace(buf, []byte("</_>"), []byte("</grp>... | go | func ParseOpenCV(r io.Reader) (cascade *Cascade, name string, err error) {
// BUG(crawshaw): tag-based parsing doesn't seem to work with <_>
buf, err := ioutil.ReadAll(r)
if err != nil {
return
}
buf = bytes.Replace(buf, []byte("<_>"), []byte("<grp>"), -1)
buf = bytes.Replace(buf, []byte("</_>"), []byte("</grp>... | [
"func",
"ParseOpenCV",
"(",
"r",
"io",
".",
"Reader",
")",
"(",
"cascade",
"*",
"Cascade",
",",
"name",
"string",
",",
"err",
"error",
")",
"{",
"// BUG(crawshaw): tag-based parsing doesn't seem to work with <_>",
"buf",
",",
"err",
":=",
"ioutil",
".",
"ReadAll... | // ParseOpenCV produces a detection Cascade from an OpenCV XML file. | [
"ParseOpenCV",
"produces",
"a",
"detection",
"Cascade",
"from",
"an",
"OpenCV",
"XML",
"file",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/detect/opencv_parser.go#L110-L125 |
135,670 | BurntSushi/graphics-go | graphics/blur.go | Blur | func Blur(dst draw.Image, src image.Image, opt *BlurOptions) error {
if dst == nil {
return errors.New("graphics: dst is nil")
}
if src == nil {
return errors.New("graphics: src is nil")
}
sd := DefaultStdDev
size := 0
if opt != nil {
sd = opt.StdDev
size = opt.Size
}
if size < 1 {
size = int(math... | go | func Blur(dst draw.Image, src image.Image, opt *BlurOptions) error {
if dst == nil {
return errors.New("graphics: dst is nil")
}
if src == nil {
return errors.New("graphics: src is nil")
}
sd := DefaultStdDev
size := 0
if opt != nil {
sd = opt.StdDev
size = opt.Size
}
if size < 1 {
size = int(math... | [
"func",
"Blur",
"(",
"dst",
"draw",
".",
"Image",
",",
"src",
"image",
".",
"Image",
",",
"opt",
"*",
"BlurOptions",
")",
"error",
"{",
"if",
"dst",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
... | // Blur produces a blurred version of the image, using a Gaussian blur. | [
"Blur",
"produces",
"a",
"blurred",
"version",
"of",
"the",
"image",
"using",
"a",
"Gaussian",
"blur",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/blur.go#L27-L68 |
135,671 | BurntSushi/graphics-go | graphics/thumbnail.go | Thumbnail | func Thumbnail(dst draw.Image, src image.Image) error {
// Scale down src in the dimension that is closer to dst.
sb := src.Bounds()
db := dst.Bounds()
rx := float64(sb.Dx()) / float64(db.Dx())
ry := float64(sb.Dy()) / float64(db.Dy())
var b image.Rectangle
if rx < ry {
b = image.Rect(0, 0, db.Dx(), int(float6... | go | func Thumbnail(dst draw.Image, src image.Image) error {
// Scale down src in the dimension that is closer to dst.
sb := src.Bounds()
db := dst.Bounds()
rx := float64(sb.Dx()) / float64(db.Dx())
ry := float64(sb.Dy()) / float64(db.Dy())
var b image.Rectangle
if rx < ry {
b = image.Rect(0, 0, db.Dx(), int(float6... | [
"func",
"Thumbnail",
"(",
"dst",
"draw",
".",
"Image",
",",
"src",
"image",
".",
"Image",
")",
"error",
"{",
"// Scale down src in the dimension that is closer to dst.",
"sb",
":=",
"src",
".",
"Bounds",
"(",
")",
"\n",
"db",
":=",
"dst",
".",
"Bounds",
"(",... | // Thumbnail scales and crops src so it fits in dst. | [
"Thumbnail",
"scales",
"and",
"crops",
"src",
"so",
"it",
"fits",
"in",
"dst",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/thumbnail.go#L13-L41 |
135,672 | BurntSushi/graphics-go | graphics/detect/projector.go | newProjector | func newProjector(dst image.Rectangle, src image.Rectangle) *projector {
return &projector{
rx: float64(dst.Dx()) / float64(src.Dx()),
ry: float64(dst.Dy()) / float64(src.Dy()),
dx: float64(dst.Min.X - src.Min.X),
dy: float64(dst.Min.Y - src.Min.Y),
r: dst,
}
} | go | func newProjector(dst image.Rectangle, src image.Rectangle) *projector {
return &projector{
rx: float64(dst.Dx()) / float64(src.Dx()),
ry: float64(dst.Dy()) / float64(src.Dy()),
dx: float64(dst.Min.X - src.Min.X),
dy: float64(dst.Min.Y - src.Min.Y),
r: dst,
}
} | [
"func",
"newProjector",
"(",
"dst",
"image",
".",
"Rectangle",
",",
"src",
"image",
".",
"Rectangle",
")",
"*",
"projector",
"{",
"return",
"&",
"projector",
"{",
"rx",
":",
"float64",
"(",
"dst",
".",
"Dx",
"(",
")",
")",
"/",
"float64",
"(",
"src",... | // newProjector creates a Projector with source src and target dst. | [
"newProjector",
"creates",
"a",
"Projector",
"with",
"source",
"src",
"and",
"target",
"dst",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/detect/projector.go#L22-L30 |
135,673 | BurntSushi/graphics-go | graphics/detect/projector.go | pt | func (s *projector) pt(p image.Point) image.Point {
return image.Point{
clamp(s.rx*float64(p.X)+s.dx, s.r.Min.X, s.r.Max.X),
clamp(s.ry*float64(p.Y)+s.dy, s.r.Min.Y, s.r.Max.Y),
}
} | go | func (s *projector) pt(p image.Point) image.Point {
return image.Point{
clamp(s.rx*float64(p.X)+s.dx, s.r.Min.X, s.r.Max.X),
clamp(s.ry*float64(p.Y)+s.dy, s.r.Min.Y, s.r.Max.Y),
}
} | [
"func",
"(",
"s",
"*",
"projector",
")",
"pt",
"(",
"p",
"image",
".",
"Point",
")",
"image",
".",
"Point",
"{",
"return",
"image",
".",
"Point",
"{",
"clamp",
"(",
"s",
".",
"rx",
"*",
"float64",
"(",
"p",
".",
"X",
")",
"+",
"s",
".",
"dx",... | // pt projects p from the source rectangle onto the target rectangle. | [
"pt",
"projects",
"p",
"from",
"the",
"source",
"rectangle",
"onto",
"the",
"target",
"rectangle",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/detect/projector.go#L33-L38 |
135,674 | BurntSushi/graphics-go | graphics/detect/projector.go | rect | func (s *projector) rect(r image.Rectangle) image.Rectangle {
return image.Rectangle{s.pt(r.Min), s.pt(r.Max)}
} | go | func (s *projector) rect(r image.Rectangle) image.Rectangle {
return image.Rectangle{s.pt(r.Min), s.pt(r.Max)}
} | [
"func",
"(",
"s",
"*",
"projector",
")",
"rect",
"(",
"r",
"image",
".",
"Rectangle",
")",
"image",
".",
"Rectangle",
"{",
"return",
"image",
".",
"Rectangle",
"{",
"s",
".",
"pt",
"(",
"r",
".",
"Min",
")",
",",
"s",
".",
"pt",
"(",
"r",
".",
... | // rect projects r from the source rectangle onto the target rectangle. | [
"rect",
"projects",
"r",
"from",
"the",
"source",
"rectangle",
"onto",
"the",
"target",
"rectangle",
"."
] | b43f31a4a96688fba0b612e25e22648b9267e498 | https://github.com/BurntSushi/graphics-go/blob/b43f31a4a96688fba0b612e25e22648b9267e498/graphics/detect/projector.go#L41-L43 |
135,675 | 0x19/goesl | server.go | Start | func (s *OutboundServer) Start() error {
Notice("Starting Freeswitch Outbound Server @ (address: %s) ...", s.Addr)
var err error
s.Listener, err = net.Listen(s.Proto, s.Addr)
if err != nil {
Error(ECouldNotStartListener, err)
return err
}
quit := make(chan bool)
go func() {
for {
Warning("Waiting f... | go | func (s *OutboundServer) Start() error {
Notice("Starting Freeswitch Outbound Server @ (address: %s) ...", s.Addr)
var err error
s.Listener, err = net.Listen(s.Proto, s.Addr)
if err != nil {
Error(ECouldNotStartListener, err)
return err
}
quit := make(chan bool)
go func() {
for {
Warning("Waiting f... | [
"func",
"(",
"s",
"*",
"OutboundServer",
")",
"Start",
"(",
")",
"error",
"{",
"Notice",
"(",
"\"",
"\"",
",",
"s",
".",
"Addr",
")",
"\n\n",
"var",
"err",
"error",
"\n\n",
"s",
".",
"Listener",
",",
"err",
"=",
"net",
".",
"Listen",
"(",
"s",
... | // Start - Will start new outbound server | [
"Start",
"-",
"Will",
"start",
"new",
"outbound",
"server"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/server.go#L28-L74 |
135,676 | 0x19/goesl | server.go | NewOutboundServer | func NewOutboundServer(addr string) (*OutboundServer, error) {
if len(addr) < 2 {
addr = os.Getenv("GOESL_OUTBOUND_SERVER_ADDR")
if addr == "" {
return nil, fmt.Errorf(EInvalidServerAddr, addr)
}
}
server := OutboundServer{
Addr: addr,
Proto: "tcp",
Conns: make(chan SocketConnection),
}
sig := m... | go | func NewOutboundServer(addr string) (*OutboundServer, error) {
if len(addr) < 2 {
addr = os.Getenv("GOESL_OUTBOUND_SERVER_ADDR")
if addr == "" {
return nil, fmt.Errorf(EInvalidServerAddr, addr)
}
}
server := OutboundServer{
Addr: addr,
Proto: "tcp",
Conns: make(chan SocketConnection),
}
sig := m... | [
"func",
"NewOutboundServer",
"(",
"addr",
"string",
")",
"(",
"*",
"OutboundServer",
",",
"error",
")",
"{",
"if",
"len",
"(",
"addr",
")",
"<",
"2",
"{",
"addr",
"=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"addr",
"==",
"\"",
"... | // NewOutboundServer - Will instanciate new outbound server | [
"NewOutboundServer",
"-",
"Will",
"instanciate",
"new",
"outbound",
"server"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/server.go#L83-L110 |
135,677 | 0x19/goesl | message.go | String | func (m *Message) String() string {
return fmt.Sprintf("%v body=%s", m.Headers, m.Body)
} | go | func (m *Message) String() string {
return fmt.Sprintf("%v body=%s", m.Headers, m.Body)
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"m",
".",
"Headers",
",",
"m",
".",
"Body",
")",
"\n",
"}"
] | // String - Will return message representation as string | [
"String",
"-",
"Will",
"return",
"message",
"representation",
"as",
"string"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/message.go#L33-L35 |
135,678 | 0x19/goesl | message.go | Dump | func (m *Message) Dump() (resp string) {
var keys []string
for k := range m.Headers {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
resp += fmt.Sprintf("%s: %s\r\n", k, m.Headers[k])
}
resp += fmt.Sprintf("BODY: %v\r\n", string(m.Body))
return
} | go | func (m *Message) Dump() (resp string) {
var keys []string
for k := range m.Headers {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
resp += fmt.Sprintf("%s: %s\r\n", k, m.Headers[k])
}
resp += fmt.Sprintf("BODY: %v\r\n", string(m.Body))
return
} | [
"func",
"(",
"m",
"*",
"Message",
")",
"Dump",
"(",
")",
"(",
"resp",
"string",
")",
"{",
"var",
"keys",
"[",
"]",
"string",
"\n\n",
"for",
"k",
":=",
"range",
"m",
".",
"Headers",
"{",
"keys",
"=",
"append",
"(",
"keys",
",",
"k",
")",
"\n",
... | // Dump - Will return message prepared to be dumped out. It's like prettify message for output | [
"Dump",
"-",
"Will",
"return",
"message",
"prepared",
"to",
"be",
"dumped",
"out",
".",
"It",
"s",
"like",
"prettify",
"message",
"for",
"output"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/message.go#L182-L198 |
135,679 | 0x19/goesl | connection.go | Dial | func (c *SocketConnection) Dial(network string, addr string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout(network, addr, timeout)
} | go | func (c *SocketConnection) Dial(network string, addr string, timeout time.Duration) (net.Conn, error) {
return net.DialTimeout(network, addr, timeout)
} | [
"func",
"(",
"c",
"*",
"SocketConnection",
")",
"Dial",
"(",
"network",
"string",
",",
"addr",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"return",
"net",
".",
"DialTimeout",
"(",
"network",... | // Dial - Will establish timedout dial against specified address. In this case, it will be freeswitch server | [
"Dial",
"-",
"Will",
"establish",
"timedout",
"dial",
"against",
"specified",
"address",
".",
"In",
"this",
"case",
"it",
"will",
"be",
"freeswitch",
"server"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/connection.go#L30-L32 |
135,680 | 0x19/goesl | connection.go | Send | func (c *SocketConnection) Send(cmd string) error {
if strings.Contains(cmd, "\r\n") {
return fmt.Errorf(EInvalidCommandProvided, cmd)
}
// lock mutex
c.mtx.Lock()
defer c.mtx.Unlock()
_, err := io.WriteString(c, cmd)
if err != nil {
return err
}
_, err = io.WriteString(c, "\r\n\r\n")
if err != nil {
... | go | func (c *SocketConnection) Send(cmd string) error {
if strings.Contains(cmd, "\r\n") {
return fmt.Errorf(EInvalidCommandProvided, cmd)
}
// lock mutex
c.mtx.Lock()
defer c.mtx.Unlock()
_, err := io.WriteString(c, cmd)
if err != nil {
return err
}
_, err = io.WriteString(c, "\r\n\r\n")
if err != nil {
... | [
"func",
"(",
"c",
"*",
"SocketConnection",
")",
"Send",
"(",
"cmd",
"string",
")",
"error",
"{",
"if",
"strings",
".",
"Contains",
"(",
"cmd",
",",
"\"",
"\\r",
"\\n",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"EInvalidCommandProvided",
",",... | // Send - Will send raw message to open net connection | [
"Send",
"-",
"Will",
"send",
"raw",
"message",
"to",
"open",
"net",
"connection"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/connection.go#L35-L56 |
135,681 | 0x19/goesl | connection.go | SendMany | func (c *SocketConnection) SendMany(cmds []string) error {
for _, cmd := range cmds {
if err := c.Send(cmd); err != nil {
return err
}
}
return nil
} | go | func (c *SocketConnection) SendMany(cmds []string) error {
for _, cmd := range cmds {
if err := c.Send(cmd); err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"c",
"*",
"SocketConnection",
")",
"SendMany",
"(",
"cmds",
"[",
"]",
"string",
")",
"error",
"{",
"for",
"_",
",",
"cmd",
":=",
"range",
"cmds",
"{",
"if",
"err",
":=",
"c",
".",
"Send",
"(",
"cmd",
")",
";",
"err",
"!=",
"nil",
"... | // SendMany - Will loop against passed commands and return 1st error if error happens | [
"SendMany",
"-",
"Will",
"loop",
"against",
"passed",
"commands",
"and",
"return",
"1st",
"error",
"if",
"error",
"happens"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/connection.go#L59-L68 |
135,682 | 0x19/goesl | connection.go | SendEvent | func (c *SocketConnection) SendEvent(eventHeaders []string) error {
if len(eventHeaders) <= 0 {
return fmt.Errorf(ECouldNotSendEvent, len(eventHeaders))
}
// lock mutex to prevent event headers from conflicting
c.mtx.Lock()
defer c.mtx.Unlock()
_, err := io.WriteString(c, "sendevent ")
if err != nil {
retu... | go | func (c *SocketConnection) SendEvent(eventHeaders []string) error {
if len(eventHeaders) <= 0 {
return fmt.Errorf(ECouldNotSendEvent, len(eventHeaders))
}
// lock mutex to prevent event headers from conflicting
c.mtx.Lock()
defer c.mtx.Unlock()
_, err := io.WriteString(c, "sendevent ")
if err != nil {
retu... | [
"func",
"(",
"c",
"*",
"SocketConnection",
")",
"SendEvent",
"(",
"eventHeaders",
"[",
"]",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"eventHeaders",
")",
"<=",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"ECouldNotSendEvent",
",",
"len",
"(",
... | // SendEvent - Will loop against passed event headers | [
"SendEvent",
"-",
"Will",
"loop",
"against",
"passed",
"event",
"headers"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/connection.go#L71-L104 |
135,683 | 0x19/goesl | connection.go | SendMsg | func (c *SocketConnection) SendMsg(msg map[string]string, uuid, data string) (m *Message, err error) {
b := bytes.NewBufferString("sendmsg")
if uuid != "" {
if strings.Contains(uuid, "\r\n") {
return nil, fmt.Errorf(EInvalidCommandProvided, msg)
}
b.WriteString(" " + uuid)
}
b.WriteString("\n")
for k... | go | func (c *SocketConnection) SendMsg(msg map[string]string, uuid, data string) (m *Message, err error) {
b := bytes.NewBufferString("sendmsg")
if uuid != "" {
if strings.Contains(uuid, "\r\n") {
return nil, fmt.Errorf(EInvalidCommandProvided, msg)
}
b.WriteString(" " + uuid)
}
b.WriteString("\n")
for k... | [
"func",
"(",
"c",
"*",
"SocketConnection",
")",
"SendMsg",
"(",
"msg",
"map",
"[",
"string",
"]",
"string",
",",
"uuid",
",",
"data",
"string",
")",
"(",
"m",
"*",
"Message",
",",
"err",
"error",
")",
"{",
"b",
":=",
"bytes",
".",
"NewBufferString",
... | // SendMsg - Basically this func will send message to the opened connection | [
"SendMsg",
"-",
"Basically",
"this",
"func",
"will",
"send",
"message",
"to",
"the",
"opened",
"connection"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/connection.go#L127-L176 |
135,684 | 0x19/goesl | connection.go | ReadMessage | func (c *SocketConnection) ReadMessage() (*Message, error) {
Debug("Waiting for connection message to be received ...")
select {
case err := <-c.err:
return nil, err
case msg := <-c.m:
return msg, nil
}
} | go | func (c *SocketConnection) ReadMessage() (*Message, error) {
Debug("Waiting for connection message to be received ...")
select {
case err := <-c.err:
return nil, err
case msg := <-c.m:
return msg, nil
}
} | [
"func",
"(",
"c",
"*",
"SocketConnection",
")",
"ReadMessage",
"(",
")",
"(",
"*",
"Message",
",",
"error",
")",
"{",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"select",
"{",
"case",
"err",
":=",
"<-",
"c",
".",
"err",
":",
"return",
"nil",
",",
"er... | // ReadMessage - Will read message from channels and return them back accordingy.
// If error is received, error will be returned. If not, message will be returned back! | [
"ReadMessage",
"-",
"Will",
"read",
"message",
"from",
"channels",
"and",
"return",
"them",
"back",
"accordingy",
".",
"If",
"error",
"is",
"received",
"error",
"will",
"be",
"returned",
".",
"If",
"not",
"message",
"will",
"be",
"returned",
"back!"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/connection.go#L186-L195 |
135,685 | 0x19/goesl | connection.go | Handle | func (c *SocketConnection) Handle() {
done := make(chan bool)
go func() {
for {
msg, err := newMessage(bufio.NewReaderSize(c, ReadBufferSize), true)
if err != nil {
c.err <- err
done <- true
break
}
c.m <- msg
}
}()
<-done
// Closing the connection now as there's nothing left to d... | go | func (c *SocketConnection) Handle() {
done := make(chan bool)
go func() {
for {
msg, err := newMessage(bufio.NewReaderSize(c, ReadBufferSize), true)
if err != nil {
c.err <- err
done <- true
break
}
c.m <- msg
}
}()
<-done
// Closing the connection now as there's nothing left to d... | [
"func",
"(",
"c",
"*",
"SocketConnection",
")",
"Handle",
"(",
")",
"{",
"done",
":=",
"make",
"(",
"chan",
"bool",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"msg",
",",
"err",
":=",
"newMessage",
"(",
"bufio",
".",
"NewReaderSize",
"("... | // Handle - Will handle new messages and close connection when there are no messages left to process | [
"Handle",
"-",
"Will",
"handle",
"new",
"messages",
"and",
"close",
"connection",
"when",
"there",
"are",
"no",
"messages",
"left",
"to",
"process"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/connection.go#L198-L220 |
135,686 | 0x19/goesl | connection.go | Close | func (c *SocketConnection) Close() error {
if err := c.Conn.Close(); err != nil {
return err
}
return nil
} | go | func (c *SocketConnection) Close() error {
if err := c.Conn.Close(); err != nil {
return err
}
return nil
} | [
"func",
"(",
"c",
"*",
"SocketConnection",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"c",
".",
"Conn",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] | // Close - Will close down net connection and return error if error happen | [
"Close",
"-",
"Will",
"close",
"down",
"net",
"connection",
"and",
"return",
"error",
"if",
"error",
"happen"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/connection.go#L223-L229 |
135,687 | 0x19/goesl | helpers.go | ExecuteSet | func (sc *SocketConnection) ExecuteSet(key string, value string, sync bool) (m *Message, err error) {
return sc.Execute("set", key+"="+value, sync)
} | go | func (sc *SocketConnection) ExecuteSet(key string, value string, sync bool) (m *Message, err error) {
return sc.Execute("set", key+"="+value, sync)
} | [
"func",
"(",
"sc",
"*",
"SocketConnection",
")",
"ExecuteSet",
"(",
"key",
"string",
",",
"value",
"string",
",",
"sync",
"bool",
")",
"(",
"m",
"*",
"Message",
",",
"err",
"error",
")",
"{",
"return",
"sc",
".",
"Execute",
"(",
"\"",
"\"",
",",
"k... | // Set - Helper that you can use to execute SET application against active ESL session | [
"Set",
"-",
"Helper",
"that",
"you",
"can",
"use",
"to",
"execute",
"SET",
"application",
"against",
"active",
"ESL",
"session"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/helpers.go#L10-L12 |
135,688 | 0x19/goesl | helpers.go | ExecuteAnswer | func (sc *SocketConnection) ExecuteAnswer(args string, sync bool) (m *Message, err error) {
return sc.Execute("answer", args, sync)
} | go | func (sc *SocketConnection) ExecuteAnswer(args string, sync bool) (m *Message, err error) {
return sc.Execute("answer", args, sync)
} | [
"func",
"(",
"sc",
"*",
"SocketConnection",
")",
"ExecuteAnswer",
"(",
"args",
"string",
",",
"sync",
"bool",
")",
"(",
"m",
"*",
"Message",
",",
"err",
"error",
")",
"{",
"return",
"sc",
".",
"Execute",
"(",
"\"",
"\"",
",",
"args",
",",
"sync",
"... | // ExecuteHangup - Helper desgned to help with executing Answer against active ESL session | [
"ExecuteHangup",
"-",
"Helper",
"desgned",
"to",
"help",
"with",
"executing",
"Answer",
"against",
"active",
"ESL",
"session"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/helpers.go#L15-L17 |
135,689 | 0x19/goesl | helpers.go | ExecuteHangup | func (sc *SocketConnection) ExecuteHangup(uuid string, args string, sync bool) (m *Message, err error) {
if uuid != "" {
return sc.ExecuteUUID(uuid, "hangup", args, sync)
}
return sc.Execute("hangup", args, sync)
} | go | func (sc *SocketConnection) ExecuteHangup(uuid string, args string, sync bool) (m *Message, err error) {
if uuid != "" {
return sc.ExecuteUUID(uuid, "hangup", args, sync)
}
return sc.Execute("hangup", args, sync)
} | [
"func",
"(",
"sc",
"*",
"SocketConnection",
")",
"ExecuteHangup",
"(",
"uuid",
"string",
",",
"args",
"string",
",",
"sync",
"bool",
")",
"(",
"m",
"*",
"Message",
",",
"err",
"error",
")",
"{",
"if",
"uuid",
"!=",
"\"",
"\"",
"{",
"return",
"sc",
... | // ExecuteHangup - Helper desgned to help with executing Hangup against active ESL session | [
"ExecuteHangup",
"-",
"Helper",
"desgned",
"to",
"help",
"with",
"executing",
"Hangup",
"against",
"active",
"ESL",
"session"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/helpers.go#L20-L26 |
135,690 | 0x19/goesl | examples/client.go | main | func main() {
// Boost it as much as it can go ...
runtime.GOMAXPROCS(runtime.NumCPU())
client, err := NewClient(*fshost, *fsport, *password, *timeout)
if err != nil {
Error("Error while creating new client: %s", err)
return
}
Debug("Yuhu! New client: %q", client)
// Apparently all is good... Let us now... | go | func main() {
// Boost it as much as it can go ...
runtime.GOMAXPROCS(runtime.NumCPU())
client, err := NewClient(*fshost, *fsport, *password, *timeout)
if err != nil {
Error("Error while creating new client: %s", err)
return
}
Debug("Yuhu! New client: %q", client)
// Apparently all is good... Let us now... | [
"func",
"main",
"(",
")",
"{",
"// Boost it as much as it can go ...",
"runtime",
".",
"GOMAXPROCS",
"(",
"runtime",
".",
"NumCPU",
"(",
")",
")",
"\n\n",
"client",
",",
"err",
":=",
"NewClient",
"(",
"*",
"fshost",
",",
"*",
"fsport",
",",
"*",
"password"... | // Small client that will first make sure all events are returned as JSON and second, will originate | [
"Small",
"client",
"that",
"will",
"first",
"make",
"sure",
"all",
"events",
"are",
"returned",
"as",
"JSON",
"and",
"second",
"will",
"originate"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/examples/client.go#L25-L62 |
135,691 | 0x19/goesl | client.go | EstablishConnection | func (c *Client) EstablishConnection() error {
conn, err := c.Dial(c.Proto, c.Addr, time.Duration(c.Timeout*int(time.Second)))
if err != nil {
return err
}
c.SocketConnection = SocketConnection{
Conn: conn,
err: make(chan error),
m: make(chan *Message),
}
return nil
} | go | func (c *Client) EstablishConnection() error {
conn, err := c.Dial(c.Proto, c.Addr, time.Duration(c.Timeout*int(time.Second)))
if err != nil {
return err
}
c.SocketConnection = SocketConnection{
Conn: conn,
err: make(chan error),
m: make(chan *Message),
}
return nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"EstablishConnection",
"(",
")",
"error",
"{",
"conn",
",",
"err",
":=",
"c",
".",
"Dial",
"(",
"c",
".",
"Proto",
",",
"c",
".",
"Addr",
",",
"time",
".",
"Duration",
"(",
"c",
".",
"Timeout",
"*",
"int",
... | // EstablishConnection - Will attempt to establish connection against freeswitch and create new SocketConnection | [
"EstablishConnection",
"-",
"Will",
"attempt",
"to",
"establish",
"connection",
"against",
"freeswitch",
"and",
"create",
"new",
"SocketConnection"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/client.go#L30-L43 |
135,692 | 0x19/goesl | client.go | Authenticate | func (c *Client) Authenticate() error {
m, err := newMessage(bufio.NewReaderSize(c, ReadBufferSize), false)
if err != nil {
Error(ECouldNotCreateMessage, err)
return err
}
cmr, err := m.tr.ReadMIMEHeader()
if err != nil && err.Error() != "EOF" {
Error(ECouldNotReadMIMEHeaders, err)
return err
}
Debug(... | go | func (c *Client) Authenticate() error {
m, err := newMessage(bufio.NewReaderSize(c, ReadBufferSize), false)
if err != nil {
Error(ECouldNotCreateMessage, err)
return err
}
cmr, err := m.tr.ReadMIMEHeader()
if err != nil && err.Error() != "EOF" {
Error(ECouldNotReadMIMEHeaders, err)
return err
}
Debug(... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Authenticate",
"(",
")",
"error",
"{",
"m",
",",
"err",
":=",
"newMessage",
"(",
"bufio",
".",
"NewReaderSize",
"(",
"c",
",",
"ReadBufferSize",
")",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"Er... | // Authenticate - Method used to authenticate client against freeswitch. In case of any errors durring so
// we will return error. | [
"Authenticate",
"-",
"Method",
"used",
"to",
"authenticate",
"client",
"against",
"freeswitch",
".",
"In",
"case",
"of",
"any",
"errors",
"durring",
"so",
"we",
"will",
"return",
"error",
"."
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/client.go#L47-L86 |
135,693 | 0x19/goesl | client.go | NewClient | func NewClient(host string, port uint, passwd string, timeout int) (*Client, error) {
client := Client{
Proto: "tcp", // Let me know if you ever need this open up lol
Addr: net.JoinHostPort(host, strconv.Itoa(int(port))),
Passwd: passwd,
Timeout: timeout,
}
err := client.EstablishConnection()
if err ... | go | func NewClient(host string, port uint, passwd string, timeout int) (*Client, error) {
client := Client{
Proto: "tcp", // Let me know if you ever need this open up lol
Addr: net.JoinHostPort(host, strconv.Itoa(int(port))),
Passwd: passwd,
Timeout: timeout,
}
err := client.EstablishConnection()
if err ... | [
"func",
"NewClient",
"(",
"host",
"string",
",",
"port",
"uint",
",",
"passwd",
"string",
",",
"timeout",
"int",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"client",
":=",
"Client",
"{",
"Proto",
":",
"\"",
"\"",
",",
"// Let me know if you ever ne... | // NewClient - Will initiate new client that will establish connection and attempt to authenticate
// against connected freeswitch server | [
"NewClient",
"-",
"Will",
"initiate",
"new",
"client",
"that",
"will",
"establish",
"connection",
"and",
"attempt",
"to",
"authenticate",
"against",
"connected",
"freeswitch",
"server"
] | 54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44 | https://github.com/0x19/goesl/blob/54ed41e51fd535a1cd6ea9e729f5d4be4dc55b44/client.go#L90-L110 |
135,694 | opsgenie/opsgenie-go-sdk | client/opsgenie_heartbeat_client.go | Add | func (cli *OpsGenieHeartbeatClient) Add(req heartbeat.AddHeartbeatRequest) (*heartbeat.AddHeartbeatResponse, error) {
var response heartbeat.HeartbeatResponseV2
err := cli.sendPostRequest(&req, &response)
if err != nil {
return nil, err;
}
result := convertAddResponseToV1Response(&response)
result.Code = 201
... | go | func (cli *OpsGenieHeartbeatClient) Add(req heartbeat.AddHeartbeatRequest) (*heartbeat.AddHeartbeatResponse, error) {
var response heartbeat.HeartbeatResponseV2
err := cli.sendPostRequest(&req, &response)
if err != nil {
return nil, err;
}
result := convertAddResponseToV1Response(&response)
result.Code = 201
... | [
"func",
"(",
"cli",
"*",
"OpsGenieHeartbeatClient",
")",
"Add",
"(",
"req",
"heartbeat",
".",
"AddHeartbeatRequest",
")",
"(",
"*",
"heartbeat",
".",
"AddHeartbeatResponse",
",",
"error",
")",
"{",
"var",
"response",
"heartbeat",
".",
"HeartbeatResponseV2",
"\n\... | // Add method creates a heartbeat at OpsGenie. | [
"Add",
"method",
"creates",
"a",
"heartbeat",
"at",
"OpsGenie",
"."
] | d57b8391ca905cccc085a075a2f7c1308d01cca3 | https://github.com/opsgenie/opsgenie-go-sdk/blob/d57b8391ca905cccc085a075a2f7c1308d01cca3/client/opsgenie_heartbeat_client.go#L26-L37 |
135,695 | opsgenie/opsgenie-go-sdk | client/opsgenie_heartbeat_client.go | Update | func (cli *OpsGenieHeartbeatClient) Update(req heartbeat.UpdateHeartbeatRequest) (*heartbeat.UpdateHeartbeatResponse, error) {
var response heartbeat.HeartbeatMetaResponseV2
err := cli.sendPatchRequest(&req, &response)
if err != nil {
return nil, err
}
return convertUpdateToV1Response(&response), nil
} | go | func (cli *OpsGenieHeartbeatClient) Update(req heartbeat.UpdateHeartbeatRequest) (*heartbeat.UpdateHeartbeatResponse, error) {
var response heartbeat.HeartbeatMetaResponseV2
err := cli.sendPatchRequest(&req, &response)
if err != nil {
return nil, err
}
return convertUpdateToV1Response(&response), nil
} | [
"func",
"(",
"cli",
"*",
"OpsGenieHeartbeatClient",
")",
"Update",
"(",
"req",
"heartbeat",
".",
"UpdateHeartbeatRequest",
")",
"(",
"*",
"heartbeat",
".",
"UpdateHeartbeatResponse",
",",
"error",
")",
"{",
"var",
"response",
"heartbeat",
".",
"HeartbeatMetaRespon... | // Update method changes configuration of an existing heartbeat at OpsGenie. | [
"Update",
"method",
"changes",
"configuration",
"of",
"an",
"existing",
"heartbeat",
"at",
"OpsGenie",
"."
] | d57b8391ca905cccc085a075a2f7c1308d01cca3 | https://github.com/opsgenie/opsgenie-go-sdk/blob/d57b8391ca905cccc085a075a2f7c1308d01cca3/client/opsgenie_heartbeat_client.go#L40-L49 |
135,696 | opsgenie/opsgenie-go-sdk | client/opsgenie_heartbeat_client.go | Enable | func (cli *OpsGenieHeartbeatClient) Enable(req heartbeat.EnableHeartbeatRequest) (*heartbeat.EnableHeartbeatResponse, error) {
var response heartbeat.HeartbeatMetaResponseV2
err := cli.sendPostRequest(&req, &response)
if err != nil {
return nil, err
}
var result heartbeat.EnableHeartbeatResponse
result.Statu... | go | func (cli *OpsGenieHeartbeatClient) Enable(req heartbeat.EnableHeartbeatRequest) (*heartbeat.EnableHeartbeatResponse, error) {
var response heartbeat.HeartbeatMetaResponseV2
err := cli.sendPostRequest(&req, &response)
if err != nil {
return nil, err
}
var result heartbeat.EnableHeartbeatResponse
result.Statu... | [
"func",
"(",
"cli",
"*",
"OpsGenieHeartbeatClient",
")",
"Enable",
"(",
"req",
"heartbeat",
".",
"EnableHeartbeatRequest",
")",
"(",
"*",
"heartbeat",
".",
"EnableHeartbeatResponse",
",",
"error",
")",
"{",
"var",
"response",
"heartbeat",
".",
"HeartbeatMetaRespon... | // Enable method enables an heartbeat at OpsGenie. | [
"Enable",
"method",
"enables",
"an",
"heartbeat",
"at",
"OpsGenie",
"."
] | d57b8391ca905cccc085a075a2f7c1308d01cca3 | https://github.com/opsgenie/opsgenie-go-sdk/blob/d57b8391ca905cccc085a075a2f7c1308d01cca3/client/opsgenie_heartbeat_client.go#L52-L65 |
135,697 | opsgenie/opsgenie-go-sdk | client/opsgenie_heartbeat_client.go | Disable | func (cli *OpsGenieHeartbeatClient) Disable(req heartbeat.DisableHeartbeatRequest) (*heartbeat.DisableHeartbeatResponse, error) {
var response heartbeat.HeartbeatMetaResponseV2
err := cli.sendPostRequest(&req, &response)
if err != nil {
return nil, err
}
var result heartbeat.DisableHeartbeatResponse
result.S... | go | func (cli *OpsGenieHeartbeatClient) Disable(req heartbeat.DisableHeartbeatRequest) (*heartbeat.DisableHeartbeatResponse, error) {
var response heartbeat.HeartbeatMetaResponseV2
err := cli.sendPostRequest(&req, &response)
if err != nil {
return nil, err
}
var result heartbeat.DisableHeartbeatResponse
result.S... | [
"func",
"(",
"cli",
"*",
"OpsGenieHeartbeatClient",
")",
"Disable",
"(",
"req",
"heartbeat",
".",
"DisableHeartbeatRequest",
")",
"(",
"*",
"heartbeat",
".",
"DisableHeartbeatResponse",
",",
"error",
")",
"{",
"var",
"response",
"heartbeat",
".",
"HeartbeatMetaRes... | // Disable method disables an heartbeat at OpsGenie. | [
"Disable",
"method",
"disables",
"an",
"heartbeat",
"at",
"OpsGenie",
"."
] | d57b8391ca905cccc085a075a2f7c1308d01cca3 | https://github.com/opsgenie/opsgenie-go-sdk/blob/d57b8391ca905cccc085a075a2f7c1308d01cca3/client/opsgenie_heartbeat_client.go#L68-L81 |
135,698 | opsgenie/opsgenie-go-sdk | client/opsgenie_heartbeat_client.go | Delete | func (cli *OpsGenieHeartbeatClient) Delete(req heartbeat.DeleteHeartbeatRequest) (*heartbeat.DeleteHeartbeatResponse, error) {
var response heartbeat.HeartbeatMetaResponseV2
err := cli.sendDeleteRequest(&req, &response)
if err != nil {
return nil, err
}
var result heartbeat.DeleteHeartbeatResponse
result.Sta... | go | func (cli *OpsGenieHeartbeatClient) Delete(req heartbeat.DeleteHeartbeatRequest) (*heartbeat.DeleteHeartbeatResponse, error) {
var response heartbeat.HeartbeatMetaResponseV2
err := cli.sendDeleteRequest(&req, &response)
if err != nil {
return nil, err
}
var result heartbeat.DeleteHeartbeatResponse
result.Sta... | [
"func",
"(",
"cli",
"*",
"OpsGenieHeartbeatClient",
")",
"Delete",
"(",
"req",
"heartbeat",
".",
"DeleteHeartbeatRequest",
")",
"(",
"*",
"heartbeat",
".",
"DeleteHeartbeatResponse",
",",
"error",
")",
"{",
"var",
"response",
"heartbeat",
".",
"HeartbeatMetaRespon... | // Delete method deletes an heartbeat from OpsGenie. | [
"Delete",
"method",
"deletes",
"an",
"heartbeat",
"from",
"OpsGenie",
"."
] | d57b8391ca905cccc085a075a2f7c1308d01cca3 | https://github.com/opsgenie/opsgenie-go-sdk/blob/d57b8391ca905cccc085a075a2f7c1308d01cca3/client/opsgenie_heartbeat_client.go#L84-L97 |
135,699 | opsgenie/opsgenie-go-sdk | client/opsgenie_heartbeat_client.go | Get | func (cli *OpsGenieHeartbeatClient) Get(req heartbeat.GetHeartbeatRequest) (*heartbeat.GetHeartbeatResponse, error) {
var response heartbeat.HeartbeatResponseV2
err := cli.sendGetRequest(&req, &response)
if err != nil {
return nil, err
}
return convertGetToV1Response(&response), nil
} | go | func (cli *OpsGenieHeartbeatClient) Get(req heartbeat.GetHeartbeatRequest) (*heartbeat.GetHeartbeatResponse, error) {
var response heartbeat.HeartbeatResponseV2
err := cli.sendGetRequest(&req, &response)
if err != nil {
return nil, err
}
return convertGetToV1Response(&response), nil
} | [
"func",
"(",
"cli",
"*",
"OpsGenieHeartbeatClient",
")",
"Get",
"(",
"req",
"heartbeat",
".",
"GetHeartbeatRequest",
")",
"(",
"*",
"heartbeat",
".",
"GetHeartbeatResponse",
",",
"error",
")",
"{",
"var",
"response",
"heartbeat",
".",
"HeartbeatResponseV2",
"\n\... | // Get method retrieves an heartbeat with details from OpsGenie. | [
"Get",
"method",
"retrieves",
"an",
"heartbeat",
"with",
"details",
"from",
"OpsGenie",
"."
] | d57b8391ca905cccc085a075a2f7c1308d01cca3 | https://github.com/opsgenie/opsgenie-go-sdk/blob/d57b8391ca905cccc085a075a2f7c1308d01cca3/client/opsgenie_heartbeat_client.go#L100-L109 |
Subsets and Splits
SQL Console for google/code_x_glue_ct_code_to_text
This query implements a thoughtful three-tier curation strategy to build a balanced safety dataset, categorizing code by destructive operations, safe I/O operations, and pure computational negatives with subsampling—revealing important patterns about how destructive intent manifests in Python code for model safety research.
SQL Console for google/code_x_glue_ct_code_to_text
This query performs meaningful classification of Python code samples into safety-relevant tiers based on destructive operations, I/O patterns, and pure computation, which could be valuable for building safety classifiers or curating training data, though the output itself is a filtered/ranked dataset rather than revealing novel statistical insights.