query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
curl -i -X GET http://localhost:8080/api/books/234234
[ "public IPromise getBooks( int id ) {\n Promise res = promise();\n // simulate blocking operation (e.g. database query)\n execInThreadPool( () -> new Book().title(\"Title \"+id).id(\"\"+id).author(\"kontraktor\") ).\n then(res);\n return res;\n }" ]
[ "public function fromBarcode($barcode)\n {\n $destinationUrl = $this->client->getRedirectLocation('/items', ['item_barcode' => $barcode]);\n\n // Extract the MMS ID from the redirect target URL.\n // Example: https://api-eu.hosted.exlibrisgroup.com/almaws/v1/bibs/999211285764702204/holdings/...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
Inspects the given Wikipedia article dict for geo-coordinates. If no coordinates are found, returns None. Otherwise, returns a new dict with the title and URL of the original article, along with coordinates.
[ "def geo_filter(d):\n \"\"\"\"\"\"\n page = d[\"page\"]\n if not \"revision\" in page:\n return None\n title = page[\"title\"]\n if skip_article(title):\n LOG.info(\"Skipping low-value article %s\", title)\n return None\n text = page[\"revision\"][\"text\"]\n if not utils.i...
[ "def parse(self, root):\n \"\"\"\"\"\"\n #Use the first element in the versions list since there should only be one.\n v = _get_xml_version(root)[0]\n result = {}\n\n for child in root: \n if child.tag in self.versions[v].entries:\n entry = self.v...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Stopped callback @param \Crud\Event\Subject $subject Event subject @return \Cake\Http\Response
[ "protected function _stopped(Subject $subject)\n {\n if (!isset($subject->success)) {\n $subject->success = false;\n }\n\n if ($subject->success) {\n return $this->_success($subject);\n }\n\n $subject->set(['success' => false]);\n $this->setFlash('e...
[ "public function handle(PublishThePost $event) {\n $this->sendEmailsFromList->sendEmails($event->data['id']['listID'], $event->data['id']);\n \\Log::info('Lasallecms\\Lasallecmsapi\\Listeners\\TriggerLaSalleCRMList listener completed');\n }" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Putting an entry to the map. @param pKey to be stored. @param pVal to be stored. @return if entry already existing, return that one. @see ConcurrentHashMap#put(Object, Object)
[ "public IMetaEntry put(final IMetaEntry pKey, final IMetaEntry pVal) {\n return mMetaMap.put(pKey, pVal);\n }" ]
[ "ArrayTagSet add(String k, String v) {\n return add(new BasicTag(k, v));\n }" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
filter data rows for fields (array keys) allowed @param $data array rows of assoc arrays @param $fields array keys allowed for assoc array @return array filtered values
[ "public function filterInsertValues($data, $fields)\n\t{\n\t\t$insertValues = array();\n\t\t$field_keys = array_flip($fields);\n\t\tforeach ($data as $key => $values) {\n\t\t\t$filteredValues = array_intersect_key($values, $field_keys);\n\t\t\t$emptyFields = array_fill_keys($fields, null);\n\t\t\t$filledValues = ar...
[ "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 sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
// SetApplicationId sets the ApplicationId field's value.
[ "func (s *UpdateGcmChannelInput) SetApplicationId(v string) *UpdateGcmChannelInput {\n\ts.ApplicationId = &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 instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Returns True if the requesting user is allowed to add an object, False otherwise.
[ "def has_add_permission(self, request):\n \n perm_string = '%s.add_%s' % (self.model._meta.app_label,\n self.model._meta.object_name.lower()\n )\n return request.user.has_perm(perm_string)" ]
[ "def set_schema(self, schema_name, include_public=True):\n \n self.tenant = FakeTenant(schema_name=schema_name)\n self.schema_name = schema_name\n self.include_public_schema = include_public\n self.set_settings_schema(schema_name)\n self.search_path_set = False\n # C...
codesearchnet
{ "query": "Represent the text about Access control:", "pos": "Represent the code about Access control:", "neg": "Represent the code:" }
Returns the payload from a guzzle request. @param \Psr\Http\Message\RequestInterface $request An instance of the guzzle request to extract a payload from. @return string The payload.
[ "protected function generateFromPsr7Request(Psr7Request $request) : string\n {\n $id = isset($this->request->getHeader('X-SIGNED-ID')[0]) ?\n $this->request->getHeader('X-SIGNED-ID')[0] : '';\n $timestamp = isset($this->request->getHeader('X-SIGNED-TIMESTAMP')[0]) ?\n $this->r...
[ "public function post($url, $body, array $headers = array()) {\n // If body is array\n if (is_array($body)) {\n // Convert to string\n $body = http_build_query($body);\n }\n // Do post and get response\n $response = $this->getClient()->post($url, $body, $headers);\n // If not response\n ...
codesearchnet
{ "query": "Represent the Github comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Sets Content of Tag. @access public @param string|object $content Content of Tag or stringable object @return void @throws InvalidArgumentException if given object has no __toString method
[ "public function setContent( $content = NULL )\n\t{\n\t\tif( is_object( $content ) ){\n\t\t\tif( !method_exists( $content, '__toString' ) ){\t\t\t\t\t\t\t\t\t\t\t// content is not a renderable object\n\t\t\t\t$message\t= 'Object of class \"'.get_class( $content ).'\" cannot be rendered';\t\t// prepare message abo...
[ "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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Build model dictionary keyed by the relation's foreign key. @param \Illuminate\Database\Eloquent\Collection $results @return array
[ "protected function buildDictionary(Collection $results)\n {\n $dictionary = [];\n\n // First we will create a dictionary of models keyed by the foreign key of the\n // relationship as this will allow us to quickly access all of the related\n // models without having to do nested loop...
[ "public function addConstraints()\n {\n if (static::$constraints)\n {\n // Get the parent node's placeholder.\n $parentNode = $this->query->getQuery()->modelAsNode($this->parent->getTable());\n // Tell the query that we need the morph model and the relationship repr...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Check if field type used to store value in java is nullable type.
[ "public static boolean isScalarNullableType(Field field) {\n FieldType type = field.getType();\n return STRING.equals(type) || BYTES.equals(type) || type instanceof io.protostuff.compiler.model.Enum;\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 Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Construct geocoding request url. Overridden. :param str base_api: Geocoding function base address - self.api or self.reverse_api. :param dict params: Geocoding params. :return: string URL.
[ "def _construct_url(self, base_api, params):\n \n params['key'] = self.api_key\n return super(OpenMapQuest, self)._construct_url(base_api, params)" ]
[ "def get_value_from_content(key):\n \n def value_from_content_function(service, message):\n \"\"\"Actual implementation of get_value_from_content function.\n\n :param service: SelenolService object.\n :param message: SelenolMessage request.\n \"\"\"\n return _get_value(messa...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
{@inheritdoc} @param string $key @param \CharlotteDunois\Yasmin\Models\User $value @return $this
[ "function set($key, $value) {\n parent::set($key, $value);\n if($this !== $this->client->users) {\n $this->client->users->set($key, $value);\n }\n \n return $this;\n }" ]
[ "public function getTokenStatusDescriptionForBridge(\\MUtil_Model_Bridge_TableBridgeAbstract $bridge, $addDescription = false)\n {\n return \\MUtil_Lazy::method($this, 'getStatusDescription', $bridge->getLazy('token_status'));\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Return a string specifying the files to submit for this project.
[ "def submit_string(self):\n \"\"\"\"\"\"\n required = []\n optional = []\n for file_verifier in self.file_verifiers:\n if file_verifier.optional:\n optional.append('[{0}]'.format(file_verifier.filename))\n else:\n required.append(file_v...
[ "def finish_parse(self, last_lineno_seen):\n \"\"\"\"\"\"\n if self.state == self.STATES['step_in_progress']:\n # We've reached the end of the log without seeing the final \"step finish\"\n # marker, which would normally have triggered updating the step. As such we\n #...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Converts the values into usable data for the drawing of the graph @param array $values
[ "private function setValues($values)\n {\n\n $numbers = Array();\n foreach ($values as $key => $val) {\n\n $value = new \\stdClass();\n $value->label = trim($key);\n\n if (!is_numeric($val)) {\n $val = null;\n }\n\n $value->value...
[ "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 comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
// WithPollingInterval sets the interval at which the diode is queried // for new data. The default is 10ms.
[ "func WithPollingInterval(interval time.Duration) PollerConfigOption {\n\treturn PollerConfigOption(func(c *Poller) {\n\t\tc.interval = interval\n\t})\n}" ]
[ "def read(self, timeout=1.0):\n \n start = time()\n while len(self.rcv_data) == 0:\n if time() - start > timeout:\n # Read operations should typically take ~1-2ms.\n # If this exception occurs, then it could indicate\n # a problem in one o...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
A generator that takes an EntryList and converts it to CSV rows @param \Concrete\Core\Express\EntryList $list @return \Generator
[ "private function projectList(EntryList $list)\n {\n $headers = array_keys(iterator_to_array($this->getHeaders($list->getEntity())));\n $statement = $list->deliverQueryObject()->execute();\n\n foreach ($statement as $result) {\n if ($entry = $list->getResult($result)) {\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 text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Removes child scope @param scope Child scope to remove
[ "public void removeChildScope(IBasicScope scope) {\r\n log.debug(\"removeChildScope: {}\", scope);\r\n if (children.containsKey(scope)) {\r\n // remove from parent\r\n children.remove(scope);\r\n if (scope instanceof Scope) {\r\n unregisterJMX();\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 text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Render content as a web page,
[ "public function actionShow($id, $slug)\n {\n $model = $this->model->node($id);\n if (empty($model) || !$model->is_visible || $model->slug != $slug) {\n throw new NotFoundHttpException(Yii::t($this->tcModule, 'Content not found'));\n }\n \n return $this->actionView($...
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns properties by ids @param int[] $ids @param bool $throwException @todo Add SMART cache here @return mixed
[ "public static function findByIds($ids, $throwException = true)\n {\n $ids = array_unique($ids);\n $ids = array_map('intval', $ids);\n $ids2find = array_diff($ids, array_keys(static::$identityMap));\n if (count($ids2find) > 0) {\n Property::find()->where(['in', 'id', $ids2f...
[ "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 summarization about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
/* Sorts the items collection by a specified key. Chainable. Ascending. @param string $key @param bool $reverse @return Model
[ "protected function sortItemsBy(string $key, bool $reverse = false)\n {\n if (is_array($this->content) && !array_key_exists('items', $this->content)) {\n return $this;\n }\n\n if (!$this->content->has('items')) {\n return $this;\n }\n\n $sortDirection = $r...
[ "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 Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
// Approve approves a blocked build stage.
[ "func (c *client) Approve(namespace, name string, build, stage int) error {\n\turi := fmt.Sprintf(pathApprove, c.addr, namespace, name, build, stage)\n\terr := c.post(uri, nil, nil)\n\treturn err\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:", "pos": "Represent the code:", "neg": "Represent the code:" }
// You should always use this function to get a new UpdateZoneParams instance, // as then you are sure you have configured all required params
[ "func (s *ZoneService) NewUpdateZoneParams(id string) *UpdateZoneParams {\n\tp := &UpdateZoneParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"id\"] = id\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 post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// CaptureState outputs state information on the logger.
[ "func (l *JSONLogger) CaptureState(env *EVM, pc uint64, op OpCode, gas, cost uint64, memory *Memory, stack *Stack, contract *Contract, depth int, err error) error {\n\tlog := StructLog{\n\t\tPc: pc,\n\t\tOp: op,\n\t\tGas: gas,\n\t\tGasCost: cost,\n\t\tMemorySize: memory.Len(...
[ "@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 instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
[ "func (fr *fr_BF) WeekdayAbbreviated(weekday time.Weekday) string {\n\treturn fr.daysAbbreviated[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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about datetime:" }
Calculates the Spread metric. @param front The front. @param referenceFront The true pareto front.
[ "public double spread(Front front, Front referenceFront) {\n PointDistance distance = new EuclideanDistance() ;\n\n // STEP 1. Sort normalizedFront and normalizedParetoFront;\n front.sort(new LexicographicalPointComparator());\n referenceFront.sort(new LexicographicalPointComparator());\n\n // STEP 2...
[ "public void setLossVariables(String... lossVariableNames){\n this.lossVariables.clear();\n for(String s : lossVariableNames){\n addLossVariable(s);\n }\n //After changing loss function variables, we (probably) need to recreate gradient function - as gradient\n // funct...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// NewEcdhesKeyWrapEncrypt creates a new key encrypter based on ECDH-ES
[ "func NewEcdhesKeyWrapEncrypt(alg jwa.KeyEncryptionAlgorithm, key *ecdsa.PublicKey) (*EcdhesKeyWrapEncrypt, error) {\n\tgenerator, err := NewEcdhesKeyGenerate(alg, key)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create key generator\")\n\t}\n\treturn &EcdhesKeyWrapEncrypt{\n\t\talgorithm: alg,...
[ "func (csp *impl) Encrypt(k bccsp.Key, plaintext []byte, opts bccsp.EncrypterOpts) ([]byte, error) {\n\t// TODO: Add PKCS11 support for encryption, when fabric starts requiring it\n\treturn csp.BCCSP.Encrypt(k, plaintext, opts)\n}" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
Creates a ConfigSettingManipulation instance from a string like: `SectionName.setting_name=value` or `SectionName.setting_name[]=value` The value must be JSON so `="string"` will work but `=string` will not. @param string $assignment @return self
[ "public static function make($assignment)\n {\n if (!preg_match('/^([a-zA-Z0-9_]+)\\.([a-zA-Z0-9_]+)(\\[\\])?=(.*)/', $assignment, $matches)) {\n throw new \\InvalidArgumentException(\"Invalid assignment string '$assignment': expected section.name=value or section.name[]=value\");\n }\n\...
[ "func (m *NamedMethod) ToRawInfo() interface{} {\n\tinfo := yaml.MapSlice{}\n\tif m.Name != \"\" {\n\t\tinfo = append(info, yaml.MapItem{Key: \"name\", Value: m.Name})\n\t}\n\t// &{Name:value Type:Method StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}\n\treturn info\n}"...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
// SetTargets sets the Targets field's value.
[ "func (s *CreateJobInput) SetTargets(v []*string) *CreateJobInput {\n\ts.Targets = 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:" }
Emulate hexists.
[ "def hexists(self, hashkey, attribute):\n \"\"\"\"\"\"\n\n redis_hash = self._get_hash(hashkey, 'HEXISTS')\n return self._encode(attribute) in redis_hash" ]
[ "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 Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Copies selected items to clipboard.
[ "def copy_to_clipboard(self):\n \n tree = self.treeview\n # get the selected item:\n selection = tree.selection()\n if selection:\n self.filter_remove(remember=True)\n root = ET.Element('selection')\n for item in selection:\n node = ...
[ "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 instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Stops read loop and closes socket if it has been created.
[ "def stop(self):\n \n self._running = False\n\n if self._socket is None:\n return\n try:\n self._socket.shutdown(socket.SHUT_RDWR)\n self._socket.close()\n except socket.error:\n pass\n self._socket = None" ]
[ "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:" }
// DescribeDBInstanceNetInfo describe rds net info // // You can read doc at https://help.aliyun.com/document_detail/26237.html?spm=5176.doc26234.6.711.vHOktx
[ "func (client *Client) DescribeDBInstanceNetInfo(args *DescribeDBInstanceNetInfoArgs) (resp *DescribeDBInstanceNetInfoResponse, err error) {\n\tresponse := DescribeDBInstanceNetInfoResponse{}\n\terr = client.Invoke(\"DescribeDBInstanceNetInfo\", args, &response)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tret...
[ "public static ReplyDetailWarpper getDummyNewsReplyDetailWarpper() {\n ReplyDetail replyDetail1 = new ReplyDetail();\n replyDetail1.setTitle(\"fork me\");\n replyDetail1.setMediaUrl(\"http://c.hiphotos.baidu.com/baike/c%3DbaikeA4%2C10%2C95/sign=c1767bbf4b36acaf4de0c1ad15b2e851/29381f30e924b899a...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// findUnits returns the machine ID of a running unit
[ "func (c *FleetClient) findUnit(name string) (machID string, err error) {\n\tu, err := c.Fleet.Unit(name)\n\tswitch {\n\tcase err != nil:\n\t\treturn \"\", fmt.Errorf(\"Error retrieving Unit %s: %v\", name, err)\n\tcase suToGlobal(*u):\n\t\treturn \"\", fmt.Errorf(\"Unable to connect to global unit %s.\\n\", name)\...
[ "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 description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Run the action @param $id integer id of model to be loaded @throws \yii\web\MethodNotAllowedHttpException @throws \yii\base\InvalidConfigException @return mixed
[ "public function run($id)\n\t{\n\t\tif (!Yii::$app->request->getIsPost()) {\n\t\t\tthrow new MethodNotAllowedHttpException();\n\t\t}\n\t\t$id = (int)$id;\n\t\t$result = null;\n\t\t\n\t\tif (empty($this->modelClass) || !class_exists($this->modelClass)) {\n\t\t\tthrow new InvalidConfigException(\"Model class doesn't ...
[ "public static function setAlreadyAddSubmodulesFor($module, $app = null)\n {\n if (empty($app)) {\n $app = Yii::$app;\n }\n $appKey = UniApplication::appKey($app);\n if($module instanceof YiiBaseModule) {\n static::$_modulesWithInstalledSubmodules[$appKey][$modul...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Checks the jacobian using a relative error threshold. @param tol fractional difference
[ "public static <S extends DMatrix>\n\tboolean jacobianR( FunctionNtoM func , FunctionNtoMxN<S> jacobian ,\n\t\t\t\t\t\t\t\t double param[] , double tol )\n\t{\n\t\treturn jacobianR(func,jacobian,param,tol,Math.sqrt(UtilEjml.EPS));\n\t}" ]
[ "def is_stationary(self):\n \"\"\"\n # for disconnected matrices, the stationary distribution depends on the estimator, so we can't compute\n # it directly. Therefore we test whether the initial distribution is stationary.\n return np.allclose(np.dot(self._Pi, self._Tij), self._Pi)" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Apply `processor` or `self.processor` to `self`.
[ "def process(self, processor:PreProcessors=None):\n \"\"\n if processor is not None: self.processor = processor\n self.processor = listify(self.processor)\n for p in self.processor: p.process(self)\n return self" ]
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Return all Ports referenced by this Compound. Returns ------- list of mb.Compound A list of all ports referenced by the Compound
[ "def referenced_ports(self):\n \n from mbuild.port import Port\n return [port for port in self.labels.values()\n if isinstance(port, Port)]" ]
[ "def values(*rels):\n '''\n \n '''\n #Action function generator to multiplex a relationship at processing time\n def _values(ctx):\n '''\n Versa action function Utility to specify a list of relationships\n\n :param ctx: Versa context used in processing (e.g. includes the prototyp...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
a method for constructing a labDT object from epoch timestamp :param epoch_time: number with epoch timestamp info :return: labDT object
[ "def fromEpoch(cls, epoch_time):\r\n\r\n ''' \r\n '''\r\n\r\n # validate input\r\n title = 'Epoch time input for labDT.fromEpoch'\r\n if not isinstance(epoch_time, float) and not isinstance(epoch_time, int):\r\n raise TypeError('\\n%s must be an integer or float.' % title)\...
[ "def infos(self, typ, light=None, date=None):\r\n '''\r\n \r\n '''\r\n d = self._getDate(typ, light)\r\n if date is None:\r\n return [c[1] for c in d]\r\n # TODO: not struct time, but time in ms since epoch\r\n return _getFromDate(d, date)[1]" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Get image files by path. @param string $path @return Finder
[ "protected function getImageFiles($path)\n {\n $finder = Finder::create()->in($path)->sortByType()->depth(0);\n foreach (config('media.images_ext') as $file) {\n $finder->name('*' . $file);\n }\n\n return $finder;\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
TODO: If error has changed to little between trainings, abort and try with a more complex network TODO: If error sometimes increase, abort and try with a less complex network TODO: Possibility to vary the number of layers
[ "function Model(options) {\n this._document = options.document;\n options.document = options.document || {};\n this._handler = options.handler;\n this._id = options._id || options.document._id;\n this.name = options.name || options.document.name;\n this.layers = options.layers || options.document....
[ "def read_description():\n \"\"\"\"\"\"\n try:\n with open(\"README.md\") as r:\n description = \"\\n\"\n description += r.read()\n with open(\"CHANGELOG.md\") as c:\n description += \"\\n\"\n description += c.read()\n return description\n ex...
codesearchnet
{ "query": "Represent the Github post about Writing/editing:", "pos": "Represent the Github code about Writing/editing:", "neg": "Represent the Github code:" }
Handler function for the start of a tag @param resource $parser @param string $name @param array $attrs
[ "function StartElement($parser, $name, $attrs = array())\n {\n //Make the name of the tag lower case\n $name = strtolower($name);\n \n //Check to see if tag is root-level\n if (count($this->stack) == 0) \n {\n //If so, set the document as the current tag\n ...
[ "public function onSniff(GenericEvent $event)\n {\n $context = $event->getArguments();\n\n $this->logger->debug('Visiting SNIFF, process {method} {sniff}', $context);\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
前の画面に戻るリンクを表示します。 @param [Hash] options
[ "def back_to_index(options = {})\n if options == nil\n options = {}\n else\n options.reject!{|_key, value| value.blank?}\n options.delete(:page) if options[:page].to_i == 1\n end\n unless controller_name == 'test'\n link_to t('page.listing', model: t(\"activerecord.mo...
[ "func (m *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\t// NOTE ucon内部のルーティングは一元的にこの関数から行う\n\t// Handlerを細分化しhttp.ServeMuxに登録すると、OPTIONSのhandleがうまくできなくなる\n\t// このため、Handlerはucon全体で1つとし、OPTIONSも通常のMethodと同じようにHandlerを設定し利用する\n\t// OPTIONSを適切にhandleするため、全てのHandlerに特殊なHookを入れるよりマシである\n\n\tm.router.S...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Create a route responding to any HTTP Verb (GET, POST, PUT, ...). @param uriPattern @param routeHandler @return
[ "public static Route ANY(String uriPattern, RouteHandler routeHandler) {\n return new Route(HttpConstants.Method.ANY, uriPattern, routeHandler);\n }" ]
[ "public static HttpHandler rewrite(final String condition, final String target, final ClassLoader classLoader, final HttpHandler next) {\n return predicateContext(predicate(PredicateParser.parse(condition, classLoader), setAttribute(next, \"%R\", target, classLoader), next));\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Handles line after open tag not empty. @param File $phpcsFile The php cs file @param int $whitespacePtr Pointer to the line after the open tag @return void
[ "private function handleLineNotEmpty(File $phpcsFile, int $whitespacePtr): void\n {\n $fixSpaceNotScndLine = $phpcsFile->addFixableError(\n self::ERROR_LINE_NOT_EMPTY,\n $whitespacePtr,\n static::CODE_LINE_NOT_EMPTY\n );\n\n if ($fixSpaceNotScndLine) {\n ...
[ "public function process(File $phpcsFile, $stackPtr)\n {\n // Don't do anything if the warning has already been thrown or is not necessary.\n if ($this->examine === false) {\n return ($phpcsFile->numTokens + 1);\n }\n\n $phpcsVersion = PHPCSHelper::getVersion();\n\n ...
codesearchnet
{ "query": "Represent the Github summarization about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code about PHP programming:" }
Set PWM value for the specified LED :param led_num: LED number (0-15) :param value: the 12 bit value (0-4095)
[ "def set_pwm(self, led_num, value):\n \n self.__check_range('led_number', led_num)\n self.__check_range('led_value', value)\n\n register_low = self.calc_led_register(led_num)\n\n self.write(register_low, value_low(value))\n self.write(register_low + 1, value_high(value))" ]
[ "def setAccelerometerSensitivity(self, value):\n \n # note that this implicitly disables the self tests on each axis\n # i.e. the full byte is actually 000[accel]000 where the 1st 3 are the accelerometer self tests, the next two\n # values are the actual sensitivity and the last 3 are un...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns true if the value of the form control is a valid http URL. Note: * Empty values are considered valid. * This validator will test if the URL actually exists. @param Control $control The form control. @return bool @since 1.0.0 @api
[ "public function validate(Control $control): bool\n {\n $value = $control->getSubmittedValue();\n\n // An empty value is valid.\n if ($value==='' || $value===null || $value===false)\n {\n return true;\n }\n\n // Objects and arrays are not a valid http URL.\n if (!is_scalar($value))\n {...
[ "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 Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
Returns the current row as a tuple.
[ "def _GetRow(self, columns=None):\n \"\"\"\"\"\"\n\n row = self._table[self._row_index]\n if columns:\n result = []\n for col in columns:\n if col not in self.header:\n raise TableError(\"Column header %s not known in table.\" % col)\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 Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
The action will be asynchronously executed with {@code android.io.AsyncTask#THREAD_POOL_EXECUTOR} in background. @param action @return
[ "static <T> ContinuableFuture<T> executeWithThreadPool(final Callable<T> action) {\r\n return execute(new FutureTask<>(action), TP_EXECUTOR);\r\n }" ]
[ "@Scheduled(initialDelayString = PROP_SCHEDULER_DELAY_PLACEHOLDER, fixedDelayString = PROP_SCHEDULER_DELAY_PLACEHOLDER)\n public void autoAssignScheduler() {\n LOGGER.debug(\"auto assign schedule checker has been triggered.\");\n // run this code in system code privileged to have the necessary\n ...
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Method created so we can ffdc the inner EntityNotFoundException
[ "private Entity innerRetrieveEntityFromRepository(Root root, Entity retEntDO, String uniqueId, boolean isAllowOperationIfReposDown,\n Set<String> failureRepositoryIds) throws WIMException {\n String METHODNAME = \"retrieveEntityFromRepository\";\n\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:", "pos": "Represent the code:", "neg": "Represent the code:" }
render template file, then display it. @param string $_swoole_tpl_file
[ "function display($_swoole_tpl_file = '')\n {\n if (empty($_swoole_tpl_file))\n {\n $_swoole_tpl_file = strtolower($this->swoole->env['mvc']['controller']) . '/' . strtolower($this->swoole->env['mvc']['view']) . '.php';\n }\n if (!is_file($this->template_dir . $_swoole_tpl_...
[ "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 Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Empty the list of all key/value pairs, if any. This works across namespaced instances as it cleans the whole storage location.
[ "function () {\n ariaStorageEventBus.stop = true;\n this._clear();\n ariaStorageEventBus.stop = false;\n\n ariaStorageEventBus.notifyChange(this.type, null, null, null);\n }" ]
[ "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 Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// SetMarker sets the Marker field's value.
[ "func (s *DescribeRulesInput) SetMarker(v string) *DescribeRulesInput {\n\ts.Marker = &v\n\treturn s\n}" ]
[ "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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Receive a message on ``sock``.
[ "def receive(self, sock):\n \"\"\"\"\"\"\n msg = None\n data = b''\n recv_done = False\n recv_len = -1\n while not recv_done:\n buf = sock.recv(BUFSIZE)\n if buf is None or len(buf) == 0:\n raise Exception(\"socket closed\")\n if recv_len == -1:\n recv_len = struct.unp...
[ "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 Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Proxy HTTP request to upstream IPython Notebook Tornado server.
[ "def proxy_it(request, port):\n \"\"\"\"\"\"\n\n # Check if we have websocket proxy configured\n websocket_proxy = request.registry.settings.get(\"pyramid_notebook.websocket_proxy\", \"\")\n if websocket_proxy.strip():\n r = DottedNameResolver()\n websocket_proxy = r.maybe_resolve(websocke...
[ "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 Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns an instance of a Zend_Db_Table_Select object. @param bool $withFromPart Whether or not to include the from part of the select based on the table @return Zend_Db_Table_Select
[ "public function select($withFromPart = self::SELECT_WITHOUT_FROM_PART)\n {\n // require_once 'Zend/Db/Table/Select.php';\n $select = new Zend_Db_Table_Select($this);\n if ($withFromPart == self::SELECT_WITH_FROM_PART) {\n $select->from($this->info(self::NAME), Zend_Db_Table_Selec...
[ "public function beforeGetFinalisedQuery(DataQuery $dataQuery, $queriedColumns = [], SQLSelect $sqlSelect)\n {\n // Get metadata and SQL from join table\n $hasManyRelation = $this->getParentRelationship($dataQuery);\n $joinTableSQLSelect = $hasManyRelation->dataQuery()->query();\n $jo...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// Custom unmarshaller to properly unmarshal embedded resources (represented as interface{})
[ "func (x *BundleEntryComponent) UnmarshalJSON(data []byte) (err error) {\n\tx2 := bundleEntryComponent{}\n\tif err = json.Unmarshal(data, &x2); err == nil {\n\t\tif x2.Resource != nil {\n\t\t\tx2.Resource = MapToResource(x2.Resource, true)\n\t\t}\n\t\t*x = BundleEntryComponent(x2)\n\t}\n\treturn\n}" ]
[ "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 comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Treat the map as a stack and pop an element off its end. @return mixed|null @api
[ "public function pop()\n {\n if (0 === count($this->array)) {\n return null;\n }\n\n // get the last hash of array\n end($this->array);\n $hash = key($this->array);\n\n // temporarily hold the element at that spot\n $element = $this->array[$hash];\n\n ...
[ "long storeSpaceForAdd() {\n return ConcurrentSubList.maximumSerializedSize() // List header\n + 3 * ConcurrentSubList.Link.maximumSerializedSize() // Current,Previous,Next links \n + 4 * owningToken.objectStore.getAddSpaceOverhead() // Store overhead for all of the above.\n ...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// SetFlowArn sets the FlowArn field's value.
[ "func (s *RevokeFlowEntitlementInput) SetFlowArn(v string) *RevokeFlowEntitlementInput {\n\ts.FlowArn = &v\n\treturn s\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 description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
// GetNode returns the a copy of the root node being edited.
[ "func (e *Editor) GetNode() *dag.ProtoNode {\n\treturn e.root.Copy().(*dag.ProtoNode)\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 text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// Contains checks if the given error contains an error with the // message msg. If err is not a wrapped error, this will always return // false unless the error itself happens to match this msg.
[ "func Contains(err error, msg string) bool {\n\treturn len(GetAll(err, msg)) > 0\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 text about Natural Language Processing:", "pos": "Represent the code about Natural Language Processing:", "neg": "Represent the code:" }
Prepare all data for this run. Take all post ids, and fetch the relevant authors, discussions, forums, and courses for them. @param int[] $postids The list of post IDs
[ "protected function prepare_data(array $postids) {\n global $DB;\n\n if (empty($postids)) {\n return;\n }\n\n list($in, $params) = $DB->get_in_or_equal(array_values($postids));\n $sql = \"SELECT p.*, f.id AS forum, f.course\n FROM {forum_posts} p\n ...
[ "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 programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Resolve failover policy for Cassandra thrift. @param failoverOption @return
[ "private HostFailoverPolicy getFailoverPolicy(String failoverOption)\n {\n if (failoverOption != null)\n {\n if (Constants.FAIL_FAST.equals(failoverOption))\n {\n return HostFailoverPolicy.FAIL_FAST;\n }\n else if (Constants.ON_FAIL_TRY_ALL...
[ "def create(self):\n \n self.queue = self.scheduler.queue.addSubQueue(self.priority, LockEvent.createMatcher(self.context, self.key),\n maxdefault = self.size, defaultQueueClass = CBQueue.AutoClassQueue.initHelper('locker', subqueuelimit = 1))" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
//Add adds d to d, returns a duration value.
[ "func (d Duration) Add(v Duration) (Duration, error) {\n\tif &v == nil {\n\t\treturn d, nil\n\t}\n\tdsum, err := AddInt64(int64(d.Duration), int64(v.Duration))\n\tif err != nil {\n\t\treturn Duration{}, errors.Trace(err)\n\t}\n\tif d.Fsp >= v.Fsp {\n\t\treturn Duration{Duration: gotime.Duration(dsum), Fsp: d.Fsp}, ...
[ "def getValue(words):\n \"\"\"\"\"\"\n value = 0\n for word in words:\n for letter in word:\n # shared.getConst will evaluate to the dictionary broadcasted by\n # the root Future\n value += shared.getConst('lettersValue')[letter]\n return value" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Natural Language Processing:" }
Args: boxes: kx4 scores: kxC
[ "def draw_predictions(img, boxes, scores):\n \n if len(boxes) == 0:\n return img\n labels = scores.argmax(axis=1)\n scores = scores.max(axis=1)\n tags = [\"{},{:.2f}\".format(cfg.DATA.CLASS_NAMES[lb], score) for lb, score in zip(labels, scores)]\n return viz.draw_boxes(img, boxes, tags)" ]
[ "def manhattan(h1, h2): # # 7 us @array, 31 us @list \\w 100 bins\n \n \"\"\"\n h1, h2 = __prepare_histogram(h1, h2)\n return scipy.sum(scipy.absolute(h1 - h2))" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Determining whether the exception is thrown Args: error_type: None: checking without specified exception Specified Exception Return: Boolean
[ "def threw(self, error_type=None):\n \n if not error_type:\n return True if len(self.exceptions) > 0 else False\n else:\n return uch.obj_in_list(self.exceptions, error_type)" ]
[ "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 Github description about Software Engineering:", "pos": "Represent the Github code about Software Engineering:", "neg": "Represent the Github code about programming:" }
Writes a CSV file @param columnHeaders headers @param rows rows @return CSV file @throws IOException throws IOException when CSV writing fails
[ "private static byte[] writeCsv(String[] columnHeaders, String[][] rows) throws IOException {\n try (ByteArrayOutputStream csvStream = new ByteArrayOutputStream(); OutputStreamWriter streamWriter = new OutputStreamWriter(csvStream, Charset.forName(\"UTF-8\"))) {\n CSVWriter csvWriter = new CSVWriter(streamW...
[ "def getMetadata(L):\n \n _l = {}\n try:\n # Create a copy. Do not affect the original data.\n _l = copy.deepcopy(L)\n # Remove values fields\n _l = rm_values_fields(_l)\n except Exception as e:\n # Input likely not formatted correctly, though other problems can occur....
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Computer Science:" }
Load the layout associated with the specified application id. @param appId An application id. @return The layout content.
[ "@Override\n public String getLayoutContentByAppId(String appId) {\n String value = propertyService.getValue(PROPERTY_LAYOUT_ASSOCIATION, appId);\n return value == null ? null : getLayoutContent(new LayoutIdentifier(value, true));\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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Format a namespace slice storage. @param dnCurDir DataStorage current directory @param nsInfo the name space info @throws IOException Signals that an I/O exception has occurred.
[ "void format(File dnCurDir, NamespaceInfo nsInfo) throws IOException {\n File curNsDir = getNsRoot(namespaceID, dnCurDir);\n StorageDirectory nsSdir = new StorageDirectory(curNsDir);\n format(nsSdir, nsInfo);\n }" ]
[ "@Override\n public void onError(Session session, Throwable thr) {\n if (onError != null) {\n Object args[] = new Object[onError.getMethod().getParameterTypes().length];\n MethodData methodData = onError.getMethodData();\n //check if method has optional Session parameter\n...
codesearchnet
{ "query": "Represent the Github summarization about storage:", "pos": "Represent the Github code about storage:", "neg": "Represent the Github code:" }
Find the child C{etree.Element} with the matching C{tag}. @raises L{WSDLParseError}: If more than one such elements are found.
[ "def _find_child(self, tag):\n \n tag = self._get_namespace_tag(tag)\n children = self._root.findall(tag)\n if len(children) > 1:\n raise WSDLParseError(\"Duplicate tag '%s'\" % tag)\n if len(children) == 0:\n return None\n return children[0]" ]
[ "def validate\n xsd = Nokogiri::XML::Schema(File.read(SCHEMA_FILE))\n out = \"\"\n xsd.validate(@report).each do |error|\n out << error.message unless error.message == \"Element 'algorithm', attribute 'publication_ref': '' is not a valid value of the atomic type 'xs:IDREF'.\" || error.message ...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
// List all documentation URLs from the specified source file
[ "func extractURLsFromSourceFile(filename string) (results []string) {\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer file.Close()\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\ttext := scanner.Text()\n\t\tres := URLDeclarationMatcher.FindStringSubmatch(text)\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 File management:", "pos": "Represent the Github code about File management:", "neg": "Represent the Github code:" }
#line 1316 "../smarty/lexer/smarty_internal_templateparser.y"
[ "function yy_r184()\n {\n $this->yystack[ $this->yyidx + - 1 ]->minor->append_subtree($this, $this->yystack[ $this->yyidx + 0 ]->minor);\n $this->_retvalue = $this->yystack[ $this->yyidx + - 1 ]->minor;\n }" ]
[ "function yy_accept()\n {\n if (self::$yyTraceFILE) {\n fprintf(self::$yyTraceFILE, \"%sAccept!\\n\", self::$yyTracePrompt);\n }\n while ($this->yyidx >= 0) {\n $stack = $this->yy_pop_parser_stack();\n }\n /* Here code is inserted which will be executed wh...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Apply requested security options to protect the session. @param bool $secure If true, forces to set the secure flag of session cookie @param bool $httponly If true, forces to set the httponly flag of session cookie
[ "public function applySecurityRules(bool $secure = false, bool $httponly = false)\n {\n $nb_engine = CNabuEngine::getEngine();\n\n $attrs = session_get_cookie_params();\n session_set_cookie_params(\n $attrs['lifetime'],\n $attrs['path'],\n $attrs['domain'],\n...
[ "private void secureCookie(Cookie cookie, HttpServletRequest request){\n // if we can mark the cookie HTTP only, do so to protect this cookie even in case of XSS vulnerability.\n if (SET_HTTP_ONLY!=null) {\n try {\n SET_HTTP_ONLY.invoke(cookie,true);\n } catch (Ill...
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Returns a dict representing the health monitor for the load balancer. If no monitor has been configured, returns an empty dict.
[ "def get_health_monitor(self, loadbalancer):\n \n uri = \"/loadbalancers/%s/healthmonitor\" % utils.get_id(loadbalancer)\n resp, body = self.api.method_get(uri)\n return body.get(\"healthMonitor\", {})" ]
[ "def applyFilters(self, endpoint):\n \"\"\"\"\"\"\n for filter_function in self.filter_functions:\n e = filter_function(endpoint)\n if e is not None:\n # Once one of the filters has returned an\n # endpoint, do not apply any more.\n re...
codesearchnet
{ "query": "Represent the Github sentence about AWS Route 53:", "pos": "Represent the Github code about AWS Route 53:", "neg": "Represent the Github code about programming:" }
Return a list of code lines to allocate and assign the local parameter definitions that match those in the signature of the wrapped executable.
[ "def _ctypes_ex_assign(executable):\n \n result = []\n for p in executable.ordered_parameters:\n _ctypes_code_parameter(result, p, \"assign\")\n\n if type(executable).__name__ == \"Function\":\n _ctypes_code_parameter(result, executable, \"assign\")\n\n return result" ]
[ "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 Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about programming:" }
{@inheritdoc} @param array $expression @param Call $call @param CompilationContext $context @throws CompilerException @return CompiledExpression
[ "public function optimize(array $expression, Call $call, CompilationContext $context)\n {\n if (!isset($expression['parameters']) || 1 != \\count($expression['parameters'])) {\n throw new CompilerException(\n sprintf(\n 'func_get_arg() expects at exactly 1 para...
[ "private function getEndCall(Expr $arg = null)\n {\n if ($arg === null) {\n $arg = NoReturnValue::create();\n }\n\n return new StaticCall(new FullyQualifiedName('Psy\\Command\\TimeitCommand'), 'markEnd', [new Arg($arg)]);\n }" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Runs behat command with provided parameters @When /^I run "behat(?: ((?:\"|[^"])*))?"$/ @param string $argumentsString
[ "public function iRunBehat($argumentsString = '')\n {\n $argumentsString = strtr($argumentsString, array('\\'' => '\"'));\n\n $this->process->setWorkingDirectory(__DIR__ . '/../../testapp');\n $this->process->setCommandLine(\n sprintf(\n '%s %s %s %s',\n ...
[ "def label(self, string):\n \n if '*/' in string:\n raise ValueError(\"Bad label - cannot be embedded in SQL comment\")\n return self.extra(where=[\"/*QueryRewrite':label={}*/1\".format(string)])" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
判断指定用户是否WebSocket在线 @param userid Serializable @return boolean
[ "@Local\r\n public CompletableFuture<Boolean> existsWebSocket(final Serializable userid) {\r\n CompletableFuture<Boolean> localFuture = null;\r\n if (this.localEngine != null) localFuture = CompletableFuture.completedFuture(localEngine.existsLocalWebSocket(userid));\r\n if (this.sncpNodeAddr...
[ "public static String getTransferQueue(String name) {\n LOG.debug(\"对于需要保序的情况,只应该启动单个中转节点,目前启动多个节点原节点会被挤掉线,但是由于重连机制,会轮着挤掉线\");\n return IdManager.generateStaticQueueId(buildTransferName(name));\n }" ]
codesearchnet
{ "query": "Represent the description about NLP:", "pos": "Represent the code about NLP:", "neg": "Represent the code:" }
Follow the steps required when the spec requires us to "push onto the list of active formatting elements". @param Element $elt
[ "public function push( Element $elt ) {\n\t\t// Must not be in the list already\n\t\tif ( $elt->prevAFE !== null || $this->head === $elt ) {\n\t\t\tthrow new \\Exception( 'Cannot insert a node into the AFE list twice' );\n\t\t}\n\n\t\t// \"Noah's Ark clause\" -- if there are already three copies of\n\t\t// this ele...
[ "final void initDocument(int documentNumber)\n {\n // save masked DTM document handle\n m_docHandle = documentNumber<<DOCHANDLE_SHIFT;\n\n // Initialize the doc -- no parent, no next-sib\n nodes.writeSlot(0,DOCUMENT_NODE,-1,-1,0);\n /...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
@param string $shadowToken @return QueryBuilder
[ "public function getUserShadowAuthQuery($shadowToken)\n {\n $qb = $this->createQueryBuilder();\n $qb->select('*')\n ->where('shadowtoken = :shadowtoken')\n ->andWhere('shadowvalidity > :shadowvalidity')\n ->setParameter('shadowtoken', $shadowToken)\n ->se...
[ "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 Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
It loads main file of configuration and checks for validity. @return self. @throws Exception.
[ "public function run()\n {\n if (!$this->isAppRootSet()) {\n throw new Exception(\"The application root wasn't defined.\", 1);\n }\n if (!$this->isConfigFileSet()) {\n throw new Exception(\"The main config file wasn't defined.\", 2);\n }\n $sConfigPath = $...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the text about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
Configures the ZooKeeper client.
[ "def setup_zk\n unless @zk\n @zk = ZK.new(\"#{@options[:zkservers]}#{@options[:chroot] || ''}\")\n @zk.register(manual_failover_path) do |event|\n handle_manual_failover_update(event)\n end\n @zk.on_connected { @zk.stat(manual_failover_path, :watch => true) }\n end\n\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 description about Technology:", "pos": "Represent the code about Technology:", "neg": "Represent the code about Programming:" }
C = C + A^T*B @param blockLength @param A row block vector @param B row block vector @param C
[ "public static void multPlusTransA(int blockLength ,\n DSubmatrixD1 A , DSubmatrixD1 B ,\n DSubmatrixD1 C )\n {\n int heightA = Math.min( blockLength , A.row1 - A.row0 );\n\n for( int i = C.row0+blockLength; i < C.row1; i += ...
[ "def _initialize_b_x(self):\n \n \"\"\"\n # Get vector(s) compatible with the matrix,\n # i.e., with the same parallel layout.\n self.petsc_x, self.petsc_b = self.petsc_A.getVecs()\n\n # Set the solution vector to zeros.\n self.petsc_x.set(0)\n\n # Define the...
codesearchnet
{ "query": "Represent the summarization about Mathematics:", "pos": "Represent the code about Mathematics:", "neg": "Represent the code about Mathematics:" }
// You should always use this function to get a new GetVirtualMachineUserDataParams instance, // as then you are sure you have configured all required params
[ "func (s *UserService) NewGetVirtualMachineUserDataParams(virtualmachineid string) *GetVirtualMachineUserDataParams {\n\tp := &GetVirtualMachineUserDataParams{}\n\tp.p = make(map[string]interface{})\n\tp.p[\"virtualmachineid\"] = virtualmachineid\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 text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Defines a new module/class based on the supplied node. @param [RubyLint::Node] node @param [RubyLint::DefinitionBuilder::Base] definition_builder @param [Hash] options
[ "def define_module(node, definition_builder, options = {})\n builder = definition_builder.new(node, self, options)\n definition = builder.build\n scope = builder.scope\n existing = scope.lookup(definition.type, definition.name, false)\n\n if existing\n definition = existing...
[ "def add_block(pBlock, pBehaviour = Languages::KEEP_LEVEL)\n return nil unless (pBlock.instance_of?Languages::BlockData)\n add_with_manager(pBlock, 'block', pBehaviour)\n end" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// mapdecode doesn't suport encoding.TextMarhsaler by default so we have to do // this manually.
[ "func (l *zapLevel) Decode(into mapdecode.Into) error {\n\tvar s string\n\tif err := into(&s); err != nil {\n\t\treturn fmt.Errorf(\"could not decode Zap log level: %v\", err)\n\t}\n\n\terr := (*zapcore.Level)(l).UnmarshalText([]byte(s))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not decode Zap log level: %v...
[ "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 about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
验证修改数据,用于update. @param array $data @return bool @throws ValidateException
[ "protected final function validateUpdateData(array $data = null) {\n\t\tif ($data === null && isset($this->_formData)) {\n\t\t\t$data = $this->_formData;\n\t\t}\n\t\tif ($this->rules) {\n\t\t\t$newRules = [];\n\t\t\tforeach ($data as $key => $v) {\n\t\t\t\tif (isset($this->rules[ $key ])) {\n\t\t\t\t\t$newRules[ $k...
[ "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 text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software Development:" }
// SetResourceShareArn sets the ResourceShareArn field's value.
[ "func (s *ResourceShare) SetResourceShareArn(v string) *ResourceShare {\n\ts.ResourceShareArn = &v\n\treturn s\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 Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Make a simple editable example. The label for this example is used to get the example for use in the unit tests.
[ "private void makeSimpleExample() {\n\t\tadd(new WHeading(HeadingLevel.H3, \"Simple WRadioButtonSelect\"));\n\t\tWPanel examplePanel = new WPanel();\n\t\texamplePanel.setLayout(new FlowLayout(FlowLayout.VERTICAL, Size.MEDIUM));\n\t\tadd(examplePanel);\n\n\t\t/**\n\t\t * The radio button select.\n\t\t */\n\t\tfinal ...
[ "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 text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Set options if you missed your opportunity in the c'tor or if you want to change the options. @param someOptions new set of options @return
[ "public Resty setOptions(Option... someOptions) {\n\t\toptions = (someOptions == null) ? new Option[0] : someOptions;\n\t\tfor (Option o : options) {\n\t\t\to.init(this);\n\t\t}\n\t\treturn this;\n\t}" ]
[ "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 description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// styleSheetWriter provides a function to save xl/styles.xml after serialize // structure.
[ "func (f *File) styleSheetWriter() {\n\tif f.Styles != nil {\n\t\toutput, _ := xml.Marshal(f.Styles)\n\t\tf.saveFileList(\"xl/styles.xml\", replaceWorkSheetsRelationshipsNameSpaceBytes(output))\n\t}\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 instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Decrypt, verify and unserialize payload. @codeCoverageIgnore @return mixed
[ "public function decode($data)\n {\n $data[\"data\"] = $this->decrypt($data[\"data\"], $this->config[\"secret\"]);\n\n if (hash_hmac(\n \"sha256\",\n $data[\"data\"],\n $this->config[\"secret\"]\n ) == $data[\"token\"]) {\n return unserialize($data...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github sentence about Technology:", "pos": "Represent the Github code about Technology:", "neg": "Represent the Github code:" }
We don't want sprites rendered using the standard mechanism because we intersperse them with objects in our scene and need to manage their z-order.
[ "@Override\n protected void paintBits (Graphics2D gfx, int layer, Rectangle dirty)\n {\n _animmgr.paint(gfx, layer, dirty);\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 post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Override preparePaintComponent in order to correct the visibility of the tab's content before it is rendered. @param request the request being responded to.
[ "@Override\n\tprotected void preparePaintComponent(final Request request) {\n\t\tsuper.preparePaintComponent(request);\n\t\tWComponent content = getContent();\n\n\t\tif (content != null) {\n\t\t\tswitch (getMode()) {\n\t\t\t\tcase EAGER: {\n\t\t\t\t\t// Will always be visible\n\t\t\t\t\tcontent.setVisible(true);\n\...
[ "public void onTransformChanged() {\n Log.v(Log.SUBSYSTEM.WIDGET, TAG, \"onTransformChanged(): %s mPreventTransformChanged = %b\",\n getName(), mPreventTransformChanged);\n\n // Even if the calling code that altered the transform doesn't request a\n // layout, we'll do a layout t...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Symbolizes keys of a hash
[ "def deep_symbolize_keys\n return each_with_object({}) { |memo, (k, v)| memo[k.to_sym] = v.deep_symbolize_keys } if self.is_a?(Hash)\n return each_with_object([]) { |memo, v| memo << v.deep_symbolize_keys } if self.is_a?(Array)\n self\n end" ]
[ "def read_description():\n \"\"\"\"\"\"\n try:\n with open(\"README.md\") as r:\n description = \"\\n\"\n description += r.read()\n with open(\"CHANGELOG.md\") as c:\n description += \"\\n\"\n description += c.read()\n return description\n ex...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Determine if the current user is authenticated, if not redirect them to the login page. @todo Move auth-check and redirection to a middleware or dedicated admin route. @param RequestInterface $request The request to initialize. @return void
[ "protected function authRedirect(RequestInterface $request)\n {\n unset($request);\n // Test if authentication is required.\n if ($this->authRequired() === false) {\n return;\n }\n\n // Test if user is authorized to access this controller\n if ($this->isAuthor...
[ "public function createService(ServiceLocatorInterface $serviceLocator)\n {\n $routeCollection = new RouteCollection();\n $requestContext = $serviceLocator->get('RouterRequestContext');\n $routerOptions = array();\n\n $logger = $serviceLocator->has('logger') ? $serviceLocator->get(...
codesearchnet
{ "query": "Represent the Github post about Laravel:", "pos": "Represent the Github code about Laravel:", "neg": "Represent the Github code about Programming:" }
Builds {@link ServerGroup} instances and populates the map {@link #serverGroups}
[ "private SortedSet<ServerGroup> deriveGroups(List<HostInfo> hosts) {\n serverGroups.clear();\n for (HostInfo host : hosts) {\n List<ServerInstance> serverInstances = host.getServerInstances();\n for (ServerInstance server : serverInstances) {\n String group = serve...
[ "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:" }
Save current analysis as file passed in. Return SAVE_SUCCESSFUL if save successful. Method doesn't do much. This method is more if need to do other things in the future for saving analysis. And to keep saving naming convention.
[ "SaveReturn saveAnalysis(final File f) {\n\n Future<Object> waiter = mainFrame.getBackgroundExecutor().submit(() -> {\n BugSaver.saveBugs(f, mainFrame.getBugCollection(), mainFrame.getProject());\n return null;\n });\n try {\n waiter.get();\n } catch (Int...
[ "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 Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Enables/disables strict highlighting. Default is off, calling this method without parameters will turn it on. See documentation for more details on strict mode and where to use it. @param boolean Whether to enable strict mode or not
[ "function enable_strict_mode($mode = true)\r\n {\r\n if (self::MAYBE == $this->language_data['STRICT_MODE_APPLIES']) {\r\n $this->strict_mode = ($mode) ? self::ALWAYS : self::NEVER;\r\n }\r\n }" ]
[ "function Scope(context, parent, meta) {\n\t// The object that will be looked on for values.\n\t// If the type of context is TemplateContext, there will be special rules for it.\n\tthis._context = context;\n\t// The next Scope object whose context should be looked on for values.\n\tthis._parent = parent;\n\t// If t...
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
<p> A JSON-formatted object that describes a compatible AMI. </p> @param compatibleImages A JSON-formatted object that describes a compatible AMI.
[ "public void setCompatibleImages(java.util.Collection<CompatibleImage> compatibleImages) {\n if (compatibleImages == null) {\n this.compatibleImages = null;\n return;\n }\n\n this.compatibleImages = new java.util.ArrayList<CompatibleImage>(compatibleImages);\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 about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }