query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
// IterateBytes iterates through all bytes contained in the BitList
[ "func (bl *BitList) IterateBytes() <-chan byte {\n\tres := make(chan byte)\n\n\tgo func() {\n\t\tc := bl.count\n\t\tshift := 24\n\t\ti := 0\n\t\tfor c > 0 {\n\t\t\tres <- byte((bl.data[i] >> uint(shift)) & 0xFF)\n\t\t\tshift -= 8\n\t\t\tif shift < 0 {\n\t\t\t\tshift = 24\n\t\t\t\ti++\n\t\t\t}\n\t\t\tc -= 8\n\t\t}\n...
[ "func (zip GobMeddler) PreRead(fieldAddr interface{}) (scanTarget interface{}, err error) {\n\t// give a pointer to a byte buffer to grab the raw data\n\treturn new([]byte), nil\n}" ]
codesearchnet
{ "query": "Represent the Github text about AWS S3:", "pos": "Represent the Github code about AWS S3:", "neg": "Represent the Github code:" }
Validate that an attribute is different from another attribute. @param string $attribute @param mixed $value @param array $parameters @return bool
[ "public function validateDifferent($attribute, $value, $parameters)\n {\n $this->requireParameterCount(1, $parameters, 'different');\n\n foreach ($parameters as $parameter) {\n if (! Arr::has($this->data, $parameter)) {\n return false;\n }\n\n $other ...
[ "public function set($value = null, $junk = null)\n {\n if (!is_bool($value)) {\n throw new Exception(['Field\\CheckBox::set() needs value to be a boolean', 'value'=>$value]);\n }\n\n parent::set($value);\n }" ]
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
Look up the BioPython file type corresponding with input extension. Look up is case insensitive.
[ "def from_extension(extension):\n \n if not extension.startswith('.'):\n raise ValueError(\"Extensions must begin with a period.\")\n try:\n return EXTENSION_TO_TYPE[extension.lower()]\n except KeyError:\n raise UnknownExtensionError(\n \"seqmagick does not know how to ha...
[ "def reset(self):\n \n\n # Use first matching element as title (0 or more xpath expressions)\n self.title = OrderedSet()\n\n # Use first matching element as body (0 or more xpath expressions)\n self.body = OrderedSet()\n\n # Use first matching element as author (0 or more x...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Exports to the given path an ASCII file containing all the scalars written so far by this instance, with the following format: {writer_id : [[timestamp, step, value], ...], ...}
[ "def export_scalars(self, path):\n \n if os.path.exists(path) and os.path.isfile(path):\n logging.warning('%s already exists and will be overwritten by scalar dict', path)\n with open(path, \"w\") as f:\n json.dump(self._scalar_dict, f)" ]
[ "def check_field_cohesion(self, present_label_fields):\n \n # Ensure all written annotation fields have the same length\n nannots = len(self.sample)\n\n for field in ['sample', 'num', 'subtype', 'chan', 'aux_note']+present_label_fields:\n if getattr(self, field) is not None:\n...
codesearchnet
{ "query": "Represent the comment about computer science:", "pos": "Represent the code about computer science:", "neg": "Represent the code about programming:" }
Get the user id from the room jid. @memberof QB.chat.helpers @param {String} jid - resourse jid. @returns {String} userId - The user id.
[ "function(jid) {\n var arrayElements = jid.toString().split('/');\n if(arrayElements.length === 0){\n return null;\n }\n return arrayElements[arrayElements.length-1];\n }" ]
[ "function SocketIo(gameServer) {\n\n /**\n * ### SocketIo.name\n *\n * The name of the socket.\n */\n this.name = 'sio';\n\n /**\n * ### Socket.gameServer\n *\n * Reference to the game server in which the socket is created.\n *\n * @see GameServer\n */\n this.game...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
@param string $key @param mixed $defaultValue @return string
[ "public function getProperty($key, $defaultValue = null)\n {\n if (empty($this->properties[$key])) {\n return $defaultValue;\n }\n\n return $this->properties[$key];\n }" ]
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code:" }
Embed resources for the given relation @param relation Embedded resource relation @param resources Resources to embed @return HAL resource
[ "public HalResource addEmbedded(String relation, Iterable<HalResource> resources) {\n return addEmbedded(relation, Iterables.toArray(resources, HalResource.class));\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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// ComputeOpenSSHKeyFingerprint computes the OpenSSH fingerprint of the SSH public key
[ "func ComputeOpenSSHKeyFingerprint(publicKey string) (string, error) {\n\tsshPublicKey, err := parseSSHPublicKey(publicKey)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\th := md5.Sum(sshPublicKey.Marshal())\n\treturn colonSeparatedHex(h[:]), nil\n}" ]
[ "def verify(build)\n # TODO might as well cache this and store in the db so we dont have to\n # convert every time\n pkey = to_rsa_pkey\n signature = Base64.decode64(build.signature)\n digest = OpenSSL::Digest::SHA256.new\n\n # If the user submits html were going to expect the\n #...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Get bdaddr with LnxSendHCIRawCommand() for demo purpose
[ "func bdaddr(d gatt.Device) {\n\trsp := bytes.NewBuffer(nil)\n\tif err := d.Option(gatt.LnxSendHCIRawCommand(&cmdReadBDAddr{}, rsp)); err != nil {\n\t\tfmt.Printf(\"Failed to send HCI raw command, err: %s\", err)\n\t}\n\tb := rsp.Bytes()\n\tif b[0] != 0 {\n\t\tfmt.Printf(\"Failed to get bdaddr with HCI Raw command,...
[ "def getNetworkFragmentID(self):\n \n print '%s call getNetworkFragmentID' % self.port\n if not self.____isOpenThreadWpanRunning():\n print 'OpenThreadWpan is not running'\n return None\n\n return self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:PartitionId')[0]...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Updates a security group
[ "def update_security_group(self, sec_grp, name=None, desc=None):\n '''\n \n '''\n sec_grp_id = self._find_security_group_id(sec_grp)\n body = {'security_group': {}}\n if name:\n body['security_group']['name'] = name\n if desc:\n body['security_g...
[ "func New(*SmartSampleConfig, log.Logger, dtsink) (*SmartSampler, error) {\n\treturn nil, errors.New(\"you are attempting to configure a regular SignalFx Gateway with the config of a Smart Gateway. This is an unsupported configuration\")\n}" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// parseEnsAPIAddress parses string according to format // [tld:][contract-addr@]url and returns ENSClientConfig structure // with endpoint, contract address and TLD.
[ "func parseEnsAPIAddress(s string) (tld, endpoint string, addr common.Address) {\n\tisAllLetterString := func(s string) bool {\n\t\tfor _, r := range s {\n\t\t\tif !unicode.IsLetter(r) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\tendpoint = s\n\tif i := strings.Index(endpoint, \":\"); i > 0 {\n\...
[ "def schema_key(s_id: str) -> SchemaKey:\n \n\n s_key = s_id.split(':')\n s_key.pop(1) # take out indy-sdk schema marker: 2 marks indy-sdk schema id\n\n return SchemaKey(*s_key)" ]
codesearchnet
{ "query": "Represent the Github sentence about htbridge.com:", "pos": "Represent the Github code about htbridge.com:", "neg": "Represent the Github code about programming:" }
@param string $localeName @param string $keyName @param string $text @return array
[ "protected function addTranslation($localeName, $keyName, $text)\n {\n $locale = new LocaleTransfer();\n $locale->setLocaleName($localeName);\n $translation = [];\n\n $translation['text'] = $text;\n $translation['created'] = false;\n $translation['updated'] = false;\n\n ...
[ "static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Return entries without specified protocol (single log)
[ "def filter_data(self, data, values=None, args=None):\n \"\"\"\"\"\"\n if args:\n if not args.rprotocol:\n return data\n if not values: values = args.rprotocol\n newdata = {}\n if 'parser' in data.keys():\n newdata['parser'] = data['parser']\n ...
[ "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 text:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Get retrieves the CustomResourceDefinition from the index for a given name.
[ "func (s *customResourceDefinitionLister) Get(name string) (*apiextensions.CustomResourceDefinition, error) {\n\tobj, exists, err := s.indexer.GetByKey(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(apiextensions.Resource(\"customresourcedefinition\"), name)\n...
[ "func getEnterpriseResourceIter(context structs.Context, _ *acl.ACL, namespace, prefix string, ws memdb.WatchSet, state *state.StateStore) (memdb.ResultIterator, error) {\n\t// If we have made it here then it is an error since we have exhausted all\n\t// open source contexts.\n\treturn nil, fmt.Errorf(\"context mus...
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Index of. @param string $haystack @param string $needle @param int $offset @return int
[ "public static function indexOf(string $haystack, string $needle, int $offset = 0): int\n {\n $pos = self::strpos($haystack, $needle, $offset);\n return is_int($pos) ? $pos : -1;\n }" ]
[ "protected static function parsePrintableString(&$data, &$result)\n {\n // Printable string type\n $data = self::parseCommon($data, $stringData);\n $result[] = [\n 'Printable String (' . self::$len . ')',\n $stringData, ];\n }" ]
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Sets a HeaderBag containing all headers; @param string $headers @return Response @author Livingstone Fultang
[ "public function setHeaders(array $headers = [])\n {\n\n $this->headers = ($headers instanceof Headers) ? $headers : new Headers((array)$headers);\n\n return $this;\n\n }" ]
[ "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 text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Creates a snapshot schema @param Schema $schema @param string $snapshotName Defaults to 'snapshot'
[ "public static function create($snapshotName = 'snapshot')\n {\n Schema::create($snapshotName, function (Blueprint $snapshot) use ($snapshotName) {\n // UUID4 of linked aggregate\n $snapshot->char('aggregate_id', 36);\n // Class of the linked aggregate\n $snapsh...
[ "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 text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Save the session data to storage. @return void
[ "public function save() {\n\t\tif ( ! $this->started ) {\n\t\t\treturn;\n\t\t}\n\n\t\t$this->age_flash_data();\n\n\t\t/* @noinspection PhpParamsInspection */\n\t\t$this->handler->write( $this->get_id(), $this->attributes );\n\n\t\t$this->started = false;\n\t}" ]
[ "@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 Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
Print a vertical pretty table from data.
[ "def print_virt_table(self, data):\n \"\"\"\"\"\"\n\n table = prettytable.PrettyTable()\n keys = sorted(data.keys())\n table.add_column('Keys', keys)\n table.add_column('Values', [data.get(i) for i in keys])\n for tbl in table.align.keys():\n table.align[tbl] = '...
[ "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 description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Get all extra fields. @return array
[ "public function getExtraFields()\n {\n if ($this->_extraFields === null) {\n $extraFields = [];\n foreach ($this->getConfig() as $pointer => $fields) {\n if (is_array($fields)) {\n foreach ($fields as $field) {\n if (isset($fi...
[ "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 sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
port of EVP_BytesToKey, as used when decrypting PEM keys
[ "function passphraseToKey(type, passphrase, salt)\n {\n debug('passphraseToKey', type, passphrase, salt);\n var nkey = keyBytes[type];\n\n if (!nkey)\n {\n var allowed = Object.keys(keyBytes);\n throw new TypeError('Unsupported type. Allowed: ' + allowed);\n }\n\n var niv = salt.length;\n var salt...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Defines the color that will be used to colorize the subTitle of the gauge. @param COLOR
[ "public void setSubTitleColor(final Color COLOR) {\n if (null == subTitleColor) {\n _subTitleColor = COLOR;\n fireUpdateEvent(REDRAW_EVENT);\n } else {\n subTitleColor.set(COLOR);\n }\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 Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
List all the related competencies. @param int $competencyid The id of the competency to check. @return competency[]
[ "public static function list_related_competencies($competencyid) {\n static::require_enabled();\n $competency = new competency($competencyid);\n\n if (!has_any_capability(array('moodle/competency:competencyview', 'moodle/competency:competencymanage'),\n $competency->get_context()...
[ "public function createRecord($eventData, $peopleId) {\n\n // Basically, just want to throw the data to the \"API\", and have the database magically updated.\n // Don't want to do the Command Bus thing, although has worked out well! The data's ready, just\n // want to get to the persist.\n\n ...
codesearchnet
{ "query": "Represent the sentence about Workspace management:", "pos": "Represent the code about Workspace management:", "neg": "Represent the code about Software Development:" }
/* (non-Javadoc) @see java.util.Properties#loadFromXML(java.io.InputStream)
[ "@Override\n\tpublic void loadFromXML(final InputStream in) throws IOException {\n\t\tlock.writeLock().lock();\n\t\ttry {\n\t\t\tproperties.loadFromXML(in);\n\t\t} finally {\n\t\t\tlock.writeLock().unlock();\n\t\t}\n\t}" ]
[ "public Object getNextObjectParam(InputStream in, String strName, Map<String, Object> properties)\n {\n String strParam = this.getNextStringParam(in, strName, properties);\n strParam = Base64.decode(strParam);\n return org.jbundle.thin.base.remote.proxy.transport.BaseTransport.convertStringT...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Returns the index of the first set bit starting at the index specified. -1 is returned if there are no more set bits.
[ "long nextSetBit(long index) {\r\n\t\t// Depends on the ghost bits being clear!\r\n\t\tassert index >= 0 && index < numBits : \"index=\" + index + \", numBits=\" + numBits;\r\n\t\tint i = (int) (index >> 6);\r\n\t\tlong word = bits[i] >> index; // skip all the bits to the right of index\r\n\r\n\t\tif (word != 0) {\...
[ "public FP64 extend(char c) {\n byte b1 = (byte)(c & 0xff);\n extend(b1);\n byte b2 = (byte) (c >>> 8);\n // NOTE pdalbora 23-Jul-2009 -- The following check is intentional. We don't extend the high order byte when it's\n // zero, in order to avoid \"weakening\" the fingerprint of primarily ASCII dat...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Metodo que permite obtener los elementos hijos y convertirlos en un objeto lista PHPHtmlDomList. @return self
[ "private function get_childs()\n {\n $this->childs = new \\PHPTools\\PHPHtmlDom\\Core\\PHPHtmlDomList($this->dom_element->childNodes);\n\n return $this;\n }" ]
[ "public static void registerAgent(Agent agent, String serviceName, String serviceType) throws FIPAException{\n DFAgentDescription dfd = new DFAgentDescription();\n ServiceDescription sd = new ServiceDescription();\n \n sd.setType(serviceType);\n sd.setName(serviceName);\n \...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// accountUpdate transitions an account from a previous format to the current // one, also providing the possibility to change the pass-phrase.
[ "func accountUpdate(ctx *cli.Context) error {\n\tif len(ctx.Args()) == 0 {\n\t\tutils.Fatalf(\"No accounts specified to update\")\n\t}\n\tstack, _ := makeConfigNode(ctx)\n\tks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)\n\n\tfor _, addr := range ctx.Args() {\n\t\taccount, oldPa...
[ "func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}" ]
codesearchnet
{ "query": "Represent the comment about Address:", "pos": "Represent the code about Address:", "neg": "Represent the code about Software development:" }
Create a CaptainHook configuration @param string $path @return \CaptainHook\App\Config @throws \Exception
[ "public function createConfig($path = '') : Config\n {\n $path = $path ?: getcwd() . DIRECTORY_SEPARATOR . CH::CONFIG;\n $json = new Json($path);\n $fileExists = $json->exists();\n $config = new Config($path, $fileExists);\n\n if ($fileExists) {\n $th...
[ "public function init()\n {\n $this->response->disableLayout();\n $this->userStore = b8\\Store\\Factory::getStore('User');\n }" ]
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Encode a msgpck'ed datetime.
[ "def _encode_datetime(obj):\n \"\"\"\"\"\"\n\n if isinstance(obj, datetime.datetime):\n obj = {'__datetime__': True, 'as_str': obj.strftime(\"%Y%m%dT%H:%M:%S.%f\").encode()}\n return obj" ]
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Write summary of level and depth counts for all active GO Terms.
[ "def write_summary_cnts_all(self):\n \"\"\"\"\"\"\n cnts = self.get_cnts_levels_depths_recs(set(self.obo.values()))\n self._write_summary_cnts(cnts)" ]
[ "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:" }
Removes all not active dirs with old caches. This method is invoked after each save of global plugin config @param configs active server configs to exclude caches from cleanup
[ "public static void clearRedundantCaches(List<GitHubServerConfig> configs) {\n Path baseCacheDir = getBaseCacheDir();\n\n if (notExists(baseCacheDir)) {\n return;\n }\n\n final Set<String> actualNames = from(configs).filter(withEnabledCache()).transform(toCacheDir())\n ...
[ "function(request, modules_root, options){\n var [path, analysis] = normalize_path(request, modules_root, options.relative_path_root);\n var cache_path = path; // define cachepath as path to file with content. For modules, defines path to package.json\n if(analysis.is_a_module) cache_path = \"m...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Find the indices of a set of angles into a set of pixels Parameters: ----------- pix : set of search pixels pixels : set of reference pixels Returns: -------- index : index into the reference pixels
[ "def index_lonlat_in_pixels(lon,lat,pixels,nside,sort=False,outside=-1):\n \n\n pix = ang2pix(nside,lon,lat)\n return index_pix_in_pixels(pix,pixels,sort,outside)" ]
[ "def label(self, input_grid):\n \n marked = self.find_local_maxima(input_grid)\n marked = np.where(marked >= 0, 1, 0)\n # splabel returns two things in a tuple: an array and an integer\n # assign the first thing (array) to markers\n markers = splabel(marked)[0]\n ret...
codesearchnet
{ "query": "Represent the Github description about mathematics:", "pos": "Represent the Github code about mathematics:", "neg": "Represent the Github code:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "public IfcElectricFlowStorageDeviceTypeEnum createIfcElectricFlowStorageDeviceTypeEnumFromString(\r\n\t\t\tEDataType eDataType, String initialValue) {\r\n\t\tIfcElectricFlowStorageDeviceTypeEnum result = IfcElectricFlowStorageDeviceTypeEnum.get(initialValue);\r\n\t\tif (result == null)\r\n\t\t\tthrow new IllegalAr...
[ "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 comment about Text generation:", "pos": "Represent the Github code about Text generation:", "neg": "Represent the Github code:" }
// MarshalCommand marshals the given command.
[ "func MarshalCommand(t Type, msg proto.Message) ([]byte, error) {\n\tvar b []byte\n\tvar err error\n\n\tswitch t {\n\tcase Protobuf:\n\t\tb, err = proto.Marshal(msg)\n\tcase JSON:\n\t\tvar str string\n\t\tm := &jsonpb.Marshaler{\n\t\t\tEmitDefaults: true,\n\t\t}\n\t\tstr, err = m.MarshalToString(msg)\n\t\tb = []byt...
[ "@Override\n public void init(TCPWriteRequestContext x, H2MuxTCPWriteCallback c) {\n writeReqContext = x;\n muxCallback = c;\n\n // callback will need to know how to get back to this write queue.\n // This means one and only one H2WriteTree per H2InboundLink which has just one true TC...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Validate the new username for a new account. If the username is invalid or in use, raises :py:exc:`UsernameInvalid` or :py:exc:`UsernameTaken`. :param person: Owner of new account. :param username: Username to validate.
[ "def validate_username_for_new_account(person, username):\n \n\n # This is much the same as validate_username_for_new_person, except\n # we don't care if the username is used by the person owning the account\n\n # is the username valid?\n\n validate_username(username)\n\n # Check for existing peop...
[ "def authenticate(self, request):\n \n auth = get_authorization_header(request).split()\n\n if not auth or auth[0].lower() != b'bearer':\n return None\n\n if len(auth) == 1:\n msg = 'Invalid authorization header. No credentials provided.'\n raise exceptio...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
Marshall the given parameter object.
[ "public void marshall(GetVpcLinksRequest getVpcLinksRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (getVpcLinksRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(getVpcLinks...
[ "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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Fetch group entity based on role name @param string $name Role name @return \Cake\Datasource\EntityInterface|null
[ "protected function getGroupByRoleName(string $name) : ?EntityInterface\n {\n $result = TableRegistry::get('Groups.Groups')->find()\n ->enableHydration(true)\n ->where(['name' => $name])\n ->first();\n\n Assert::nullOrIsInstanceOf($result, EntityInterface::class);\n...
[ "function newService()\n {\n ### Attain Login Continue If Has\n /** @var iHttpRequest $request */\n $request = \\IOC::GetIoC()->get('/HttpRequest');\n $tokenAuthIdentifier = new IdentifierHttpToken;\n $tokenAuthIdentifier\n ->setRequest($request)\n ->setT...
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Close the connection asynchronously, and close any associated CBS authentication session.
[ "async def destroy_async(self):\n \n try:\n await self.lock_async()\n _logger.debug(\"Unlocked connection %r to close.\", self.container_id)\n await self._close_async()\n except asyncio.TimeoutError:\n _logger.debug(\n \"Connection %r t...
[ "private void stopOut() throws IOException {\n if (outClosed) {\n return;\n }\n outClosed = true;\n\n LOG.log(Level.FINE, \"Shutting down socket for output\");\n\n // close socket for output - that will initiate normal socket close procedure; in case of TCP\n // socket this is\n // a buffe...
codesearchnet
{ "query": "Represent the sentence about Computer Networking:", "pos": "Represent the code about Computer Networking:", "neg": "Represent the code:" }
Check if current upload is expired. @return bool
[ "public function isExpired() : bool\n {\n $expiresAt = $this->getCache()->get($this->getKey())['expires_at'] ?? null;\n\n return empty($expiresAt) || Carbon::parse($expiresAt)->lt(Carbon::now());\n }" ]
[ "private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }" ]
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Returns the value of a configuration parameter.
[ "def get(self, id, param):\n \n assert isinstance(id, basestring)\n assert isinstance(param, basestring)\n return self.params_.get(param, {}).get(id)" ]
[ "@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 description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
/* (non-Javadoc) @see org.duracloud.mill.workman.TaskProcessor#execute()
[ "@Override\n public final void execute() throws TaskExecutionFailedException {\n long startTime = System.currentTimeMillis();\n\n try {\n executeImpl();\n log.info(createMessage(\"success\", System.currentTimeMillis() - startTime));\n } catch (TaskExecutionFailedExcepti...
[ "private void addRestResourceClasses(Set<Class<?>> resources) {\n resources.add(pl.setblack.airomem.direct.banksample.rest.BankResource.class);\n }" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Resets the account id, property id and profile id @param int id
[ "public function resetPropertyId($id = false)\n {\n $em = $this->getEntityManager();\n $config = $id ? $this->find($id) : $this->findFirst();\n $config->setAccountId('');\n $config->setProfileId('');\n $config->setPropertyId('');\n $em->persist($config);\n $em->fl...
[ "function completeQuery(err) {\n if (err) return cb(err);\n db.eval(zahd, 2, 'expiring_domains', 'querying_domains',\n expiration, domain, next);\n }" ]
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Description: Returns dict of information about the TV name, model, version
[ "def info(self):\n \n return {\"name\": self._send_command('name'),\n \"model\": self._send_command('model'),\n \"version\": self._send_command('version'),\n \"ip_version\": self._send_command('ip_version')\n }" ]
[ "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 Github comment about Data processing:", "pos": "Represent the Github code about Data processing:", "neg": "Represent the Github code:" }
// Only add if we haven't seen the key already. Return whether the key was // added.
[ "func (s *YubiStore) addKey(keyID string, role data.RoleName, privKey data.PrivateKey) (\n\tbool, error) {\n\n\t// We only allow adding root keys for now\n\tif role != data.CanonicalRootRole {\n\t\treturn false, fmt.Errorf(\n\t\t\t\"yubikey only supports storing root keys, got %s for key: %s\", role, keyID)\n\t}\n\...
[ "public static long createFileId(long containerId) {\n long id = BlockId.createBlockId(containerId, BlockId.getMaxSequenceNumber());\n if (id == INVALID_FILE_ID) {\n // Right now, there's not much we can do if the file id we're returning is -1, since the file\n // id is completely determined by the ...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Create an array of OG tags and their values for a show. https://developers.facebook.com/docs/sharing/webmasters @param object $show The show object. @return array
[ "public static function createOpenGraphTagsForShow($show) {\n return [\n 'og:title' => $show->title,\n 'og:type' => 'website',\n 'og:url' => Config('app.url') .'/'. $show->slug,\n 'og:image' => Config('app....
[ "function Api(config) {\n // config\n this._config = config || {};\n this._config.transforms = _.merge(this._config.transforms || {},{\n defaults: {\n serialize: JSON.stringify,\n deserialize: JSON.parse\n }\n });\n\n this._config.headers = this._config.headers || {};\n\n // stack of [('one' |...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// SetLogGroupName sets the LogGroupName field's value.
[ "func (s *PutMetricFilterInput) SetLogGroupName(v string) *PutMetricFilterInput {\n\ts.LogGroupName = &v\n\treturn s\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 sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Returns the js code to attach a Google event or a Dom event to a js object @param string $name the object name @return string the js event
[ "public function getJs($name)\n {\n switch ($this->getType()) {\n case EventType::DEFAULT_ONCE:\n return $this->getEventJs($name, true);\n case EventType::DOM:\n return $this->getDomEventJs($name);\n case EventType::DOM_ONCE:\n ...
[ "function(element, options) {\n\n var $el = $(element);\n // React on every server/socket.io message.\n // If the element is defined with a data-react-on-event attribute\n // we take that as an eventType the user wants to be warned on this\n // element and we forward the event via jQuery events on $(...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Sets or gets layout OpenGraph property. @param string $property @param string $value @return string
[ "public static function og(string $property, string $value = null)\n {\n return $value !== null ? static::$openGraph[$property] = $value : (static::$openGraph[$property] ?? null);\n }" ]
[ "static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// getSystemTimes makes the system call to windows to get the system data
[ "func getSystemTimes(idleTime, kernelTime, userTime *FileTime) bool {\n\tret, _, _ := procGetSystemTimes.Call(\n\t\tuintptr(unsafe.Pointer(idleTime)),\n\t\tuintptr(unsafe.Pointer(kernelTime)),\n\t\tuintptr(unsafe.Pointer(userTime)))\n\n\treturn ret != 0\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 description about File management:", "pos": "Represent the code about File management:", "neg": "Represent the code about programming:" }
Constructs a random filename with the given prefix and a random part generated from hex characters. @param prefix the prefix to the filename to be constructed @return the generated random filename with the given prefix
[ "public static String getRandomFilename(final String prefix) {\n\t\tfinal Random rnd = new Random();\n\t\tfinal StringBuilder stringBuilder = new StringBuilder(prefix);\n\n\t\tfor (int i = 0; i < RANDOM_FILE_NAME_LENGTH; i++) {\n\t\t\tstringBuilder.append(ALPHABET[rnd.nextInt(ALPHABET.length)]);\n\t\t}\n\n\t\tretur...
[ "def get_sphinx_ref(self, url, label=None):\n \n\n # Raise an exception if the initial part of url does not match\n # the base url for this object\n n = len(self.baseurl)\n if url[0:n] != self.baseurl:\n raise KeyError('base of url %s does not match base url %s' %\n ...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Register additional object constructors for custom classes.
[ "public static void registerConstructor(String module, String classname, IObjectConstructor constructor) {\n\t\tobjectConstructors.put(module + \".\" + classname, constructor);\n\t}" ]
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Will list *all* the content of the bucket given in options Recursively requests the bucket with a marker if there's more than 1000 objects. Ensures uniqueness of keys in the returned list.
[ "function (prefix, callback, marker, contents) {\n\n\t\t\tvar search = {\n\t\t\t\tPrefix: prefix, \n\t\t\t\tBucket: options.bucket\n\t\t\t};\n\n\t\t\tif (marker) {\n\t\t\t\tsearch.Marker = marker;\n\t\t\t}\n\n\t\t\ts3.listObjects(search, function (err, list) { \n\n\t\t\t\tif (!err) {\n\n\t\t\t\t\tvar objects = (con...
[ "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 Github summarization about AWS S3:", "pos": "Represent the Github code about AWS S3:", "neg": "Represent the Github code about programming:" }
A redirect that uses 307 see other. @param url The url used as redirect target. @return A nicely configured result with status code 307 and the url set as Location header.
[ "public Result redirectTemporary(String url) {\n status(Status.TEMPORARY_REDIRECT);\n with(HeaderNames.LOCATION, url);\n return this;\n }" ]
[ "func (c *UserController) PostRegister() mvc.Result {\n\t// get firstname, username and password from the form.\n\tvar (\n\t\tfirstname = c.Ctx.FormValue(\"firstname\")\n\t\tusername = c.Ctx.FormValue(\"username\")\n\t\tpassword = c.Ctx.FormValue(\"password\")\n\t)\n\n\t// create the new user, the password will b...
codesearchnet
{ "query": "Represent the sentence about Laravel:", "pos": "Represent the code about Laravel:", "neg": "Represent the code about programming:" }
// Set The Remote Address
[ "func SetRemoteAddr(a net.UDPAddr) func(*Server) error {\n\treturn func(s *Server) error {\n\t\ts.raddr = a\n\t\treturn nil\n\t}\n}" ]
[ "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 instruction about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about File management:" }
Open a GRIB file groupping incompatible hypercubes to different datasets via simple heuristics.
[ "def open_datasets(path, backend_kwargs={}, no_warn=False, **kwargs):\n # type: (str, T.Dict[str, T.Any], bool, T.Any) -> T.List[xr.Dataset]\n \n if not no_warn:\n warnings.warn(\"open_datasets is an experimental API, DO NOT RELY ON IT!\", FutureWarning)\n\n fbks = []\n datasets = []\n try:...
[ "def surface(self, canvas, X, Y, Z, color=None, label=None, **kwargs):\n \n raise NotImplementedError(\"Implement all plot functions in AbstractPlottingLibrary in order to use your own plotting library\")" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// newPeer creates a new peer from an establish connection object, and a // pointer to the main server.
[ "func newPeer(conn net.Conn, connReq *connmgr.ConnReq, server *server,\n\taddr *lnwire.NetAddress, inbound bool,\n\tlocalFeatures *lnwire.RawFeatureVector,\n\tchanActiveTimeout time.Duration,\n\tfinalCltvRejectDelta, outgoingCltvRejectDelta uint32) (\n\t*peer, error) {\n\n\tnodePub := addr.IdentityKey\n\n\tp := &pe...
[ "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 post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
// You should always use this function to get a new UploadCustomCertificateParams instance, // as then you are sure you have configured all required params
[ "func (s *CertificateService) NewUploadCustomCertificateParams(certificate string, domainsuffix string) *UploadCustomCertificateParams {\n\tp := &UploadCustomCertificateParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"certificate\"] = certificate\n\tp.p[\"domainsuffix\"] = domainsuffix\n\treturn p\n}" ]
[ "function (err, collection) {\n if (err) {\n return callback(err);\n }\n\n // ensure that the collection option is present before starting a run\n if (!_.isObject(collection)) {\n return callback(new Error(COLLECTION_L...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// RegisterSubChannel registers the given channel c in channelz database with ref // as its reference name, and add it to the child list of its parent (identified // by pid). It returns the unique channelz tracking id assigned to this subchannel.
[ "func RegisterSubChannel(c Channel, pid int64, ref string) int64 {\n\tif pid == 0 {\n\t\tgrpclog.Error(\"a SubChannel's parent id cannot be 0\")\n\t\treturn 0\n\t}\n\tid := idGen.genID()\n\tsc := &subChannel{\n\t\trefName: ref,\n\t\tc: c,\n\t\tsockets: make(map[int64]string),\n\t\tid: id,\n\t\tpid: p...
[ "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 text:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Helper function to get all possible geometry :param layer_purpose_key: A layer purpose key. :type layer_purpose_key: str :returns: List of all allowed geometries. :rtype: list
[ "def get_allowed_geometries(layer_purpose_key):\n \n preferred_order = [\n 'point',\n 'line',\n 'polygon',\n 'raster'\n ]\n allowed_geometries = set()\n all_layer_type = []\n if layer_purpose_key == layer_purpose_hazard['key']:\n all_layer_type = hazard_all\n ...
[ "def node_iterator(self):\n \n return iter(self._node_attributes)\n\n\tdef has_hypernode(self, hypernode):\n \"\"\"Determines if a specific hypernode is present in the hypergraph.\n\n :param node: reference to hypernode whose presence is being checked.\n :returns: bool -- true iff...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Private Attempt to send the event to the socket. If socket no longer exists, remove it from set
[ "function sendToMultiple(send, msg, destinations, type) {\n destinations = destinations instanceof Array && destinations || [destinations];\n destinations.forEach(function(destination) {\n var set, socketIds;\n set = subscriptions[type];\n if ((socketIds = set.members(destination))) {\n return socke...
[ "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 about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about programming:" }
Returns the utf8 string corresponding to the unicode value (from php.net, courtesy - romans@void.lv) @param int $num one unicode value @return string the UTF-8 char corresponding to the unicode value
[ "public static function code2utf8($num) {\n if ($num < 128) {\n return chr($num);\n }\n if ($num < 2048) {\n return chr(($num >> 6) + 192) . chr(($num & 63) + 128);\n }\n if ($num < 65536) {\n return chr(($num >> 12) + 224) . chr((($num >> 6) & 63)...
[ "def GetDictToFormat(self):\n \"\"\"\"\"\"\n d = {}\n for k, v in self.__dict__.items():\n # TODO: Better handling of unicode/utf-8 within Schedule objects.\n # Concatinating a unicode and utf-8 str object causes an exception such\n # as \"UnicodeDecodeError: 'ascii' codec can't decode byte ...
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Cancel request and worker on host. @param targetHosts the target hosts
[ "@SuppressWarnings(\"deprecation\")\n private void cancelRequestAndWorkerOnHost(List<String> targetHosts) {\n\n List<String> validTargetHosts = new ArrayList<String>(workers.keySet());\n validTargetHosts.retainAll(targetHosts);\n logger.info(\"targetHosts for cancel: Total: {}\"\n ...
[ "@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 comment:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Creates a new {@link QueueProducer}. The producer accepts arbitrary objects and uses the Jackson object mapper to convert them into JSON and sends them as a text message.
[ "public QueueProducer<Object> createQueueJsonMessageProducer(final String topic)\n {\n Preconditions.checkState(connectionFactory != null, \"connection factory was never injected!\");\n return new QueueProducer<Object>(connectionFactory, jmsConfig, topic, producerCallback);\n }" ]
[ "void offerData(byte[] chunk) {\n if (chunk == null || chunk.length == 0) {\n throw new IllegalArgumentException(\"chunk must have at least one byte of data\");\n }\n\n if (closed) {\n return;\n }\n\n // Since this is an unbounded queue, offer() always succeeds. In addition, we don't make a...
codesearchnet
{ "query": "Represent the instruction about software development:", "pos": "Represent the code about software development:", "neg": "Represent the code:" }
TODO: Clean this up!
[ "def add_versions\n new_gemfile = Tempfile.new(\"Gemfile.versioned\")\n begin\n gemfile_content.each do |gem_line|\n if is_gem_line?(gem_line)\n new_gemfile.puts(build_gem_line(gem_line))\n else\n new_gemfile.puts(gem_line)\n end\n end\n ...
[ "public function postCommit(\n InputInterface $input,\n OutputInterface $output,\n ParameterBagInterface $configuration\n ): void {\n // Yes we can send a notification to slack fx?\n // Then we would just add some configuration with slack channel, username etc etc\n // A...
codesearchnet
{ "query": "Represent the description about writing:", "pos": "Represent the code about writing:", "neg": "Represent the code about programming:" }
Retrieves the event id for a SIP Response event. @param eventLookupFacility @param response @return
[ "public FireableEventType getEventId(EventLookupFacility eventLookupFacility,\n\t\t\tResponse response) {\n\n\t\tString statusCodeName = null;\n\t\tfinal int responseStatus = response.getStatusCode();\n\t\tif (responseStatus == 100) {\n\t\t\tstatusCodeName = \"TRYING\";\n\t\t} else if (100 < responseStatus && respo...
[ "public static OriginIdElement addOriginId(Message message) {\n OriginIdElement originId = new OriginIdElement();\n message.addExtension(originId);\n // TODO: Find solution to have both the originIds stanzaId and a nice to look at incremental stanzaID.\n // message.setStanzaId(originId.g...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
@param array $config @return CouchbaseQueue|\Illuminate\Contracts\Queue\Queue
[ "public function connect(array $config)\n {\n /** @var CouchbaseConnection $connection */\n $connection = $this->connectionResolver->connection($config['driver']);\n\n return new CouchbaseQueue(\n $connection,\n $config['bucket'],\n $config['queue'],\n ...
[ "public function register()\n {\n $this->registerFileConfig();\n $this->registerDatabaseConfig();\n\n // Bind the concrete types\n $this->app->bind('Concrete\\Core\\Config\\Repository\\Repository', 'config');\n $this->app->bind('Illuminate\\Config\\Repository', 'Concrete\\Core\...
codesearchnet
{ "query": "Represent the Github text about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Checks if the given $nodeType would be allowed as a child node of this node according to the configured constraints. @param NodeType $nodeType @return boolean true if the passed $nodeType is allowed as child node @throws NodeTypeNotFoundException
[ "public function isNodeTypeAllowedAsChildNode(NodeType $nodeType): bool\n {\n if ($this->isAutoCreated()) {\n return $this->getParent()->getNodeType()->allowsGrandchildNodeType($this->getName(), $nodeType);\n } else {\n return $this->getNodeType()->allowsChildNodeType($nodeTyp...
[ "private function resolveType(ObjectTypeInterface $type)\n {\n $parentType = $type->getParent();\n\n if (null !== $parentType) {\n $parentType = $this->registry->getType($parentType);\n }\n\n return $this->resolvedTypeFactory->createResolvedType(\n $type,\n ...
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
login action GET | POST @return void
[ "public function login()\n {\n if ($this->request->is('post')) {\n $this->loadModel('Wasabi/Core.LoginLogs');\n $clientIp = $this->request->clientIp();\n $ipIsBlocked = $this->LoginLogs->ipIsBlocked($clientIp);\n\n if ($ipIsBlocked) {\n $errorMsg ...
[ "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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
[ "func (in *APIService) DeepCopyInto(out *APIService) {\n\t*out = *in\n\tout.TypeMeta = in.TypeMeta\n\tin.ObjectMeta.DeepCopyInto(&out.ObjectMeta)\n\tin.Spec.DeepCopyInto(&out.Spec)\n\tin.Status.DeepCopyInto(&out.Status)\n\treturn\n}" ]
[ "func ExternalCAsEqualStable(a, b []*api.ExternalCA) bool {\n\t// because DeepEqual will treat an empty list and a nil list differently, we want to manually check this first\n\tif len(a) == 0 && len(b) == 0 {\n\t\treturn true\n\t}\n\t// The assumption is that each individual api.ExternalCA within both lists are cre...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
---- RAW RENDERER ----
[ "function rawRender (vdom, isSvg) {\n if (Array.isArray(vdom)) return renderArray(vdom, isSvg)\n if (vdom instanceof window.Element) return renderDirectDom(vdom, isSvg)\n if (typeof vdom !== 'object') return renderPrimitive(vdom, isSvg)\n\n // one-level deep flatten children array\n var props = extend(\n ex...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Setup formats. @return Client
[ "public function setupFormats()\n {\n//through HTTP_ACCEPT\n if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], '*/*') === false) {\n foreach ($this->outputFormats as $formatCode => $formatMethod) {\n if (strpos($_SERVER['HTTP_ACCEPT'], $formatCode) !== false) ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
is not called on ajax actions!
[ "public function beforeRender(Event $event)\n {\n\n parent::beforeRender($event);\n\n // when a shop order was placed, the pdfs that are rendered for the order confirmation email\n // called this method and therefore called resetOriginalLoggedCustomer() => email was sent t\n // the us...
[ "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 summarization:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// fragCombos returns a map (by uri) of lists of fragments for a given index // by creating every combination of field/view specified in `fieldViews` up // for the given set of shards with data.
[ "func (c *cluster) fragCombos(idx string, availableShards *roaring.Bitmap, fieldViews viewsByField) fragsByHost {\n\tt := make(fragsByHost)\n\tavailableShards.ForEach(func(i uint64) {\n\t\tnodes := c.shardNodes(idx, i)\n\t\tfor _, n := range nodes {\n\t\t\t// for each field/view combination:\n\t\t\tfor field, views...
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Process provided grammars by parsing them into Python objects.
[ "def process_grammars(self, grammars):\n \"\"\"\"\"\"\n for path in self.default_grammars:\n grammars.insert(0, open(os.path.relpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),\n os.path.normcase(path)))))\n ...
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the comment about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software development:" }
Gets Web UI workers page data. @return the response object
[ "@GET\n @Path(WEBUI_WORKERS)\n @ReturnType(\"alluxio.wire.MasterWebUIWorkers\")\n public Response getWebUIWorkers() {\n return RestUtils.call(() -> {\n MasterWebUIWorkers response = new MasterWebUIWorkers();\n\n response.setDebug(ServerConfiguration.getBoolean(PropertyKey.DEBUG));\n\n List<Work...
[ "@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 about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Programming:" }
// Lookup looks for a statement with the given ID
[ "func (s Stmts) Lookup(id string) (Stmt, bool) {\n\tfor _, stmt := range s {\n\t\tif stmt.ID() == id {\n\t\t\treturn stmt, true\n\t\t}\n\t}\n\treturn nil, false\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 description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Create a default set of options with a custom number of retry attempts. @param numberOfAttempts The number of execution attempts. @return The TransactionOptions object.
[ "@Nonnull\n public static TransactionOptions create(int numberOfAttempts) {\n Preconditions.checkArgument(numberOfAttempts > 0, \"You must allow at least one attempt\");\n return new TransactionOptions(numberOfAttempts, null, null);\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 description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Get the list of templates available. Returns an array of associative arrays e.g. array( array( 'id' => 'home', 'title' => 'Home', ), array( 'id' => 'about-us', 'title' => 'About Us' ) ); @return array
[ "public function getTemplates()\n {\n $templates = array();\n\n if ($handle = opendir(Primer::$PATTERN_PATH . '/templates')) {\n while (false !== ($entry = readdir($handle))) {\n if (substr($entry, 0, 1) !== '.') {\n $templates[] = array(\n ...
[ "public function get($id)\n {\n $response = $this->getResponse();\n $contentType = 'application/json';\n $adapter = '\\Zend\\Serializer\\Adapter\\Json';\n $response->getHeaders()->addHeaderLine('Content-Type', $contentType);\n $adapter = new $adapter();\n \n $appI...
codesearchnet
{ "query": "Represent the summarization about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
// Convert_certificates_CertificateSigningRequestList_To_v1beta1_CertificateSigningRequestList is an autogenerated conversion function.
[ "func Convert_certificates_CertificateSigningRequestList_To_v1beta1_CertificateSigningRequestList(in *certificates.CertificateSigningRequestList, out *v1beta1.CertificateSigningRequestList, s conversion.Scope) error {\n\treturn autoConvert_certificates_CertificateSigningRequestList_To_v1beta1_CertificateSigningRequ...
[ "func GetCertAuthoritySchema() string {\n\treturn fmt.Sprintf(V2SchemaTemplate, MetadataSchema, fmt.Sprintf(CertAuthoritySpecV2Schema, RotationSchema, RoleMapSchema), DefaultDefinitions)\n}" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// NewMemoryKeyValue returns a KeyValue implementation that's backed only // by memory. It's mostly useful for tests and development.
[ "func NewMemoryKeyValue() KeyValue {\n\tdb := memdb.New(comparer.DefaultComparer, 128)\n\treturn &memKeys{db: db}\n}" ]
[ "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 Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Returns if this object is peregrine.
[ "def isPeregrine(self):\n \n return isPeregrine(self.obj.id,\n self.obj.sign,\n self.obj.signlon)" ]
[ "@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:" }
Sets the digest method (hashing algo) used to calculate the digest of the document @param string $method Digest method (class const) @return XmlDigitalSignature
[ "public function setDigestMethod($method)\n\t{\n\t\tif (array_key_exists($method, $this->openSSLAlgoMapping) &&\n\t\t\tarray_key_exists($method, $this->digestMethodUriMapping))\n\t\t{\n\t\t\t$this->digestMethod = $method;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttrigger_error(sprintf('The chosen digest method (%s) is not sup...
[ "private static function resource($resource)\n {\n exception_if(($resource != 'session' && $resource != 'cookie'), LogicException::class, 'The resource name of \\''.$resource.'\\' is not supported by Vinala, only session or cookie');\n\n return Hash::make(config('auth.'.$resource));\n\n // F...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
Attempt to delete a durable subscription on a remote ME.
[ "public static void deleteRemoteDurableSub(\n MessageProcessor MP,\n String subName,\n String userName,\n SIBUuid8 remoteMEUuid)\n throws SIResourceException,\n SIDurableSubscriptionNotFoundException,\n SIDestinationLockedException,\n SINotAuthorizedException\n {\n i...
[ "@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 about Messaging:", "pos": "Represent the code about Messaging:", "neg": "Represent the code:" }
Handles removing object state groups based on submitted form. @param \Symfony\Component\HttpFoundation\Request $request @param int $objectStateGroupId @return \Symfony\Component\HttpFoundation\Response
[ "public function bulkDeleteAction(Request $request, int $objectStateGroupId): Response\n {\n $this->denyAccessUnlessGranted(new Attribute('state', 'administrate'));\n $form = $this->formFactory->create(\n ObjectStatesDeleteType::class,\n new ObjectStatesDeleteData()\n )...
[ "public function createUrlAlias(URLAlias $urlAlias): UIValue\\Content\\UrlAlias\n {\n return new UIValue\\Content\\UrlAlias($urlAlias);\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about Symfony:", "pos": "Represent the Github code about Symfony:", "neg": "Represent the Github code about Programming:" }
// SetNextToken sets the NextToken field's value.
[ "func (s *ListAggregateDiscoveredResourcesOutput) SetNextToken(v string) *ListAggregateDiscoveredResourcesOutput {\n\ts.NextToken = &v\n\treturn s\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 post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Partition the limit by a request header. @return Chainable builder
[ "public GrpcServerLimiterBuilder partitionByHeader(Metadata.Key<String> header) {\n return partitionResolver(context -> context.getHeaders().get(header));\n }" ]
[ "def property_(getter: Map[Domain, Range]) -> property:\n \n return property(map_(WeakKeyDictionary())(getter))" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// subHandler just spins on the socket and publishes messages. It sends // "PUB #<count> <time>". Not very interesting...
[ "func subHandler(sock mangos.Socket) {\n\tcount := 0\n\tfor {\n\t\tmsg := fmt.Sprintf(\"PUB #%d %s\", count, time.Now().String())\n\t\tif e := sock.Send([]byte(msg)); e != nil {\n\t\t\tdie(\"Cannot send pub: %v\", e)\n\t\t}\n\t\ttime.Sleep(5 * time.Second)\n\t\tcount++\n\t}\n}" ]
[ "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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns the full path name of this file if it is listed in the path
[ "public File getAbsolutePath(String filename)\n {\n if (pathenv == null || pathSep == null || fileSep == null)\n {\n return null;\n }\n int val = -1;\n String classvalue = pathenv + pathSep;\n\n while (((val = classvalue.indexOf(pathSep)) >= 0) &&\n classvalue.length(...
[ "def template(self):\n \n\n # First try props\n if self.props.template:\n return self.props.template\n else:\n # Return the wtype of the widget, and we'll presume that,\n # like resources, there's a .html file in that directory\n return self.wt...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Get all global options :type cmd_line_options: dict :param cmd_line_options: Dictionary with all command line options :type conf_file_options: dict :param conf_file_options: Dictionary with all config file options :returns: dict
[ "def __get_global_options(cmd_line_options, conf_file_options=None):\n \n options = {}\n\n for option in DEFAULT_OPTIONS['global'].keys():\n options[option] = DEFAULT_OPTIONS['global'][option]\n\n if conf_file_options and option in conf_file_options:\n options[option] = conf_file_o...
[ "def fix_config(self, options):\n \n options = super(SetStorageValue, self).fix_config(options)\n\n opt = \"storage_name\"\n if opt not in options:\n options[opt] = \"unknown\"\n if opt not in self.help:\n self.help[opt] = \"The storage value name for storing...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// Bindings prints the bindings from r to w.
[ "func Bindings(w io.Writer, r Output) error {\n\tif r.Error != nil {\n\t\treturn prettyError(w, r.Error)\n\t}\n\tfor _, rs := range r.Result {\n\t\tif err := JSON(w, rs.Bindings); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\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:" }
Buffer text changed.
[ "def run_reporter(self):\n \" \"\n if not self._reporter_is_running:\n self._reporter_is_running = True\n\n text = self.buffer.text\n self.report_errors = []\n\n # Don't run reporter when we don't have a location. (We need to\n # know the filetyp...
[ "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 about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Resolves an event. (delayed action)
[ "def post_event(self, client, check):\n \n self._request('POST', '/resolve',\n data=json.dumps({'client': client, 'check': check}))\n return True" ]
[ "public H2StreamProcessor startNewInboundSession(Integer streamID) {\n H2StreamProcessor h2s = null;\n h2s = muxLink.createNewInboundLink(streamID);\n return h2s;\n // call the stream processor with the data it needs to then call \"ready\" are the underlying HttpInboundLink\n // (...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
在日期上加指定的年数 @param @param @return
[ "public static Date addYear(Date date1, int addYear) {\n Date resultDate = null;\n Calendar c = Calendar.getInstance();\n c.setTime(date1); // 设置当前日期\n c.add(Calendar.YEAR, addYear); // 日期加1\n resultDate = c.getTime(); // 结果\n return resultDate;\n }" ]
[ "public static SqlInfo getSqlInfoSimply(String nsAtZealotId, Object paramObj) {\n String[] arr = nsAtZealotId.split(ZealotConst.SP_AT);\n if (arr.length != LEN) {\n throw new ValidFailException(\"nsAtZealotId参数的值必须是xml文件中的 nameSpace + '@@' + zealotId 节点的值,\"\n + \"如:'stu...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software Development:" }
Add the instance tied to the field for the given "value" (via `args`) to the index For the parameters, see ``BaseIndex.add``
[ "def add(self, *args, **kwargs):\n \n\n check_uniqueness = kwargs.get('check_uniqueness', True)\n\n key = self.get_storage_key(*args)\n if self.field.unique and check_uniqueness:\n self.check_uniqueness(key=key, *args)\n\n # Do index => create a key to be able to retrie...
[ "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 instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Matches if an annotation is of a given type. @param type The expected annotation type. @param <T> The type of the matched object. @return A matcher that matches the annotation's type for being equal to the given type.
[ "public static <T extends AnnotationDescription> ElementMatcher.Junction<T> annotationType(TypeDescription type) {\n return annotationType(is(type));\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 description:", "pos": "Represent the code:", "neg": "Represent the code:" }
exposed for testing
[ "int bucket(double x) {\n if (x <= min) {\n return 0;\n } else if (x >= max) {\n return counts.length - 1;\n } else {\n return bucketIndex(x);\n }\n }" ]
[ "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 Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
(private) Extract the value from a database response @param {Array} res A database response array @return {*}
[ "function extractResponseVal(res) {\n if (_u.isArray(res) && res.length && _u.isObject(res[0])) {\n var resObj = _u.values(res[0]);\n\n if (resObj.length) {\n return resObj[0];\n }\n }\n }" ]
[ "@Route(method= HttpMethod.GET, uri=\"/{id}\")\n public Result get(@Parameter(\"id\") String id) {\n // The value of id is computed from the {id} url fragment.\n return ok(id);\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about database:", "pos": "Represent the Github code about database:", "neg": "Represent the Github code about Programming:" }
To handle console command
[ "public function handle()\r\n {\r\n $listenerName = $this->input->getArgument('name');\r\n $eventName = $this->input->getOption('event');\r\n\r\n $listenerNamespace = $this->getNamespace('Listeners', $listenerName);\r\n\r\n if(!is_null($eventName)) {\r\n $eventName = str_r...
[ "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 post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Get the user's configuration @return {*} A configuration object
[ "function getOverrides() {\n const configPath = path.join(process.cwd(), \"crafty.config.js\");\n\n if (fs.existsSync(configPath)) {\n return require(configPath);\n }\n\n console.log(`No crafty.config.js found in '${process.cwd()}', proceeding...`);\n return {};\n}" ]
[ "@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 about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
// Root returns the Root Iteration for a space
[ "func (m *GormIterationRepository) Root(ctx context.Context, spaceID uuid.UUID) (*Iteration, error) {\n\tdefer goa.MeasureSince([]string{\"goa\", \"db\", \"iteration\", \"query\"}, time.Now())\n\tvar itr Iteration\n\n\ttx := m.db.Where(\"space_id = ? AND nlevel(path)=1\", spaceID).First(&itr)\n\tif tx.Error != nil ...
[ "@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 programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }