query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Create a curl post request. @param string $url @param array $requestHeaders @param array $postFields @param bool $returnResponseHeaders @return array|mixed
[ "public function postRequest(string $url, array $requestHeaders = [], array $postFields = [], bool $returnResponseHeaders = false)\n {\n $handle = $this->createCurlHandle($url);\n\n if (Config::get('hpProxy')) {\n $handle->setOption(CURLOPT_PROXY, Config::get('hpProxy'));\n }\n\n ...
[ "public function getCopyReference($path)\n {\n //Path cannot be null\n if (is_null($path)) {\n throw new Exceptions\\BoxClientException(\"Path cannot be null.\");\n }\n\n //Get Copy Reference\n $response = $this->postToAPI('/files/copy_reference/get', ['path' => $pat...
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Enter copy mode.
[ "def copy_mode(pymux, variables):\n \n go_up = variables['-u'] # Go in copy mode and page-up directly.\n # TODO: handle '-u'\n\n pane = pymux.arrangement.get_active_pane()\n pane.enter_copy_mode()" ]
[ "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:" }
Delete cached file if present
[ "def delete_item(key):\r\n \"\"\"\"\"\"\r\n CACHED_KEY_FILE = os.path.join(CURRENT_DIR, key)\r\n\r\n if os.path.isfile(CACHED_KEY_FILE):\r\n os.remove(CACHED_KEY_FILE)" ]
[ "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 instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
// Our custom Var will add one to any and all ints
[ "func (env *CustomEnv) Var(ident string) reflect.Value {\n\t// Note that variables are always pointer values.\n\tif v := env.Env.Var(ident); v.IsValid() && v.Type().Elem().Kind() == reflect.Int {\n\t\ti := v.Elem().Int()\n\t\tplusOne := reflect.New(v.Type().Elem()).Elem()\n\t\tplusOne.Set(reflect.ValueOf(int(i + 1)...
[ "@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 sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// Run executes the Bee's event loop.
[ "func (mod *WebBee) Run(cin chan bees.Event) {\n\tmod.eventChan = cin\n\n\tsrv := &http.Server{Addr: mod.addr, Handler: mod}\n\tl, err := net.Listen(\"tcp\", mod.addr)\n\tif err != nil {\n\t\tmod.LogErrorf(\"Can't listen on %s\", mod.addr)\n\t\treturn\n\t}\n\tdefer l.Close()\n\n\tgo func() {\n\t\terr := srv.Serve(l...
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
returns the current value of the slider
[ "@Override\n public Double getValue() {\n Double rslt = getUiValue();\n if (rslt == null) return internVal;\n\n if (internVal == null) {\n Double min = getMin();\n if (rslt == min || rslt != null && rslt.equals(min)) return null;\n }\n internVal = rslt;\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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Loads entity IDs using a pager sorted by the entity id. @return array An array of entity IDs.
[ "protected function getEntityIds() {\n $query = $this->getStorage()->getQuery()\n ->sort($this->entityType->getKey('id'), 'DESC');\n\n $this->limit = 1000;\n if ($this->limit) {\n $query->pager($this->limit);\n }\n\n return $query->execute();\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 post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Get the Rates object from the Provider @param null|string $base @param null|string $date @return Rates
[ "public function getRateModel($base = null, $date = null) : Rates\n {\n $base = strtoupper($base);\n if (empty($base)) {\n $base = 'USD';\n }\n if (empty($date)) {\n $date = date('Y-m-d');\n }\n $this->fromCache = false;\n $api = $this->api;\...
[ "protected function processDetails(Buffer &$buffer, Result &$result)\n {\n parent::processDetails($buffer, $result);\n\n // Add in map\n $result->add('mapname', 'Panau');\n $result->add('dedicated', 'true');\n }" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Check if a given request has access to delete a post. @param WP_REST_Request $request Full details about the request. @return bool|WP_Error
[ "public function delete_item_permissions_check( $request ) {\n\n\t\t$post = $this->get_post( $request['id'] );\n\n\t\tif ( $post && ! $this->check_delete_permission( $post ) ) {\n\t\t\treturn new WP_Error( 'rest_cannot_delete', __( 'Sorry, you are not allowed to delete posts.' ), array( 'status' => rest_authorizati...
[ "private static function forceReloadAuthUsingTokenAuth($tokenAuth)\n {\n /**\n * Triggered when authenticating an API request, but only if the **token_auth**\n * query parameter is found in the request.\n *\n * Plugins that provide authentication capabilities should subscri...
codesearchnet
{ "query": "Represent the sentence about Access control:", "pos": "Represent the code about Access control:", "neg": "Represent the code about Programming:" }
Initializes TBODY element for messaging. @method _initMsgTbodyEl @param elTable {HTMLElement} TABLE element into which to create TBODY @private
[ "function(elTable) {\n if(elTable) {\n var elMsgTbody = document.createElement(\"tbody\");\n elMsgTbody.className = DT.CLASS_MESSAGE;\n var elMsgTr = elMsgTbody.appendChild(document.createElement(\"tr\"));\n elMsgTr.className = DT.CLASS_FIRST + \" \" + DT.CLASS_LAST;\n this._el...
[ "function (event) {\n if (event.event.name == \"ContextualTargetFound\") {\n var templateCtxt = event.event.templateCtxt;\n // NO NEED TO REFRESH -> displaying the context menu does it already\n this._selectFromTemplateCtxt(templateCtxt);\n }\n ...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
{@inheritDoc} @see org.jboss.shrinkwrap.api.container.EnterpriseContainer#addAsModule(java.lang.String)
[ "@Override\n public T addAsModule(String resourceName) {\n Validate.notNull(resourceName, \"ResourceName must be specified\");\n\n ArchivePath location = new BasicPath(AssetUtil.getNameForClassloaderResource(resourceName));\n return addAsModule(resourceName, location);\n }" ]
[ "public static ConfigurationOption factoryConfiguration(String pid) {\n return new org.ops4j.pax.exam.cm.internal.ConfigurationProvisionOption(pid, new HashMap<String, Object>()).factory(true);\n }" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// _NET_NUMBER_OF_DESKTOPS set
[ "func NumberOfDesktopsSet(xu *xgbutil.XUtil, numDesks uint) error {\n\treturn xprop.ChangeProp32(xu, xu.RootWin(), \"_NET_NUMBER_OF_DESKTOPS\",\n\t\t\"CARDINAL\", numDesks)\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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Wrap the apply_async function of multiprocessing.pools. Get the function that will be called and wrap it then add the opencensus context.
[ "def wrap_submit(submit_func):\n \"\"\"\"\"\"\n\n def call(self, func, *args, **kwargs):\n wrapped_func = wrap_task_func(func)\n _tracer = execution_context.get_opencensus_tracer()\n propagator = binary_format.BinaryFormatPropagator()\n\n wrapped_kwargs = {}\n wrapped_kwargs...
[ "def stash_split(fqdn, result, *argl, **argd):\n \n global _splits\n if fqdn == \"sklearn.cross_validation.train_test_split\":\n key = id(result[1])\n _splits[key] = result\n\n #We don't actually want to return anything for the analysis; we are using it\n #as a hook to save pointers to ...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// GetMessages returns a list of messages in a room. // Pagination is optional. You can pass nil or specific pagination params.
[ "func (gitter *Gitter) GetMessages(roomID string, params *Pagination) ([]Message, error) {\n\n\tvar messages []Message\n\turl := gitter.config.apiBaseURL + \"rooms/\" + roomID + \"/chatMessages\"\n\tif params != nil {\n\t\turl += \"?\" + params.encode()\n\t}\n\tresponse, err := gitter.get(url)\n\tif err != nil {\n\...
[ "function normalizeLimit (options) {\n const limit = options.limit || options.resultRecordCount || options.count || options.maxFeatures\n // If there is a limit, add 1 to it so we can later calculate a limitExceeded. The result set will be resized accordingly, post SQL\n if (limit) return limit + 1\n}" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Gets controller class for a resource. @param resource Resource that will managed by the controller class. @return The fully qualified name of the controller class for this resource and extension.
[ "String getControllerClass(String resource) {\n\t\tControllerFinder finder = new ControllerFinder(config);\n\t\tString controllerClass = finder.findResource(resource);\n\t\tLOGGER.debug(\"Controller class: {}\", controllerClass);\n\t\treturn controllerClass;\n\t}" ]
[ "public static String getName(DistributedObject distributedObject) {\n /*\n * The motivation of this behaviour is that some distributed objects (`ICache`) can have prefixed name.\n * For example, for the point of view of cache,\n * it has pure name and full name which contains prefixe...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Build the Unirest {@link HttpRequest} that will be used to make the call to the API. @param query The query to be made @return Properly configured {@link HttpRequest} representing query
[ "private HttpRequest buildHTTPRequest(final Query<?, ?> query) {\n\t\tfinal String url = API_ENDPOINT + query.getPath();\n\n\t\tHttpRequest request;\n\t\tswitch (query.getHttpRequestMethod()) {\n\t\t\tcase GET:\n\t\t\t\trequest = Unirest.get(url);\n\n\t\t\t\tif ((query.getQueryParameters() != null) && !query.getQue...
[ "public static RpcRequest rpcRequest(MethodDescriptor<?, ?> method, Object message) {\n // We don't actually use the RpcRequest for request processing since it doesn't fit well with streaming.\n // We still populate it with a reasonable method name for use in logging. The service type is currently\n ...
codesearchnet
{ "query": "Represent the Github comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Returns all registered commands. @return array
[ "protected function getCommands(): array\n\t{\n\t\t// Define core commands\n\n\t\t$commands =\n\t\t[\n\t\t\t'app.generate_key' => GenerateKey::class,\n\t\t\t'app.generate_secret' => GenerateSecret::class,\n\t\t];\n\n\t\tif($this->container->has(Routes::class))\n\t\t{\n\t\t\t$commands = array_merge($commands,\n\t...
[ "def getKeySequenceCounter(self):\n \"\"\"\"\"\"\n print '%s call getKeySequenceCounter' % self.port\n keySequence = ''\n keySequence = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:KeyIndex')[0]\n return keySequence" ]
codesearchnet
{ "query": "Represent the Github comment about database:", "pos": "Represent the Github code about database:", "neg": "Represent the Github code:" }
Single fields endpoints: ************************************************************************** This function create a new field for the post.
[ "def create_relay_field\n # find post field\n @post_field = LatoBlog::PostField.find_by(id: params[:post_field_id])\n unless @post_field\n @error = true\n respond_to { |r| r.js }\n end\n # find subfield info\n child_field_info = nil\n @post_field.meta_datas[:fields]....
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Restore metable table records for this current model since it was just restorede. @return void
[ "private function handleRestoredModelMetas()\n\t{\n\t\tif (!$this->metableTableSoftDeletes()) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tforeach ($this->metas as $meta) {\n\t\t\t$this->syncMetableTableAttributes();\n\t\t\t$meta->increment('num_items');\n\t\t}\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 sentence about Database management:", "pos": "Represent the Github code about Database management:", "neg": "Represent the Github code:" }
打印rpc消息传输耗时等信息:术语rpcFly
[ "private static void logRpcFly(JSONObject msgJson, ChannelHandlerContext ctx) {\n try {\n String ssid = msgJson.getString(\"$ssid\");\n String from = msgJson.getString(\"$LOCAL_NODE_ID\");\n String msgType = msgJson.getString(\"$msgType\");\n if (ssid != null) {\n ...
[ "public static String getTransferQueue(String name) {\n LOG.debug(\"对于需要保序的情况,只应该启动单个中转节点,目前启动多个节点原节点会被挤掉线,但是由于重连机制,会轮着挤掉线\");\n return IdManager.generateStaticQueueId(buildTransferName(name));\n }" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
@param ChartOption|array $chartOption @param string $name @return string
[ "protected function renderWithJavascriptCallback($chartOption, $name)\n {\n $result = \"\";\n\n if (gettype($chartOption) === 'array') {\n $result .= $this->renderArrayWithCallback($chartOption, $name);\n }\n\n if (gettype($chartOption) === 'object') {\n $result ...
[ "static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}" ]
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Get the Presenter for a given {@link MvpView} if exists or <code>null</code> @param viewId The mosby internal view id @param <P> The type tof the {@link MvpPresenter} @return The Presenter for the given view id or <code>null</code>
[ "@Nullable public <P> P getPresenter(@NonNull String viewId) {\n PresenterHolder holder = presenterMap.get(viewId);\n return holder == null ? null : (P) holder.presenter;\n }" ]
[ "public @Nonnull <U extends T> U getInstance(@Nonnull Class<U> type) throws IllegalStateException {\n for (T ext : this)\n if(ext.getClass()==type)\n return type.cast(ext);\n \n throw new IllegalStateException(\"The class \" + type.getName() + \" was not found, potenti...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Returns the output to input symbol mapping for the given source channel
[ "public Map<Symbol, Symbol> sourceSymbolMap(int sourceIndex)\n {\n ImmutableMap.Builder<Symbol, Symbol> builder = ImmutableMap.builder();\n for (Map.Entry<Symbol, Collection<Symbol>> entry : outputToInputs.asMap().entrySet()) {\n builder.put(entry.getKey(), Iterables.get(entry.getValue()...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
@param string $file @return string
[ "protected function getFormat( $file ) {\n\t\t$file_class = $this->getCssClass( $file );\n\t\treturn \\Pressbooks\\Modules\\Export\\get_name_from_filetype_slug( $file_class );\n\t}" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Get a MPConnection from the cache @param conn The MEConnection for which we want a MPConnection for @return the MPConnection
[ "public MPConnection getMPConnection(MEConnection conn)\n {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())\n SibTr.entry(tc, \"getMPConnection\", new Object[] { conn });\n\n MPConnection mpConn;\n synchronized(_mpConnectionsByMEConnection)\n {\n //look up the MPConnection ...
[ "def get_cursor(self, instance, db_key, db_name=None):\n '''\n \n '''\n conn_key = self._conn_key(instance, db_key, db_name)\n try:\n conn = self.connections[conn_key]['conn']\n except KeyError:\n # We catch KeyError to avoid leaking the auth info used...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Programming:" }
/* Private methods
[ "public static function embedded(Factory $factory, $class, $value = null)\n {\n if ( !$value ) $value = array();\n else if ( $value instanceOf $class ) return $value->toArray() ;\n\n $bp = new Blueprint($factory, $class);\n\n return $bp->build($value, false);\n }" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
For an already established connection return its state.
[ "def get_connection_state(self, connection: str) -> Dict[str, Any]:\n \n if connection not in self.connections:\n raise ConnectionNotOpen(connection)\n\n return self.connections[connection].state" ]
[ "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 instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Prepare the value to pass up to the {@link AbstractCallMethod} type parent. @return {@link #EVAL_PAGE} to continue evaluating the page
[ "public int doEndTag()\n throws JspException {\n\n if(hasErrors())\n reportErrors();\n else {\n AbstractCallMethod cm = (AbstractCallMethod)getParent();\n cm.addParameter(_type, _isNull ? null : _value);\n }\n\n localRelease();\n return ...
[ "public LHS toLHS( CallStack callstack, Interpreter interpreter)\n throws EvalError\n {\n // loosely typed map expression new {a=1, b=2} are treated\n // as non assignment (LHS) to retrieve Map.Entry key values\n // then wrapped in a MAP_ENTRY type LHS for value assignment.\n r...
codesearchnet
{ "query": "Represent the Github description about text processing:", "pos": "Represent the Github code about text processing:", "neg": "Represent the Github code:" }
Stop listening to a job Parameters ---------- id_ : str An ID to remove Returns -------- str or None The ID removed or None if the ID was not removed
[ "def unlisten_to_node(self, id_):\n \n id_pubsub = _pubsub_key(id_)\n\n if id_pubsub in self._listening_to:\n del self._listening_to[id_pubsub]\n self.toredis.unsubscribe(id_pubsub)\n\n parent = json_decode(r_client.get(id_)).get('parent', None)\n if ...
[ "def _is_process_filtered(self, process, key=None):\n \"\"\"\"\"\"\n if key is None:\n key = self.filter_key\n try:\n # If the item process[key] is a list, convert it to a string\n # in order to match it with the current regular expression\n if isinst...
codesearchnet
{ "query": "Represent the Github post about Work management:", "pos": "Represent the Github code about Work management:", "neg": "Represent the Github code about programming:" }
=========================================================================== Utility functions Replaces characters with the JSON escaped version
[ "function escapeChars(text) {\n var r = JSON.stringify(text);\n return r.slice(1, r.length - 1);\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 Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// To attempts rewrite. It attempts to rewrite to first valid path // or the last path if none of the paths are valid.
[ "func To(fs http.FileSystem, r *http.Request, to string, replacer httpserver.Replacer) Result {\n\ttos := strings.Fields(to)\n\n\t// try each rewrite paths\n\tt := \"\"\n\tquery := \"\"\n\tfor _, v := range tos {\n\t\tt = replacer.Replace(v)\n\t\ttparts := strings.SplitN(t, \"?\", 2)\n\t\tt = path.Clean(tparts[0])\...
[ "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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns all attributes� name and value as a String array. @return string array with all attributes� name and value.
[ "public String[] toStringArray() {\n String key;\n String attrs[] = new String[hashAttributes.size() * 2];\n String[] keys = hashAttributes.keySet().toArray(new String[0]);\n for (int x = 0; x < keys.length; x++) {\n attrs[(x * 2)] = keys[x];\n attrs[(x * 2) + 1] = ...
[ "def reset ():\n \n global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache\n\n __register_features ()\n\n # Stores suffixes for generated targets.\n __prefixes_suffixes = [property.PropertyMap(), property.PropertyMap()]\n\n # Maps suffixes to types...
codesearchnet
{ "query": "Represent the post about Documentation:", "pos": "Represent the code about Documentation:", "neg": "Represent the code:" }
// SetCookie set cookies for the request. If expire is 0, create a session cookie.
[ "func (ctx *Context) SetCookie(key string, value string, expire int) {\n\tnow := time.Now()\n\tcookie := &http.Cookie{\n\t\tName: key,\n\t\tValue: value,\n\t\tPath: \"/\",\n\t\tMaxAge: expire,\n\t}\n\tif expire != 0 {\n\t\texpireTime := now.Add(time.Duration(expire) * time.Second)\n\t\tcookie.Expires = expireT...
[ "function() {\n var app = this;\n var config = app.config;\n var cookiesecret = config.cookie_secret;\n if (!cookiesecret) {\n cookiesecret = crypto.randomBytes(64).toString('base64');\n log.warn('no cookie_secret set in config/app.js, randomly choosing %s', cookiesecret);\n }\n app.use(cookieParser(coo...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Get the parameters for the given key An empty array will be returned for non-matched keys. @param string $key @return array
[ "public function paramsFor(string $key): array\n {\n $params = [];\n if (isset($this->params[$key])) {\n $params = $this->params[$key];\n }\n\n return $params;\n }" ]
[ "public function insert(): self\n {\n /** @var self $data */\n $data = $this;\n\n if(!$this->validate(\"post\", $missing))\n {\n throw new \\Exception(\"[MVQN\\REST\\Endpoints\\Endpoint] Annotations for the '\".get_class($this).\"' class require valid values be set \".\n ...
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:" }
Return a defined thing or an empty object (Metrodi_Proto) @return object defined thing or empty object (Metrodi_Proto)
[ "public function & make($thing, $singleton=TRUE) {\n\t\tif (!isset($this->thingList[$thing])) {\n\t\t\t$this->thingList[$thing] = $thing;\n\t\t}\n\n\t\t//closures and anon funcs are objects of type/class Closure\n\t\tif (is_object($this->thingList[$thing]) && !is_callable($this->thingList[$thing])) {\n\t\t\treturn ...
[ "public List<Symbol> getSymbolList(final String param) {\n return get(param, new StringToSymbolList(\",\"),\n new AlwaysValid<List<Symbol>>(),\n \"comma-separated list of strings\");\n }" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about Documentation:" }
Sets the audio application. @param string $app The audio application to set. @return \React\Promise\Promise
[ "public function setAudioApplication($app)\n {\n $deferred = new Deferred();\n\n $legal = ['voip', 'audio', 'lowdelay'];\n\n if (false === array_search($app, $legal)) {\n $deferred->reject(new \\InvalidArgumentException(\"{$app} is not a valid option. Valid options are: \".trim(im...
[ "function validateService($pluginInstance)\n {\n if (! is_object($pluginInstance) )\n throw new \\Exception(sprintf('Can`t resolve to (%s) Instance.', $pluginInstance));\n\n if (!$pluginInstance instanceof aGrantRequest)\n throw new exContainerInvalidServiceType('Invalid Plugi...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
/* Method called when a client attachment fails
[ "public void fail (ClientConnection cc, Throwable t) {\n if (tc.isEntryEnabled()) {\n SibTr.entry(tc, \"fail\", new Object[]{ cc, t });\n SibTr.exit(tc, \"fail\");\n }\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 Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Opens the first level in the categories tree.<p>
[ "public void openFirstLevel() {\n\n if (!m_categories.isEmpty()) {\n for (int i = 0; i < m_scrollList.getWidgetCount(); i++) {\n CmsTreeItem item = (CmsTreeItem)m_scrollList.getItem(i);\n item.setOpen(true);\n }\n }\n }" ]
[ "def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Return selection bounds (block numbers)
[ "def get_selection_bounds(self):\r\n \"\"\"\"\"\"\r\n cursor = self.textCursor()\r\n start, end = cursor.selectionStart(), cursor.selectionEnd()\r\n block_start = self.document().findBlock(start)\r\n block_end = self.document().findBlock(end)\r\n return sorted([block_start....
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato...
codesearchnet
{ "query": "Represent the Github summarization about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about Natural Language Processing:" }
Returns a :class:`SparkStageInfo` object, or None if the stage info could not be found or was garbage collected.
[ "def getStageInfo(self, stageId):\n \n stage = self._jtracker.getStageInfo(stageId)\n if stage is not None:\n # TODO: fetch them in batch for better performance\n attrs = [getattr(stage, f)() for f in SparkStageInfo._fields[1:]]\n return SparkStageInfo(stageId, ...
[ "function LoggerContext() {\n LifeCycle.call(this);\n\n /**\n * Context start time\n */\n this.startTime = new Date();\n\n /**\n * The list of trace levels that the logger context knows about\n */\n this.logLevel = new LogLevel();\n\n /**\n * Root logger, final ancestor of all ...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
是否是符合特殊的文件格式, 如果 fi 或者 fileExt 是null, 空, 将会直接返回TRUE. @param fi @param ignoreCase @param fileExt @return
[ "private static boolean isTargetValid(File fi, boolean ignoreCase, String... fileExt) {\n if (fi == null || fileExt == null || fileExt.length == 0)\n return true;\n\n String ext = getExtension(fi);\n\n for (String str : fileExt) {\n if (ignoreCase ? ext.equalsIgnoreCase(st...
[ "public Select parseSelect(MySqlSelectQueryBlock query) throws SqlParseException {\n\n Select select = new Select();\n /*zhongshu-comment SqlParser类没有成员变量,里面全是方法,所以将this传到WhereParser对象时是无状态的,\n 即SqlParser对象并没有给WhereParser传递任何属性,也不存在WhereParser修改SqlParser的成员变量值这一说\n ...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Translates and adds the escape sequence. :param idx: Provides the ending index of the escape sequence. :param char: The actual character that was escaped.
[ "def add_escape(self, idx, char):\n \n\n self.fmt.append_text(self.fmt._unescape.get(\n self.format[self.str_begin:idx], char))" ]
[ "def _set_text(self, value):\n \n working_index = self.working_index\n working_lines = self._working_lines\n\n original_value = working_lines[working_index]\n working_lines[working_index] = value\n\n # Return True when this text has been changed.\n if len(value) != l...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// Print prints build version in default format.
[ "func Print() {\n\tpayload, err := json.Marshal(Get())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"%s\", payload)\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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns true if the specified span intersects with this span. @param s The span to compare with this span. @return true is the spans overlap; false otherwise.
[ "public boolean intersects(final Span s) {\n final int sstart = s.getStart();\n // either s's start is in this or this' start is in s\n return this.contains(s) || s.contains(this)\n || getStart() <= sstart && sstart < getEnd()\n || sstart <= getStart() && getStart() < s.getEnd();\n }" ]
[ "function createGraph(options) {\n // Graph structure is maintained as dictionary of nodes\n // and array of links. Each node has 'links' property which\n // hold all links related to that node. And general links\n // array is used to speed up all links enumeration. This is inefficient\n // in terms of memory,...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Get returns chunk data if the chunk with key exists for node // on address addr.
[ "func (s *GlobalStore) Get(addr common.Address, key []byte) (data []byte, err error) {\n\thas, err := s.db.Has(indexForHashesPerNode(addr, key), nil)\n\tif err != nil {\n\t\treturn nil, mock.ErrNotFound\n\t}\n\tif !has {\n\t\treturn nil, mock.ErrNotFound\n\t}\n\tdata, err = s.db.Get(indexDataKey(key), nil)\n\tif er...
[ "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 about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Prune influence map to include only edges where the object of the upstream rule matches the subject of the downstream rule.
[ "def prune_influence_map_subj_obj(self):\n \"\"\"\"\"\"\n def get_rule_info(r):\n result = {}\n for ann in self.model.annotations:\n if ann.subject == r:\n if ann.predicate == 'rule_has_subject':\n result['subject'] = ann.o...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Marshall the given parameter object.
[ "public void marshall(UpdateFileSystemLustreConfiguration updateFileSystemLustreConfiguration, ProtocolMarshaller protocolMarshaller) {\n\n if (updateFileSystemLustreConfiguration == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Generate content from static template compilation @param string $template @param array $vars @param array $blocks @return string
[ "public static function make($template, array $vars = [], array $blocks = [])\n {\n if(!static::$instance) {\n static::$instance = new static;\n }\n\n return static::$instance->render($template, $vars, $blocks);\n }" ]
[ "private function generateFrontEndRoutes()\n {\n $this->comment(\"Front End Routes...\");\n if (!$this->checkWilling('frontend')) {\n return $this->line(\"\\tskip\");\n }\n\n $moduleName = $this->starter->getModuleName();\n // 1. To generate the module route file if ...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// UnmarshalJSON sets *args fields with given data.
[ "func (args *FilterCriteria) UnmarshalJSON(data []byte) error {\n\ttype input struct {\n\t\tBlockHash *common.Hash `json:\"blockHash\"`\n\t\tFromBlock *rpc.BlockNumber `json:\"fromBlock\"`\n\t\tToBlock *rpc.BlockNumber `json:\"toBlock\"`\n\t\tAddresses interface{} `json:\"address\"`\n\t\tTopics []inte...
[ "@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:" }
// Download downloads the application source code from the Git repository // and checkout the Ref specified in the config.
[ "func (c *Clone) Download(config *api.Config) (*git.SourceInfo, error) {\n\ttargetSourceDir := filepath.Join(config.WorkingDir, constants.Source)\n\tconfig.WorkingSourceDir = targetSourceDir\n\n\tref := config.Source.URL.Fragment\n\tif ref == \"\" {\n\t\tref = \"HEAD\"\n\t}\n\n\tif len(config.ContextDir) > 0 {\n\t\...
[ "def platform\n # If you are declaring a new platform, you will need to tell\n # Train a bit about it.\n # If you were defining a cloud API, you should say you are a member\n # of the cloud family.\n\n # This plugin makes up a new platform. Train (or rather InSpec) only\n # know how t...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Adds a variable to the symbol table. @param int $type @param string $name @param CompilationContext $compilationContext @return Variable
[ "public function addVariable($type, $name, CompilationContext $compilationContext)\n {\n $currentBranch = $compilationContext->branchManager->getCurrentBranch();\n $branchId = $currentBranch->getUniqueId();\n if ($this->globalsManager->isSuperGlobal($name) || 'zephir_fcall_cache_entry' == $t...
[ "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 post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Retrieve all Ontraport objects. @param string $name @return mixed
[ "public function get($name = null)\n {\n if (is_null($name)) {\n return $this->all();\n }\n\n return $this->find($name);\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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns HTML for code blocks formatted with Pygment
[ "def format_code(text)\n simple_format( truncate( Sanitize.clean(markdown(text)).html_safe, escape: false, length: 300, separator: ' ', omission: ' …' ))\n end" ]
[ "def pandoc_process(app, what, name, obj, options, lines):\n \"\n\n if not lines:\n return None\n\n input_format = app.config.mkdsupport_use_parser\n output_format = 'rst'\n\n # Since default encoding for sphinx.ext.autodoc is unicode and pypandoc.convert_text, which will always return a\n ...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
[getDsn description]. @return [type] [description]
[ "public function getDsn()\n {\n if (!$this->config) {\n return '';\n }\n $dsn = array();\n $dbName = null;\n\n if ($this->config->getName()) {\n $dbName = $this->config->getName();\n }\n\n if ($this->config->getHost()) {\n if ($thi...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Calibrate the data.
[ "def calibrate(self, data, calibration):\n \"\"\"\"\"\"\n tic = datetime.now()\n\n if calibration == 'counts':\n return data\n elif calibration == 'radiance':\n raise NotImplementedError(\"Can't calibrate to radiance.\")\n else:\n cal = self.calibr...
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
TODO: all others are 'typed', e.g. get_user, get_record_items ... should this be typed, too ?
[ "def search(request, *args)\n request = request.is_a?(Search::Request) ? request : Search::Request.new(request)\n self.class::Search.new(self).call(request, *args)\n end" ]
[ "def set_identifiers(self, data):\n \n for id_info in self._details.identifiers:\n var_name = id_info['var_name']\n self._data[var_name] = data.get(var_name)\n\n # FIXME: This needs to likely kick off invalidating/rebuilding\n # relations.\n # F...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Parse a serialized object id string into an ObjectId instance. @param $oid The string @return ObjectId or null, if the id cannot be parsed
[ "public static function parse($oid) {\n // fast checks first\n if ($oid instanceof ObjectId) {\n return $oid;\n }\n\n $oidParts = self::parseOidString($oid);\n $type = $oidParts['type'];\n $ids = $oidParts['id'];\n $prefix = $oidParts['prefix'];\n\n // check the type\n if (!ObjectFac...
[ "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 description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Check if the current version of the library is outdated.
[ "def _check_update_(self):\n \"\"\"\"\"\"\n try:\n data = requests.get(\"https://pypi.python.org/pypi/jira/json\", timeout=2.001).json()\n\n released_version = data['info']['version']\n if parse_version(released_version) > parse_version(__version__):\n w...
[ "def platform\n # If you are declaring a new platform, you will need to tell\n # Train a bit about it.\n # If you were defining a cloud API, you should say you are a member\n # of the cloud family.\n\n # This plugin makes up a new platform. Train (or rather InSpec) only\n # know how t...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Update replaces a kapacitor from the file system directory
[ "func (d *Kapacitors) Update(ctx context.Context, kapacitor chronograf.Server) error {\n\tboard, _, err := d.idToFile(kapacitor.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := d.Delete(ctx, board); err != nil {\n\t\treturn err\n\t}\n\tfile := kapacitorFile(d.Dir, kapacitor)\n\treturn d.Create(file, kapac...
[ "def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Technology:" }
:raises TypeError: If the value is not matched the type that the class represented.
[ "def validate(self, error_message=None):\n \n\n if self.is_type():\n return\n\n if not error_message:\n error_message = \"invalid value type\"\n\n raise TypeError(\n \"{}: expected={}, actual={}\".format(error_message, self.typename, type(self._data))\n ...
[ "def path(self, path):\n \"\"\"\"\"\"\n\n # pylint: disable=attribute-defined-outside-init\n self._path = copy_.copy(path)\n\n # The provided path is shallow copied; it does not have any attributes\n # with mutable types.\n\n # We perform this check after the initialization...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
生成带有效期鉴权的RTMP推流地址 @param streamKey 流名称 @param expireAfterSeconds 流过期时间,单位秒
[ "public String rtmpPublishUrl(String streamKey, int expireAfterSeconds) {\n long expire = System.currentTimeMillis() / 1000 + expireAfterSeconds;\n String path = String.format(\"/%s/%s?e=%d\", hub, streamKey, expire);\n String token;\n try {\n token = auth.sign(path);\n ...
[ "protected boolean isVirtualDns(Host host) {\n\t\tlong millis = host.getExpiration() - System.currentTimeMillis();\n\t\t// JVM的DNS缓存默认是30秒过期,如果过期时间大于1年则表示自定义的域名解析记录\n\t\t// 在要求特别准确的情况下请注意:如果自定义了JVM DNS缓存时间超过1年,则会返回错误数据.\n\t\treturn (millis > ABOUT_YEAR);\n\t}" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
Adding response for SSE, print preview, modal and popup request @param Controller &$controller Instantiating controller @return void
[ "protected function _addSpecificResponse(Controller &$controller) {\n\t\t$controller->response->type(['sse' => 'text/event-stream']);\n\t\t$controller->response->type(['mod' => 'text/html']);\n\t\t$controller->response->type(['pop' => 'text/html']);\n\t\t$controller->response->type(['prt' => 'text/html']);\n\t}" ]
[ "private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
Check if the Cross-Site-Request-Forgery (CSRF) security token was valid or not. @return boolean
[ "public function isCsrfValid()\n {\n // csrf protection is disabled.\n if (!$this->isCsrfProtectionEnabled()) {\n return true;\n }\n\n // the form is not submitted\n if (!$this->isSubmitted()) {\n return true;\n }\n\n // the form is valid, so...
[ "public void setHeader(String name, String s) {\n if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15\n logger.logp(Level.FINE, CLASS_NAME,\"setHeader\", \" name --> \" + name + \" value --> \" + PasswordNullifier.nullifyParams(s), \"[\"+this+\"...
codesearchnet
{ "query": "Represent the comment about NLP:", "pos": "Represent the code about NLP:", "neg": "Represent the code about Programming:" }
Make the request to the Twilio API to perform the read. @param client TwilioRestClient with which to make the request @return Fax ResourceSet
[ "@Override\n public ResourceSet<Fax> read(final TwilioRestClient client) {\n return new ResourceSet<>(this, client, firstPage(client));\n }" ]
[ "@Help(\n help =\n \"Resumes a NSR that failed while executing a script in a VNFR. The id in the URL specifies the Network Service Record that will be resumed.\"\n )\n public void resume(final String idNsr) throws SDKException {\n String url = idNsr + \"/resume\";\n requestPost(url);\n }" ]
codesearchnet
{ "query": "Represent the Github description about Twilio:", "pos": "Represent the Github code about Twilio:", "neg": "Represent the Github code:" }
<p> The names of the DAX clusters being described. </p> @param clusterNames The names of the DAX clusters being described.
[ "public void setClusterNames(java.util.Collection<String> clusterNames) {\n if (clusterNames == null) {\n this.clusterNames = null;\n return;\n }\n\n this.clusterNames = new java.util.ArrayList<String>(clusterNames);\n }" ]
[ "func (c *NetworkGetCommand) Info() *cmd.Info {\n\targs := \"<binding-name> [--ingress-address] [--bind-address] [--egress-subnets]\"\n\tdoc := `\nnetwork-get returns the network config for a given binding name. By default\nit returns the list of interfaces and associated addresses in the space for\nthe binding, as...
codesearchnet
{ "query": "Represent the comment about AWS Redshift:", "pos": "Represent the code about AWS Redshift:", "neg": "Represent the code about programming:" }
// decodedLen returns the length of the decoded block and the number of bytes // that the length header occupied.
[ "func decodedLen(src []byte) (blockLen, headerLen int, err error) {\n\tv, n := binary.Uvarint(src)\n\tif n <= 0 || v > 0xffffffff {\n\t\treturn 0, 0, ErrCorrupt\n\t}\n\n\tconst wordSize = 32 << (^uint(0) >> 32 & 1)\n\tif wordSize == 32 && v > 0x7fffffff {\n\t\treturn 0, 0, ErrTooLarge\n\t}\n\treturn int(v), n, nil\...
[ "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 description about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about File management:" }
Unlinks the non-null first element.
[ "E unlinkFirst() {\n final E f = first;\n final E next = f.getNext();\n f.setNext(null);\n\n first = next;\n if (next == null) {\n last = null;\n } else {\n next.setPrevious(null);\n }\n return f;\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 text:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Sorts posts, pages, and static files.
[ "def sort_files!\n site.collections.each_value { |c| c.docs.sort! }\n site.pages.sort_by!(&:name)\n site.static_files.sort_by!(&:relative_path)\n end" ]
[ "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:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Download a file from a url and save it to disk.
[ "def download_url(url, dir_name='.', save_name=None, store_directory=None, messages=True, suffix=''):\n \"\"\"\"\"\"\n if sys.version_info>=(3,0):\n from urllib.parse import quote\n from urllib.request import urlopen \n from urllib.error import HTTPError, URLError\n else:\n from...
[ "public function postCommit(\n InputInterface $input,\n OutputInterface $output,\n ParameterBagInterface $configuration\n ): void {\n // Yes we can send a notification to slack fx?\n // Then we would just add some configuration with slack channel, username etc etc\n // A...
codesearchnet
{ "query": "Represent the Github comment about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about programming:" }
获取最小一个符合条件的processId,排除loadedProcessId
[ "private Long getMinTransformedProcessId(Long loadedProcessId) {\n ProcessMonitor processMonitor = ArbitrateFactory.getInstance(getPipelineId(), ProcessMonitor.class);\n List<Long> processIds = processMonitor.getCurrentProcessIds();\n // 如果需要当前node处理当前process的load时,rpc请求一定会将对应的stage状态发到这机器上,并保存...
[ "protected static void fixResultByRule(List<Vertex> linkedArray)\n {\n\n //--------------------------------------------------------------------\n //Merge all seperate continue num into one number\n mergeContinueNumIntoOne(linkedArray);\n\n //-------------------------------------------...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about text processing:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "@SuppressWarnings(\"unchecked\")\n\t@Override\n\tpublic void eSet(int featureID, Object newValue) {\n\t\tswitch (featureID) {\n\t\t\tcase AfplibPackage.MCF__RG:\n\t\t\t\tgetRG().clear();\n\t\t\t\tgetRG().addAll((Collection<? extends MCFRG>)newValue);\n\t\t\t\treturn;\n\t\t}\n\t\tsuper.eSet(featureID, newValue);\n\...
[ "protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license...
codesearchnet
{ "query": "Represent the Github sentence about Text generation:", "pos": "Represent the Github code about Text generation:", "neg": "Represent the Github code:" }
Set up config values, these are merged with the defaults. @param array @return RoyalMail\RoyalMail $this
[ "function configure($config = []) {\n $this->config = array_replace_recursive($this->config, $this->modes[@$config['mode'] ?: $this->config['mode']]);\n \n $this->config = array_replace_recursive($this->config, $config);\n \n return $this;\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 sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Perform a clean operation on all caches. @return bool Returns true if clean succeeded on all caches in the stack.
[ "public function clean()\n {\n $cleanCallback = function ($allCleaned, $cache) {\n return $allCleaned && $cache->clean();\n };\n return array_reduce($this->caches, $cleanCallback, true);\n }" ]
[ "static function removeExpiryCacheFromDisk( $expiryCachePath )\n {\n $fileHandler = eZClusterFileHandler::instance();\n if ( $fileHandler instanceof eZFSFileHandler )\n {\n // We will only delete files if the FS file handler is used,\n // if the DB file handler is in us...
codesearchnet
{ "query": "Represent the description about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about Software development:" }
Mask a bit mask selecting the rows that pass a selection
[ "def make_mask(cat_table, cut):\n \n cut_var = cut['cut_var']\n min_val = cut.get('min_val', None)\n max_val = cut.get('max_val', None)\n\n nsrc = len(cat_table)\n if min_val is None:\n min_mask = np.ones((nsrc), bool)\n else:\n min_mask = cat_table[cut_var] >= min_val\n if max...
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Natural Language Processing:" }
// AlreadyRevoked returns a ProblemDetails with a AlreadyRevokedProblem and a 400 Bad // Request status code.
[ "func AlreadyRevoked(detail string, a ...interface{}) *ProblemDetails {\n\treturn &ProblemDetails{\n\t\tType: AlreadyRevokedProblem,\n\t\tDetail: fmt.Sprintf(detail, a...),\n\t\tHTTPStatus: http.StatusBadRequest,\n\t}\n}" ]
[ "private boolean isCloudantAuthError(Response response) {\n String server = response.header(\"Server\");\n // Cloudant could send `CouchDB/ad97a06 (Erlang OTP/17)` as Server header value\n // Another cloudant server value example: `CouchDB/1.0.2`\n if (server == null || server.indexOf(\"...
codesearchnet
{ "query": "Represent the description about PHP:", "pos": "Represent the code about PHP:", "neg": "Represent the code:" }
Add an external documentation
[ "protected function addDocumentation()\n {\n $docDirectory = $this->getDocumentationDirectory();\n\n // If there's a documentation directory\n if (is_dir($docDirectory)) {\n $validIndexDocuments = [\n 'index.md',\n 'readme.md',\n strtol...
[ "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:", "pos": "Represent the code:", "neg": "Represent the code:" }
A bit dummy compareTo implementation use by the tree Map. @param rElem the {@link ControllerRouteModel} that we want to compare to <code>this</code>. @return {@inheritDoc}
[ "@Override\n public int compareTo(ControllerRouteModel rElem) {\n if (rElem == null) {\n throw new NullPointerException(\"Cannot compare to null\");\n }\n\n if (rElem.equals(this)) {\n return 0;\n }\n\n int compare = getPath().compareTo(rElem.getPath());\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 summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Execute a query and returns an ODBC result identifier @param string $query @return resource @throws Exception
[ "protected function executeQuery($query)\n {\n $res = @odbc_exec($this->_lnk, $query);\n if(!$res) {\n $error = odbc_errormsg($this->_lnk);\n $this->log('Query failed: '.$error);\n throw new Exception('Executing query failed ' . $error, self:...
[ "public AttributeConfig[] get_attribute_config(TacoTangoDevice tacoDevice, String[] attrnames) throws DevFailed {\n Except.throw_exception(\"Api_TacoFailed\",\n \"Taco protocol not supported\",\n \"TacoTangoDeviceDAODefaultImpl.command_inout()\");\n return null;\n }" ]
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about N/A:" }
onBeforeRouting @param Event $event @return void
[ "public function onBeforeRouting(Event $event): void\n {\n /** @var WebApplication $app */\n $app = $event['app'];\n\n if ($app->get('system.offline', false) && !$app->get('system.debug')) {\n $app->server->setHandler(\n function (RequestInterface $request, Response...
[ "static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}" ]
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
// makeRequest makes a HTTP request and returns the body as a byte slice, // closing it before returnng. params will be serialized to JSON.
[ "func (api *API) makeRequest(method, uri string, params interface{}) ([]byte, error) {\n\treturn api.makeRequestWithAuthType(context.TODO(), method, uri, params, api.authType)\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 Github description about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about programming:" }
Hide the toast after the duration is up. Also remove the element from the DOM once the transition is complete. @param {jQuery} element
[ "function(element) {\n element = $(element);\n\n // Pass the element since it gets removed\n this.fireEvent('hiding', [element]);\n\n element.transitionend(function() {\n element.remove();\n this.fireEvent('hidden');\n }.bind(this)).conceal();\n }" ]
[ "function fixContainerSizeNow() {\n if( !showContent || !scope.isVisible ) { return; }\n let contentHeight = 0;\n jqElement.children().each( ( index, child ) => {\n contentHeight += $( child ).outerHeight( true );\n } );\n if( co...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about language and writing:" }
Runs through the query, creating a clone directory structure in the new_root. Then applies process
[ "def shadow(self,new_root,visitor) :\n \n for n in self.walk() :\n sn = n.clone(new_root)\n if n.isdir() :\n visitor.process_dir(n,sn)\n else :\n visitor.process_file(n,sn)" ]
[ "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 text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Delegate to the JournalWorker.
[ "public String ingest(Context context,\n InputStream serialization,\n String logMessage,\n String format,\n String encoding,\n String pid) throws ServerException {\n return worker.ingest(co...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetSecondarySourcesOverride sets the SecondarySourcesOverride field's value.
[ "func (s *StartBuildInput) SetSecondarySourcesOverride(v []*ProjectSource) *StartBuildInput {\n\ts.SecondarySourcesOverride = 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 sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Is this API notification? @return bool
[ "public function isAPINotification()\n {\n return (bool)(isset($this->notificationObj->unique_id) && !empty($this->notificationObj->unique_id));\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the text about NLP:", "pos": "Represent the code about NLP:", "neg": "Represent the code:" }
Gets application server service. @return \OxidEsales\Eshop\Core\Service\ApplicationServerServiceInterface
[ "protected function getAppServerService()\n {\n $config = \\OxidEsales\\Eshop\\Core\\Registry::getConfig();\n $database = \\OxidEsales\\Eshop\\Core\\DatabaseProvider::getDb();\n $appServerDao = oxNew(\\OxidEsales\\Eshop\\Core\\Dao\\ApplicationServerDao::class, $database, $config);\n $...
[ "public function init()\n {\n // @deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.\n if (\\OxidEsales\\Eshop\\Core\\Registry::getConfig()->getRequestParameter('recommid') && !$this->getActiveRecommList()) {\n \\OxidEsales\\Eshop\\Core\\Registry::getUtils()->r...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Example of running a query with timestamp query parameters.
[ "public void runQueryWithTimestampParameters() throws InterruptedException {\n // [START bigquery_query_params_timestamps]\n // BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();\n ZonedDateTime timestamp = LocalDateTime.of(2016, 12, 7, 8, 0, 0).atZone(ZoneOffset.UTC);\n String query...
[ "@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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
<p> An array of <code>BotAliasMetadata</code> objects, each describing a bot alias. </p> @param botAliases An array of <code>BotAliasMetadata</code> objects, each describing a bot alias.
[ "public void setBotAliases(java.util.Collection<BotAliasMetadata> botAliases) {\n if (botAliases == null) {\n this.botAliases = null;\n return;\n }\n\n this.botAliases = new java.util.ArrayList<BotAliasMetadata>(botAliases);\n }" ]
[ "function (parameters) {\n\n /**\n * Job identifier.\n * @type {string}\n */\n this.hash = parameters.hash;\n\n /**\n * Array of hashes to {@link Artifact}s containing each requested result.\n * @type {string[]}\n */\n this.resultHashes = p...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Round `x` and `y` down to integers.
[ "def floor(self):\n \"\"\"\"\"\"\n return Point(int(math.floor(self.x)), int(math.floor(self.y)))" ]
[ "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 summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
set path to storage
[ "def set_settings(self, releases=None, default_release=None):\n \"\"\"\"\"\"\n if (self._storage is None or\n getattr(self, 'releases', {}) != releases or\n getattr(self, 'default_release', '') != default_release):\n self._storage = {}\n self.release...
[ "def execPath(self):\n \"\"\"\"\"\"\n vers = self.version.label if self.version else None # executables in Versions folder are stored by baseVersion (modified by game data patches)\n return self.installedApp.exec_path(vers)" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Creates an enum type. @param name The human-readable name associated with the enum, or null if unknown.
[ "public EnumType createEnumType(String name, Node source, JSType elementsType) {\n return new EnumType(this, name, source, elementsType);\n }" ]
[ "function DataModelMigration() {\n /**\n * Gets an array that contains the definition of fields that are going to be added\n * @type {Array}\n */\n this.add = [];\n /**\n * Gets an array that contains a collection of constraints which are going to be added\n * @type {Array}\n */\n ...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Create the requested component instance
[ "protected SlingBean createComponent() throws ClassNotFoundException, IllegalAccessException,\r\n InstantiationException {\r\n SlingBean component = null;\r\n Class<? extends SlingBean> type = getComponentType();\r\n if (type != null) {\r\n BeanFactory factoryRule = type.g...
[ "def surface(self, canvas, X, Y, Z, color=None, label=None, **kwargs):\n \n raise NotImplementedError(\"Implement all plot functions in AbstractPlottingLibrary in order to use your own plotting library\")" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Parse the field options query string and return it as a dictionary.
[ "def parse_field_options(self, *options):\n \n defaults = {}\n for option in options:\n if isinstance(option, six.text_type):\n tokens = [token.strip() for token in option.split(self.view.lookup_sep)]\n\n for token in tokens:\n if not ...
[ "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 Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
execute the benchmark @param {String} id @param {Number} iters
[ "function run(id, iters){\n var bench = new Bench(id, ƒ)\n\n try { Result.when(bench.do(iters), send, error) }\n catch (e) { error(e) }\n\n function send(result){\n process.send({\n type: 'result',\n value: result,\n id: id\n })\n }\n\n function error(e){\n process.send({\n type: ...
[ "def setTargets(self, targets):\n \n if not self.verifyArguments(targets) and not self.patterned:\n raise NetworkError('setTargets() requires [[...],[...],...] or [{\"layerName\": [...]}, ...].', targets)\n self.targets = targets" ]
codesearchnet
{ "query": "Represent the text about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
// UnloadMetadata resets the local metadata state
[ "func (l *State) UnloadMetadata() {\n\tl.Lock()\n\tdefer l.Unlock()\n\tl.metadata = make(map[string]string)\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the text about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
Returns an array of only the persistent fields of {@link $model} @param ModelObject $model The modelObject to analyze @return array An array with persistent field names as keys with their values
[ "public function modelToPersistentArray(ModelObject $model)\n {\n $persistent = array_intersect_key($model->toArray(), array_flip($model->getPersistentFields()));\n\n return $persistent;\n }" ]
[ "def reset ():\n \n global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache\n\n __register_features ()\n\n # Stores suffixes for generated targets.\n __prefixes_suffixes = [property.PropertyMap(), property.PropertyMap()]\n\n # Maps suffixes to types...
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Generate the container @param Input\InputInterface $input The commands input @param Output\OutputInterface $output The commands output @return null
[ "protected function execute(Input\\InputInterface $input, Output\\OutputInterface $output)\n {\n $this->generatorService->process($input->getOption('force'));\n $output->writeln('Completed');\n }" ]
[ "protected function executeCliAction(Config\\Action $action) : void\n {\n // since the cli has no straight way to communicate back to php\n // cli hooks have to handle sync stuff by them self\n // so no 'beforeAction' or 'afterAction' is called here\n $runner = new Action\\Cli();\n ...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software Development:" }
Parse the request path to extract the path and template elements. @param string $path The complet server path @return array Array of 'template' and 'path' portions of the URL
[ "private function parsePath($path)\n {\n $parts = array(\n 'template' => null,\n 'path' => null,\n );\n\n // strip out any query params\n if (preg_match('/^\\/?(.*?)\\/(.*)/', $path, $matches)) {\n $parts['template'] = $matches[1];\n $parts[...
[ "def get_docs_url(self, role, name):\n \n\n # Expand partial names to full names\n name = self.get_full_name(role, name)\n # Look up domain corresponding to role\n dom = IntersphinxInventory.roledomain[role]\n # Get the inventory entry tuple corresponding to the name\n ...
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Return a single or double quote, if a string is wrapped in extra quotes. Otherwise return an empty string.
[ "def is_quoted(value):\n '''\n \n '''\n ret = ''\n if isinstance(value, six.string_types) \\\n and value[0] == value[-1] \\\n and value.startswith(('\\'', '\"')):\n ret = value[0]\n return ret" ]
[ "def get_quoted_strings(quoted_string):\n '''\n \n '''\n try:\n # This regex grabs all quoted data from string.\n # Note that this gets everything in between the first and last double quote.\n # This is intentional, as printed (and quoted) strings from a target file may contain\n ...
codesearchnet
{ "query": "Represent the post about Natural Language Processing:", "pos": "Represent the code about Natural Language Processing:", "neg": "Represent the code about Programming:" }
We will load all messages into array. @param $files @param $trans @return array
[ "private function loadMessages($files, $trans)\n {\n $message = [];\n foreach ($files as $file) {\n // Merge the language strings into the sub message array\n if (is_readable($file)) {\n $message = array_merge($message, include $file);\n }\n }\...
[ "function resolve(){\n\t\tLRState::clear_index();\n\t\tLRStation::clear_index();\n\t\t// create Root Set\n\t\t// we SHOULD have a single etransition to an intial state\n\t\treturn LRStateSet::init( $this->etransitions[0], $this->Grammar );\n\t}" ]
codesearchnet
{ "query": "Represent the text about PHP programming:", "pos": "Represent the code about PHP programming:", "neg": "Represent the code about Computer Science:" }