query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
// MustNewPluginInfo returns the result of calling NewInfo with the provided parameters. Panics if the call to // NewPluginInfo returns an error, so this function should only be used when the inputs are static and known to be valid.
[ "func MustNewPluginInfo(group, product, version string, params ...PluginInfoParam) PluginInfo {\n\tcmd, err := NewPluginInfo(group, product, version, params...)\n\tif err != nil {\n\t\tpanic(errors.Wrapf(err, \"failed to create plugin info\"))\n\t}\n\treturn cmd\n}" ]
[ "public static CodedInputStream newInstance(final byte[] buf, final int off,\n final int len) {\n CodedInputStream result = new CodedInputStream(buf, off, len);\n try {\n // Some uses of CodedInputStream can be more efficient if they know\n // exactly how ...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// MarkSucceeded Indicate the process has succeeded in its run.
[ "func (v *ProcTableImpl) MarkSucceeded(pvName string) error {\n\treturn v.markStatus(pvName, CSSucceeded)\n}" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// GetSessionFromCtx retrieves a session from a given context
[ "func GetSessionFromCtx(ctx context.Context) *session.Session {\n\tsessionVal := ctx.Value(constants.SessionCtxKey)\n\tif sessionVal == nil {\n\t\tlogger.Log.Warn(\"ctx doesn't contain a session, are you calling GetSessionFromCtx from inside a remote?\")\n\t\treturn nil\n\t}\n\treturn sessionVal.(*session.Session)\...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the summarization about Go programming language:", "pos": "Represent the code about Go programming language:", "neg": "Represent the code:" }
Set a value for an attribute. If a value already exists it will be replaced. If the value is empty the attribute will be cleared/reset. @param string $attribute @param mixed $value @return $this
[ "public function set($attribute, $value)\n {\n if ($value === [] || $value === '' || $value === null) {\n return $this->reset($attribute);\n }\n\n if ($this->has($attribute)) {\n $attribute = $this->resolveAttributeName($attribute);\n $this->attributes[$attri...
[ "public function initializeArguments()\n {\n $this->registerTagAttribute('enctype', 'string', 'MIME type with which the form is submitted');\n $this->registerTagAttribute('method', 'string', 'Transfer type (GET or POST or dialog)');\n $this->registerTagAttribute('name', 'string', 'Name of fo...
codesearchnet
{ "query": "Represent the sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
// Generic add function for filter rules
[ "func (f *ScmpFilter) addRuleGeneric(call ScmpSyscall, action ScmpAction, exact bool, conds []ScmpCondition) error {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\n\tif !f.valid {\n\t\treturn errBadFilter\n\t}\n\n\tif len(conds) == 0 {\n\t\tif err := f.addRuleWrapper(call, action, exact, 0, nil); err != nil {\n\t\t\t...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about Technology:", "pos": "Represent the Github code about Technology:", "neg": "Represent the Github code:" }
Builds a new Rack::Builder with the middleware and the app
[ "def build\n @builder = Rack::Builder.new\n\n @middlewares.each do |middleware|\n if middleware[0] == :map\n @builder.map(middleware[1], &middleware[2])\n else\n @builder.use(*middleware[0], &middleware[1])\n end\n end\n\n @builder.run(@app)\n end" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Auto Generated Code
[ "def BGPNeighborPrefixExceeded_neighborPrefixLimit(self, **kwargs):\n \n config = ET.Element(\"config\")\n BGPNeighborPrefixExceeded = ET.SubElement(config, \"BGPNeighborPrefixExceeded\", xmlns=\"http://brocade.com/ns/brocade-notification-stream\")\n neighborPrefixLimit = ET.SubElement(B...
[ "public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }" ]
codesearchnet
{ "query": "Represent the Github text about Natural Language Processing:", "pos": "Represent the Github code about Natural Language Processing:", "neg": "Represent the Github code about File management:" }
Column reduction and reduction transfer steps from LAPJV algorithm
[ "def _column_reduction(self):\n \n #assign each column to its lowest cost row, ensuring that only row\n #or column is assigned once\n i1, j = np.unique(np.argmin(self.c, axis=0), return_index=True)\n self._x[i1] = j\n\n #if problem is solved, return\n if len(i1) == s...
[ "function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Initiate a sniffing task. Make sure we only have one sniff request running at any given time. If a finished sniffing request is around, collect its result (which can raise its exception).
[ "def initiate_sniff(self, initial=False):\n \n if self.sniffing_task and self.sniffing_task.done():\n try:\n if self.sniffing_task is not None:\n self.sniffing_task.result()\n except:\n if self.raise_on_sniff_error:\n ...
[ "def connect(self, host, port):\n '''\n \n '''\n # Clear the connect state immediately since we're no longer connected\n # at this point.\n self._connected = False\n\n # Only after the socket has connected do we clear this state; closed\n # must be False so th...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// FindUserByID retrieves a user by id.
[ "func (s *Service) FindUserByID(ctx context.Context, id influxdb.ID) (*influxdb.User, error) {\n\tvar u *influxdb.User\n\n\terr := s.kv.View(ctx, func(tx Tx) error {\n\t\tusr, err := s.findUserByID(ctx, tx, id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tu = usr\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t...
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Return a ViewCount for a view. :param include: list of objects to sideload. `Side-loading API Docs <https://developer.zendesk.com/rest_api/docs/core/side_loading>`__. :param view: View or view id
[ "def count(self, view, include=None):\n \n return self._get(self._build_url(self.endpoint.count(id=view, include=include)))" ]
[ "def fetch(self, plan_id, data={}, **kwargs):\n \"\n return super(Plan, self).fetch(plan_id, data, **kwargs)" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Text processing:" }
[VARIABLE "my_key_name2"]
[ "public void multipleDeleteEntities(String keyName1, String keyName2) {\n Datastore datastore = transaction.getDatastore();\n // [START multipleDeleteEntities]\n Key key1 = datastore.newKeyFactory().setKind(\"MyKind\").newKey(keyName1);\n Key key2 = datastore.newKeyFactory().setKind(\"MyKind\").newKey(k...
[ "def _init_prtfmt(self, key=\"fmta\"):\n \"\"\"\"\"\"\n prtfmt = self.gosubdag.prt_attr[key]\n return prtfmt.replace(\"{NS}\", \"{NS} {hdr1usr01:2} {num_usrgos:>4} uGOs\")" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Marshall the given parameter object.
[ "public void marshall(DescribeBudgetsRequest describeBudgetsRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (describeBudgetsRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Execute all updates asynchronously and wait for results.
[ "private void executeUpdatesAsynchronous(DBTransaction transaction) {\n Collection<BoundStatement> mutations = getMutations(transaction);\n List<ResultSetFuture> futureList = new ArrayList<>(mutations.size());\n for(BoundStatement mutation: mutations) {\n ResultSetFuture future = m_d...
[ "function errorAndExit(msg, logMe) {\n // @todo Only trigger if `verbosity > 1`\n if (logMe) {\n // Adding some empty lines before error message for readability\n console.log();\n console.log();\n console.log(logMe);\n }\n error(`Error: ${msg}`);\n\n // There's a few ways to handle exiting\n\n // ...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Returns the directory containing JAR files bundled with the Cloud SDK. @return the directory containing JAR files bundled with the Cloud SDK
[ "public Path getAppEngineSdkForJavaPath() {\n Path resolved = getPath().resolve(APPENGINE_SDK_FOR_JAVA_PATH);\n if (resolved == null) {\n throw new RuntimeException(\"Misconfigured App Engine SDK for Java\");\n }\n return resolved;\n }" ]
[ "private static String driverVersion()\n {\n // \"Session\" is arbitrary - the only thing that matters is that the class we use here is in the\n // 'org.neo4j.driver' package, because that is where the jar manifest specifies the version.\n // This is done as part of the build, adding a MANIF...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns the number of significant figures in a string number. @param string $n Decimal number @return int number of sigfigs
[ "public function getSigFigs($n)\r\n {\r\n $n = ltrim($n, '0+-');\r\n $dp = strpos($n, '.'); // decimal position\r\n if ($dp === false) {\r\n $sigfigs = strlen(rtrim($n, '0'));\r\n } else {\r\n $sigfigs = strlen(ltrim($n, '0.')); // eliminate extra decimal charact...
[ "def formatDecimalMark(value, decimalmark='.'):\n \n # We have to consider the possibility of working with decimals such as\n # X.000 where those decimals are important because of the precission\n # and significant digits matters\n # Using 'float' the system delete the extre desimals with 0 as a valu...
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Returns the raw Model record that stores the settings. @return Model
[ "public function getSettingsRecord()\n {\n $record = $this->model\n ->where('item', $this->recordCode)\n ->remember(1440, $this->getCacheKey())\n ->first();\n\n return $record ?: null;\n }" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// LPersist removes the TTL of list.
[ "func (db *DB) LPersist(key []byte) (int64, error) {\n\tif err := checkKeySize(key); err != nil {\n\t\treturn 0, err\n\t}\n\n\tt := db.listBatch\n\tt.Lock()\n\tdefer t.Unlock()\n\n\tn, err := db.rmExpire(t, ListType, key)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\terr = t.Commit()\n\treturn n, err\n}" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github comment about Agent Identity Management:", "pos": "Represent the Github code about Agent Identity Management:", "neg": "Represent the Github code:" }
Invokes the /workflow-xxxx/describe API method. For more info, see: https://wiki.dnanexus.com/API-Specification-v1.0.0/Workflows-and-Analyses#API-method%3A-%2Fworkflow-xxxx%2Fdescribe
[ "def workflow_describe(object_id, input_params={}, always_retry=True, **kwargs):\n \n return DXHTTPRequest('/%s/describe' % object_id, input_params, always_retry=always_retry, **kwargs)" ]
[ "def Create(alias=None,location=None,session=None):\n\t\t\n\n\t\tif not alias: alias = clc.v2.Account.GetAlias(session=session)\n\t\tif not location: location = clc.v2.Account.GetLocation(session=session)\n\n\t\treturn clc.v2.Requests(\n\t\t\tclc.v2.API.Call('POST','/v2-experimental/networks/%s/%s/claim' % (alias...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
get all endpoints known on the Ariane server :return:
[ "def get_endpoints():\n \n LOGGER.debug(\"EndpointService.get_endpoints\")\n params = SessionService.complete_transactional_req(None)\n if params is None:\n if MappingService.driver_type != DriverFactory.DRIVER_REST:\n params = {'OPERATION': 'getEndpoints'}\n ...
[ "def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Auto Generated Code
[ "def get_mac_address_table_input_request_type_get_next_request_last_mac_address_details_last_vlan_id(self, **kwargs):\n \n config = ET.Element(\"config\")\n get_mac_address_table = ET.Element(\"get_mac_address_table\")\n config = get_mac_address_table\n input = ET.SubElement(get_m...
[ "public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }" ]
codesearchnet
{ "query": "Represent the Github text about Natural Language Processing:", "pos": "Represent the Github code about Natural Language Processing:", "neg": "Represent the Github code about File management:" }
Marshall the given parameter object.
[ "public void marshall(DeleteDirectConnectGatewayAssociationProposalRequest deleteDirectConnectGatewayAssociationProposalRequest,\n ProtocolMarshaller protocolMarshaller) {\n\n if (deleteDirectConnectGatewayAssociationProposalRequest == null) {\n throw new SdkClientException(\"Invalid ar...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
调用之前进行压栈的函数 @private @param {Array} callQueue 调用队列 @param {Object} target flash对象 @return {Null}
[ "function _callFn(callQueue, target){\n var result = null;\n \n callQueue = callQueue.reverse();\n baidu.each(callQueue, function(item){\n result = target.call(item.fnName, item.params);\n item.callBack(result);\n });\n }" ]
[ "public void addSharedFunctionByString(String content) {\r\n\t\t// content 中的内容被解析后会存放在 Env 之中,而 StringSource 所对应的\r\n\t\t// Template 对象 isModified() 始终返回 false,所以没有必要对其缓存\r\n\t\tStringSource stringSource = new StringSource(content, false);\r\n\t\tdoAddSharedFunction(stringSource, null);\r\n\t}" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Marshall the given parameter object.
[ "public void marshall(EndpointConfiguration endpointConfiguration, ProtocolMarshaller protocolMarshaller) {\n\n if (endpointConfiguration == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(en...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
PDF link handler; never gets explicitly called by user
[ "def handle_starttag(self, tag, attrs):\n '''\n \n '''\n if tag == 'a' and ( ('class', 'download-pdf') in attrs or ('id', 'download-pdf') in attrs ):\n for attr in attrs:\n if attr[0] == 'href':\n self.download_link = 'http://www.nature.com' + attr[1]" ]
[ "function() {\n var test = \"chat-bubble-storage-test\"\n try {\n localStorage.setItem(test, test)\n localStorage.removeItem(test)\n return true\n } catch (error) {\n console.error(\n \"Your server does not allow storing data locally. Most likely it's because you've opened this p...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetConfigurationOptions sets the ConfigurationOptions field's value.
[ "func (s *LoadBalancer) SetConfigurationOptions(v map[string]*string) *LoadBalancer {\n\ts.ConfigurationOptions = v\n\treturn s\n}" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the text about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
Updates a role @param integer $role_id @param array $data @return boolean
[ "public function update($role_id, array $data)\n {\n $result = null;\n $this->hook->attach('user.role.update.before', $role_id, $data, $result, $this);\n\n if (isset($result)) {\n return (bool) $result;\n }\n\n $result = (bool) $this->db->update('role', $data, array(...
[ "public function delete($id)\n {\n $this->innerHandler->delete($id);\n // Delete by primary key will remove the object, so we don't need to clear `ez-language-code-` here.\n $this->cache->deleteMulti(['ez-language-' . $id, 'ez-language-list']);\n }" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software Development:" }
Get X and Y for fine plotting of a stick spectrum. Usage: X,Y = getStickXY(TableName).
[ "def getStickXY(TableName):\n \n cent,intens = getColumns(TableName,('nu','sw'))\n n = len(cent)\n cent_ = zeros(n*3)\n intens_ = zeros(n*3)\n for i in range(n):\n intens_[3*i] = 0\n intens_[3*i+1] = intens[i]\n intens_[3*i+2] = 0\n cent_[(3*i):(3*i+3)] = cent[i]\n r...
[ "def ystep(self):\n \n \"\"\"\n\n self.Y = self.Pcn(self.AX + self.U)" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns the long version of the application. @return string The long application version
[ "public function getLongVersion()\n {\n $output = '';\n\n if ('UNKNOWN' !== $this->getName()) {\n if ('UNKNOWN' !== $this->getVersion()) {\n $output .= sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());\n } else {\n ...
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// RotateKeyPassphrase rotates the key-encryption-key
[ "func (rdb RethinkDBKeyStore) RotateKeyPassphrase(keyID, newPassphraseAlias string) error {\n\tdbPrivateKey, decryptedPrivKey, err := rdb.getKey(keyID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Get the new passphrase to use for this key\n\tnewPassphrase, _, err := rdb.retriever(dbPrivateKey.KeyID, newPassphra...
[ "def get_password_hash(username):\n \n try:\n h = spwd.getspnam(username)\n except KeyError:\n return None\n\n # mitogen.core.Secret() is a Unicode subclass with a repr() that hides the\n # secret data. This keeps secret stuff out of logs. Like blobs, secrets can\n # also be serializ...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
// buildSourceDefinition returns true and current context if it is an BuildSource // nil and false otherwise.
[ "func buildSourceDefinition(failIfNotSD bool) (*gorma.BuildSource, bool) {\n\ta, ok := dslengine.CurrentDefinition().(*gorma.BuildSource)\n\tif !ok && failIfNotSD {\n\t\tdslengine.IncompatibleDSL()\n\t}\n\treturn a, ok\n}" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// handleNonTLFSpecialFile handles special files that are outside a TLF, // i.e. /keybase, /keybase/private, and /keybase/public.
[ "func handleNonTLFSpecialFile(\n\tname string, fs *FS, entryValid *time.Duration) fs.Node {\n\tspecialNode := handleCommonSpecialFile(name, fs, entryValid)\n\tif specialNode != nil {\n\t\treturn specialNode\n\t}\n\n\tswitch name {\n\tcase libfs.StatusFileName:\n\t\treturn NewNonTLFStatusFile(fs, entryValid)\n\tcase...
[ "func NewUpdaterContext(appName string, pathToKeybase string, log Log, mode UpdaterMode) (updater.Context, *updater.Updater) {\n\tcfg, err := newConfig(appName, pathToKeybase, log, mode.IgnoreSnooze())\n\tif err != nil {\n\t\tlog.Warningf(\"Error loading config for context: %s\", err)\n\t}\n\n\tsrc := NewUpdateSour...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// POST /api/user/signup
[ "func SignUp(c *m.ReqContext, form dtos.SignUpForm) Response {\n\tif !setting.AllowUserSignUp {\n\t\treturn Error(401, \"User signup is disabled\", nil)\n\t}\n\n\texisting := m.GetUserByLoginQuery{LoginOrEmail: form.Email}\n\tif err := bus.Dispatch(&existing); err == nil {\n\t\treturn Error(422, \"User with same em...
[ "def get_api_publisher(self, social_user):\n \n\n def _post(**kwargs):\n api = self.get_api(social_user)\n from pudb import set_trace; set_trace()\n # api.group.getInfo('uids'='your_group_id', 'fields'='members_count')\n #response = api.wall.post(**kwargs)\n...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Initializes the endpoint with the context keys based on the passed and/or based on the query parameters (request.GET).
[ "def initialize_context(self, request: HttpRequest, *args, **kwargs) -> None:\n \n for key in self.CONTEXT_KEYS:\n setattr(self, key, kwargs.get(key))\n for key in self.QUERY_CONTEXT_KEYS:\n setattr(self, key, request.query_params.get(key))\n self._initialize_contex...
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Create a gauge that will be part of a merged version of all column families. The global gauge will merge each CF gauge by adding their values
[ "protected <T extends Number> Gauge<T> createColumnFamilyGauge(final String name, Gauge<T> gauge)\n {\n return createColumnFamilyGauge(name, gauge, new Gauge<Long>()\n {\n public Long value()\n {\n long total = 0;\n for (Metric cfGauge : allColumn...
[ "public static function getRankingQueryLimit()\n {\n $configGeneral = Config::getInstance()->General;\n $configLimit = $configGeneral['archiving_ranking_query_row_limit'];\n $limit = $configLimit == 0 ? 0 : max(\n $configLimit,\n $configGeneral['datatable_archiving_maxi...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Convert obj into TaskManager instance. Accepts string, filepath, dictionary, `TaskManager` object. If obj is None, the manager is initialized from the user config file.
[ "def as_manager(cls, obj):\n \n if isinstance(obj, cls): return obj\n if obj is None: return cls.from_user_config()\n\n if is_string(obj):\n if os.path.exists(obj):\n return cls.from_file(obj)\n else:\n return cls.from_string(obj)\n\n ...
[ "def path(self, path):\n \"\"\"\"\"\"\n\n # pylint: disable=attribute-defined-outside-init\n self._path = copy_.copy(path)\n\n # The provided path is shallow copied; it does not have any attributes\n # with mutable types.\n\n # We perform this check after the initialization...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
テーブルが存在するかどうかを返します。 @param string テーブル名 @param bool 強制再取得フラグ @return bool テーブルが既に存在する場合はtrue, そうでない場合はfalse
[ "public static function ExistTable (array $options, $table_name, $forced_obtain = false) {\n\t\t$tables = static::GetConnection($options)->getTables($forced_obtain);\n\t\treturn isset($tables[$table_name]);\n\t}" ]
[ "public static double calculateLofWithUpdate(int kn, int max, LofPoint addedPoint,\n LofDataSet dataSet)\n {\n // データ数が最大に達している場合には古い方からデータの削除を行う\n String deleteId = addPointToDataSet(max, addedPoint, dataSet);\n\n // K距離、K距離近傍、局所到達可能密度の更新を行う対象点の一覧を取得する。\n Set<String> updat...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// getNextBuildNameFromBuild returns name of the next build with random uuid added at the end
[ "func getNextBuildNameFromBuild(build *buildv1.Build, buildConfig *buildv1.BuildConfig) string {\n\tvar buildName string\n\tif buildConfig != nil {\n\t\treturn getNextBuildName(buildConfig)\n\t}\n\t// for builds created by hand, append a timestamp when cloning/rebuilding them\n\t// because we don't have a sequence ...
[ "function newParam (columnName) {\n var i = 0\n // get placeholder name based on column name with counter\n // added if the same column name is used multiple times\n while (i < 99) {\n // use column name as base for param name\n var paramName = columnName+i\n // if param name is not...
codesearchnet
{ "query": "Represent the instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Given a layer ID, search for the WMS layer. @param layerId layer id @return WMS layer or null if layer is not a WMS layer
[ "private WmsLayer getLayer(String layerId) {\n\t\tRasterLayer layer = configurationService.getRasterLayer(layerId);\n\t\tif (layer instanceof WmsLayer) {\n\t\t\treturn (WmsLayer) layer;\n\t\t}\n\t\treturn null;\n\t}" ]
[ "function(terria) {\n CatalogGroup.call(this, terria, \"csw\");\n\n /**\n * Gets or sets the URL of the CSW server. This property is observable.\n * @type {String}\n */\n this.url = \"\";\n\n /**\n * Gets or sets the template XML string to POST to the CSW server to query for catalog items. If this pro...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about AWS Redshift:" }
// GetMaster returns the default macro and its parameter type, // by default it will return the `String` macro which is responsible for the "string" parameter type.
[ "func (ms *Macros) GetMaster() *Macro {\n\tfor _, m := range *ms {\n\t\tif m.Master() {\n\t\t\treturn m\n\t\t}\n\t}\n\n\treturn nil\n}" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Process HTTP headers @return boolean Success
[ "protected function httpProcessHeaders()\n {\n $this->req->attrs->paramsDone = true;\n if (isset($this->req->attrs->server['HTTP_CONNECTION'])\n && preg_match('~(?:^|\\W)Upgrade(?:\\W|$)~i', $this->req->attrs->server['HTTP_CONNECTION'])\n && isset($this->req->attrs->server['HT...
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the description about NLP:", "pos": "Represent the code about NLP:", "neg": "Represent the code about Programming:" }
Get the predecessor of given instruction within the basic block. @param handle the instruction @return the instruction's predecessor, or null if the instruction is the first in the basic block
[ "public InstructionHandle getPredecessorOf(InstructionHandle handle) {\n if (VERIFY_INTEGRITY && !containsInstruction(handle)) {\n throw new IllegalStateException();\n }\n return handle == firstInstruction ? null : handle.getPrev();\n }" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
/* Post-processing changes on an object
[ "function (obj) {\r\n var t = shared.tracker.getTracker(obj);\r\n t.tc().disable++;\r\n // Loop old props to find any to delete\r\n var oldProps = shared.utils.cloneArray(t.type().props());\r\n var newProps = Object.keys(obj);\r\n ...
[ "def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
returns instance of this factory (singelton = always the same instance) do auto update when changes occur @param config @return Singelton Instance of the Factory @throws ServletException
[ "public synchronized static CFMLEngine getInstance(final ServletConfig config) throws ServletException {\n\n\tif (singelton != null) {\n\t if (factory == null) factory = singelton.getCFMLEngineFactory(); // not sure if this ever is done, but it does not hurt\n\t return singelton;\n\t}\n\n\tif (factory == null...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Find the second-level objects - Properties, Constructor, Methods, Constants, Events
[ "function isaSecondLevelObject ($) {return (\n $.comment.getTag(\"property\").length ||\n ($.is(\"CONSTRUCTOR\") && $.name.match(/^[A-Z][A-Za-z]+$/)) ||\n ($.is(\"FUNCTION\") && $.name.match(/^[a-z][A-Za-z]+$/)) ||\n $.isConstant ||\n ($.type == \"Function\" && $.is(\"OBJECT\"))\n );}" ]
[ "@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Encode the message's payload in quoted-printable. Also, add an appropriate Content-Transfer-Encoding header.
[ "def encode_quopri(msg):\n \n orig = msg.get_payload()\n encdata = _qencode(orig)\n msg.set_payload(encdata)\n msg['Content-Transfer-Encoding'] = 'quoted-printable'" ]
[ "public static String pathEncode(String path, Charset charset) {\n return encodeReserved(path, FragmentType.PATH_SEGMENT, charset);\n\n /*\n * path encoding is not equivalent to query encoding, there are few differences, namely dealing\n * with spaces, !, ', (, ), and ~ characters. we will need to man...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
Insert (or update if already existing) a list of Sosa individuals @param array $sosa_records
[ "public function insertOrUpdate($sosa_records) {\n if(!$this->is_setup) return;\n \n $treeid = $this->tree->getTreeId();\n $userid = $this->user->getUserId();\n $questionmarks_table = array();\n $values_table = array();\n \n $i = 0;\n foreach ($sosa_re...
[ "def search_prod_type_tags(self, ins, type, tags, pipeline):\n ''''''\n return StoredProduct(id=100, content='null.fits', tags={})" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Marshall the given parameter object.
[ "public void marshall(PlacementConstraint placementConstraint, ProtocolMarshaller protocolMarshaller) {\n\n if (placementConstraint == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(placemen...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// GetAllAWSOpsWorksUserProfileResources retrieves all AWSOpsWorksUserProfile items from an AWS CloudFormation template
[ "func (t *Template) GetAllAWSOpsWorksUserProfileResources() map[string]*resources.AWSOpsWorksUserProfile {\n\tresults := map[string]*resources.AWSOpsWorksUserProfile{}\n\tfor name, untyped := range t.Resources {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *resources.AWSOpsWorksUserProfile:\n\t\t\tresults[nam...
[ "@Override\n public List<Workflow> getWorkflowsByType(String workflowName, Long startTime, Long endTime) {\n throw new UnsupportedOperationException(\"This method is not implemented in CassandraExecutionDAO. Please use ExecutionDAOFacade instead.\");\n }" ]
codesearchnet
{ "query": "Represent the description about Cloud Foundry API:", "pos": "Represent the code about Cloud Foundry API:", "neg": "Represent the code:" }
Determine whether this function Type is a variadic function type.
[ "def is_function_variadic(self):\n \"\"\"\"\"\"\n assert self.kind == TypeKind.FUNCTIONPROTO\n\n return conf.lib.clang_isFunctionTypeVariadic(self)" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Send error messsage to the user @param res @param err
[ "function sendError(res,err) {\n console.error(err);\n // also log last executed query, for easier debugging\n console.error(lastQry.sql);\n res.statusCode = 500;\n res.send({\n result: 'error',\n err: err\n });\n}" ]
[ "def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
User pressed Enter in an editor Enter in a list item should split the list item Enter in an empty list item should remove it Shift+Enter in a list item should make a new line
[ "function onEnter(\n event: *,\n change: Change,\n editor: *,\n opts: Options\n): void | any {\n // Pressing Shift+Enter\n // should split block normally\n if (event.shiftKey) {\n return undefined;\n }\n\n const { value } = change;\n const currentItem = getCurrentItem(opts, valu...
[ "function (evt) {\n var keyCode = evt.keyCode;\n if (this.controller._isExpanded && (keyCode == ariaDomEvent.KC_ARROW_UP || keyCode == ariaDomEvent.KC_ARROW_DOWN)) {\n // in expanded mode (similar to the multiselect), for arrow keys, do not bring the focus\n // ba...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetAdminPrivacy sets the AdminPrivacy field's value.
[ "func (s *UpdateDomainContactPrivacyInput) SetAdminPrivacy(v bool) *UpdateDomainContactPrivacyInput {\n\ts.AdminPrivacy = &v\n\treturn s\n}" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
A status for this trigger. [required] Generated from protobuf field <code>.google.privacy.dlp.v2.JobTrigger.Status status = 10;</code> @param int $var @return $this
[ "public function setStatus($var)\n {\n GPBUtil::checkEnum($var, \\Google\\Cloud\\Dlp\\V2\\JobTrigger_Status::class);\n $this->status = $var;\n\n return $this;\n }" ]
[ "@java.lang.Deprecated\n public java.util.Map<java.lang.String, com.google.cloud.automl.v1beta1.DataType> getFields() {\n return getFieldsMap();\n }" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// Implements cache.ListerWatcher interface.
[ "func (lw *cacherListerWatcher) Watch(options metav1.ListOptions) (watch.Interface, error) {\n\treturn lw.storage.WatchList(context.TODO(), lw.resourcePrefix, options.ResourceVersion, storage.Everything)\n}" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
# $req_data = []; 传递的参数
[ "public function fetch($obj_data,$req_data=[]){\r\n\t\tif(!is_array($req_data)){\r\n\t\t\t$message = 'fetch($obj_data,$req_data),$req_data must be array';\r\n\t\t\tthrow new \\yii\\web\\HttpException(406,$message);\r\n\t\t} \r\n\t\t$data = '';\r\n\t\tif(is_array($obj_data) && !empty($obj_data)){\r\n\t\t\t$modules \...
[ "private static function appRun(){\n // echo \"runing\";\n // 当有get参数传递时 获取get参数\n if(isset($_GET['s'])){\n // 更加\"/\"将get参数分割成数组\n $info = explode('/',$_GET['s']);\n\n // 获取模块名称 转换成小写\n $m = strtolower($info[0]);\n // 获取控制器名称 转换成小写\n ...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
SetupComponent::log404() @param bool $notifyAdminOnInternalErrors @return void
[ "public function log404($notifyAdminOnInternalErrors = false) {\n\t\tif ($this->Controller->name === 'CakeError') {\n\t\t\t$referer = $this->Controller->referer();\n\t\t\t$this->Controller->log('REF: ' . $referer . ' - URL: ' . $this->Controller->request->url, '404');\n\t\t}\n\t}" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
return ruby script to eliminate duplicated @return [String] ruby script
[ "def script_dup\n r = \"require 'fileutils'\\n\"\n duplicates.each do |entries|\n flg_first = true\n r += \"\\n\"\n entries.each do |entry|\n src = File.join(@dirname, entry.path, entry.name)\n if flg_first\n flg_first = false\n r += \"# FileUti...
[ "def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
highlight the search result
[ "def format_result(line, line_num, txt):\n \n \n return '&nbsp;&nbsp;' + str(line_num) + ': ' + line.replace(txt, '<span style=\"background-color: #FFFF00\">' + txt + '</span>')" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
// multiscan scans all DNS addresses returned for the host, returning the lowest grade // and the concatenation of all the output.
[ "func multiscan(host string, scan func(string) (Grade, Output, error)) (grade Grade, output Output, err error) {\n\tdomain, port, _ := net.SplitHostPort(host)\n\tvar addrs []string\n\taddrs, err = net.LookupHost(domain)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tgrade = Good\n\tout := make(map[string]Output)\n\n\tfor...
[ "def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys ...
codesearchnet
{ "query": "Represent the Github summarization about software development:", "pos": "Represent the Github code about software development:", "neg": "Represent the Github code:" }
// SetReportFileFormat sets the ReportFileFormat field's value.
[ "func (s *GetAssessmentReportInput) SetReportFileFormat(v string) *GetAssessmentReportInput {\n\ts.ReportFileFormat = &v\n\treturn s\n}" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
// WeekdayShort returns the locales short weekday given the 'weekday' provided
[ "func (en *en_SX) WeekdayShort(weekday time.Weekday) string {\n\treturn en.daysShort[weekday]\n}" ]
[ "func parseDay(buff []byte, cursor *int, l int) (int, error) {\n\t// XXX : this is a relaxed constraint\n\t// XXX : we do not check if valid regarding February or leap years\n\t// XXX : we only checks that day is in range [01 -> 31]\n\t// XXX : in other words this function will not rant if you provide Feb 31th\n\tr...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about datetime:" }
Stores authorization token passed as an argument. @param token Token instance to be stored. @param envKey Environment key for token.
[ "@Override\r\n public void store(OAuthToken token, String envKey) {\r\n FileOutputStream fileOut;\r\n try {\r\n fileOut = new FileOutputStream(getFilePath(envKey));\r\n ObjectOutputStream out = new ObjectOutputStream(fileOut);\r\n out.writeObject(token);\r\n ...
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
// pushObject assembles a JSVM object wrapping a swappable opcode and pushes it // onto the VM stack.
[ "func (ow *opWrapper) pushObject(vm *duktape.Context) {\n\tobj := vm.PushObject()\n\n\tvm.PushGoFunction(func(ctx *duktape.Context) int { ctx.PushInt(int(ow.op)); return 1 })\n\tvm.PutPropString(obj, \"toNumber\")\n\n\tvm.PushGoFunction(func(ctx *duktape.Context) int { ctx.PushString(ow.op.String()); return 1 })\n\...
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
===========================================
[ "public void setAttributeValue(final AttributeValue_4 attributeValue_4) {\n use_union = true;\n attributeValue_5.name = attributeValue_4.name;\n attributeValue_5.value = attributeValue_4.value;\n attributeValue_5.quality = attributeValue_4.quality;\n attributeValue_5.time = attrib...
[ "public static function protect()\n\t{\n\t\t$eye = \\Cli::color(\"*\", 'green');\n\n\t\treturn \\Cli::color(\"\n\t\t\t\t\t\\\"PROTECT ALL HUMANS\\\"\n\t\t\t _____ /\n\t\t\t /_____\\\\\", 'blue').\"\\n\"\n.\\Cli::color(\"\t\t\t ____[\\\\\", 'blue').$eye.\\Cli::color('---', 'blue').$eye.\\Cli:...
codesearchnet
{ "query": "Represent the sentence about N/A:", "pos": "Represent the code about N/A:", "neg": "Represent the code about Programming:" }
// NewDataScope create new instance of data scope
[ "func NewDataScope(data map[string]interface{}) app.DataScope {\n\treturn app.DataScope(&DataScope{\n\t\tData: make(map[string]interface{}),\n\t})\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Trim double quotes off the ends of a value, un-escaping inner double quotes and literal backslashes. Also convert escapes to unicode. If the string is not quoted, return it unmodified.
[ "def _trim_value(self, value):\n \n\n if value[0] == '\"':\n assert value[-1] == '\"'\n value = value[1:-1].replace('\\\\\"', '\"').replace(\"\\\\\\\\\", \"\\\\\")\n return Parser._unescape_re.sub(Parser._unescape_fn, value)\n return value" ]
[ "def _safe_match_string(value):\n \"\"\"\"\"\"\n if not isinstance(value, six.string_types):\n if isinstance(value, bytes): # should only happen in py3\n value = value.decode('utf-8')\n else:\n raise GraphQLInvalidArgumentError(u'Attempting to convert a non-string into a s...
codesearchnet
{ "query": "Represent the comment about Writing:", "pos": "Represent the code about Writing:", "neg": "Represent the code about programming:" }
// Command applies an SMTP verb and arguments to the state machine
[ "func (proto *Protocol) Command(command *Command) (reply *Reply) {\n\tdefer func() {\n\t\tproto.lastCommand = command\n\t}()\n\tif proto.SMTPVerbFilter != nil {\n\t\tproto.logf(\"sending to SMTP verb filter\")\n\t\tr := proto.SMTPVerbFilter(command.verb)\n\t\tif r != nil {\n\t\t\tproto.logf(\"response returned by S...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Get the google data client.
[ "def get_client(self, email=None, password=None, **__):\n \"\"\"\"\"\"\n if self.client is not None:\n return self.client\n return Auth(email, password)" ]
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Try fetching instance metadata at 'curl http://169.254.169.254/latest/meta-data/' to see if host is on an ec2 instance
[ "def is_ec2_instance():\n \"\"\"\"\"\"\n\n # Note: this code assumes that docker containers running on ec2 instances\n # inherit instances metadata, which they do as of 2016-08-25\n\n global IS_EC2_INSTANCE\n\n if IS_EC2_INSTANCE != -1:\n # Returned the cached value\n return IS_EC2_INST...
[ "def docker(gandi, vm, args):\n \n if not [basedir for basedir in os.getenv('PATH', '.:/usr/bin').split(':')\n if os.path.exists('%s/docker' % basedir)]:\n gandi.echo(\"\"\"'docker' not found in $PATH, required for this command \\\nto work\nSee https://docs.docker.com/installation/#installat...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Instance of |CoreProperties| holding the read/write Dublin Core document properties for this presentation. Creates a default core properties part if one is not present (not common).
[ "def core_properties(self):\n \n try:\n return self.part_related_by(RT.CORE_PROPERTIES)\n except KeyError:\n core_props = CorePropertiesPart.default()\n self.relate_to(core_props, RT.CORE_PROPERTIES)\n return core_props" ]
[ "def __resolveport(self, definitions):\n \n ref = qualify(self.type, self.root, definitions.tns)\n port_type = definitions.port_types.get(ref)\n if port_type is None:\n raise Exception(\"portType '%s', not-found\" % (self.type,))\n # Later on we will require access to t...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Remove the acknowledge if it is not sticky :return: None
[ "def unacknowledge_problem_if_not_sticky(self):\n \n if hasattr(self, 'acknowledgement') and self.acknowledgement is not None:\n if not self.acknowledgement.sticky:\n self.unacknowledge_problem()" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Subscribe adds new listener to events, returns slice of 256 stored // last events, a channel in which you can expect new events (in form // of interface{}, so you need type assertion), and a function to call // to stop the stream of events.
[ "func (e *Events) Subscribe() ([]eventtypes.Message, chan interface{}, func()) {\n\teventSubscribers.Inc()\n\te.mu.Lock()\n\tcurrent := make([]eventtypes.Message, len(e.events))\n\tcopy(current, e.events)\n\tl := e.pub.Subscribe()\n\te.mu.Unlock()\n\n\tcancel := func() {\n\t\te.Evict(l)\n\t}\n\treturn current, l, c...
[ "func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
After configuring this storage you need to create it explicitly.
[ "@Override\n public GraphHopperStorage create(long byteCount) {\n baseGraph.checkInit();\n if (encodingManager == null)\n throw new IllegalStateException(\"EncodingManager can only be null if you call loadExisting\");\n\n dir.create();\n long initSize = Math.max(byteCount, ...
[ "def platform\n # If you are declaring a new platform, you will need to tell\n # Train a bit about it.\n # If you were defining a cloud API, you should say you are a member\n # of the cloud family.\n\n # This plugin makes up a new platform. Train (or rather InSpec) only\n # know how t...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
//DecisionFunc builds a DecisionFunc from your typed DecisionFunc that verifies the right typing at construction time.
[ "func (t *TypedFuncs) DecisionFunc(decisionFunc interface{}) DecisionFunc {\n\ttypeCheck(decisionFunc, []string{\"*fsm.FSMContext\", \"*swf.HistoryEvent\", t.typeArg()}, []string{\"*swf.Decision\"})\n\treturn marshalledFunc{reflect.ValueOf(decisionFunc)}.decisionFunc\n}" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Create a public key from a Mdanter Ecc Public Key. @param PublicKeyInterface $eccKey @throws InvalidArgumentException When the public key is not the correct length.
[ "public static function createFromEccKey(PublicKeyInterface $eccKey) : self\n {\n $math = EccFactory::getAdapter();\n $pointSerializer = new UncompressedPointSerializer($math);\n $point = $eccKey->getPoint();\n $hex = $pointSerializer->serialize($point);\n\n $binary = new Binar...
[ "public static function createNotMerged(Envelope $envelope, \\Exception $e = null)\n {\n $message = 'The given DigiDoc envelope must be merged with Api (using Api::merge) before calling this method.';\n\n return new static($message, null, $e);\n }" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about API documentation:" }
Gets the {@code DrawableParent} for index.
[ "public DrawableParent getDrawableParentForIndex(int index) {\n Preconditions.checkArgument(index >= 0);\n Preconditions.checkArgument(index < mDrawableParents.length);\n if (mDrawableParents[index] == null) {\n mDrawableParents[index] = createDrawableParentForIndex(index);\n }\n return mDrawabl...
[ "def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Parse a literal provided as part of a GraphQL query string into a Carbon instance. @param \GraphQL\Language\AST\Node $valueNode @param mixed[]|null $variables @return \Carbon\Carbon @throws \GraphQL\Error\Error
[ "public function parseLiteral($valueNode, ?array $variables = null): Carbon\n {\n if (! $valueNode instanceof StringValueNode) {\n throw new Error(\n \"Query error: Can only parse strings, got {$valueNode->kind}\",\n [$valueNode]\n );\n }\n\n ...
[ "static function parseWith($optionsResource, array $_ = null)\n {\n if (!static::isConfigurableWith($optionsResource))\n throw new \\InvalidArgumentException(sprintf(\n 'Invalid Configuration Resource provided on (%s); given: (%s).'\n , static::class, \\Poirot\\Std...
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Run flake8 against all py files
[ "def lint():\n \"\"\"\"\"\"\n py_files = subprocess.check_output(\"git ls-files\")\n if PY3:\n py_files = py_files.decode()\n py_files = [x for x in py_files.split() if x.endswith('.py')]\n py_files = ' '.join(py_files)\n sh(\"%s -m flake8 %s\" % (PYTHON, py_files), nolog=True)" ]
[ "def determine_target_roots(self, goal_name):\n \n if not self.context.target_roots:\n print('WARNING: No targets were matched in goal `{}`.'.format(goal_name), file=sys.stderr)\n\n # For the v2 path, e.g. `./pants list` is a functional no-op. This matches the v2 mode behavior\n # of e.g. `./pants ...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
/* (non-Javadoc) @see com.emc.ecs.nfsclient.nfs.NfsFile#makeMkdirRequest(com.emc.ecs.nfsclient. nfs.NfsSetAttributes)
[ "public NfsMkdirRequest makeMkdirRequest(NfsSetAttributes attributes) throws IOException {\n return getNfs().makeMkdirRequest(getParentFile().getFileHandle(), getName(), attributes);\n }" ]
[ "private void addRestResourceClasses(Set<Class<?>> resources) {\n resources.add(pl.setblack.airomem.direct.banksample.rest.BankResource.class);\n }" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Checks if there is already a Storage Policy Assignment and creates one if one does not exist. @param userID the ID of the user you want to assign the Storage Policy to. @return information about this {@link BoxStoragePolicyAssignment}.
[ "public BoxStoragePolicyAssignment.Info assign(String userID) {\n return BoxStoragePolicyAssignment.assign(this.getAPI(), this.getID(), userID);\n }" ]
[ "function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Returns all active (published) file type sets
[ "public function getActiveFileTypeSets(DataContainer $dc)\n {\n $arrFileTypeSets = array();\n \n $objFileTypeSets = $this->Database->prepare(\"SELECT * FROM tl_dms_file_type_sets WHERE published = 1 ORDER BY name\")\n ->execute();\n \n while($objFileTypeSets->next())\n {\n $ar...
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
@param string $entityFqn @return EntitySaverInterface
[ "public function getSaverForEntityFqn(string $entityFqn): EntitySaverInterface\n {\n $saverFqn = $this->getSaverFqn($entityFqn);\n if (class_exists($saverFqn)) {\n return new $saverFqn($this->entityManager, $this->namespaceHelper);\n }\n\n return $this->genericSaver;\n }...
[ "public function initServices() {\n $this->getFrontController()->getRequestHandler()->addService($entityService = $this->getEntityService());\n \n // wir mappen den users controller auf den in Psc\n $entityService->setControllerClass('User', 'Psc\\CMS\\Controller\\UserEntityController');\n }" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Obtain the extents for a list of vectors. @param vectors list of vectors @return array of extents (not sorted) @see #extent(javax.vecmath.Vector2d)
[ "static double[] extents(final List<Vector2d> vectors) {\n final int n = vectors.size();\n final double[] extents = new double[n];\n for (int i = 0; i < n; i++)\n extents[i] = VecmathUtil.extent(vectors.get(i));\n return extents;\n }" ]
[ "def Vector(self, off):\n \"\"\"\"\"\"\n N.enforce_number(off, N.UOffsetTFlags)\n\n off += self.Pos\n x = off + self.Get(N.UOffsetTFlags, off)\n # data starts after metadata containing the vector length\n x += N.UOffsetTFlags.bytewidth\n return x" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Adds a set of specified permissions to a channel. Multiple permissions can be added by providing the two parameters of each permission. @param integer $cid @param integer $permid @param integer $permvalue @return void
[ "public function channelPermAssign($cid, $permid, $permvalue)\n {\n if(!is_array($permid))\n {\n $permident = (is_numeric($permid)) ? \"permid\" : \"permsid\";\n }\n else\n {\n $permident = (is_numeric(current($permid))) ? \"permid\" : \"permsid\";\n }\n\n $this->execute(\"channeladd...
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Return a json dictionary representing this model.
[ "def _to_dict(self):\n \"\"\"\"\"\"\n _dict = {}\n if hasattr(self, 'duration') and self.duration is not None:\n _dict['duration'] = self.duration\n if hasattr(self, 'name') and self.name is not None:\n _dict['name'] = self.name\n if hasattr(self, 'details') ...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
volume of a zone defined by two polygon bases
[ "def vol(poly1, poly2):\n \"\n c_point = central_p(poly1, poly2)\n c_point = (c_point[0], c_point[1], c_point[2])\n vol_therah = 0\n num = len(poly1)\n poly1.append(poly1[0])\n poly2.append(poly2[0])\n for i in range(num - 2):\n # the upper part\n tehrahedron = [c_point, poly1[...
[ "def gaussian_window(t, params):\n \n window = suspect.basis.gaussian(t, 0, 0, params[\"line_broadening\"])\n\n # the above gaussian function returns an area 1 fid, for a windowing\n # function we need to be area preserving (first point must be 1)\n return window / window[0]" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
String representation with addtional information
[ "def to_string(self, other):\n \"\"\"\"\"\"\n arg = \"%s/%s,%s\" % (\n self.ttl, self.get_remaining_ttl(current_time_millis()), other)\n return DNSEntry.to_string(self, \"record\", arg)" ]
[ "private static String keyToGoWithElementsString(String label, DuplicateGroupedAndTyped elements) {\n /*\n * elements.toString(), which the caller is going to use, includes the homogeneous type (if\n * any), so we don't want to include it here. (And it's better to have it in the value, rather\n * tha...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "public EClass getIfcLabel() {\r\n\t\tif (ifcLabelEClass == null) {\r\n\t\t\tifcLabelEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers()\r\n\t\t\t\t\t.get(693);\r\n\t\t}\r\n\t\treturn ifcLabelEClass;\r\n\t}" ]
[ "protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license...
codesearchnet
{ "query": "Represent the Github sentence about Text generation:", "pos": "Represent the Github code about Text generation:", "neg": "Represent the Github code:" }
Called when the user scrolls in the color bar viewer. Pan up or down to show additional bars.
[ "def scroll_cb(self, viewer, direction, amt, data_x, data_y):\n \n bd = viewer.get_bindings()\n direction = bd.get_direction(direction)\n pan_x, pan_y = viewer.get_pan()[:2]\n qty = self._cmsep * amt * self.settings.get('cbar_pan_accel', 1.0)\n if direction == 'up':\n ...
[ "@Override\n public void onGestureBegin(TransformGestureDetector detector) {\n FLog.v(TAG, \"onGestureBegin\");\n mPreviousTransform.set(mActiveTransform);\n onTransformBegin();\n // We only received a touch down event so far, and so we don't know yet in which direction a\n // future move event will...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
// writeCstring writes BSON cstring. This is not a BSON element.
[ "func writeCstring(buf *bytes.Buffer, s string) error {\n\tif _, err := buf.WriteString(s); err != nil {\n\t\treturn err\n\t}\n\treturn buf.WriteByte(0x00)\n}" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Search model object @param array $params Query params @return array
[ "public function search($params = array()) {\r\n $this->checkPermissions('search');\r\n \r\n return $this->client->retrieveData($this->resourceName . '/search', $params);\r\n }" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
@param int $width @param int $height @param int $ttl @return \ManaPHP\Http\ResponseInterface
[ "public function generate($width = 100, $height = 30, $ttl = 300)\n {\n $code = '';\n $charsetCount = strlen($this->_charset);\n for ($i = 0; $i < $this->_length; $i++) {\n $code .= $this->_charset[mt_rand() % $charsetCount];\n }\n\n if (class_exists('Imagick')) {\n ...
[ "final public static function sinfo(array $params):string\n {\n return (\\iumioFramework\\Core\\Base\\Server\\GlobalServer::getServerInfo($params['name']));\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
// Ping returns a 0xFF packet ready to be sent (written to an io.Writer) as // response to a 0xFE (ServerListPing) packet.
[ "func Ping(s []string) *packet.Disconnect {\n\treturn &packet.Disconnect{Reason: strings.Join(s, \"\\x00\")}\n}" ]
[ "def get_finished_record_bytes(cls, tls_version: TlsVersionEnum) -> bytes:\n \n # TODO(AD): The ROBOT poc script uses the same Finished record for all possible client hello (default, GCM,\n # etc.); as the Finished record contains a hashes of all previous records, it will be wrong and will caus...
codesearchnet
{ "query": "Represent the Github description about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
Marshall the given parameter object.
[ "public void marshall(ContinueDeploymentRequest continueDeploymentRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (continueDeploymentRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// FileServer file server that disabled file listing
[ "func FileServer(dir http.Dir) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tp := path.Join(string(dir), r.URL.Path)\n\t\tif f, err := os.Stat(p); err == nil && !f.IsDir() {\n\t\t\thttp.ServeFile(w, r, p)\n\t\t\treturn\n\t\t}\n\n\t\thttp.NotFound(w, r)\n\t})\n}" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// AddEvent adds the event to the aggregator, automatically creating new classes // as needed.
[ "func (a *Aggregator) AddEvent(event *log.Event, id, fingerprint string) {\n\tif a.rateLimit != event.RateLimit {\n\t\ta.rateLimit = event.RateLimit\n\t}\n\n\toutlier := false\n\tif a.outlierTime > 0 && event.TimeMetrics[\"Query_time\"] > a.outlierTime {\n\t\toutlier = true\n\t}\n\n\ta.global.AddEvent(event, outlie...
[ "function WidgetDef(config, endFunc, out) {\n this.type = config.type; // The widget module type name that is passed to the factory\n this.id = config.id; // The unique ID of the widget\n this.config = config.config; // Widget config object (may be null)\n this.state = config.state; // Widget state obje...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Function or decorator which registers a given function as a recognized control command.
[ "def register(name, func=None):\n \n\n def decorator(func):\n # Perform the registration\n ControlDaemon._register(name, func)\n return func\n\n # If func was given, call the decorator, otherwise, return the\n # decorator\n if func:\n return decorator(func)\n else:\n ...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Writes flow results for a given flow.
[ "def WriteFlowResults(self, results):\n \"\"\"\"\"\"\n for r in results:\n dest = self.flow_results.setdefault((r.client_id, r.flow_id), [])\n to_write = r.Copy()\n to_write.timestamp = rdfvalue.RDFDatetime.Now()\n dest.append(to_write)" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the text about writing:", "pos": "Represent the code about writing:", "neg": "Represent the code:" }
/* There are no capabilities registered for the following addresses, so this is an emulation unfortunately, there is no capability-reference also, so, each attribute that wants to have the auto-complete, must add the SuggestionResource as a factory.
[ "private void registerManualCapabilities() {\n\n capabilities.register(EJB_CACHE, true,\n AddressTemplate.of(\"/{selected.profile}/subsystem=ejb3/cache=*\"));\n\n capabilities.register(EJB_PASSIVATION_STORE, true,\n AddressTemplate.of(\"/{selected.profile}/subsystem=ejb3/...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }