query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Calculate number of colors in an image. @param resource $im the image. @return int
[ "private function colorsTotal($im)\n {\n if (imageistruecolor($im)) {\n $this->log(\"Colors as true color.\");\n $h = imagesy($im);\n $w = imagesx($im);\n $c = array();\n for ($x=0; $x < $w; $x++) {\n for ($y=0; $y < $h; $y++) {\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:" }
// ActiveScopedKeyManagers returns a slice of all the active scoped key // managers currently known by the root key manager.
[ "func (m *Manager) ActiveScopedKeyManagers() []*ScopedKeyManager {\n\tm.mtx.RLock()\n\tdefer m.mtx.RUnlock()\n\n\tvar scopedManagers []*ScopedKeyManager\n\tfor _, smgr := range m.scopedManagers {\n\t\tscopedManagers = append(scopedManagers, smgr)\n\t}\n\n\treturn scopedManagers\n}" ]
[ "func getEnterpriseResourceIter(context structs.Context, _ *acl.ACL, namespace, prefix string, ws memdb.WatchSet, state *state.StateStore) (memdb.ResultIterator, error) {\n\t// If we have made it here then it is an error since we have exhausted all\n\t// open source contexts.\n\treturn nil, fmt.Errorf(\"context mus...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Dict representation of the database as credentials plus tables dict representation.
[ "def to_dict(self):\n \"\"\"\"\"\"\n db_dict = self.credentials\n db_dict.update(self.tables.to_dict())\n return db_dict" ]
[ "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 description about Data processing:", "pos": "Represent the Github code about Data processing:", "neg": "Represent the Github code:" }
Cache the modification times of any modules imported in this execution
[ "def post_execute(self):\n \n newly_loaded_modules = set(sys.modules) - self.loaded_modules\n for modname in newly_loaded_modules:\n _, pymtime = self._reloader.filename_and_mtime(sys.modules[modname])\n if pymtime is not None:\n self._reloader.modules_mtime...
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Plan returns a IR plan for the policy query.
[ "func (p *Planner) Plan() (*ir.Policy, error) {\n\n\tfor _, q := range p.queries {\n\t\tp.curr = &ir.Block{}\n\t\tdefined := false\n\n\t\tif err := p.planQuery(q, 0, func() error {\n\t\t\tp.appendStmt(ir.ReturnStmt{\n\t\t\t\tCode: ir.Defined,\n\t\t\t})\n\t\t\tdefined = true\n\t\t\treturn nil\n\t\t}); err != nil {\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 summarization about Agent Identity Management:", "pos": "Represent the code about Agent Identity Management:", "neg": "Represent the code:" }
处理Guzzle代码 @return void
[ "protected function parseGuzzle()\n {\n $filePath = dirname(__DIR__) . '/load.php';\n $config = $this->composer->getConfig();\n\n $filesystem = new Filesystem();\n $filesystem->ensureDirectoryExists($config->get('vendor-dir'));\n $vendorPath = $filesystem->normalizePath(realpat...
[ "public static String getTransferQueue(String name) {\n LOG.debug(\"对于需要保序的情况,只应该启动单个中转节点,目前启动多个节点原节点会被挤掉线,但是由于重连机制,会轮着挤掉线\");\n return IdManager.generateStaticQueueId(buildTransferName(name));\n }" ]
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Evaluate and replace a constant XPath expression @param array $m @return string
[ "protected function foldConstantXPathExpression(array $m)\n\t{\n\t\t$expr = $m[0];\n\t\tif ($this->isConstantExpression($expr))\n\t\t{\n\t\t\t$result = $this->evaluate($expr);\n\t\t\tif ($this->canBeSerialized($result))\n\t\t\t{\n\t\t\t\t$foldedExpr = XPath::export($result);\n\t\t\t\tif (strlen($foldedExpr) < strle...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Set up a working copy of the project for building.
[ "protected function setupBuild()\n {\n $this->buildPath = $this->build->getBuildPath();\n\n $this->interpolator->setupInterpolationVars(\n $this->build,\n $this->buildPath,\n PHPCI_URL\n );\n\n $this->commandExecutor->setBuildPath($this->buildPath);\n\...
[ "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 post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Decrypts a string using a secret @param string $cipher_string Ciphered string @param string $cipher_key Secret used to encrypt @return string
[ "public function decrypt($cipher_string, $cipher_key)\n {\n $cipher_key = $this->_genKey($cipher_key);\n\n $hmacSize = 64;\n $hmacString = mb_substr($cipher_string, 0, $hmacSize, \"8bit\");\n $cipher_text = mb_substr($cipher_string, $hmacSize, null, \"8bit\");\n\n if(!$this->va...
[ "function(algo) {\n switch (algo) {\n // Algorithm-Specific Fields for RSA encrypted session keys:\n // - MPI of RSA encrypted value m**e mod n.\n case enums.publicKey.rsa_encrypt:\n case enums.publicKey.rsa_encrypt_sign:\n return [type_mpi];\n\n // Algorithm-Specific Fi...
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Encryption:" }
Find all files of the given type in the [start, end) GPS interval.
[ "def find_urls(self, site, frametype, gpsstart, gpsend,\n match=None, on_gaps='warn'):\n \n span = Segment(gpsstart, gpsend)\n cache = [e for e in self._read_ffl_cache(site, frametype) if\n e.observatory == site and e.description == frametype and\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 instruction about File management:", "pos": "Represent the code about File management:", "neg": "Represent the code:" }
// Set sets the value of a particular instance of PCPCounterVector.
[ "func (c *PCPCounterVector) Set(val int64, instance string) error {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\n\tv, err := c.valInstance(instance)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif val < v.(int64) {\n\t\treturn errors.Errorf(\"cannot set instance %s to a lesser value %v\", instance, val)\n\t}\n\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 description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Draw the points where each point is one needle
[ "function () {\n\t\t\tvar series = this,\n\t\t\t\tyAxis = series.yAxis,\n\t\t\t\tcenter = yAxis.center,\n\t\t\t\toptions = series.options,\n\t\t\t\trenderer = series.chart.renderer,\n\t\t\t\tovershoot = options.overshoot,\n\t\t\t\tovershootVal = overshoot && typeof overshoot === 'number' ? overshoot / 180 * Math.PI...
[ "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 post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Natural Language Processing:" }
@param \Spryker\Zed\CodeGenerator\Business\GeneratorProjectTypeResolver\GeneratorProjectTypeResolverInterface $typeResolver @return string
[ "public function getProviderNameSpace(GeneratorProjectTypeResolverInterface $typeResolver): string\n {\n if ($typeResolver->isDemoShop()) {\n return $this->getDemoShopProviderNamespace();\n }\n\n return $this->getSuitProviderNamespace();\n }" ]
[ "public function entityIdFrom(IEntitySet $entities) : ObjectFieldBuilder\n {\n return new ObjectFieldBuilder($this->type(new ObjectIdType(new EntityIdOptions($entities))));\n }" ]
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Flush the data and checksum data out to the stream. Please call sync to make sure to write the data in to disk @throws IOException
[ "@Override\n public void flush(boolean forceSync)\n throws IOException {\n if (blockDataWriter != null) {\n blockDataWriter.flush();\n if (forceSync) {\n blockDataWriter.force(true);\n }\n }\n }" ]
[ "def buffer_leave(self, filename):\n \"\"\"\"\"\"\n self.log.debug('buffer_leave: %s', filename)\n # TODO: This is questionable, and we should use location list for\n # single-file errors.\n self.editor.clean_errors()" ]
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Programming:" }
Return the canonical URL path for an image for the given region/size/ rotation/quality/format API tranformation settings. See http://iiif.io/api/image/2.1/#canonical-uri-syntax
[ "def make_canonical_path(\n image_identifier, image_width, image_height,\n region, size, rotation, quality, format_str\n):\n \n original_aspect_ratio = float(image_width) / image_height\n\n if (\n region == 'full' or\n # Use 'full' if 'square' is requested for an already square ...
[ "def get_url_metadata(self):\n \n # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template\n metadata = dict(self._mdata['url'])\n metadata.update({'existing_string_values': self._my_map['url']})\n return Metadata(**metadata)" ]
codesearchnet
{ "query": "Represent the Github sentence about storage:", "pos": "Represent the Github code about storage:", "neg": "Represent the Github code about Software Development:" }
// AddSSHKey 公開鍵 追加
[ "func (b *DiskBuilder) AddSSHKey(sshKey string) {\n\tb.sshKeys = append(b.sshKeys, sshKey)\n}" ]
[ "func (m *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\t// NOTE ucon内部のルーティングは一元的にこの関数から行う\n\t// Handlerを細分化しhttp.ServeMuxに登録すると、OPTIONSのhandleがうまくできなくなる\n\t// このため、Handlerはucon全体で1つとし、OPTIONSも通常のMethodと同じようにHandlerを設定し利用する\n\t// OPTIONSを適切にhandleするため、全てのHandlerに特殊なHookを入れるよりマシである\n\n\tm.router.S...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// Equals returns true if all the fields of this Bools match the // provided Bools. // // This function performs a deep comparison.
[ "func (v *Bools) Equals(rhs *Bools) bool {\n\tif v == nil {\n\t\treturn rhs == nil\n\t} else if rhs == nil {\n\t\treturn false\n\t}\n\tif !_Bool_EqualsPtr(v.ImTrue, rhs.ImTrue) {\n\t\treturn false\n\t}\n\tif !_Bool_EqualsPtr(v.ImFalse, rhs.ImFalse) {\n\t\treturn false\n\t}\n\n\treturn true\n}" ]
[ "@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
// GET /load_balancers/{id}
[ "func (api *API) GetLoadBalancer(lb_id string) (*LoadBalancer, error) {\n\turl := createUrl(api, loadBalancerPathSegment, lb_id)\n\tresult := new(LoadBalancer)\n\terr := api.Client.Get(url, &result, http.StatusOK)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult.api = api\n\treturn result, nil\n}" ]
[ "def delete_user_id(self, user_id, mount_point='app-id'):\n \n return self._adapter.delete('/v1/auth/{0}/map/user-id/{1}'.format(mount_point, user_id))" ]
codesearchnet
{ "query": "Represent the text about Object properties:", "pos": "Represent the code about Object properties:", "neg": "Represent the code about Software development:" }
(non-PHPdoc). @see \Mathielen\ImportEngine\Storage\Provider\StorageProviderInterface::select()
[ "public function select($id = null)\n {\n if ($id instanceof \\SplFileInfo) {\n $selection = new StorageSelection($id, $id->getRealPath(), $id->getFilename());\n\n return $selection;\n } elseif (is_string($id)) {\n if (!file_exists($id)) {\n throw new...
[ "public function afterRegistry()\n {\n parent::afterRegistry();\n\n $this->_fieldsDefinition = $this->tracker->createTrackClass('Engine\\\\FieldsDefinition', $this->_trackId);\n }" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// MarshalBinary interface implementation
[ "func (m *Pet) MarshalBinary() ([]byte, error) {\n\tif m == nil {\n\t\treturn nil, nil\n\t}\n\treturn swag.WriteJSON(m)\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:" }
<pre> Use this operation to get the current hostname. </pre>
[ "public static current_hostname[] get(nitro_service client) throws Exception\r\n\t{\r\n\t\tcurrent_hostname resource = new current_hostname();\r\n\t\tresource.validate(\"get\");\r\n\t\treturn (current_hostname[]) resource.get_resources(client);\r\n\t}" ]
[ "func (c StatusSetCmd) Info() *cmd.Info {\n\treturn jujucmd.Info(&cmd.Info{\n\t\tName: StatusSetCmdName,\n\t\tArgs: \"<class> <id> <status>\",\n\t\tPurpose: \"update the status of a payload\",\n\t\tDoc: `\n\"payload-status-set\" is used to update the current status of a registered payload.\nThe <class> and <i...
codesearchnet
{ "query": "Represent the Github description about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about programming:" }
A progess bar dialog. Optionally a `title`, `ticks` and `label` can be provided. :: from fontParts.ui import ProgressBar bar = ProgressBar() # do something bar.close()
[ "def ProgressBar(title=\"RoboFab...\", ticks=None, label=\"\"):\n \n return dispatcher[\"ProgressBar\"](title=title, ticks=ticks, label=label)" ]
[ "def info(self, message):\n \n\n info = self.findChild(QtWidgets.QLabel, \"Info\")\n info.setText(message)\n\n # Include message in terminal\n self.data[\"models\"][\"terminal\"].append({\n \"label\": message,\n \"type\": \"info\"\n })\n\n anima...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
// next returns the next rune in the input.
[ "func (l *lexer) next() rune {\n\tif int(l.pos.byteNo) >= len(l.input) {\n\t\tl.prev = l.pos\n\t\treturn lexEOF\n\t}\n\tr, w := utf8.DecodeRuneInString(l.input[l.pos.byteNo:])\n\tl.prev = l.pos\n\tl.pos.byteNo += w\n\tif r == '\\n' {\n\t\tl.pos.lineStart = l.pos.byteNo\n\t\tl.pos.lineNo++\n\t\tl.freshLine = true\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 about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// SetMesh sets the Mesh field's value.
[ "func (s *DeleteMeshOutput) SetMesh(v *MeshData) *DeleteMeshOutput {\n\ts.Mesh = v\n\treturn s\n}" ]
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// SetIotEvents sets the IotEvents field's value.
[ "func (s *Action) SetIotEvents(v *IotEventsAction) *Action {\n\ts.IotEvents = 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 post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Get a string containing the SQL statements and any parameters for a given batch passed to an ad-hoc query. Used for debugging and logging.
[ "public static String adHocSQLFromInvocationForDebug(StoredProcedureInvocation invocation) {\n assert(invocation.getProcName().startsWith(\"@AdHoc\"));\n ParameterSet params = invocation.getParams();\n // the final param is the byte array we need\n byte[] serializedBatchData = (byte[]) p...
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Returns destination image function @param string|null $imgExtension @return null|string
[ "private static function getDestinationFunction(string $imgExtension = null): ?string\n {\n switch ($imgExtension) {\n case 'jpg':\n case 'jpeg':\n $dst['function'] = 'imagejpeg';\n break;\n case 'png':\n $dst['function'] = 'ima...
[ "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 sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
<p> An array of descriptions for the specified pipelines. </p> @return An array of descriptions for the specified pipelines.
[ "public java.util.List<PipelineDescription> getPipelineDescriptionList() {\n if (pipelineDescriptionList == null) {\n pipelineDescriptionList = new com.amazonaws.internal.SdkInternalList<PipelineDescription>();\n }\n return pipelineDescriptionList;\n }" ]
[ "function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ...
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Used in Application core, please do not touch @param string $step
[ "public static function handleApplicationPlugins($step)\n {\n foreach (self::$pluginsOrder as $plugins) {\n foreach ($plugins as $pluginClass) {\n self::$plugins[$pluginClass]->$step();\n }\n }\n }" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Starts a new iteration.
[ "def _initialiseIteration(self):\n \n self._searchIterator = self._search(\n self._request.start,\n self._request.end if self._request.end != 0 else None)\n self._currentObject = next(self._searchIterator, None)\n if self._currentObject is not None:\n sel...
[ "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:" }
// SetSRID sets the SRID of g.
[ "func (g *MultiLineString) SetSRID(srid int) *MultiLineString {\n\tg.srid = srid\n\treturn g\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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Manage the instance IAM policy Example: ``` $iam = $instance->iam(); ``` @return Iam
[ "public function iam()\n {\n if (!$this->iam) {\n $this->iam = new Iam(\n new IamInstance($this->connection),\n $this->name\n );\n }\n\n return $this->iam;\n }" ]
[ "function newService()\n {\n # build with merged config\n /** @var DataEntity $config */\n $services = $this->services();\n $config = $services->get('/sapi')->config();\n $config = $config->get(Module::CONF_KEY, array());\n\n $mongoDriver = new MongoDriverAction($config)...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Set 'Content' value @param \Protobuf\Stream $value
[ "public function setContent($value)\n {\n if ($value !== null && ! $value instanceof \\Protobuf\\Stream) {\n $value = \\Protobuf\\Stream::wrap($value);\n }\n\n $this->Content = $value;\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// BindJSON binds v to the json data in the request body. It calls json.Unmarshal and // sets the value of v.
[ "func (d Data) BindJSON(v interface{}) error {\n\tif len(d.jsonBody) == 0 {\n\t\treturn nil\n\t}\n\treturn json.Unmarshal(d.jsonBody, v)\n}" ]
[ "func (re RawExtension) MarshalJSON() ([]byte, error) {\n\tif re.Raw == nil {\n\t\t// TODO: this is to support legacy behavior of JSONPrinter and YAMLPrinter, which\n\t\t// expect to call json.Marshal on arbitrary versioned objects (even those not in\n\t\t// the scheme). pkg/kubectl/resource#AsVersionedObjects and ...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
schedule and download a v13 report
[ "def schedule(argv)\n\n report = @account.report do\n name 'boh'\n type 'Url'\n aggregation 'Daily'\n cross_client true\n zero_impression true\n\n start_day '2010-01-01'\n end_day '2010-01-30'\n\n column \"CustomerName\"\n ...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run.
[ "@Override\n public Request<DetachClassicLinkVpcRequest> getDryRunRequest() {\n Request<DetachClassicLinkVpcRequest> request = new DetachClassicLinkVpcRequestMarshaller().marshall(this);\n request.addParameter(\"DryRun\", Boolean.toString(true));\n return request;\n }" ]
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the description about PHP programming:", "pos": "Represent the code about PHP programming:", "neg": "Represent the code about Software development:" }
Unlock the active advisory lock.
[ "def unlock(self):\n \n logger.debug(\"Releasing lock %s\", self.lock_file)\n self._lock.release()\n try:\n os.unlink(self.lock_file)\n except FileNotFoundError:\n pass" ]
[ "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:" }
// NewListControllersCommand returns a command to list registered controllers.
[ "func NewListControllersCommand() cmd.Command {\n\tcmd := &listControllersCommand{\n\t\tstore: jujuclient.NewFileClientStore(),\n\t}\n\treturn modelcmd.WrapBase(cmd)\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 post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Returns a {@link Enum} value constant. @param enumerationDescription The enumeration value to represent. @return A dynamically resolved enumeration constant.
[ "public static JavaConstant ofEnumeration(EnumerationDescription enumerationDescription) {\n return new Dynamic(new ConstantDynamic(enumerationDescription.getValue(),\n enumerationDescription.getEnumerationType().getDescriptor(),\n new Handle(Opcodes.H_INVOKESTATIC,\...
[ "@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:" }
Read a string up to the given number of bytes, blocking until some data is available but returning immediately if some data is available
[ "def readpartial(length = nil)\n if length.nil? && @buffer.length > 0\n slice = @buffer\n @buffer = \"\"\n else\n unless finished_reading? || (length && length <= @buffer.length)\n @connection.readpartial(length ? length - @buffer.length : @connection.buffer_size)\n en...
[ "def count(self):\n \n # Save the existing rows and start parameters to see how many results were actually expected\n _rows = self._solr_params.get('rows', None)\n _start = self._solr_params.get('start', 0)\n if not self._solr_cache:\n # Get the count for everything\n ...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Deletes the unselected group ids @param array $exGroupIDs Currently assigned group ids @param array $selGroupIDs Selected group ids
[ "private function DeleteOldGroups(array $selGroupIDs)\n {\n $tblMmg = MemberMembergroup::Schema()->Table();\n $sql = Access::SqlBuilder();\n $where = $sql->Equals($tblMmg->Field('Member'), $sql->Value($this->member->GetID()));\n if (count($selGroupIDs) > 0)\n {\n $se...
[ "def getSampleTypeTitles(self):\n \n sample_types = self.getSampleTypes()\n sample_type_titles = map(lambda obj: obj.Title(), sample_types)\n\n # N.B. This is used only for search purpose, because the catalog does\n # not add an entry to the Keywordindex for an empty list.\n ...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
/* Check like score and convert to integer if not. ## Args value: Like score to be checked. ## Returns Integer value.
[ "function check_like_score(value) {\n if (value != null) {\n const res = parseInt(value, 10);\n if (!isNaN(res)) {\n return res;\n }\n }\n return 0;\n}" ]
[ "function run(booleanOrString, anyDataType, functionOrObject, aNumber, anArray) {\n /*\n * if expectations aren't met, args checker will throw appropriate exceptions\n * notifying the user regarding the errors of the arguments.\n * */\n \targs.expect(arguments, ['boolean|string', '*',...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
获取网页中满足指定css选择器的所有元素的指定属性的集合 例如通过attr("img[src]","abs:src")可获取网页中第一个图片的链接 @param cssSelector @param attrName @return
[ "public String attr(String cssSelector, String attrName) {\n return select(cssSelector).attr(attrName);\n }" ]
[ "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 Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
List all Environments
[ "def list_environments_raw(page_size=200, page_index=0, sort=\"\", q=\"\"):\n \n response = utils.checked_api_call(pnc_api.environments, 'get_all', page_size=page_size, page_index=page_index, sort=sort, q=q)\n if response:\n return response.content" ]
[ "def includeme(config):\n \n root = config.get_root_resource()\n root.add('nef_polymorphic', '{collections:.+,.+}',\n view=PolymorphicESView,\n factory=PolymorphicACL)" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Stops the master processes and cleans up client connections.
[ "public void stop() throws Exception {\n if (mSecondaryMasterThread != null) {\n mSecondaryMaster.stop();\n while (mSecondaryMasterThread.isAlive()) {\n LOG.info(\"Stopping thread {}.\", mSecondaryMasterThread.getName());\n mSecondaryMasterThread.join(1000);\n }\n mSecondaryMast...
[ "def _shutdown_broker(self):\n \n if self.broker:\n self.broker.shutdown()\n self.broker.join()\n self.broker = None\n self.router = None\n\n # #420: Ansible executes \"meta\" actions in the top-level process,\n # meaning \"reset_connec...
codesearchnet
{ "query": "Represent the Github description about Computer Networking:", "pos": "Represent the Github code about Computer Networking:", "neg": "Represent the Github code about programming:" }
Get list of relative path to file or directory @param string $source (example: "default:*.txt") @return null|string
[ "public function relGlob($source)\n {\n $list = (array)$this->glob($source);\n foreach ($list as $key => $item) {\n $list[$key] = FS::getRelative($item, $this->root, '/');\n }\n\n return $list;\n }" ]
[ "private function cmdGenerate()\n {\n //check if path exists\n if (!is_dir($this->configKeyPath)) {\n Main::copyDirectoryContents(dirname(__DIR__).'/Config/Devbr/Key', $this->configKeyPath);\n }\n //Now, OPEN_SSL\n $this->createKeys();\n return \"\\n Can, Ope...
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
@param string $container @param array $files @param string $root @throws BadRequestException @return array
[ "public function deleteFiles($container, $files, $root = '')\n {\n $root = FileUtilities::fixFolderPath($root);\n foreach ($files as $key => $fileInfo) {\n try {\n // path is full path, name is relative to root, take either\n $path = array_get($fileInfo, 'pa...
[ "private static function validation()\n {\n $files = ['Validator', 'ValidationResult'];\n $folder = static::$root.'Validation'.'/';\n\n self::call($files, $folder);\n\n //Initiate the validation surface\n Validator::ini();\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about PHP:", "pos": "Represent the Github code about PHP:", "neg": "Represent the Github code about Software development:" }
Check for the presence of docstrings, but ignore some of the options
[ "def hacked_pep257(to_lint):\n \n def ignore(*args, **kwargs):\n pass\n\n pep257.check_blank_before_after_class = ignore\n pep257.check_blank_after_last_paragraph = ignore\n pep257.check_blank_after_summary = ignore\n pep257.check_ends_with_period = ignore\n pep257.check_one_liners = ign...
[ "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 about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Converts a Selenium cookie to a HTTP client one. @param seleniumCookie the browser cookie to be converted @return the converted HTTP client cookie
[ "public static BasicClientCookie convertToHttpClientCookie(final Cookie seleniumCookie) {\n BasicClientCookie httpClientCookie\n = new BasicClientCookie(seleniumCookie.getName(), seleniumCookie.getValue());\n httpClientCookie.setDomain(seleniumCookie.getDomain());\n httpClientCoo...
[ "@Override\r\n protected String getEscapedValue(HttpMessage msg, String value) {\r\n // ZAP: unfortunately the method setQuery() defined inside the httpclient Apache component\r\n // create trouble when special characters like ?+? are set inside the parameter, \r\n // because this method imp...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about PHP programming:" }
// NewDeliverSMResp creates and initializes a new DeliverSMResp PDU.
[ "func NewDeliverSMResp() Body {\n\tb := newDeliverSMResp(&Header{ID: DeliverSMRespID})\n\tb.init()\n\treturn b\n}" ]
[ "@Override\n public void init(TCPWriteRequestContext x, H2MuxTCPWriteCallback c) {\n writeReqContext = x;\n muxCallback = c;\n\n // callback will need to know how to get back to this write queue.\n // This means one and only one H2WriteTree per H2InboundLink which has just one true TC...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Lists all files and directories in a directory @param integer $depth @param mixed $filter @param string $type @param boolean $asHandlers @return array
[ "public function listContents($depth = 0, $filter = null, $type = 'all', $asHandlers = false)\n\t{\n\t\t$pattern = $this->path.'/*';\n\n\t\tif (is_array($filter))\n\t\t{\n\t\t\t$filters = $filter;\n\t\t\t$filter = new Filter;\n\n\t\t\tforeach ($filters as $f => $type)\n\t\t\t{\n\t\t\t\tif ( ! is_int($f))\n\t\t\t\t{...
[ "public function help()\n {\n $style = new Eurekon\\Style(' *** RUN - HELP ***');\n Eurekon\\Out::std($style->color('fg', Eurekon\\Style::COLOR_GREEN)->get());\n Eurekon\\Out::std('');\n\n $help = new Eurekon\\Help('...', true);\n $help->addArgument('', 'directory', 'Config dir...
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about NLP:" }
@brief This function prints in the screen the difference between the time saved with function tic.py and current time. @param label String: if something is desired to print (default = ''). @see also tic()
[ "def tac(label=''):\n \n\n global _tic\n\n delta_t = time.time() - _tic\n\n if label != '':\n print('%s - %3.4f s' % (label, delta_t))\n else:\n print('%3.4f s' % delta_t)" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Write part header @param name @param filename @return this request @throws java.io.IOException
[ "protected OkRequest<T> writePartHeader(final String name, final String filename)\n throws IOException {\n return writePartHeader(name, filename, null);\n }" ]
[ "public void setLog(String log) throws ApplicationException {\n\tif (StringUtil.isEmpty(log, true)) return;\n\tthis.log = log.trim();\n\t// throw new ApplicationException(\"invalid value for attribute log [\"+log+\"]\",\"valid values are\n\t// [application, scheduler,console]\");\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:" }
Evaluates messages against a [[State]], executing a [[Transition]]. @param state The [[State]]. @param instance The state machine instance. @param message The message to evaluate. @returns Returns true if the message caused a [[Transition]]. @internal
[ "function evaluateState(state, instance, message) {\n var result = false;\n // delegate to child regions first if a non-continuation\n if (message !== state) {\n state.regions.every(function (region) {\n var currentState = instance.getLastKnownState(region);\n if (currentState ...
[ "def ObjectInitializedEventHandler(analysis, event):\n \n\n # Initialize the analysis if it was e.g. added by Manage Analysis\n wf.doActionFor(analysis, \"initialize\")\n\n # Try to transition the analysis_request to \"sample_received\". There are\n # some cases that can end up with an inconsistent s...
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Checks if tenant database exists. @param Website $website @return bool
[ "protected function tenantDatabaseExists(Website $website) : bool\n {\n try {\n $this->connection->set($website);\n\n $schema = $this->connection->get()->getSchemaBuilder();\n\n if ($schema->hasTable($this->table)) {\n return true;\n }\n } ...
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Programming:" }
Encodes the number as a JSON string. @param number a finite value. May not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}. @return the encoded value @throws JSONException if an error occurs
[ "public static String numberToString(Number number) throws JSONException {\n\t\tif (number == null) {\n\t\t\tthrow new JSONException(\"Number must be non-null\");\n\t\t}\n\n\t\tdouble doubleValue = number.doubleValue();\n\t\tJSON.checkDouble(doubleValue);\n\n\t\t// the original returns \"-0\" instead of \"-0.0\" fo...
[ "public static Double toDouble(Number self) {\n // Conversions in which all decimal digits are known to be good.\n if ((self instanceof Double)\n || (self instanceof Long)\n || (self instanceof Integer)\n || (self instanceof Short)\n || (self...
codesearchnet
{ "query": "Represent the Github sentence about text processing:", "pos": "Represent the Github code about text processing:", "neg": "Represent the Github code about programming:" }
/* (non-Javadoc) @see uk.ac.ebi.embl.flatfile.writer.FlatFileWriter#write(java.io.Writer)
[ "@Override\n\tpublic boolean write(Writer writer) throws IOException {\n\n\t\twriteBlock(writer, EmblPadding.PA_PADDING, accession);\n\n\t\treturn true;\n\t}" ]
[ "@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 sentence about writing:", "pos": "Represent the code about writing:", "neg": "Represent the code:" }
Verify if all submitted data of this area and it's children is valid. @return boolean
[ "public function isValid()\n {\n $blnReturn = true;\n\n $intDynamicCount = $this->getDynamicCount();\n\n for ($intCount = 0; $intCount <= $intDynamicCount; $intCount ++) {\n $blnReturn = $this->__validate($intCount);\n\n if (! $blnReturn) {\n break;\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 instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Attempt to read the Jandex index. If Jandex is not enabled, immediately answer null. If no Jandex index is available, or if it cannot be read, answer null. @return The read Jandex index.
[ "protected Index getJandexIndex() {\n \tString methodName = \"getJandexIndex\";\n\n boolean doLog = tc.isDebugEnabled();\n boolean doJandexLog = JandexLogger.doLog();\n\n boolean useJandex = getUseJandex();\n\n if ( !useJandex ) {\n \t// Figuring out if there is a Jandex index ...
[ "private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {\n // Get default form\n in.defaultReadObject();\n\n // Create new Archive\n final String name = this.name;\n final ZipImporter archive = ShrinkWrap.create(ZipImporter.class, name);\n\...
codesearchnet
{ "query": "Represent the Github description about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
Marshall the given parameter object.
[ "public void marshall(ProjectDescription projectDescription, ProtocolMarshaller protocolMarshaller) {\n\n if (projectDescription == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(projectDesc...
[ "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 about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Pretty-print JSON string Use 'indent' option to select indentation string - by default it's a tab @param string $json Original JSON string @param array $options Encoding options @return string
[ "public static function prettyPrint($json, $options = array())\n {\n $tokens = preg_split('|([\\{\\}\\]\\[,])|', $json, -1, PREG_SPLIT_DELIM_CAPTURE);\n $result = \"\";\n $indent = 0;\n\n $ind = \" \";\n if (isset($options['indent'])) {\n $ind = $options['indent']...
[ "function (format) {\n throw new Error(index$1.red('[indian-ocean] You passed in an object but converting to ' + index$1.bold(format) + ' requires a list of objects.') + index$1.cyan('\\nIf you would like to write a one-row csv, put your object in a list like so: `' + index$1.bold('[data]') + '`\\n'));\n}" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// AddIdentity adds a single identity to the set. // // The receiver must not be nil.
[ "func (s *Set) AddIdentity(id identity.Identity) {\n\tif !s.All {\n\t\tif s.IDs == nil {\n\t\t\ts.IDs = make(identSet, 1)\n\t\t}\n\t\ts.IDs[id] = struct{}{}\n\t}\n}" ]
[ "func getEnterpriseResourceIter(context structs.Context, _ *acl.ACL, namespace, prefix string, ws memdb.WatchSet, state *state.StateStore) (memdb.ResultIterator, error) {\n\t// If we have made it here then it is an error since we have exhausted all\n\t// open source contexts.\n\treturn nil, fmt.Errorf(\"context mus...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Determines if the module haas resources whose site is undefined.<p> @return true if there are module resources with an undefined site
[ "public boolean hasModuleResourcesWithUndefinedSite() {\n\n if (getSite() == null) {\n for (String modRes : getResources()) {\n if (!CmsStringUtil.isPrefixPath(\"/system/\", modRes)\n && !OpenCms.getSiteManager().startsWithShared(modRes)) {\n re...
[ "def __resolveport(self, definitions):\n \n ref = qualify(self.type, self.root, definitions.tns)\n port_type = definitions.port_types.get(ref)\n if port_type is None:\n raise Exception(\"portType '%s', not-found\" % (self.type,))\n # Later on we will require access to t...
codesearchnet
{ "query": "Represent the Github summarization about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
插入数据,如果数据已经存在,则替换数据 @see insert()
[ "public function replace($table, $data) {\n\n $_fileds = '';\n $_values = '';\n $_T_fields = $this->getTableFields($table);\n foreach ( $data as $_key => $_val ) {\n\n //自动过滤掉不存在的字段\n if ( !in_array( $_key, $_T_fields ) ) continue;\n\n $_fileds .= ( $_fil...
[ "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 Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Marshall the given parameter object.
[ "public void marshall(DescribeConnectionsOnInterconnectRequest describeConnectionsOnInterconnectRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (describeConnectionsOnInterconnectRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Get a fresh application instance. @return \Illuminate\Foundation\Application
[ "protected function getFreshApplication()\n {\n return tap(require app(\\Antares\\Foundation\\Application::class)->bootstrapPath() . '/app.php', function ($app) {\n $app->make(\\Illuminate\\Contracts\\Console\\Kernel::class)->bootstrap();\n });\n }" ]
[ "public function register()\n {\n $this->registerFileConfig();\n $this->registerDatabaseConfig();\n\n // Bind the concrete types\n $this->app->bind('Concrete\\Core\\Config\\Repository\\Repository', 'config');\n $this->app->bind('Illuminate\\Config\\Repository', 'Concrete\\Core\...
codesearchnet
{ "query": "Represent the Github summarization about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
// ListClusters returns list of clusters
[ "func (db *db) ListClusters(ctx context.Context) (*appv1.ClusterList, error) {\n\tclusterSecrets, err := db.listClusterSecrets()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclusterList := appv1.ClusterList{\n\t\tItems: make([]appv1.Cluster, len(clusterSecrets)),\n\t}\n\thasInClusterCredentials := false\n\tfor i...
[ "func getEnterpriseResourceIter(context structs.Context, _ *acl.ACL, namespace, prefix string, ws memdb.WatchSet, state *state.StateStore) (memdb.ResultIterator, error) {\n\t// If we have made it here then it is an error since we have exhausted all\n\t// open source contexts.\n\treturn nil, fmt.Errorf(\"context mus...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Get a nonce to use in a request, removing it from the nonces on hand.
[ "def _get_nonce(self, url):\n \n action = LOG_JWS_GET_NONCE()\n if len(self._nonces) > 0:\n with action:\n nonce = self._nonces.pop()\n action.add_success_fields(nonce=nonce)\n return succeed(nonce)\n else:\n with action....
[ "func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
// machineStatusHistory returns status history for the given machine.
[ "func (c *Client) machineStatusHistory(machineTag names.MachineTag, filter status.StatusHistoryFilter, kind status.HistoryKind) ([]params.DetailedStatus, error) {\n\tmachine, err := c.api.stateAccessor.Machine(machineTag.Id())\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tvar sInfo []status.StatusIn...
[ "@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 post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Set favorite to the logged in user. If no user, no action is done
[ "public void add(DbSession dbSession, ComponentDto componentDto, @Nullable Integer userId, boolean failIfTooManyFavorites) {\n if (userId == null) {\n return;\n }\n\n List<PropertyDto> existingFavoriteOnComponent = dbClient.propertiesDao().selectByQuery(PropertyQuery.builder()\n .setKey(PROP_FAVO...
[ "def get_render_language(contentitem):\n \n plugin = contentitem.plugin\n\n if plugin.render_ignore_item_language \\\n or (plugin.cache_output and plugin.cache_output_per_language):\n # Render the template in the current language.\n # The cache also stores the output under the current lang...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about Language and programming:" }
@param SearchNodesRequest $request @param ParsedQuery $parsedQuery @return SchemaQName[]
[ "protected function createQNamesForSearchNodes(SearchNodesRequest $request, ParsedQuery $parsedQuery): array\n {\n $curie = $request::schema()->getCurie();\n $vendor = $curie->getVendor();\n // converts search-articles-request to \"article\"\n // converts search-categories-request to ...
[ "public static Call.Mapper<List<List<Span>>, List<List<Span>>> filterTraces(QueryRequest request) {\n return new FilterTracesIfClashOnLowerTraceId(request);\n }" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Technology:" }
Construct a WebSocket frame. @example frame = LibWebSocket::Frame.new('foo') frame.to_s # => \x00foo\xff
[ "def to_s\n ary = [\"\\x00\", @buffer.dup, \"\\xff\"]\n\n ary.collect{ |s| s.force_encoding('UTF-8') if s.respond_to?(:force_encoding) }\n\n return ary.join\n end" ]
[ "def send(packet)\n id = Common.packet_to_id(packet)\n data = [id, [packet.to_a]].to_msgpack\n\n @stream.write Common.encode_u16(data.length)\n @stream.write data\n end" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
extract the real user from the given token string
[ "private String getUserFromToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException {\n return authFactory.getUserFromToken(tokenStr);\n }" ]
[ "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 text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Technology:" }
The given string has one of the following formats YYYYMMDDhhmmssZ YYYYMMDDhhmmss+hhmm YYYYMMDDhhmmss-hhmm @return: a datetime object or None on error
[ "def asn1_generaltime_to_seconds(timestr):\n \n res = None\n timeformat = \"%Y%m%d%H%M%S\"\n try:\n res = datetime.strptime(timestr, timeformat + 'Z')\n except ValueError:\n try:\n res = datetime.strptime(timestr, timeformat + '%z')\n except ValueError:\n pa...
[ "function getNightlyPatch(plainPatch) {\n // We're going to append a representation of the current time at the end of the current version.\n // String.prototype.toISOString() returns a 24-character string formatted as 'YYYY-MM-DDTHH:mm:ss.sssZ',\n // but we'd prefer to just remove separators and limit ours...
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Returns the schema definition parser for the <code>name</code> value @param $name @return \Neoxygen\Neogen\Parser\ParserInterface @throws ParserNotFoundException
[ "public function getParser($name)\n {\n if (!$this->hasParser($name)) {\n throw new ParserNotFoundException(sprintf('The parser with NAME \"%s\" is not registered', $name));\n }\n\n return $this->parsers[$name];\n }" ]
[ "protected function initDefaultInitialContext()\n {\n\n // initialize the configuration values for the initial context\n $description = new DescriptionNode(new NodeValue('The initial context configuration.'));\n $storage = new StorageNode('AppserverIo\\Storage\\StackableStorage');\n\n ...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// And computes the intersection between two bitmaps and stores the result in the current bitmap
[ "func (rb *Bitmap) And(x2 *Bitmap) {\n\tpos1 := 0\n\tpos2 := 0\n\tintersectionsize := 0\n\tlength1 := rb.highlowcontainer.size()\n\tlength2 := x2.highlowcontainer.size()\n\nmain:\n\tfor {\n\t\tif pos1 < length1 && pos2 < length2 {\n\t\t\ts1 := rb.highlowcontainer.getKeyAtIndex(pos1)\n\t\t\ts2 := x2.highlowcontainer...
[ "def handle_dims(opts):\n '''\n \n '''\n use,res = [],[];\n if opts['--X']:\n use.append('x');\n res.append(int(opts['--xres']));\n if opts['--Y']:\n use.append('y');\n res.append(int(opts['--yres']));\n if opts['--Z']:\n use.append('z');\n res.append(i...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
To fire off start entity trace event @param name Name of entity
[ "protected void fireStartEntity(String name)\n throws org.xml.sax.SAXException\n { \n if (m_tracer != null)\n {\n flushMyWriter();\n m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENTITYREF, name);\n } \t \t \t\n }" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
// Hash will hash the given type. This has built-in support for auth, // requests, and responses. If it is a type that isn't recognized, then // it will be passed through. // // The structure is modified in-place.
[ "func Hash(salter *salt.Salt, raw interface{}, nonHMACDataKeys []string) error {\n\tfn := salter.GetIdentifiedHMAC\n\n\tswitch s := raw.(type) {\n\tcase *logical.Auth:\n\t\tif s == nil {\n\t\t\treturn nil\n\t\t}\n\t\tif s.ClientToken != \"\" {\n\t\t\ts.ClientToken = fn(s.ClientToken)\n\t\t}\n\t\tif s.Accessor != \"...
[ "func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Compute the type of a break expression. @param object the expression. @param state the state of the type resolver.
[ "protected void _computeTypes(SarlBreakExpression object, ITypeComputationState state) {\n\t\tfinal LightweightTypeReference primitiveVoid = getPrimitiveVoid(state);\n\t\tstate.acceptActualType(primitiveVoid);\n\t}" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Iterator interface current. Return a model object with cursor document. (used in foreach). @return mixed
[ "public function current()\n {\n $document = $this->getCursor()->current();\n\n if ($document instanceof ActiveRecord) {\n $documentToArray = $document->toArray();\n $this->entitySchema = $document->getSchema();\n } else {\n $documentToArray = (array) $docume...
[ "def property_(getter: Map[Domain, Range]) -> property:\n \n return property(map_(WeakKeyDictionary())(getter))" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// SetMaxResults sets the MaxResults field's value.
[ "func (s *ListAccountsInput) SetMaxResults(v int64) *ListAccountsInput {\n\ts.MaxResults = &v\n\treturn s\n}" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Runs Eval once. Args: saver: Saver. summary_writer: Summary writer. top_1_op: Top 1 op. top_5_op: Top 5 op. summary_op: Summary op.
[ "def _eval_once(saver, summary_writer, top_1_op, top_5_op, summary_op):\n \n with tf.Session() as sess:\n ckpt = tf.train.get_checkpoint_state(FLAGS.checkpoint_dir)\n if ckpt and ckpt.model_checkpoint_path:\n print(\"ckpt.model_checkpoint_path: {0}\".format(ckpt.model_checkpoint_path))\n saver.res...
[ "def train(target, dataset, cluster_spec, ctx):\n \"\"\"\"\"\"\n # Number of workers and parameter servers are infered from the workers and ps\n # hosts string.\n num_workers = len(cluster_spec.as_dict()['worker'])\n num_parameter_servers = len(cluster_spec.as_dict()['ps'])\n # If no value is given, num_repli...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// MaybeWriteLXDProfile implements environs.LXDProfiler.
[ "func (broker *lxdBroker) MaybeWriteLXDProfile(pName string, put *charm.LXDProfile) error {\n\tprofileMgr, ok := broker.manager.(container.LXDProfileManager)\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn profileMgr.MaybeWriteLXDProfile(pName, put)\n}" ]
[ "def includeme(config):\n \n root = config.get_root_resource()\n root.add('nef_polymorphic', '{collections:.+,.+}',\n view=PolymorphicESView,\n factory=PolymorphicACL)" ]
codesearchnet
{ "query": "Represent the instruction about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
// getdeviceid finds out a TAP device from registry, it *may* requires privileged right to prevent some weird issue.
[ "func getdeviceid(componentID string, interfaceName string) (deviceid string, err error) {\n\tk, err := registry.OpenKey(registry.LOCAL_MACHINE, tapDriverKey, registry.READ)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"Failed to open the adapter registry, TAP driver may be not installed, %v\", err)\n\t}\n\tdef...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the summarization about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
Implementation from Zend\Diactoros\marshalHeadersFromSapi().
[ "public static function getHeadersFromServer(array $server): array\n {\n $headers = [];\n foreach ($server as $key => $value) {\n // Apache prefixes environment variables with REDIRECT_\n // if they are added by rewrite rules\n if (0 === \\strpos($key, 'REDIRECT_'))...
[ "public Descriptor replaceAllAcls(PSequence<ServiceAcl> acls) {\n return new Descriptor(name, calls, pathParamSerializers, messageSerializers, serializerFactory, exceptionSerializer, autoAcl, acls, headerFilter, locatableService, circuitBreaker, topicCalls);\n }" ]
codesearchnet
{ "query": "Represent the Github comment about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code:" }
Show device model.
[ "def get_device_model(self) -> str:\n ''''''\n output, _ = self._execute(\n '-s', self.device_sn, 'shell', 'getprop', 'ro.product.model')\n return output.strip()" ]
[ "def getDeviceRole(self):\n \"\"\"\"\"\"\n print '%s call getDeviceRole' % self.port\n return self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:NodeType')[0])" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
// SetInitialVersion sets the InitialVersion field's value.
[ "func (s *CreateDeviceDefinitionInput) SetInitialVersion(v *DeviceDefinitionVersion) *CreateDeviceDefinitionInput {\n\ts.InitialVersion = v\n\treturn s\n}" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Resolve a single node or all when node is omitted.
[ "def resolve_node(self, node=None, resolved=None, seen=None):\n \n if seen is None:\n seen = []\n if resolved is None:\n resolved = []\n if node is None:\n dependencies = sorted(self._nodes.keys())\n else:\n dependencies = self._nodes[no...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// List returns a list of entries with the given prefix
[ "func (s *Store) List(ctx context.Context, prefix string) ([]string, error) {\n\tkeys, err := s.list(ctx, prefix)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor i, e := range keys {\n\t\tkeys[i] = path.Join(s.alias, e)\n\t}\n\treturn keys, nil\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 sentence about Agent Identity Management:", "pos": "Represent the code about Agent Identity Management:", "neg": "Represent the code:" }
Sends the HELO command to the smtp server. This makes sure that we and the server are in the same known state. Implements from rfc 821: HELO <SP> <domain> <CRLF> SMTP CODE SUCCESS: 250 SMTP CODE ERROR : 500, 501, 504, 421 @access public @return bool
[ "function Hello($host=\"\") {\n $this->error = null; # so no confusion is caused\n\n if(!$this->connected()) {\n $this->error = array(\n \"error\" => \"Called Hello() without being connected\");\n return false;\n }\n\n # if a hostname for the HELO wasn't specified determine\n # a suita...
[ "public function mail($from)\n {\n if ($this->_sess !== true) {\n /**\n * @see Zend_Mail_Protocol_Exception\n */\n // require_once 'Zend/Mail/Protocol/Exception.php';\n throw new Zend_Mail_Protocol_Exception('A valid session has not been started');\...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about PHP programming:" }
Check if the condition is valid @return boolean
[ "public function isValid()\n {\n $row = $this->getActulRow();\n return ($row[$this->column] > $this->value) ? true : false;\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 NLP:", "pos": "Represent the Github code about NLP:", "neg": "Represent the Github code:" }
Get the widget instance. @param string $fieldName The property name. @param string $serializedId The serialized id of the model. @param string $propertyValue The property value. @return Widget
[ "protected function getWidget($fieldName, $serializedId, $propertyValue)\n {\n $environment = $this->getEnvironment();\n $property = $environment->getDataDefinition()->getPropertiesDefinition()->getProperty($fieldName);\n $propertyValues = new PropertyValueBag();\n\n if (null...
[ "public function getStoreValue($data = null)\n {\n\n // If Overrite Value\n if (isset($this->value) && $this->overwriteValue) {\n return $this->value;\n }\n\n // If user have user input value\n if ($data != null && isset($data[$this->getName()])) {\n\n // ...
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Method createGDProtocolItemStreams @param transaction @throws OutOfCacheSpace @throws MessageStoreException @throws SIResourceException
[ "public void createGDProtocolItemStreams(TransactionCommon transaction)\n throws OutOfCacheSpace,MessageStoreException, SIResourceException \n {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())\n SibTr.entry(tc, \"createGDProtocol...
[ "public Validation validate(@PName(\"context\") Context context, @PName(\"pid\") String pid,\n @PName(\"asOfDateTime\") Date asOfDateTime) throws ServerException {\n throw rejectCallsFromOutsideWhileInRecoveryMode();\n }" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Set property value. @param $reflection @param $classInstance @param $classProperty @param $object
[ "protected function setPropertyValue($reflection, $classInstance, $classProperty, $object)\n {\n /*\n | We will make property accessible and set the value into it\n */\n $reflection->makePropertyAccessible($classProperty);\n $reflectionProperty = $reflection->getReflectionPro...
[ "private function buildFactory() {\n $this->getObject()->addUse(get_class($this->getModel()).' as Model');\n $method = new Object\\Method();\n $method->setDescription('When called, this should return a new entity');\n $method->setReturnType('Model');\n $method->setAccess('public')...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Determine if a zone file hash was sent by a name. Return True if so, false if not
[ "def namedb_is_name_zonefile_hash(cur, name, zonefile_hash):\n \n select_query = 'SELECT COUNT(value_hash) FROM history WHERE history_id = ? AND value_hash = ?'\n select_args = (name,zonefile_hash)\n\n rows = namedb_query_execute(cur, select_query, select_args)\n count = None\n\n for r in rows:\n ...
[ "def match(tgt, opts=None):\n '''\n \n '''\n\n if not opts:\n opts = __opts__\n try:\n if ',' + opts['id'] + ',' in tgt \\\n or tgt.startswith(opts['id'] + ',') \\\n or tgt.endswith(',' + opts['id']):\n return True\n # tgt is a string, whi...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
tests to see if we should flush cache
[ "@Override\n public synchronized void run(){\n Date now = new Date();\n if ( !cache.isEmpty() &&\n ((cache.size() > cacheSize - 1) || (now.getTime() - lastCacheAccess.getTime() > cacheMillis))) {\n try {\n flush();\n } catch (RepositoryException e...
[ "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 sentence about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about programming:" }
组装sql用于DEBUG @return string
[ "private function buildDebugSql()\n {\n $bindParams = $this->bindParams;\n foreach ($bindParams as $key => $val) {\n $bindParams[$key] = str_replace('\\\\\\\\', '\\\\', addslashes($val));\n }\n return vsprintf(str_replace('%s', \"'%s'\", $this->currentSql), $bindParams);\n ...
[ "public static SqlInfo getSqlInfoSimply(String nsAtZealotId, Object paramObj) {\n String[] arr = nsAtZealotId.split(ZealotConst.SP_AT);\n if (arr.length != LEN) {\n throw new ValidFailException(\"nsAtZealotId参数的值必须是xml文件中的 nameSpace + '@@' + zealotId 节点的值,\"\n + \"如:'stu...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software Development:" }
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)\n throws RemoteException {\n // Get the NativeStyleService.\n NativeStyleServiceInterface nativeStyleService =\n adManagerServices.get(session, NativeStyleServiceInterface.class);\n\n String htmlSnippe...
[ "static void runAssetDiscovery(OrganizationName organizationName) {\n try (SecurityCenterClient client = SecurityCenterClient.create()) {\n // Call the API. Note calls to runAssetDiscovery are throttled if too many requests\n // are made.\n OperationFuture<Empty, Empty> result = client.runAssetDi...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Check if given CSRF token is valid @param string $token @return bool @throws ConfigException @throws Exception @throws \Koldy\Exception
[ "public static function isTokenValid(string $token): bool\n {\n if (!static::hasTokenStored()) {\n return false;\n }\n\n $storedToken = static::getStoredToken();\n return $storedToken->getToken() === $token;\n }" ]
[ "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 iAuthenticator)\n throw new exContainerInvalidServiceType('Invalid Plugin...
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Set Load Areas with too high demand to aggregated type. Args ---- peak_current_branch_max: float Max. allowed current for line/cable
[ "def set_nodes_aggregation_flag(self, peak_current_branch_max):\n \n\n for lv_load_area in self.grid_district.lv_load_areas():\n peak_current_node = (lv_load_area.peak_load / (3**0.5) / self.v_level) # units: kVA / kV = A\n if peak_current_node > peak_current_branch_max:\n ...
[ "def dependent_on_composite_state(self):\n \n composite_state = NodesCompositeState()\n\n for dependent_on in self.tree.dependent_on:\n node_b = self.find_counterpart_in(dependent_on)\n\n if node_b is None:\n # special case when counterpart tree has no proce...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }