query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Decode the temperature.
[ "def decode_temperature(packet, channel=1):\n \"\"\"\"\"\"\n val = str(packet.get(QSDATA, ''))\n if len(val) == 12 and val.startswith('34') and channel == 1:\n temperature = int(val[-4:], 16)\n return round(float((-46.85 + (175.72 * (temperature / pow(2, 16))))))\n return None" ]
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// TransferLeadership attempts to transfer leadership to a different node, // and wait for the transfer to happen.
[ "func (n *Node) TransferLeadership(ctx context.Context) error {\n\tctx, cancelTransfer := context.WithTimeout(ctx, n.reqTimeout())\n\tdefer cancelTransfer()\n\n\tn.stopMu.RLock()\n\tdefer n.stopMu.RUnlock()\n\n\tif !n.IsMember() {\n\t\treturn ErrNoRaftMember\n\t}\n\n\tif !n.isLeader() {\n\t\treturn ErrLostLeadershi...
[ "boolean detectAndHandleBackupTimeout(long timeoutMillis) {\n // if the backups have completed, we are done; this also filters out all non backup-aware operations\n // since the backupsAcksExpected will always be equal to the backupsAcksReceived\n boolean backupsCompleted = backupsAcksExpected ...
codesearchnet
{ "query": "Represent the Github summarization about Networking:", "pos": "Represent the Github code about Networking:", "neg": "Represent the Github code:" }
Get the article checkout URL. @param Article $article The article. @param Customer|null $customer The customer. @return string
[ "public function getArticleCheckoutURL(Article $article, Customer $customer = null)\n {\n if ($customer === null) {\n return $article->getCheckoutUrl();\n }\n\n return $this->generateCheckoutURLForCustomer($customer->getHash(), $article->getArticleNumber());\n }" ]
[ "public static function adminEmail()\n {\n // Checks if a user is connected\n if (Session::isLogged() == false) {\n return null;\n }\n // Reads the admin datas, then stores it\n $admin = ModelFactory::get('User')->read(1);\n // Returns the admin email\n ...
codesearchnet
{ "query": "Represent the instruction about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software Development:" }
POST /<path> :param path: :type path: :param wrap_ttl: :type wrap_ttl: :param kwargs: :type kwargs: :return: :rtype:
[ "def write(self, path, wrap_ttl=None, **kwargs):\n \n response = self._adapter.post('/v1/{0}'.format(path), json=kwargs, wrap_ttl=wrap_ttl)\n\n if response.status_code == 200:\n return response.json()" ]
[ "def initialize(self, id, timestamp=None, user=None, page=None, minor=None,\n comment=None, text=None, bytes=None, sha1=None,\n parent_id=None, model=None, format=None, deleted=None):\n\n self.id = none_or(id, int)\n \n\n self.timestamp = none_or(timestamp, T...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Test whether the given name is a valid Java identifier. @param name The name @return True if it is
[ "public static boolean isValidJavaIdentifier(String name) {\n if (isBlank(name)) {\n return false;\n }\n\n final char[] chars = name.toCharArray();\n if (!Character.isJavaIdentifierStart(chars[0])) {\n return false;\n }\n\n for (char c : chars) {\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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
/* (non-Javadoc) @see javax.servlet.sip.Proxy#proxyTo(java.util.List)
[ "public void proxyTo(final List<? extends URI> uris) {\r\n\t\tfor (URI uri : uris)\r\n\t\t{\r\n\t\t\tif(uri == null) {\r\n\t\t\t\tthrow new NullPointerException(\"URI can't be null\");\r\n\t\t\t}\r\n\t\t\tif(!JainSipUtils.checkScheme(uri.toString())) {\r\n\t\t\t\tthrow new IllegalArgumentException(\"Scheme \" + uri...
[ "@SuppressWarnings(\"unchecked\")\n public static StackFinder getInstance() {\n if (finder == null) {\n AccessController.doPrivileged(new PrivilegedAction() {\n public Object run() {\n finder = new StackFinder();\n return null;\n ...
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
/* Render Tool Platform Container
[ "public function renderContainerAction(){\n \n $translator = $this->getServiceLocator()->get('translator');\n $melisKey = $this->params()->fromRoute('melisKey', '');\n $noAccessPrompt = '';\n // Checks wether the user has access to this tools or not\n $melisCoreRights = $th...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Get list of present plugins of given type. @param string $type @return array|null list of presnet plugins $name=>$diskversion, null if unknown
[ "public function get_present_plugins($type) {\n $this->load_present_plugins();\n if (isset($this->presentplugins[$type])) {\n return $this->presentplugins[$type];\n }\n return null;\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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Checks if the given array of item children contains at least one URL that is allowed to the current user. @param array $children item children @return bool
[ "protected function _hasAllowedChildren(array $children): bool\n {\n foreach ($children as $child) {\n if ($this->Auth->urlAllowed($child['url'])) {\n return true;\n }\n }\n\n return false;\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 sentence about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
// SetName sets the Name field's value.
[ "func (s *CancelRotateSecretOutput) SetName(v string) *CancelRotateSecretOutput {\n\ts.Name = &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 instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
@param string $operation @return DOMNode
[ "protected function buildOperation($operation)\n {\n $body = $this->document->getElementsByTagNameNS(self::SOAP_ENVELOPE, 'Body')->item(0);\n $operation = $this->document->createElementNS(self::ETP_NAME_SPACE, 'etp:' . $operation);\n\n return $body->appendChild($operation);\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 description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
@param array $iteratables @param PsiOptions $options @return \AppendIterator|KeylessAppendIterator @throws PsiException
[ "protected function createIteratorForMultipleInputs(array $iteratables, PsiOptions $options)\n {\n // when we have multiple inputs we need an option to decide on how to deal with colliding keys\n if ($options->isPreserveKeysOfMultipleInputs()) {\n // this iterator return the original key...
[ "public function handleManipulateAST(ManipulateAST $ManipulateAST): void\n {\n $ManipulateAST->documentAST = ASTHelper::attachDirectiveToObjectTypeFields(\n $ManipulateAST->documentAST,\n PartialParser::directive('@deferrable')\n );\n\n $ManipulateAST->documentAST->setD...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Fetches Base ID from the transmitter, if required. Otherwise returns the currently set Base ID.
[ "def base_id(self):\n ''' '''\n # If base id is already set, return it.\n if self._base_id is not None:\n return self._base_id\n\n # Send COMMON_COMMAND 0x08, CO_RD_IDBASE request to the module\n self.send(Packet(PACKET.COMMON_COMMAND, data=[0x08]))\n # Loop ove...
[ "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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// StatusCodeIs returns a retry condition function. // The condition returns an error if the given response's status code is not the // given HTTP status code.
[ "func StatusCodeIs(status int) ResponseCondition {\n\treturn func(res *http.Response) error {\n\t\tif res.StatusCode != status {\n\t\t\treturn fmt.Errorf(\"got status code %d, wanted %d\", res.StatusCode, status)\n\t\t}\n\t\treturn nil\n\t}\n}" ]
[ "func (sm *StateMachine) validate() []error {\n\tvalidationErrors := make([]error, 0)\n\tif sm.stateDefinitionError != nil {\n\t\tvalidationErrors = append(validationErrors, sm.stateDefinitionError)\n\t}\n\n\t// TODO - add Catcher validator\n\t/*\n\t\tEach Catcher MUST contain a field named “ErrorEquals”, specified...
codesearchnet
{ "query": "Represent the Github post about NLP:", "pos": "Represent the Github code about NLP:", "neg": "Represent the Github code about programming:" }
// createPipe is a helper function to make sure we always create pipes // with the same arguments, since subsequent calls to create pipe need // to use the same arguments as the first one. If first is set, fail // if the pipe already exists.
[ "func createPipe(address string, first bool) (syscall.Handle, error) {\n\tn, err := syscall.UTF16PtrFromString(address)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tmode := uint32(pipe_access_duplex | syscall.FILE_FLAG_OVERLAPPED)\n\tif first {\n\t\tmode |= file_flag_first_pipe_instance\n\t}\n\treturn createNamedP...
[ "function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about File management:" }
Execute the proc if not done so already.
[ "private synchronized void ensureIsRun() {\r\n if (!isRun) {\r\n isRun = true;\r\n try {\r\n result = executeProc(args);\r\n exception = null;\r\n } catch (ProcError e) {\r\n throw e.asRuntimeException();\r\n } catch (Th...
[ "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 post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Deletes the stored data associated to the key @param string $key Cache key associated to the data @return boolean True upon success, false on failure
[ "public function delete($key)\n {\n if (!$this->enabled)\n return true;\n\n $this->Logger->debug(\"Delete key: {$key}\");\n\n $ret = @$this->getConnection()->delete($this->key($key));\n\n $this->Logger->debug(\"\". (($ret) ? \"Successful\" : \"Failed to\") . \" delete '{$ke...
[ "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 summarization about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software development:" }
// DeadlineTime returns a boolean whether the drain strategy allows an infinite // duration or otherwise the deadline time. The force drain is captured by the // deadline time being in the past.
[ "func (d *DrainStrategy) DeadlineTime() (infinite bool, deadline time.Time) {\n\t// Treat the nil case as a force drain so during an upgrade where a node may\n\t// not have a drain strategy but has Drain set to true, it is treated as a\n\t// force to mimick old behavior.\n\tif d == nil {\n\t\treturn false, time.Tim...
[ "function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about File management:" }
/* (non-Javadoc) @see net.timewalker.ffmq4.common.connection.AbstractConnection#onConnectionClose()
[ "@Override\n\tprotected void onConnectionClose()\n {\n \tsuper.onConnectionClose();\n \t\n \ttry\n {\n \tif (transport != null && !transport.isClosed())\n \t{\n\t log.debug(\"#\"+id+\" Closing transport\");\n\t this.transport.close();\n \t}\n }\n ...
[ "@SuppressWarnings(\"unchecked\")\n public static StackFinder getInstance() {\n if (finder == null) {\n AccessController.doPrivileged(new PrivilegedAction() {\n public Object run() {\n finder = new StackFinder();\n return null;\n ...
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Register update. @param _instance the _instance @throws EFapsException the e faps exception
[ "public static void registerUpdate(final Instance _instance)\n throws EFapsException\n {\n // check if SystemConfiguration exists, necessary during install\n if (EFapsSystemConfiguration.get() != null\n && EFapsSystemConfiguration.get().getAttributeValueAsBoolean(Kerne...
[ "def send_put(self, mri, attribute_name, value):\n \n path = attribute_name + \".value\"\n typ, value = convert_to_type_tuple_value(serialize_object(value))\n if isinstance(typ, tuple):\n # Structure, make into a Value\n _, typeid, fields = typ\n value = ...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
@param string $file_path @return void
[ "public function checkFile($file_path)\n {\n if ($this->debug_output) {\n echo 'Checking ' . $file_path . \"\\n\";\n }\n\n $this->config->hide_external_errors = $this->config->isInProjectDirs($file_path);\n\n $this->codebase->addFilesToAnalyze([$file_path => $file_path]);\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 Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Get tree data for node @param DataObject $node @param int $depth @return array|string
[ "protected function getSubtree($node, $depth = 0)\n {\n // Check if this node is limited due to child count\n $numChildren = $this->getNumChildren($node);\n $limited = $this->isNodeLimited($node, $numChildren);\n\n // Build root rode\n $expanded = $this->isExpanded($node);\n ...
[ "public static function getPageAuthority($url = false)\n {\n $data = static::getCols('34359738368', $url);\n return (parent::noDataDefaultValue() == $data) ? $data :\n $data['upa'];\n }" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Setting value of a key to nil in opts_defaults forces non-nil value of key in opts_in
[ "def parse_opts(opts_in, opts_defaults)\n diff_id = opts_in.keys - opts_defaults.keys\n raise ArgumentError, \"Unrecognised argument(s): #{diff_id.join(\", \")}\" if diff_id.any?\n\n (opts_in.keys & opts_defaults.keys).each do |k|\n raise ArgumentError, \"Argument #{k.to_s} must not be nil\" i...
[ "def delete_node_storage(node)\n return if node == BLANK_NODE\n raise ArgumentError, \"node must be Array or BLANK_NODE\" unless node.instance_of?(Array)\n\n encoded = encode_node node\n return if encoded.size < 32\n\n # FIXME: in current trie implementation two nodes can share identical\n ...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// AddOrUpdateTolerationInPodSpec tries to add a toleration to the toleration list in PodSpec. // Returns true if something was updated, false otherwise.
[ "func AddOrUpdateTolerationInPodSpec(spec *v1.PodSpec, toleration *v1.Toleration) bool {\n\tpodTolerations := spec.Tolerations\n\n\tvar newTolerations []v1.Toleration\n\tupdated := false\n\tfor i := range podTolerations {\n\t\tif toleration.MatchToleration(&podTolerations[i]) {\n\t\t\tif helper.Semantic.DeepEqual(t...
[ "func (f *RecordFlags) AddFlags(cmd *cobra.Command) {\n\tif f == nil {\n\t\treturn\n\t}\n\n\tif f.Record != nil {\n\t\tcmd.Flags().BoolVar(f.Record, \"record\", *f.Record, \"Record current kubectl command in the resource annotation. If set to false, do not record the command. If set to true, record the command. If ...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Get historical prices for the given ticker symbol. Date format is 'YYYY-MM-DD' Returns a nested list.
[ "def getQuotes(self, symbol, start, end):\r\n \r\n try:\r\n start = str(start).replace('-', '')\r\n end = str(end).replace('-', '')\r\n\r\n url = 'http://ichart.yahoo.com/table.csv?s=%s&' % symbol + \\\r\n 'd=%s&' % str(int(end[4:6]) - 1) + \\\r\n ...
[ "def historical_pandas_yahoo(symbol, source='yahoo', start=None, end=None):\n '''\n \n '''\n #NOTE Panel for multiple symbols ?\n #NOTE Adj Close column name not cool (a space)\n return DataReader(symbol, source, start=start, end=end)" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Gets all the built in policy definitions. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "public ServiceFuture<List<PolicyDefinitionInner>> listBuiltInAsync(final ListOperationCallback<PolicyDefinitionInner> serviceCallback) {\n return AzureServiceFuture.fromPageResponse(\n listBuiltInSinglePageAsync(),\n new Func1<String, Observable<ServiceResponse<Page<PolicyDefinitionInn...
[ "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 comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
@param \Sonata\AdminBundle\Admin\AdminInterface $admin @param string $adminCode @return bool
[ "public function isAdminActive(AdminInterface $admin, $adminCode = '')\n {\n $active = false;\n if ($adminCode == $admin->getCode()) {\n $active = true;\n }\n\n if (method_exists($admin, 'getSubNavLinks')) {\n foreach ($admin->getSubNavLinks() as $value) {\n ...
[ "abstract public function __construct(DataAccessInterface $dataSource);\n \n /**\n * Returns an array with all entities for the given data request.\n * \n * @param \\Zepi\\DataSource\\Core\\DataRequest $dataRequest\n * @return false|array\n */\n public function find(DataRequest $dataReq...
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Find all the devices on the serial buss and store the results in a class member object.
[ "def findConnectedDevices(self):\n \n tmpTimeout = self._serial.timeout\n self._serial.timeout = 0.01\n\n for dev in range(128):\n device = self._getDeviceID(dev)\n\n if device is not None and int(device) not in self._deviceConfig:\n config = self._de...
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Calculate which packages should be installed or uninstalled, given a set of compiled requirements and a list of currently installed modules.
[ "def diff(compiled_requirements, installed_dists):\n \n requirements_lut = {r.link or key_from_req(r.req): r for r in compiled_requirements}\n\n satisfied = set() # holds keys\n to_install = set() # holds InstallRequirement objects\n to_uninstall = set() # holds keys\n\n pkgs_to_ignore = get_di...
[ "def resolveEntryPoint(entryPoint):\n \n if inVirtualEnv():\n path = os.path.join(os.path.dirname(sys.executable), entryPoint)\n # Inside a virtualenv we try to use absolute paths to the entrypoints.\n if os.path.isfile(path):\n # If the entrypoint is present, Toil must have be...
codesearchnet
{ "query": "Represent the comment about Logistics:", "pos": "Represent the code about Logistics:", "neg": "Represent the code about Software development:" }
// updateMaxRate recalculates the current max rate and updates all // threadThrottlers accordingly. // The rate changes when the number of thread changes or a module updated its // max rate.
[ "func (t *Throttler) updateMaxRate() {\n\t// Set it to infinite initially.\n\tmaxRate := int64(math.MaxInt64)\n\n\t// Find out the new max rate (minimum among all modules).\n\tfor _, m := range t.modules {\n\t\tif moduleMaxRate := m.MaxRate(); moduleMaxRate < maxRate {\n\t\t\tmaxRate = moduleMaxRate\n\t\t}\n\t}\n\n...
[ "@Override\n protected void updateCount() {\n // set counter to the actual value, rather than to try and\n // keep track with a seperate variable.\n // This counter must only be updated by the selector thread,\n // which allows us to omit synchronized logic.\n // there can be t...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
:param checksum: checksum :return: filename no storage base part
[ "def get_filename(self, checksum):\n \n filename = None\n for _filename, metadata in self._log.items():\n if metadata['checksum'] == checksum:\n filename = _filename\n break\n return filename" ]
[ "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 Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Get a floating point value by key. @param string $key @param float $default @return float @throws \OutOfBoundsException When the key was not found and no default value is given.
[ "public function getFloat($key)\n\t{\n\t\t$resolved = false;\n\t\t$value = $this->getByKey($key, $this->data, $resolved);\n\t\t\n\t\tif($resolved)\n\t\t{\n\t\t\treturn floatval($value);\n\t\t}\n\t\t\n\t\tif(func_num_args() > 1)\n\t\t{\n\t\t\treturn func_get_arg(1);\n\t\t}\n\t\t\n\t\tthrow new \\OutOfBoundsException...
[ "public function set($key, $value)\n {\n if (!is_null($key)\n && is_scalar($key)\n ) {\n return $this->_items[$key] = $value;\n } else {\n // given index name is not valid\n throw new EnumeratorException('Element could not be added to list. Index i...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Programming:" }
// NewRawSection creates a new section with an unparseable body.
[ "func (f *File) NewRawSection(name, body string) (*Section, error) {\n\tsection, err := f.NewSection(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsection.isRawSection = true\n\tsection.rawBody = body\n\treturn section, 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 instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
// Exists determines if the current build supports incremental workflow. // It checks if the previous image exists in the system and if so, then it // verifies that the save-artifacts script is present.
[ "func (builder *STI) Exists(config *api.Config) bool {\n\tif !config.Incremental {\n\t\treturn false\n\t}\n\n\tpolicy := config.PreviousImagePullPolicy\n\tif len(policy) == 0 {\n\t\tpolicy = api.DefaultPreviousImagePullPolicy\n\t}\n\n\ttag := util.FirstNonEmpty(config.IncrementalFromTag, config.Tag)\n\n\tstartTime ...
[ "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 Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Set the data that will be appended to the publican.cfg file when built. @param name The custom configuration name. @param publicanCfg The data to be appended.
[ "public void setAdditionalPublicanCfg(final String name, final String publicanCfg) {\n if (publicanCfg == null && !publicanCfgs.containsKey(name)) {\n return;\n } else if (publicanCfg == null) {\n removeChild(publicanCfgs.get(name));\n publicanCfgs.remove(name);\n ...
[ "def _env(self, line):\n '''\n \n '''\n line = self._setup('ENV', line)\n\n # Extract environment (list) from the line\n environ = parse_env(line)\n\n # Add to global environment, run during install\n self.install += environ\n\n # Also define for global envi...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
// DeleteBlock removes all block data associated with a hash.
[ "func DeleteBlock(db ethdb.Writer, hash common.Hash, number uint64) {\n\tDeleteReceipts(db, hash, number)\n\tDeleteHeader(db, hash, number)\n\tDeleteBody(db, hash, number)\n\tDeleteTd(db, hash, number)\n}" ]
[ "def delete_node_storage(node)\n return if node == BLANK_NODE\n raise ArgumentError, \"node must be Array or BLANK_NODE\" unless node.instance_of?(Array)\n\n encoded = encode_node node\n return if encoded.size < 32\n\n # FIXME: in current trie implementation two nodes can share identical\n ...
codesearchnet
{ "query": "Represent the Github comment about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Software development:" }
// GetAttributePaths returns a list of entries in .gitattributes which are // configured with the filter=lfs attribute // workingDir is the root of the working copy // gitDir is the root of the git repo
[ "func GetAttributePaths(mp *gitattr.MacroProcessor, workingDir, gitDir string) []AttributePath {\n\tpaths := make([]AttributePath, 0)\n\n\tfor _, file := range findAttributeFiles(workingDir, gitDir) {\n\t\tpaths = append(paths, attrPaths(mp, file.path, workingDir, file.readMacros)...)\n\t}\n\n\treturn paths\n}" ]
[ "def register (g):\n \n assert isinstance(g, Generator)\n id = g.id()\n\n __generators [id] = g\n\n # A generator can produce several targets of the\n # same type. We want unique occurence of that generator\n # in .generators.$(t) in that case, otherwise, it will\n # be tried twice and we'll...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// InputFilter ...
[ "func (sf StatFilter) InputFilter(data []byte, context rpc.Context) []byte {\n\tsf.stat(context)\n\treturn data\n}" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the text about Technology:", "pos": "Represent the code about Technology:", "neg": "Represent the code:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "@Override\n\tpublic boolean eIsSet(int featureID)\n\t{\n\t\tswitch (featureID)\n\t\t{\n\t\t\tcase XtypePackage.XFUNCTION_TYPE_REF__PARAM_TYPES:\n\t\t\t\treturn paramTypes != null && !paramTypes.isEmpty();\n\t\t\tcase XtypePackage.XFUNCTION_TYPE_REF__RETURN_TYPE:\n\t\t\t\treturn returnType != null;\n\t\t\tcase Xtyp...
[ "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 description about Text generation:", "pos": "Represent the code about Text generation:", "neg": "Represent the code:" }
Create or update a customer with given id @return [Customer] if successfully created or updated @raise [Httparty::Error] for all sorts of HTTP statuses.
[ "def save!\n result = Api.post(\"#{BASE_PATH}/#{customer_id}\", body: attributes.to_json)\n Customer.new(result.parsed_response[\"rg_customer\"])\n end" ]
[ "def get(resource, params: {}, key: Steam.apikey)\n params[:key] = key\n response = @conn.get resource, params\n JSON.parse(response.body)\n rescue JSON::ParserError\n # If the steam web api returns an error it's virtually never in json, so\n # lets pretend that we're getting some sort...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
// Validate inspects the fields of the type to determine if they are valid.
[ "func (s *Toolchain) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"Toolchain\"}\n\tif s.RoleArn != nil && len(*s.RoleArn) < 1 {\n\t\tinvalidParams.Add(request.NewErrParamMinLen(\"RoleArn\", 1))\n\t}\n\tif s.Source == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Source\"))\...
[ "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 programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Set lang @param \Core\Entity\Language $lang @return TranslateMenuPage
[ "public function setLang(\\Core\\Entity\\Language $lang = null)\n {\n $this->lang = $lang;\n\n return $this;\n }" ]
[ "public function initServices() {\n $this->getFrontController()->getRequestHandler()->addService($entityService = $this->getEntityService());\n \n // wir mappen den users controller auf den in Psc\n $entityService->setControllerClass('User', 'Psc\\CMS\\Controller\\UserEntityController');\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Decorator retries a function when expected exceptions are raised.
[ "def retryable_transaction(attempts=3, exceptions=(OperationalError,)):\n \"\"\"\"\"\"\n assert len(exceptions) > 0\n assert attempts > 0\n\n def wrapper(f):\n @functools.wraps(f)\n def wrapped(*args, **kwargs):\n for i in xrange(attempts):\n try:\n ...
[ "def cancel(self, *args, **kwargs):\n \"\"\"\"\"\"\n # Because remove all futures will trigger `set_result`,\n # we cancel itself first.\n super().cancel()\n for future in self.traverse():\n # All cancelled futures should have callbacks to removed itself\n # ...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Returns the inner HTML code of the tbody element of this table form control. @return string
[ "protected function getHtmlBody(): string\n {\n $ret = '';\n $i = 0;\n foreach ($this->controls as $control)\n {\n if ($control!==$this->footerControl)\n {\n $control->addClass(OverviewTable::$class);\n $control->addClass(($i % 2==0) ? 'even' : 'odd');\n\n $ret .= $cont...
[ "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 instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
@param Request $request @param ParamConverter $configuration @return bool
[ "public function apply(Request $request, ParamConverter $configuration)\n {\n $fieldName = $this->getOptions($configuration)['type_field'];\n\n if ($fieldName) {\n $value = $request->attributes->get($fieldName);\n if (!$value) {\n throw new NotFoundHttpException...
[ "public function execute($request)\n {\n RequestNotSupportedException::assertSupports($this, $request);\n\n //$model = ArrayObject::ensureArrayObject($request->getModel());\n\n $this->gateway->execute(new PaymentResponse($request->getModel()));\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about writing:" }
This is needed because of mailserver goes down. Will resend activation email to those classifieds where date_insert = date_edit and state = 2. Dispatch a classified created event with data
[ "public function activationEmailResendAction() \n\t{\n\t $classifiedService = $this->getServiceLocator()->get('document.service.classified');\n\t\t\n\t\ttry {\n\t\t\t$ids = $classifiedService->activationEmailResend(1);\n\t\t\t$data = array(\n\t\t\t\t'status' => 'success',\n\t\t\t\t'message' => implode(\", \", $i...
[ "def manager_post_save_handler(sender, instance, created, **kwargs):\n \"\"\"\"\"\"\n if instance.status == Data.STATUS_DONE or instance.status == Data.STATUS_ERROR or created:\n # Run manager at the end of the potential transaction. Otherwise\n # tasks are send to workers before transaction end...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
$ANTLR start "STRING_WITH_QUOTE_DOUBLE"
[ "public final void mSTRING_WITH_QUOTE_DOUBLE() throws RecognitionException {\n try {\n int _type = STRING_WITH_QUOTE_DOUBLE;\n int _channel = DEFAULT_TOKEN_CHANNEL;\n // C:\\\\Project\\\\Obdalib\\\\obdalib-parent\\\\obdalib-core\\\\src\\\\main\\\\java\\\\it\\\\unibz\\\\inf\\\...
[ "def rewritten_code\n @node.loc.expression.source_buffer.source[begin_pos...end_pos].sub(Engine::ERUBY_STMT_SPLITTER, \"@output_buffer.append= \")\n .sub(Engine::ERUBY_STMT_SPLITTER, Engine::ERUBY_EXPR_SPLITTER)\n end" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about text processing:" }
Set offset to the given index. @param {number} startIndex The start index to set. @param {number} offset The offset of the tokens. @param {number} baseline The line of the base offset. @returns {void}
[ "function setOffsetToIndex(startIndex, offset, baseline) {\n const loc = sourceCode.getLocFromIndex(startIndex)\n setOffsetToLoc(loc, offset, baseline)\n }" ]
[ "function(c, i, array) {\n if (c === undefined || c === null) return;\n // c is the component, type is dimension|attribute,\n // level is dataset|series|observation, i is index,\n // array is the component array\n failed += !iterator.call(context, c, type, level, i, array);\n }" ]
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
// Stream.Flush flushes the playback buffer, discarding any audio therein
[ "func (s *Stream) Flush() (error) {\n\tvar err C.int\n\t_ = C.pa_simple_flush(s.simple, &err)\n\tif err == C.PA_OK {\n\t\treturn nil\n\t}\n\treturn errorFromCode(err)\n}" ]
[ "function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about File management:" }
// GetAll returns all users.
[ "func (s *userService) GetAll() []datamodels.User {\n\treturn s.repo.SelectMany(func(_ datamodels.User) bool {\n\t\treturn true\n\t}, -1)\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:" }
Return source code based on tokens.
[ "def untokenize_without_newlines(tokens):\n \"\"\"\"\"\"\n text = ''\n last_row = 0\n last_column = -1\n\n for t in tokens:\n token_string = t[1]\n (start_row, start_column) = t[2]\n (end_row, end_column) = t[3]\n\n if start_row > last_row:\n last_column = 0\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 Github text about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
// GenerateUpdatePos returns a statement to update a value in the // _vt.vreplication table.
[ "func GenerateUpdatePos(uid uint32, pos mysql.Position, timeUpdated int64, txTimestamp int64) string {\n\tif txTimestamp != 0 {\n\t\treturn fmt.Sprintf(\n\t\t\t\"update _vt.vreplication set pos=%v, time_updated=%v, transaction_timestamp=%v, message='' where id=%v\",\n\t\t\tencodeString(mysql.EncodePosition(pos)), 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 comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Determine the start and end columns and names of the fields.
[ "def parse_fields(self):\n \"\"\"\"\"\"\n\n rule = self.t['toprule'].rstrip() # keep leading space for correct columns!!\n if not (rule == self.t['midrule'].rstrip() and rule == self.t['botrule'].rstrip()):\n raise ParseError(\"Table rules differ from each other (check white space)....
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
*********************** Types **************************
[ "@Override\n\tpublic LexNameSet caseABracketType(ABracketType node, FreeVarInfo info) throws AnalysisException\n\t{\n\t\treturn node.getType().apply(this, info);\n\t}" ]
[ "public static function protect()\n\t{\n\t\t$eye = \\Cli::color(\"*\", 'green');\n\n\t\treturn \\Cli::color(\"\n\t\t\t\t\t\\\"PROTECT ALL HUMANS\\\"\n\t\t\t _____ /\n\t\t\t /_____\\\\\", 'blue').\"\\n\"\n.\\Cli::color(\"\t\t\t ____[\\\\\", 'blue').$eye.\\Cli::color('---', 'blue').$eye.\\Cli:...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Check if the join units consist of blocks of uniform type that can be concatenated using Block.concat_same_type instead of the generic concatenate_join_units (which uses `_concat._concat_compat`).
[ "def is_uniform_join_units(join_units):\n \n return (\n # all blocks need to have the same type\n all(type(ju.block) is type(join_units[0].block) for ju in join_units) and # noqa\n # no blocks that would get missing values (can lead to type upcasts)\n # unless we're an extension d...
[ "def collect(self):\n \"\"\"\"\"\"\n # The order of the frame order appends is based on the implementation\n # of reduce which calls our function with\n # f(valueToBeAdded, accumulator) so we do our reduce implementation.\n def append_frames(frame_a, frame_b):\n return ...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Create takes the representation of a podSecurityPolicyReview and creates it. Returns the server's representation of the podSecurityPolicyReview, and an error, if there is any.
[ "func (c *FakePodSecurityPolicyReviews) Create(podSecurityPolicyReview *security.PodSecurityPolicyReview) (result *security.PodSecurityPolicyReview, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewCreateAction(podsecuritypolicyreviewsResource, c.ns, podSecurityPolicyReview), &security.PodSecurityPolicyR...
[ "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 Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
/* Return a new Decimal whose value is the natural logarithm of `x` truncated to `sd` significant digits. ln(n) is non-terminating (n != 1)
[ "function ln(y, sd) {\n var c, c0, denominator, e, numerator, sum, t, wpr, x2,\n n = 1,\n guard = 10,\n x = y,\n xd = x.d,\n Ctor = x.constructor,\n pr = Ctor.precision;\n\n // ln(-x) = NaN\n // ln(0) = -Infinity\n if (x.s < 1) throw Error(decimalError + (x.s ? 'NaN' : '-In...
[ "def quantize(number, digits=0, q=builtins.round):\n \n base, fraction = split(digits)\n\n # quantization beyond an order of magnitude results in a variable amount\n # of decimal digits depending on the lowest common multiple,\n # e.g. floor(1.2341234, 1.25) = 1.225 but floor(1.2341234, 1.5) = 1.20\n...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// SetTemplateId sets the TemplateId field's value.
[ "func (s *CreateCloudFormationChangeSetRequest) SetTemplateId(v string) *CreateCloudFormationChangeSetRequest {\n\ts.TemplateId = &v\n\treturn s\n}" ]
[ "@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Yield features from DataBC WFS
[ "def get_features(\n dataset,\n query=None,\n crs=\"epsg:4326\",\n bounds=None,\n sortby=None,\n pagesize=10000,\n max_workers=5,\n):\n \n param_dicts = define_request(dataset, query, crs, bounds, sortby, pagesize)\n\n with ThreadPoolExecutor(max_workers=max_workers) as executor:\n ...
[ "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 summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Update the configuration for a block. @param ServerRequestInterface $request @param int $block_id @return void
[ "public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void\n {\n $this->setBlockSetting($block_id, 'num', $request->get('num', self::DEFAULT_NUMBER));\n $this->setBlockSetting($block_id, 'infoStyle', $request->get('infoStyle', self::DEFAULT_STYLE));\n }" ]
[ "@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Delegates the `focusin` event with the `selectBoxIt` namespace to the list items
[ "function() {\n\n // Removes the hover class from the previous drop down option\n self.listItems.not($(this)).removeAttr(\"data-active\");\n\n $(this).attr(\"data-active\", \"\");\n\n var listIsHidden = self.list.is(\":hidden\");\n\n ...
[ "function _doLaunchAfterServerReady(initialDoc) {\n // update status\n _setStatus(STATUS_CONNECTING);\n _createLiveDocumentForFrame(initialDoc);\n\n // start listening for requests\n _server.start();\n\n // Install a one-time event handler when connected to the launcher pag...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Send a PUT request with JSON-encoded params. @param string $path @param array $params @param array $headers @throws \Http\Client\Exception @return array
[ "protected function put(string $path, array $params = [], array $headers = [])\n {\n $body = self::createJsonBody($params);\n\n if ($body) {\n $headers = self::addJsonContentType($headers);\n }\n\n return $this->putRaw($path, $body, $headers);\n }" ]
[ "public function run()\n {\n $this->loadMiddleware();\n\n //~ Default response\n $response = new HttpMessage\\Response();\n //$response->getBody()->write('-- static --');\n\n //~ Get response\n $stack = new HttpMiddleware\\Stack($response, $this->middleware);\n ...
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Check if two rectangles intersect
[ "def intersect(a, b):\n \n if a[x0] == a[x1] or a[y0] == a[y1]:\n return False\n if b[x0] == b[x1] or b[y0] == b[y1]:\n return False\n return a[x0] <= b[x1] and b[x0] <= a[x1] and a[y0] <= b[y1] and b[y0] <= a[y1]" ]
[ "def _check_graph(self, graph):\n \"\"\"\"\"\"\n if graph.num_vertices != self.size:\n raise TypeError(\"The number of vertices in the graph does not \"\n \"match the length of the atomic numbers array.\")\n # In practice these are typically the same arrays using the s...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Check if view exists. @param string $name @return array|false
[ "public function exists($name, $nest = null)\n {\n $file = str_replace('.', '/', $name);\n\n $extensions = [\n '.php',\n '.atom.php',\n '.atom',\n '.tpl.php',\n ];\n\n if (!is_null($nest)) {\n $nest = $nest.'resources/views/';\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 post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Creates the given directory path, as well as intermediate directories. Catches any I/O exception, returning False in that case; otherwise, True is returned.
[ "def safeMakeDirs(path, mode=0o777):\n \n try:\n os.makedirs(path, mode)\n\n return True\n except OSError:\n return False" ]
[ "public static CodedInputStream newInstance(final byte[] buf, final int off,\n final int len) {\n CodedInputStream result = new CodedInputStream(buf, off, len);\n try {\n // Some uses of CodedInputStream can be more efficient if they know\n // exactly how ...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Set the foreign ID and type for creating a related model. @param Model $model @return void
[ "protected function setForeignAttributesForCreate(Model $model)\n\t{\n\t\t$model->{$this->getPlainForeignKey()} = $this->getParentKey();\n\n\t\t$model->{last(explode('.', $this->morphType))} = $this->morphClass;\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 description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Create a SVG line element. Do not confuse this with path elements. @param document document to create in (factory) @param x1 first point x @param y1 first point y @param x2 second point x @param y2 second point y @return new element
[ "public static Element svgLine(Document document, double x1, double y1, double x2, double y2) {\n Element line = SVGUtil.svgElement(document, SVGConstants.SVG_LINE_TAG);\n SVGUtil.setAtt(line, SVGConstants.SVG_X1_ATTRIBUTE, x1);\n SVGUtil.setAtt(line, SVGConstants.SVG_Y1_ATTRIBUTE, y1);\n SVGUtil.setAtt...
[ "function(props) {\n props = defaultValue(props, {});\n\n this.title = props.title;\n\n /**\n * Gets or sets the list of items, ordered from bottom to top, with properties:\n * * `color`: CSS color description,\n * * `lineColor`: CSS color description,\n * * `multipleColors`: An array of CSS color descri...
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
putExternalMirrorQuery: putExternalMirror's Query Sign Way @link https://docs.qingcloud.com/qingstor/api/bucket/external_mirror/put_external_mirror.html Documentation URL @param string 'source_site' Source site url @return Request
[ "public function putExternalMirrorQuery($expires, $options=array())\n {\n $req = $this->putExternalMirrorRequest($options);\n return $req->query_sign($expires);\n }" ]
[ "def get(self):\n ''''''\n request = TOPRequest('xxxxx.xxxxx.campaign.areaoptions.get')\n self.create(self.execute(request), fields=['success','result'], models={'result':AreaOption})\n return self.result" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Execute this transaction. @param scope The server scope. @param req The request created for the exec command. @param res The response created for the exec command.
[ "function exec(scope, req, res) {\n var replies = [], item;\n\n // NOTE: incrby invalid amount will trigger EXECABORT\n // NOTE: wrong number of args are returned to the client\n // NOTE: but other types of validation errors (argument type coercion)\n // NOTE: trigger EXECABORT\n\n if(this.error) return this....
[ "function RowStatementPostExec(\n statementOptions, context, services, connectionConfig)\n{\n // call super\n BaseStatement.apply(this, arguments);\n\n // add the result request headers to the context\n context.resultRequestHeaders = buildResultRequestHeadersRow();\n\n /**\n * Called when the statement re...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// startAcceptedLoop sets up required state and starts a goroutine with the // main loop for accepted connections.
[ "func (e *endpoint) startAcceptedLoop(waiterQueue *waiter.Queue) {\n\te.waiterQueue = waiterQueue\n\te.workerRunning = true\n\tgo e.protocolMainLoop(false)\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 post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Configures a {@link ViewTransitionBuilder} per the Cascade's Type. @param builder @param config Contains context about the view being configured.
[ "@Override\n public void transit(ViewTransitionBuilder builder, ViewTransitionBuilder.ViewGroupTransitionConfig config) {\n float cascadeLength = cascadeEnd - mCascadeStart;\n float minEffectLength = mTransitionEnd - cascadeEnd;\n float fraction = cascadeLength / (config.total - 1);\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 text about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Get the distance from this point to another, squared. This can sometimes be used in place of distance and avoids the additional sqrt. @param other The other point we're measuring to @return The distance to the other point squared
[ "public float distanceSquared(Vector2f other) {\r\n\t\tfloat dx = other.getX() - getX();\r\n\t\tfloat dy = other.getY() - getY();\r\n\t\t\r\n\t\treturn (float) (dx*dx)+(dy*dy);\r\n\t}" ]
[ "def radiansBetween(self, other):\n '''\n \n\n '''\n # a dot b = |a||b| * cos(theta)\n # a dot b / |a||b| = cos(theta)\n # cos-1(a dot b / |a||b|) = theta\n\n # translate each line so that it passes through the origin and\n # produce a new point whose distance...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about mathematics:" }
Publishes each saved message to Centrifugo.
[ "def publish_message_to_centrifugo(sender, instance, created, **kwargs):\n \n if created is True:\n client = Client(\"{0}api/\".format(getattr(settings, \"CENTRIFUGE_ADDRESS\")), getattr(settings, \"CENTRIFUGE_SECRET\"))\n # we ensure the client is still in the thread (he may have left or have b...
[ "@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 about Messaging:", "pos": "Represent the code about Messaging:", "neg": "Represent the code about Programming:" }
Register support for the SHIM header with the given `name`. If the header has already been registered as supported, :class:`ValueError` is raised.
[ "def register_header(self, name):\n \n\n self._node.register_feature(\n \"#\".join([namespaces.xep0131_shim, name])\n )" ]
[ "def _find_entity_in_records_by_class_name(self, entity_name):\n \"\"\"\"\"\"\n records = {\n key: value for (key, value)\n in self._registry.items()\n if value.name == entity_name\n }\n # If more than one record was found, we are dealing with the case of...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Update an existing pipeline coupling.
[ "func (s *Service) PipelineCouplingUpdate(ctx context.Context, pipelineCouplingIdentity string, o PipelineCouplingUpdateOpts) (*PipelineCoupling, error) {\n\tvar pipelineCoupling PipelineCoupling\n\treturn &pipelineCoupling, s.Patch(ctx, &pipelineCoupling, fmt.Sprintf(\"/pipeline-couplings/%v\", pipelineCouplingIde...
[ "@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 about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// Update sets a new bundle as the bundle source and calls any registered callbacks
[ "func (bs *BundleSource) Update(newBundle *Bundle) {\n\tbs.bundle.Store(newBundle)\n\tfor _, callback := range bs.callbacks {\n\t\tcallback(newBundle)\n\t}\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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Returns seo uri @return string
[ "public function getEntryUri()\n {\n $oManufacturer = oxNew(\\OxidEsales\\Eshop\\Application\\Model\\Manufacturer::class);\n if ($oManufacturer->load($this->getEditObjectId())) {\n return $this->_getEncoder()->getManufacturerUri($oManufacturer, $this->getEditLang());\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 comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
// ServeHTTP returns a simple 404 Not found response
[ "func (notFound) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\tw.WriteHeader(http.StatusNotFound)\n\tfmt.Fprint(w, \"Not found\")\n\n}" ]
[ "public static String getDefaultMediaType(ResultType expectedType) {\n ResponseFormat format = (expectedType != null) ? defaultTypeFormats.get(expectedType) : null;\n \n // If the expected type is unknown, we should let the server decide, otherwise we could\n // wind up requesting a response type that d...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// Register a new user with the controller. // If controller registration is set to administrators only, a valid administrative // user token is required in the client.
[ "func Register(c *deis.Client, username, password, email string) error {\n\tuser := api.AuthRegisterRequest{Username: username, Password: password, Email: email}\n\tbody, err := json.Marshal(user)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := c.Request(\"POST\", \"/v2/auth/register/\", body)\n\tif err ...
[ "protected function authenticateViaCookie($request)\n {\n // If we need to retrieve the token from the cookie, it'll be encrypted so we must\n // first decrypt the cookie and then attempt to find the token value within the\n // database. If we can't decrypt the value we'll bail out with a nu...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
Webdav Move method implementation. @param session current session. @param srcPath source resource path @param destPath destination resource path @return the instance of javax.ws.rs.core.Response
[ "public Response move(Session session, String srcPath, String destPath)\r\n {\r\n try\r\n {\r\n session.move(srcPath, destPath);\r\n session.save();\r\n\r\n // If the source resource was successfully moved\r\n // to a pre-existing destination resource.\r\n if (ite...
[ "def processRequest(cls, ps, **kw):\n \n resource = kw['resource']\n method = resource.getOperation(ps, None) # This getOperation method is valid for ServiceSOAPBinding subclass\n rsp = method(ps, **kw)[1] # return (request, response) but we only need response\n return rsp" ]
codesearchnet
{ "query": "Represent the Github summarization about file transfer:", "pos": "Represent the Github code about file transfer:", "neg": "Represent the Github code about Computer Science:" }
Default (required) command - just executes run @return void
[ "public function execute()\n\t{\n\t\tif ($this->output->isInteractive())\n\t\t{\n\t\t\t$actions = array('add', 'delete', 'install', 'enable', 'disable');\n\t\t\t$action = $this->output->getResponse('What do you want to do? ['.implode(\"|\", $actions).']');\n\n\t\t\tif (in_array($action, $actions))\n\t\t\t{\n\t\t\t...
[ "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 instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// WeightValue returns the weight value for this edge, normalizing if a // divisor is available.
[ "func (e *Edge) WeightValue() int64 {\n\tif e.WeightDiv == 0 {\n\t\treturn e.Weight\n\t}\n\treturn e.Weight / e.WeightDiv\n}" ]
[ "def _pdf_value(pdf, population, fitnesses, fitness_threshold):\n \n # Add the chance of obtaining a solution from the pdf\n # when the fitness for that solution exceeds a threshold\n value = 0.0\n for solution, fitness in zip(population, fitnesses):\n if fitness >= fitness_threshold:\n ...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
// Validate inspects the fields of the type to determine if they are valid.
[ "func (s *CreateNotificationSubscriptionInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"CreateNotificationSubscriptionInput\"}\n\tif s.Endpoint == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"Endpoint\"))\n\t}\n\tif s.Endpoint != nil && len(*s.Endpoint) < 1 {\n\t\tinv...
[ "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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// AuditEventFrom returns the audit event struct on the ctx
[ "func AuditEventFrom(ctx context.Context) *audit.Event {\n\tev, _ := ctx.Value(auditKey).(*audit.Event)\n\treturn ev\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 description about Go programming language:", "pos": "Represent the Github code about Go programming language:", "neg": "Represent the Github code:" }
// SetStatus sets the Status field's value.
[ "func (s *RecordDetail) SetStatus(v string) *RecordDetail {\n\ts.Status = &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 instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
parse_options() -> opts, args Parse any command-line options given returning both the parsed options and arguments. https://docs.python.org/2/library/optparse.html
[ "def parse_options():\n\t\n\n\tparser = optparse.OptionParser(usage=USAGE, version=ontospy.VERSION)\n\n\tparser.add_option(\"-p\", \"--port\",\n\t\t\taction=\"store\", type=\"int\", default=DEFAULT_PORT, dest=\"port\",\n\t\t\thelp=\"A number specifying which port to use for the server.\")\n\n\topts, args = parser.p...
[ "def _convert_to_3(path): # pragma: no cover\n \"\"\"\"\"\"\n try:\n log.warn('##### Trying to convert %s to Python 3. #####', path)\n subprocess.call(['2to3', '-w', path])\n except subprocess.SubprocessError:\n log.exception('Check if 2to3 is installed. https://docs.python.org/2/libr...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns a table source matching the descriptor.
[ "public static <T> TableSource<T> findAndCreateTableSource(Descriptor descriptor) {\n\t\tMap<String, String> properties = descriptor.toProperties();\n\n\t\tTableSource tableSource;\n\t\ttry {\n\t\t\ttableSource = TableFactoryService\n\t\t\t\t.find(TableSourceFactory.class, properties)\n\t\t\t\t.createTableSource(pr...
[ "@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 text about Data processing:", "pos": "Represent the Github code about Data processing:", "neg": "Represent the Github code:" }
Return (width, height) for a given img file content no requirements
[ "def getDPI(filepath):\n \n xDPI = -1\n yDPI = -1\n with open(filepath, 'rb') as fhandle:\n head = fhandle.read(24)\n size = len(head)\n # handle GIFs\n # GIFs doesn't have density\n if size >= 10 and head[:6] in (b'GIF87a', b'GIF89a'):\n pass\n # see...
[ "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 text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// SetConfigurationSetName sets the ConfigurationSetName field's value.
[ "func (s *SendTemplatedEmailInput) SetConfigurationSetName(v string) *SendTemplatedEmailInput {\n\ts.ConfigurationSetName = &v\n\treturn s\n}" ]
[ "@NotNull\n @ApiModelProperty(required = true, value = \"Key-value pairs to add as custom property into alert. You can refer here for example values\")\n public Map<String, String> getDetails() {\n return details;\n }" ]
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Make some L{liveform.LiveForm} instances for editing the contact information of the wrapped L{Person}.
[ "def makeEditorialLiveForms(self):\n \n parameters = [\n liveform.Parameter(\n 'nickname', liveform.TEXT_INPUT,\n _normalizeWhitespace, 'Name',\n default=self.person.name)]\n separateForms = []\n for contactType in self.organizer.ge...
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Connect and logins to an Apple TV.
[ "def connect_to_apple_tv(details, loop, protocol=None, session=None):\n \"\"\"\"\"\"\n service = _get_service_used_to_connect(details, protocol)\n\n # If no session is given, create a default one\n if session is None:\n session = ClientSession(loop=loop)\n\n # AirPlay service is the same for b...
[ "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:" }
Get a placeholder image, using placehold.it by default @param [String] size @param [Hash] options @return [String]
[ "def image(size, options={})\n domain = options[:domain] || 'http://placehold.it'\n src = \"#{domain}/#{size}\"\n hex = %w(a b c d e f 0 1 2 3 4 5 6 7 8 9)\n background_color = options[:background_color]\n color = options[:color]\n\n if op...
[ "function class_ (options) {\n options.hash.kind = 'class'\n var result = ddata._identifier(options)\n return result ? options.fn(result) : 'ERROR, Cannot find class.'\n}" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
check if any friendship exists with another user
[ "def friendshiped_with?(user)\n (friend_ids + inverse_friend_ids + pending_friend_ids + pending_inverse_friend_ids + blocked_friend_ids).include?(user.id)\n end" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the comment about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
Logs to Info if the debug level is greater than or equal to 1.
[ "static void i(String message){\n if (getStaticDebugLevel() >= CleverTapAPI.LogLevel.INFO.intValue()){\n Log.i(Constants.CLEVERTAP_LOG_TAG,message);\n }\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 Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Extracts snapshot return header.
[ "def _parse_snapshot_share(response, name):\n '''\n \n '''\n snapshot = response.headers.get('x-ms-snapshot')\n\n return _parse_share(response, name, snapshot)" ]
[ "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 summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Gets the client registration for the http request. @param context application contextx @param clientAnn client annotation @return client registration
[ "private HttpClient getClient(MethodInvocationContext<Object, Object> context, AnnotationValue<Client> clientAnn) {\n String clientId = getClientId(clientAnn);\n String path = clientAnn.get(\"path\", String.class).orElse(null);\n String clientKey = computeClientKey(clientId, path);\n if ...
[ "@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 summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
// SetSetupFailed sets the SetupFailed field's value.
[ "func (s *InstancesCount) SetSetupFailed(v int64) *InstancesCount {\n\ts.SetupFailed = &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 summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Returns an object literal representation of `test` free of cyclic properties, etc. @private @param {Test} test - Instance used as data source. @return {Object} object containing pared-down test instance data
[ "function clean(test) {\n return {\n title: test.title,\n fullTitle: test.fullTitle(),\n duration: test.duration,\n currentRetry: test.currentRetry()\n };\n}" ]
[ "function Entry (content, name, parent) {\n if (!(this instanceof Entry)) return new Entry(content, name, parent);\n\n this._parent = parent; // parent can be a Document or ArrayField\n this._schema = parent._schema; // the root Document\n this._name = name; // the field name supplied by the user\n this._hidde...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
// SetStatus sets the Status field's value.
[ "func (s *ProvisionedProductAttribute) SetStatus(v string) *ProvisionedProductAttribute {\n\ts.Status = &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 text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
<p> Creates an new instance of the list add the sorted list to it. </p> @param list the list which content should be ordered. @param <T> the type of the list elements. @return a new sorted list. @see java.util.Collections#sort(List)
[ "public static <T extends Comparable<? super T>> List<T> sort(final List<T> list) {\n Validate.notNull(list, \"Cannot execute list sort: list is null\");\n final Object[] a = list.toArray();\n Arrays.sort(a);\n \n return fillNewList(a, list.getClass());\n }" ]
[ "public void applyChildren( Object defaultee ) {\n\n if ( defaultee == null ) {\n throw new TransformException( \"Defaultee should never be null when \" +\n \"passed to the applyChildren method.\" );\n }\n\n // This has nothing to do with this being an ArrayKey or ...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }