query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
@param GetResponseEvent $event
@throws ClientAccessDeniedHttpException | [
"public function handle(GetResponseEvent $event)\n {\n $request = $event->getRequest();\n if ($this->securityContext->getToken() instanceof TokenInterface && $this->securityContext->getToken()->isAuthenticated()) {\n return;\n }\n\n if (!($accessToken = $request->get('acces... | [
"public function execute($request)\n {\n RequestNotSupportedException::assertSupports($this, $request);\n $this->logger->info(\"Ecommpay order #{$request->getFirstModel()->getOrder()->getNumber()} have paid\");\n throw new HttpResponse('OK');\n }"
] | codesearchnet | {
"query": "Represent the description about PHP:",
"pos": "Represent the code about PHP:",
"neg": "Represent the code about Software development:"
} |
// LoadDump clears all data and loads dump file to db | [
"func (l *Ledis) LoadDump(r io.Reader) (*DumpHead, error) {\n\tl.wLock.Lock()\n\tdefer l.wLock.Unlock()\n\n\tvar err error\n\tif err = l.flushAll(); err != nil {\n\t\treturn nil, err\n\t}\n\n\trb := bufio.NewReaderSize(r, 4096)\n\n\th := new(DumpHead)\n\n\tif err = h.Read(rb); err != nil {\n\t\treturn nil, err\n\t}... | [
"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 sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
show error message for user
@param {Error} error | [
"function showError(error) {\n console.error(logSymbols.error, \"Error\");\n console.error(`${error.message}\\n`);\n console.error(logSymbols.error, \"Stack trace\");\n console.error(error.stack);\n}"
] | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Adds all event handlers from another container into this one. Existing event handlers will be overwritten.
@param container [Module] A module that `extend`s {EventContainer} from which the handlers will be added. | [
"def include_events(container)\n handlers = container.instance_variable_get '@event_handlers'\n return unless handlers\n\n @event_handlers ||= {}\n @event_handlers.merge!(handlers) { |_, old, new| old + new }\n end"
] | [
"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 text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
// Write implements net.Conn.Write(b []byte) | [
"func (f *Conn) Write(b []byte) (n int, err error) {\n\tlength := len(b)\n\n\tif uint(length) > f.MaxFrameSize {\n\t\treturn 0, ErrFrameTooLarge\n\t}\n\tswitch f.PrefixLength {\n\tcase 1:\n\t\terr = binary.Write(f.Conn, f.Endianess, uint8(length))\n\tcase 2:\n\t\terr = binary.Write(f.Conn, f.Endianess, uint16(lengt... | [
"func (c *conn) Read() (pdu.Body, error) {\n\treturn pdu.Decode(c.r)\n}"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Combination of #check() and #reset(). | [
"def check_and_reset(self, value=None):\n \n\n if self.check():\n self.reset(value)\n return True\n return False"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
@private
See `FileTreeViewModel.moveMarker` | [
"function _moveMarker(treeData, markerName, oldPath, newPath) {\n var objectPath;\n\n if (newPath) {\n objectPath = _filePathToObjectPath(treeData, newPath);\n }\n\n var newTreeData = treeData;\n\n if (oldPath && oldPath !== newPath) {\n var lastObjectPath = ... | [
"public static List<ListViewColumn> createDefaultInitialColumnList(Class<? extends View> context) {\n return createDefaultInitialColumnList(DescriptorVisibilityFilter.applyType(context, ListViewColumn.all()));\n }"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Return the value for an option from the context if the option
or `--all` is given, else return None. | [
"def from_like_context(ctx, param, value):\n \"\"\"\"\"\"\n if ctx.obj and ctx.obj.get(\"like\") and (value == \"like\" or ctx.obj.get(\"all_like\")):\n return ctx.obj[\"like\"][param.name]\n else:\n return None"
] | [
"def generate(options, command: nil)\n # First, enable `always_trace`, to show the stack trace\n always_trace!\n\n used_switches = []\n options.each do |option|\n next if option.description.to_s.empty? # \"private\" options\n next unless option.display_in_shell\n\n short_swi... | codesearchnet | {
"query": "Represent the text about Software Engineering:",
"pos": "Represent the code about Software Engineering:",
"neg": "Represent the code:"
} |
// GetImageEntrypoint returns an empty entrypoint | [
"func (f *FakeDocker) GetImageEntrypoint(image string) ([]string, error) {\n\treturn f.GetImageEntrypointResult, f.GetImageEntrypointError\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:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
---------------------- EVENTS ---------------------- | [
"function ( e ) {\n\n //if( this.isSelect ) return;\n\n var name = this.testZone( e );\n\n if( name === '' ) return false;\n\n\n this.current = name;\n this.isDown = true;\n\n this.prev = { x:e.clientX, y:e.clientY, d:0, v: this.isNumber ? parseFloat(this.value) : parseFloa... | [
"protected function prepareResponseHeaders()\n {\n $this->getResponse(true)->headers->set('Content-Type', 'text/html');\n $this->getResponse()->setCharset('utf-8');\n\n\n // FIX FOR IE SESSION COOKIE\n // CAO IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\n //... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about PHP programming:"
} |
Determine how many bytes can be read out of C{fObj} (assuming it is not
modified from this point on). If the determination cannot be made,
return C{UNKNOWN_LENGTH}. | [
"def _determineLength(self, fObj):\n \n try:\n seek = fObj.seek\n tell = fObj.tell\n except AttributeError:\n return UNKNOWN_LENGTH\n originalPosition = tell()\n seek(0, self._SEEK_END)\n end = tell()\n seek(originalPosition, self._SE... | [
"def seek(self, offset, whence=SEEK_SET):\n \n # A nice trick is to (ab)use BytesIO.seek() to go to the desired position for easier calculation.\n # This will not add any data to the buffer however - very convenient!\n self.data.seek(offset, whence)\n new_pos = self.data.tell()\n ... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software Development:"
} |
Parse query error.
@param string $query
@return array | [
"private function parseQueryError(string $query): array\n {\n $return = ['sql_state' => null, 'code' => null, 'message' => 'Unknown error.'];\n if ($error = error_get_last()) {\n $error = explode(\"\\n\", $error['message']);\n // search for sql state\n preg_match('~... | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the Github sentence about PHP:",
"pos": "Represent the Github code about PHP:",
"neg": "Represent the Github code about programming:"
} |
// Broadcast a transaction and waits for a response from the mempool. Transactions to BroadcastTx will block during
// various mempool operations (managed by Tendermint) including mempool Reap, Commit, and recheckTx. | [
"func (trans *Transactor) CheckTxSync(ctx context.Context, txEnv *txs.Envelope) (*txs.Receipt, error) {\n\ttrans.logger.Trace.Log(\"method\", \"CheckTxSync\",\n\t\tstructure.TxHashKey, txEnv.Tx.Hash(),\n\t\t\"tx\", txEnv.String())\n\t// Sign unless already signed\n\tunlock, err := trans.MaybeSignTxMempool(txEnv)\n\... | [
"func (bcR *BlockchainReactor) AddPeer(peer p2p.Peer) {\n\tmsgBytes := cdc.MustMarshalBinaryBare(&bcStatusResponseMessage{bcR.store.Height()})\n\tif !peer.Send(BlockchainChannel, msgBytes) {\n\t\t// doing nothing, will try later in `poolRoutine`\n\t}\n\t// peer is added to the pool once we receive the first\n\t// b... | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Software development:"
} |
Stores a new Statement instance with the given configuration
@param string $query
@param \eMapper\Reflection\ClassProfile $entity
@param string $asList | [
"protected function saveStatement($query, ClassProfile $entity, $asList = true) {\n\t\t//fetched columns depend on the entity used\n\t\t//setting a result map avoids getting imcomplete results\n\t\t$config = array_merge(['map.result' => $this->entity, 'map.type' => $asList ? $this->buildListExpression($entity) : $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 Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// GetWeight returns the weight between a given source and
// target neuron (counted from 1). | [
"func (n *Network) GetWeight(src, target int) float64 {\n\tsrc--\n\ttarget--\n\treturn n.weights.At(target, src)\n}"
] | [
"def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys ... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Generates the random walks which will be used as the skip-gram input.
:return: List of walks. Each walk is a list of nodes. | [
"def parallel_generate_walks(d_graph, global_walk_length, num_walks, cpu_num, sampling_strategy=None,\n num_walks_key=None, walk_length_key=None, neighbors_key=None, probabilities_key=None,\n first_travel_key=None, quiet=False):\n \n\n walks = list()\n\n\n... | [
"def _default_hparams():\n \"\"\"\"\"\"\n return hparam.HParams(\n # Use this parameter to get comparable perplexity numbers with different\n # tokenizations. This value should be set to the ratio of the number of\n # tokens in the test set according to the tokenization used to the number\n #... | codesearchnet | {
"query": "Represent the description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Remove downloaded packages | [
"def delete_package(path, packages):\n \n if _meta_.del_all in [\"on\", \"ON\"]:\n for pkg in packages:\n os.remove(path + pkg)"
] | [
"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:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
读取Excel为Map的列表<br>
Map表示一行,标题为key,单元格内容为value
@param headerRowIndex 标题所在行,如果标题行在读取的内容行中间,这行做为数据将忽略
@param startRowIndex 起始行(包含,从0开始计数)
@param endRowIndex 读取结束行(包含,从0开始计数)
@return Map的列表 | [
"public List<Map<String, Object>> read(int headerRowIndex, int startRowIndex, int endRowIndex) {\r\n\t\tcheckNotClosed();\r\n\t\t// 边界判断\r\n\t\tfinal int firstRowNum = sheet.getFirstRowNum();\r\n\t\tfinal int lastRowNum = sheet.getLastRowNum();\r\n\t\tif (headerRowIndex < firstRowNum) {\r\n\t\t\tthrow new IndexOutO... | [
"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 summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about text processing:"
} |
Parse the XPath Selector expression.
@param selector
@throws InvalidXPathSyntaxException | [
"private void parseSelector(String selector) throws InvalidXPathSyntaxException\n {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())\n tc.entry(cclass,\n \"parseSelector\",\n \"selector: \" + selector); \n // Set the locationStep to -1\n locationStep = ... | [
"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 text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Documentation:"
} |
@
#.draw
@comp DOM
@kind Method
@private
@sign public this .draw(void)
Updates the CSS properties of the node to draw on the stage. | [
"function() {\n var style = this._element.style,\n coord = this.__coord || [0, 0, 0, 0],\n co = {\n x: coord[0],\n y: coord[1],\n w: coord[2],\n h: coord[3]\n },\n prefix = Crafty.support.prefix,\n ... | [
"function ready(bounds, elem) {\n form.scope(\"item\", elem ); // initiate the scope which uses the svg dom as parent node\n space.bindMouse();\n space.play();\n}"
] | codesearchnet | {
"query": "Represent the Github post about writing:",
"pos": "Represent the Github code about writing:",
"neg": "Represent the Github code about Programming:"
} |
Answers true if the object is disabled within the template.
@return boolean | [
"public function isDisabled()\n {\n if ($page = $this->getCurrentPage(Page::class)) {\n \n if ($this->getLevel()) {\n return parent::isDisabled();\n }\n \n }\n \n return 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 Github post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
// intersectsLatEdge reports whether the edge AB intersects the given edge of constant
// latitude. Requires the points to have unit length. | [
"func intersectsLatEdge(a, b Point, lat s1.Angle, lng s1.Interval) bool {\n\t// Unfortunately, lines of constant latitude are curves on\n\t// the sphere. They can intersect a straight edge in 0, 1, or 2 points.\n\n\t// First, compute the normal to the plane AB that points vaguely north.\n\tz := Point{a.PointCross(b... | [
"def gaussian_window(t, params):\n \n window = suspect.basis.gaussian(t, 0, 0, params[\"line_broadening\"])\n\n # the above gaussian function returns an area 1 fid, for a windowing\n # function we need to be area preserving (first point must be 1)\n return window / window[0]"
] | codesearchnet | {
"query": "Represent the Github post about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about Software development:"
} |
Get callable resolver
@return CallbackResolverInterface|null | [
"public function getCallbackResolver()\n {\n if (! $this->callbackResolver instanceof CallbackResolverInterface) {\n $this->callbackResolver = new CallbackResolver($this);\n }\n\n return $this->callbackResolver;\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 description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Generate set of operations need to change column. We are expecting that column constrains
will be dropped separately.
@param DriverInterface $driver
@param AbstractColumn $initial
@return array | [
"public function alterOperations(DriverInterface $driver, AbstractColumn $initial): array\n {\n $operations = [];\n\n $currentType = [\n $this->type,\n $this->size,\n $this->precision,\n $this->scale,\n $this->nullable,\n ];\n\n $... | [
"@Override\n public AccessPlan fromView(XsStringVal schema, XsStringVal view) {\n return new AccessPlanSubImpl(this, \"op\", \"from-view\", new Object[]{ schema, view });\n }"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Initializes the sparkline component with the given width and height
@param WIDTH
@param HEIGHT | [
"private void init(final int WIDTH, final int HEIGHT) {\n if (WIDTH <= 1 || HEIGHT <= 1) {\n return;\n }\n\n final double CORNER_RADIUS = WIDTH > HEIGHT ? (HEIGHT * 0.095) : (WIDTH * 0.095);\n if (recreateImages) {\n if (sparkLineBackgroundImage != null) {\n ... | [
"function get_margin_width()\n {\n //ignore image width, use same width as on predefined bullet ListBullet\n //for proper alignment of bullet image and text. Allow image to not fitting on left border.\n //This controls the extra indentation of text to make room for the bullet image.\n ... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Get the value for ReturnConsumedCapacity from provided value | [
"def _default_capacity(self, value):\n \n if value is not None:\n return value\n if self.default_return_capacity or self.rate_limiters:\n return INDEXES\n return NONE"
] | [
"@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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Instead of calling the annotation methods directly, we peer inside the proxy and investigate the array of
AnnotationMember objects stored by the AnnotationFactory. | [
"private static DatabaseFieldConfig buildConfig(DatabaseField databaseField, String tableName, Field field)\n\t\t\tthrows Exception {\n\t\tInvocationHandler proxy = Proxy.getInvocationHandler(databaseField);\n\t\tif (proxy.getClass() != annotationFactoryClazz) {\n\t\t\treturn null;\n\t\t}\n\t\t// this should be an ... | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
return a set of coding and non-coding transcript_ids from a GTF | [
"def get_coding_noncoding_transcript_ids(gtf):\n \n coding_gtf = partition_gtf(gtf, coding=True)\n coding_db = get_gtf_db(coding_gtf)\n coding_ids = set([x['transcript_id'][0] for x in coding_db.all_features()\n if 'transcript_id' in x.attributes])\n noncoding_gtf = partition_gtf(gtf... | [
"def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated... | codesearchnet | {
"query": "Represent the Github comment about Text processing:",
"pos": "Represent the Github code about Text processing:",
"neg": "Represent the Github code:"
} |
Close the hub connection | [
"def shutdown(self):\n ''\n log.info(\"shutting down\")\n self._peer.go_down(reconnect=False, expected=True)"
] | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the Github post about Computer Networking:",
"pos": "Represent the Github code about Computer Networking:",
"neg": "Represent the Github code about programming:"
} |
Uses the spectral type to lookup an approximate absolute magnitude for
the star. | [
"def estimateAbsoluteMagnitude(spectralType):\n \n\n from .astroclasses import SpectralType\n\n specType = SpectralType(spectralType)\n\n if specType.classLetter == '':\n return np.nan\n elif specType.classNumber == '':\n specType.classNumber = 5 # approximation using mid magnitude val... | [
"def read_description():\n \"\"\"\"\"\"\n try:\n with open(\"README.md\") as r:\n description = \"\\n\"\n description += r.read()\n with open(\"CHANGELOG.md\") as c:\n description += \"\\n\"\n description += c.read()\n return description\n ex... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Returns the value of the EDBObjectEntry for the given key, casted as the given class. Returns null if there is no
element for the given key, or the value for the given key is null. | [
"@SuppressWarnings(\"unchecked\")\n public <T> T getObject(String key, Class<T> clazz) {\n EDBObjectEntry entry = get(key);\n return entry == null ? null : (T) entry.getValue();\n }"
] | [
"def persistent_id(self, obj):\n \"\"\"\"\"\"\n if isinstance(obj, Element):\n # Here, our persistent ID is simply a tuple, containing a tag and\n # a key\n return obj.__class__.__name__, obj.symbol\n else:\n # If obj does not have a persistent ID, re... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Albers Conical Equal Area forward equations--mapping lat,long to x,y
@param Point $p
@return Point $p | [
"public function forward($p)\r\n {\r\n $lon = $p->x;\r\n $lat = $p->y;\r\n\r\n $this->sin_phi = sin($lat);\r\n $this->cos_phi = cos($lat);\r\n\r\n // NOTE: qsfnz() only takes two parameters, so the third will be ignored.\r\n // Is this ther correct function to use here?\... | [
"def ystep(self):\n \n \"\"\"\n\n self.Y = self.Pcn(self.AX + self.U)"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Sets a field from the object by Position as specified in the xml schema.
Zero-based.
@param int $pos position in xml schema
@param mixed $value field value
@return $this|\eXpansion\Framework\GameCurrencyBundle\Model\Gamecurrency | [
"public function setByPosition($pos, $value)\n {\n switch ($pos) {\n case 0:\n $this->setId($value);\n break;\n case 1:\n $this->setSenderlogin($value);\n break;\n case 2:\n $this->setReceiverlogin(... | [
"protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }"
] | codesearchnet | {
"query": "Represent the sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Creates and fills a fraud model
@param array $response
@return Fraud | [
"private function _createFraud(array $response)\n {\n $model = new Fraud();\n $model->setId($response['id']);\n $model->setLivemode($response['livemode']);\n $model->setStatus($response['status']);\n $model->setCreatedAt($response['created_at']);\n $model->setUpdatedAt($... | [
"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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Sets the default value for form element - wrapper to $this->_form->setType()
@param HTML_QuickForm_element|string $element
@param int $type | [
"public function set_element_type($element, $type) {\n if ($element instanceof HTML_QuickForm_element) {\n $element = $element->getName();\n }\n $this->_form->setType($element, $type);\n }"
] | [
"public function render($renderer)\n {\n $renderer->setCurrentStyle('footnotenum');\n $renderer->Write($renderer->getCurrentStyleHeight(), $this->numText, $this->addlink); //source link numbers after name\n }"
] | codesearchnet | {
"query": "Represent the summarization about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
The anycast protocol contains no guesses.
@see com.ibm.ws.sib.processor.runtime.SIMPDeliveryStreamSetTransmitControllable#containsGuesses() | [
"public boolean containsGuesses()\n {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) \n SibTr.entry(tc, \"containsGuesses\");\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) \n SibTr.exit(tc, \"containsGuesses\", Boolean.FALSE);\n return false;\n }"
] | [
"def addLocalCacheService(self):\n \"\"\n _cache = self.getCacheService()\n _cache.setName('cache_proxy')\n _cache.setServiceParent(self.hendrix)"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Define text content.
@param string $value
@param array $args
@return Markup instance | [
"public function text($value, ...$args)\n {\n if (sizeof($args)) {\n $value = sprintf($value, ...$args);\n }\n\n if ($this->tag === 'textarea') {\n $value = htmlspecialchars($value);\n }\n parent::text($value);\n\n return $this;\n }"
] | [
"public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
@param object $entity
@return bool | [
"public function isNested($entity)\n {\n if ($nestedDocument = $this->getClassAnnotation($entity, self::DOCUMENT_NESTED_CLASS)) {\n return true;\n }\n\n return false;\n }"
] | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Load a Question from the database. | [
"def question_default_loader(self, pk):\n \"\"\"\"\"\"\n try:\n obj = Question.objects.get(pk=pk)\n except Question.DoesNotExist:\n return None\n else:\n self.question_default_add_related_pks(obj)\n return obj"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Simple ajax call
@param string|null $url
@param string|null $target
@param bool $history increment history if no target specified
@return string | [
"public static function buildJsLink($url, $target = null, bool $history = true, bool $replaceTag = false)\n {\n $targetArg = $target ? ($target[0] === '$' ? \",\" . $target : \",'#\" . $target . \"'\") : '';\n $targetArg .= $replaceTag ? ',1' : '';\n if (!$history || $targetArg) {\n ... | [
"public function insertInsertTagMD( $objPage, $objLayout, $objPageRegular)\n {\n // set vary header for browsers to avoid caching in Proxies for different browsers\n header('Vary: User-Agent', false);\n \n // add mobiledetectioncss class to page css class\n $objPage->cssClass = $... | codesearchnet | {
"query": "Represent the sentence about PHP:",
"pos": "Represent the code about PHP:",
"neg": "Represent the code:"
} |
Returns a RavenHandler
@param array $config An array of config values to use
@param string $title The title/subject to use
@return \Monolog\Handler\RavenHandler | [
"protected static function raven(array $config = [], $title = null){\n $defaults = [\n 'dsn' => null,\n 'level' => Logger::ERROR,\n 'bubble' => true,\n ];\n\n $c = array_merge($defaults, $config);\n\n return new \\Monolog\\Handler\\RavenHandler(\n ... | [
"public function listen($uri, EventHandler $handler, $overRideYamlKey) {\n //CP-2 added this while working on calling listeners during core/components/render call\n //no need to add handlers that will never match our request\n //CP-265 - $overRideYamlKey - render component is the main __YML_KEY... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Start changing light level manually. Direction should be 'up' or 'down | [
"def start_change(self, direction):\n \"\"\"'\"\"\"\n self.logger.info(\"Dimmer %s start_change: %s\", self.device_id, direction)\n\n if direction == 'up':\n level = '01'\n elif direction == 'down':\n level = '00'\n else:\n self.logger.error(\"Dimm... | [
"def do(actor, targets)\n #Acceleration will be limited by elapsed time.\n pull_force = delta\n targets.each do |target|\n #Angle from target to actor is also angle of pull force (opposite of that for push).\n pull_angle = Utility.find_angle(target.location, actor.location)\n #Apply the forc... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
To determine whether the suffix `.tar.gz` or `.tgz` format | [
"def __isValidTGZ(self, suffix):\r\n \"\"\"\"\"\"\r\n if suffix and isinstance(suffix, string_types):\r\n if suffix.endswith(\".tar.gz\") or suffix.endswith(\".tgz\"):\r\n return True\r\n return False"
] | [
"def set_regionfiles(self, filenames):\n \n for filename in filenames:\n # Assume that filenames have the name r.<x-digit>.<z-digit>.<extension>\n m = re.match(r\"r.(\\-?\\d+).(\\-?\\d+).\"+self.extension, os.path.basename(filename))\n if m:\n x = int(m.... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
<code>optional .tensorflow.CollectionDef.FloatList float_list = 4;</code> | [
"public org.tensorflow.framework.CollectionDef.FloatListOrBuilder getFloatListOrBuilder() {\n if (kindCase_ == 4) {\n return (org.tensorflow.framework.CollectionDef.FloatList) kind_;\n }\n return org.tensorflow.framework.CollectionDef.FloatList.getDefaultInstance();\n }"
] | [
"func (m *SchemaItem) ToRawInfo() interface{} {\n\t// ONE OF WRAPPER\n\t// SchemaItem\n\t// {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}\n\tv0 := m.GetSchema()\n\tif v0 != nil {\n\t\treturn v0.ToRawInfo()\n\t}\n\t// {Name:fileSchema Type:FileSchema Strin... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
把坐标位置信息和geohash封装为一个WildGeo对象
@param {Array.<number>} location [latitude, longitude]坐标数组
@param {string} geohash 坐标位置的geohash值
@return {Object} GoeDog对象 | [
"function encodeWildGeoObject(location, geohash) {\n validateLocation(location);\n validateGeohash(geohash);\n return {\n \".priority\": geohash,\n \"g\": geohash,\n \"l\": location\n };\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 post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
上传文件
@param file 上传的文件对象
@param key 上传文件保存的文件名
@param token 上传凭证
@param mime 指定文件mimetype
@param checkCrc 是否验证crc32 | [
"public Response put(File file, String key, String token, StringMap params,\n String mime, boolean checkCrc) throws QiniuException {\n checkArgs(key, null, file, token);\n if (mime == null) {\n mime = Client.DefaultMime;\n }\n params = filterParam(params... | [
"public function info() {\n /**\n * avatar\t用户头像\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\thttps://tfsimg.alipay.com/images/partner/T1k0xiXXRnXXXXXXXX\n nick_name\t用户昵称\tString\t如果没有数据的时候不会返回该数据,请做好容错\t可空\t张三\n province\t省份\tString\t用户注册时填写的省份 如果没有数据的时候不会返回该数据,请做好容错\t可空\t浙江省\n city\t城... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Places the specified Overlay instance on top of all other
Overlay instances.
@method bringToTop
@param {YAHOO.widget.Overlay} p_oOverlay Object representing an
Overlay instance.
@param {String} p_oOverlay String representing the id of an
Overlay instance. | [
"function (p_oOverlay) {\n\n var oOverlay = this.find(p_oOverlay),\n nTopZIndex,\n oTopOverlay,\n aOverlays;\n\n if (oOverlay) {\n\n aOverlays = this.overlays;\n aOverlays.sort(this.compareZIndexDesc);\n\n ... | [
"function(id) {\n this._el = Dom.get(id);\n this.id = Dom.generateId(this._el,\"yui-tv-auto-id-\");\n\n /**\n * When animation is enabled, this event fires when the animation\n * starts\n * @event animStart\n * @type CustomEvent\n * @param {YAHOO.widget.Node}... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Get the node at $idx position in the set, no cache, each call creates new instance.
@param int $idx - index of an element, starts with 0.
@return hQuery_Element | [
"public function eq($idx)\n {\n $i = array_slice($this->ids, $idx, 1, true) or\n $i = array();\n // Create wraper instance for $i\n $o = new self($this->doc, $i);\n return $o;\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 text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Determines the median value of the data set.
@return If the number of elements is odd, returns the middle element.
If the number of elements is even, returns the midpoint of the two
middle elements.
@since 1.0.1 | [
"public final double getMedian()\n {\n assertNotEmpty();\n // Sort the data (take a copy to do this).\n double[] dataCopy = new double[getSize()];\n System.arraycopy(dataSet, 0, dataCopy, 0, dataCopy.length);\n Arrays.sort(dataCopy);\n int midPoint = dataCopy.length / 2;... | [
"def Mean(self):\n \"\"\"\"\"\"\n values = [v for v, _ in self.data if v is not None]\n if not values:\n return None\n\n # TODO(hanuszczak): Why do we return a floored division result instead of\n # the exact value?\n return sum(values) // len(values)"
] | codesearchnet | {
"query": "Represent the Github instruction about Mathematics:",
"pos": "Represent the Github code about Mathematics:",
"neg": "Represent the Github code about Mathematics:"
} |
Get app labels which this handler can treat.
Specified with :attr:`includes` and :attr:`excludes` of this instance.
Returns
-------
set
A set instance of app_label | [
"def get_supported_app_labels(self):\n \n get_app_label = lambda x: x.split(\".\", 1)[0]\n if not hasattr(self, '_app_labels_cache'):\n perms = self.get_supported_permissions()\n self._app_labels_cache = set([get_app_label(x) for x in perms])\n return self._app_labe... | [
"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 post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Evaluate Filesystem changes
@return mixed | [
"public function evaluate()\n {\n $this->tracker->clearChangeSet();\n $this->modified = array();\n\n $inEvents = inotify_read($this->inotify);\n $inEvents = is_array($inEvents) ? $inEvents:array();\n\n foreach($inEvents as $inEvent){\n\n $this->translateEvent($inEven... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
UserDelete deletes a specified user.
@param AuthUserDeleteRequest $argument input argument
@param array $metadata metadata
@param array $options call options
@return UnaryCall | [
"public function UserDelete(AuthUserDeleteRequest $argument,\n $metadata = [], $options = [])\n {\n return $this->_simpleRequest('/etcdserverpb.Auth/UserDelete',\n $argument,\n ['\\Etcdserverpb\\AuthUserDeleteResponse', 'decode'],\n $metadata,... | [
"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 post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
Specify type and directory and it will return array of all files
of a matching type inside that directory. This will work even
if specified directory exists inside multiple locations. | [
"public function searchDir($type, $directory = '')\n {\n $dirs = $this->search($type, $directory, 'path');\n $files = array();\n foreach ($dirs as $dir) {\n $this->_searchDirFiles($dir, $files);\n }\n\n return $files;\n }"
] | [
"def resolveEntryPoint(entryPoint):\n \n if inVirtualEnv():\n path = os.path.join(os.path.dirname(sys.executable), entryPoint)\n # Inside a virtualenv we try to use absolute paths to the entrypoints.\n if os.path.isfile(path):\n # If the entrypoint is present, Toil must have be... | codesearchnet | {
"query": "Represent the text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
`git merge`
@return [String] the output of 'git merge' | [
"def merge(base, opts= {})\n logger.info { \"Merging #{branches.current.name} with #{base}\" }\n args = []\n args << '-s' << opts[:merge_strategy] if opts[:merge_strategy]\n args << base\n return command(:merge, args)\n end"
] | [
"def show(number, full = false)\n request = server.get_request_by_number(number)\n # Determine whether to show full diff or stats only.\n option = full ? '' : '--stat '\n diff = \"diff --color=always #{option}HEAD...#{request.head.sha}\"\n # TODO: Refactor into using Request model.\n p... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Return options from the collection
@param string $filteringOption Can be optionally filtered by one option
@return array | [
"public function getAllOptions($filteringOption = null)\n {\n if (is_null($filteringOption)) {\n return array_values($this->container);\n } else {\n $result = array();\n\n foreach ($this->container as $key => $options) {\n if (isset($options[$filterin... | [
"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 comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
// Get the value of the property with the given name. | [
"func (self Object) Get(name string) (Value, error) {\n\tvalue := Value{}\n\terr := catchPanic(func() {\n\t\tvalue = self.object.get(name)\n\t})\n\tif !value.safe() {\n\t\tvalue = Value{}\n\t}\n\treturn value, err\n}"
] | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Forward the last ``n`` elements from an asynchronous sequence.
If ``n`` is negative, it simply terminates after iterating the source.
Note: it is required to reach the end of the source before the first
element is generated. | [
"async def takelast(source, n):\n \n queue = collections.deque(maxlen=n if n > 0 else 0)\n async with streamcontext(source) as streamer:\n async for item in streamer:\n queue.append(item)\n for item in queue:\n yield item"
] | [
"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 sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about File management:"
} |
Called by each task when it is completed (either successfully, with an error or due to
user cancellation).
@param uploadId the uploadID of the finished task | [
"protected synchronized void taskCompleted(String uploadId) {\n UploadTask task = uploadTasksMap.remove(uploadId);\n uploadDelegates.remove(uploadId);\n\n // un-hold foreground upload ID if it's been hold\n if (isExecuteInForeground() && task != null && task.params.id.equals(foregroundUp... | [
"def finish_parse(self, last_lineno_seen):\n \"\"\"\"\"\"\n if self.state == self.STATES['step_in_progress']:\n # We've reached the end of the log without seeing the final \"step finish\"\n # marker, which would normally have triggered updating the step. As such we\n #... | codesearchnet | {
"query": "Represent the instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Returns the metric name.
@param name the initial metric name
@param type the initial type of the metric.
@return a string the unique metric name | [
"static String generateFullMetricName(String name, String type) {\n return SOURCE + DELIMITER + name + DELIMITER + type;\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 comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Filter map and remove excluded content. | [
"private void filterBranches(final Element root) {\n final QName[][] props = getExtProps(root.getAttribute(ATTRIBUTE_NAME_DOMAINS));\n filterBranches(root, Collections.emptyList(), props);\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 post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// GetMe Call getMe path | [
"func (bot TgBot) GetMe() (User, error) {\n\tbody, err := getPetition(bot.buildPath(\"getMe\"), nil)\n\n\tif err != nil {\n\t\treturn User{}, err\n\t}\n\n\tvar data ResultGetUser\n\tdec := json.NewDecoder(strings.NewReader(body))\n\tdec.Decode(&data)\n\n\tif !data.Ok {\n\t\terrc := 403\n\t\tdesc := \"\"\n\t\tif dat... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
// ResetAll resets all counter values and clears all keys. | [
"func (c *counters) ResetAll() {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tc.counts = make(map[string]*int64)\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 post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Offset to set
@link http://php.net/manual/en/arrayaccess.offsetset.php
@param mixed $offset <p>
The offset to assign the value to.
</p>
@param mixed $value <p>
The value to set.
</p>
@return void
@since 5.0.0 | [
"public function offsetSet($offset, $value)\n {\n list($namespace, $dataKey) = $this->namespaceAndKey($offset);\n\n $prefix = $this->firstKeySegments($dataKey, $this->prefixLength($namespace, $dataKey));\n $arrayKey = $this->arrayKey($dataKey, $prefix);\n\n if (!isset($this->customDat... | [
"function assign($array)\n {\n if (!is_array($array) && !($array instanceof \\Traversable)) {\n throw new \\InvalidArgumentException('$array must be array or Traversable.');\n }\n\n foreach ($array as $key => $value) {\n $this->storage[$key] = $value;\n }\n }"... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Get options from webdav server.
@return array with all header fields returned from webdav server. false if server does not speak http. | [
"function options() {\n $this->header_unset();\n $this->create_basic_request('OPTIONS');\n $this->send_request();\n $this->get_respond();\n $response = $this->process_respond();\n // validate the response ...\n // check http-version\n if ($response['status']['... | [
"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 text about PHP programming:",
"pos": "Represent the Github code about PHP programming:",
"neg": "Represent the Github code about programming:"
} |
// SetAuthorizerCredentials sets the AuthorizerCredentials field's value. | [
"func (s *Authorizer) SetAuthorizerCredentials(v string) *Authorizer {\n\ts.AuthorizerCredentials = &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:"
} |
Deserialise the body of a Request.
@param {String} body
@param {String} bodyType
@returns {Promise} | [
"function remakeBody (body, bodyType) {\n return blobUtil\n .base64StringToBlob(body)\n .then(function (blob) {\n switch (bodyType) {\n case BodyTypes.ARRAY_BUFFER:\n return blobUtil.blobToArrayBuffer(blob)\n case BodyTypes.BLOB:\n return blob\n case BodyTypes.FORM... | [
"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 Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Documentation:"
} |
Rounds a bandit variable by selecting the closest point in the domain
Closest here is defined by euclidian distance
Assumes an 1d array of the same length as the single variable value | [
"def round(self, value_array):\n \n distances = np.linalg.norm(np.array(self.domain) - value_array, axis=1)\n idx = np.argmin(distances)\n return [self.domain[idx]]"
] | [
"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 about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Return all possible paths to find view files in order
@param string|null $plugin Optional plugin name to scan for view files.
@param bool $cached Set to false to force a refresh of view paths. Default true.
@return array paths | [
"protected function _paths($plugin = null, $cached = true)\n {\n if ($cached === true) {\n if ($plugin === null && !empty($this->_paths)) {\n return $this->_paths;\n }\n if ($plugin !== null && isset($this->_pathsForPlugin[$plugin])) {\n retur... | [
"public function initializeArguments()\n {\n $this->registerArgument('path', 'string', 'Location of the resource, can be either a path relative to the Public resource directory of the package or a resource://... URI', false, null);\n $this->registerArgument('package', 'string', 'Target package key.... | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Convert value to the correct format for display.
@param string $value Field value.
@param array $options Field options.
@param bool $js Return formatted from jQuery UI format? (only for custom formats).
@return string
@since 2.7.0 | [
"public function format_value_display( $value, $options, $js = false ) {\n\n\t\tif ( 'custom' !== pods_v( static::$type . '_type', $options, 'format' ) ) {\n\t\t\t$js = false;\n\t\t}\n\t\t$format = $this->format_datetime( $options, $js );\n\t\tif ( $js ) {\n\t\t\t$format = $this->convert_format( $format, array( 'so... | [
"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 comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Add a Menu item
@api
@param Control $item Item Control in the Menu bar
@param Control $control Toggled Menu Control
@param bool $isStartElement (optional) Whether the Menu should start with this Element
@return static | [
"public function addItem(Control $item, Control $control, $isStartElement = false)\n {\n $menuElement = new MenuElement($item, $control);\n $this->addElement($menuElement, $isStartElement);\n return $this;\n }"
] | [
"function() {\n inputEx.TypeField.superclass.initEvents.call(this); \n \n // \"Toggle the properties panel\" button :\n Event.addListener(this.button, 'click', this.onTogglePropertiesPanel, this, true);\n \n // Prevent the button to receive a \"click\" event if the propertyPanel doesn'... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
puts an object back into the pool for recycling
@param object
the pooled object
@return true on success, false if pool is full | [
"public boolean put(T object) {\n if (object == null) {\n throw new IllegalArgumentException(\"returning null object to pool\");\n }\n\n while (true) {\n // 1. get the index of the next free cell\n int g = m_get.get();\n int p = m_put.get();\n ... | [
"def do_threaded_dispatch(participant, msg)\n\n msg = Rufus::Json.dup(msg)\n #\n # the thread gets its own copy of the message\n # (especially important if the main thread does something with\n # the message 'during' the dispatch)\n\n # Maybe at some point a limit on the number... | codesearchnet | {
"query": "Represent the Github sentence about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
Adds a key value pair to the end of the
header. Duplicates are allowed | [
"public synchronized void add(String k, String v) {\n grow();\n keys[nkeys] = k;\n values[nkeys] = v;\n nkeys++;\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 summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Sets given row to the selected state.
@method selectRow
@param row {HTMLElement | String | YAHOO.widget.Record | Number} HTML element
reference or ID string, Record instance, or RecordSet position index. | [
"function(row) {\n var oRecord, elRow;\n\n if(row instanceof YAHOO.widget.Record) {\n oRecord = this._oRecordSet.getRecord(row);\n elRow = this.getTrEl(oRecord);\n }\n else if(lang.isNumber(row)) {\n oRecord = this.getRecord(row);\n elRow = this.getTrEl(oRecord);\n }\n ... | [
"function Entry (content, name, parent) {\n if (!(this instanceof Entry)) return new Entry(content, name, parent);\n\n this._parent = parent; // parent can be a Document or ArrayField\n this._schema = parent._schema; // the root Document\n this._name = name; // the field name supplied by the user\n this._hidde... | codesearchnet | {
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Check if the given user can be impersonated.
@param \Arcanedev\LaravelImpersonator\Contracts\Impersonatable $impersonater
@param \Arcanedev\LaravelImpersonator\Contracts\Impersonatable $impersonated
@return bool | [
"public function canBeImpersonatedPolicy(Impersonatable $impersonater, Impersonatable $impersonated)\n {\n return $this->canImpersonatePolicy($impersonater) && $impersonated->canBeImpersonated();\n }"
] | [
"protected function registerBindings()\n {\n $this->app->bind(\n \\LaravelFlare\\Flare\\Contracts\\Permissions\\Permissionable::class,\n \\Flare::config('permissions')\n );\n }"
] | codesearchnet | {
"query": "Represent the Github comment about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code:"
} |
stream handler to apply further gulp plugins
@param {Object} stream gulp file stream
@return {Object} processed stream | [
"function streamHandler(stream) {\n return stream\n .pipe(plumber())\n .pipe(sourcemaps.init({loadMaps: true}))\n .pipe(sourcemaps.write('.', {includeContent: true, sourceRoot: '.'}))\n .pipe(gulp.dest(dest));\n }"
] | [
"function logentriesJsonStream(pathname, query={}) {\n query = Object.assign({}, query);\n\n // Force query format to JSON.\n query.format = 'json';\n\n // Parse each array entry from raw stream and emit JSON objects.\n return pump(logentriesRawStream(pathname, query), JSONStream.parse('*'));\n}"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Search the index with a query.
Can at most return 10'000 results from a search. If the search would yield more than 10'000 hits, only the first 10'000 are returned.
The default number of hits returned is 100. | [
"def search(self, query=None, size=100, unpack=True):\n \n logging.info('Download all documents from index %s.', self.index)\n if query is None:\n query = self.match_all\n results = list()\n data = self.instance.search(index=self.index, doc_type=self.doc_type, body=quer... | [
"public static function getRankingQueryLimit()\n {\n $configGeneral = Config::getInstance()->General;\n $configLimit = $configGeneral['archiving_ranking_query_row_limit'];\n $limit = $configLimit == 0 ? 0 : max(\n $configLimit,\n $configGeneral['datatable_archiving_maxi... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Find the user by their email address.
This method does not require authentication.
@param email
The email address
@return The User
@throws FlickrException | [
"public User findByEmail(String email) throws FlickrException {\r\n Map<String, Object> parameters = new HashMap<String, Object>();\r\n parameters.put(\"method\", METHOD_FIND_BY_EMAIL);\r\n\r\n parameters.put(\"find_email\", email);\r\n\r\n Response response = transportAPI.get(transportA... | [
"def _unlinkUser(self):\n \n KEY = \"linked_contact_uid\"\n\n # Nothing to do if no user is linked\n if not self.hasUser():\n return False\n\n user = self.getUser()\n username = user.getId()\n\n # Unset the UID from the User Property\n user.setMembe... | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Processes transition.
@param name the name of transition. | [
"public void signal(String name) throws UnknownTransitionException {\n\n // check that start state defined\n if (start == null) {\n throw new IllegalStateException(\"The start sate is not defined\");\n }\n\n // check that end state defined\n if (end == null) {\n ... | [
"def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\""
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
prepare the query for the rest api | [
"def _toedn(self):\n \n finds = u\"\"\n inputs = u\"\"\n wheres = u\"\"\n args = []\n \": in and args\"\n for a,b in self._input:\n inputs += \" {0}\".format(a)\n args.append(dump_edn_val(b))\n if inputs:\n inputs = u\":in ${0}\".format(inputs)\n \" :where \"\n for wh... | [
"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:"
} |
Child element or child spirit of type.
@param @optional {function} type Spirit constructor
@returns {Element|gui.Spirit} | [
"function(type) {\n\t\t\tvar result = this.spirit.element.firstElementChild;\n\t\t\tif (type) {\n\t\t\t\tresult = this.children(type)[0] || null;\n\t\t\t}\n\t\t\treturn result;\n\t\t}"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
[NOT IMPLEMENTED]
:raises NotImplementedError: because it isn't | [
"def get_prior(self, twig=None, **kwargs):\n \n raise NotImplementedError\n kwargs['context'] = 'prior'\n return self.filter(twig=twig, **kwargs)"
] | [
"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 description:",
"pos": "Represent the code:",
"neg": "Represent the code about N/A:"
} |
Auto Generated Code | [
"def fcoe_get_interface_output_fcoe_intf_list_fcoe_intf_tx_disc_unsol_adv(self, **kwargs):\n \n config = ET.Element(\"config\")\n fcoe_get_interface = ET.Element(\"fcoe_get_interface\")\n config = fcoe_get_interface\n output = ET.SubElement(fcoe_get_interface, \"output\")\n ... | [
"public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }"
] | codesearchnet | {
"query": "Represent the sentence about Natural Language Processing:",
"pos": "Represent the code about Natural Language Processing:",
"neg": "Represent the code about File management:"
} |
method to compile a Smarty template
@param mixed $_content template source
@return bool true if compiling succeeded, false if it failed | [
"protected function doCompile($_content)\n {\n /* here is where the compiling takes place. Smarty\n tags in the templates are replaces with PHP code,\n then written to compiled files. */\n // init the lexer/parser to compile the template\n $this->lex = new $this->lexer_clas... | [
"public function _setAttributes($attributes)\n {\n if (is_array($attributes)) {\n foreach ($attributes as $attribute => $value) {\n $this->{$attribute} = $value;\n }\n\n return $this;\n }\n\n //@todo: put real exception here cos exception' gon ... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Transitive closure. | [
"public void transitiveClosure() {\n IntBitRelation next;\n\n while (true) {\n next = new IntBitRelation(getMax());\n next.composeRightLeft(this, this);\n if (contains(next)) {\n return;\n }\n addAll(next);\n }\n }"
] | [
"def property_(getter: Map[Domain, Range]) -> property:\n \n return property(map_(WeakKeyDictionary())(getter))"
] | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Public : Return the columns attribute of the ReportRequest as a valid Hash for SOAP requests
Author:: jlopezn@neonline.cl
keys_case - specifies the keys_case for the hash: :underscore or :camelcase
Returns:: Hash | [
"def columns_to_hash(valid_columns, columns, keys_case=:underscore)\n\t\t\traise Exception.new(\"Invalid time value: nil\") if columns.nil?\n\t\t\t\n\t\t\tkey = self.class.to_s.demodulize.gsub(/ReportRequest/, 'ReportColumn')\n\t\t\treturn { key => \n\t\t\t\t\tcolumns.map do |col|\n\t\t\t\t\t\tif col.is_a?(String)\... | [
"def attributes_properties(**options)\n options_set = Set.new options.keys.map(&:to_s)\n\n unless options_set.subset? Set.new(@fields)\n fail \"You have to provide correct attribute names in\" +\n \"'attributes_properties' for '#{@model}'.\"\n end\n\n # TODO: Check for valid v... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Creates new KubernetesClient builder.
@return | [
"@SuppressWarnings(\"unchecked\")\n public static ClientServerEndpointBuilder<KubernetesClientBuilder, KubernetesClientBuilder> kubernetes() {\n return new ClientServerEndpointBuilder(new KubernetesClientBuilder(), new KubernetesClientBuilder()) {\n @Override\n public EndpointBuilder... | [
"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 summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
{@inheritdoc}
@throws \RuntimeException If Client failed to fetch data | [
"public function getStatuses()\n {\n if (!$this->response) {\n $this->response = $this->prepareRequest()->send();\n }\n\n if (200 !== $this->response->getStatusCode()) {\n throw new \\RuntimeException(sprintf('Client faild with \"%s\". Status: \"%s\"', $this->feedUrl , ... | [
"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 comment about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Programming:"
} |
Format the phone number in our very special and customized manner.
@param string $date
@return string | [
"public static function format($phone)\n {\n // Since we are a US-based application, we want to strip the \"+1\" US country code to facilitate formatting below\n if (substr($phone, 0, 3) == '+1 ') {\n $phone = str_replace('+1 ', '', $phone);\n }\n\n // US numbers will have ... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// isCoordinator is true if this node is the coordinator. | [
"func (c *cluster) isCoordinator() bool {\n\tc.mu.RLock()\n\tdefer c.mu.RUnlock()\n\treturn c.unprotectedIsCoordinator()\n}"
] | [
"public void away (ClientObject caller, String message)\n {\n BodyObject body = _locator.forClient(caller);\n // we modify this field via an invocation service request because a body object is not\n // modifiable by the client\n body.setAwayMessage(message);\n }"
] | codesearchnet | {
"query": "Represent the instruction about Networking:",
"pos": "Represent the code about Networking:",
"neg": "Represent the code about Software development:"
} |
If img is set to have the same height as the view, it will overflow horizontally. | [
"function cropHorizontally( img ) {\n var zoom = this.height / img.height;\n var x = 0;\n if( this.cropping == 'body' ) {\n x = 0.5 * (this.width - img.width * zoom);\n }\n else if( this.cropping == 'tail' ) {\n x = this.width - img.width * zoom;\n }\n draw.call( this, img, x, 0, zoom );\n}"
] | [
"function CssStage(opts) {\n this.constructor.super_.call(this, opts);\n\n this._loader = new HtmlImageLoader(this);\n\n this._domElement = document.createElement('div');\n\n setAbsolute(this._domElement);\n setFullSize(this._domElement);\n\n // N.B. the CSS stage requires device adaptation to be configured t... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Make a find ref request.
@param {Session} session - the session
@param {number} offset - the offset of where to jump from | [
"function requestFindReferences(session, offset) {\n var response = requestFindRefs(session, session.editor.document, offset);\n\n if (response && response.hasOwnProperty(\"promise\")) {\n response.promise.done(handleFindRefs).fail(function () {\n result.rejec... | [
"function NDDBIndex(idx, nddb) {\n // The name of the index.\n this.idx = idx;\n // Reference to the whole nddb database.\n this.nddb = nddb;\n // Map indexed-item to a position in the original database.\n this.resolve = {};\n // List of all keys in `resolve` object.... | codesearchnet | {
"query": "Represent the instruction about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
Download artwork and save it to artwork.png. | [
"async def artwork_save(self):\n \"\"\"\"\"\"\n artwork = await self.atv.metadata.artwork()\n if artwork is not None:\n with open('artwork.png', 'wb') as file:\n file.write(artwork)\n else:\n print('No artwork is currently available.')\n re... | [
"def help_func():\n \n tprint(\"art\")\n tprint(\"v\" + VERSION)\n print(DESCRIPTION + \"\\n\")\n print(\"Webpage : http://art.shaghighi.ir\\n\")\n print(\"Help : \\n\")\n print(\" - list --> (list of arts)\\n\")\n print(\" - fonts --> (list of fonts)\\n\")\n print(\" - test -... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Create an instance of the local adapter.
@param array $config
@return \yuncms\filesystem\Filesystem | [
"public function createLocalAdapter(array $config)\n {\n $permissions = $config['permissions'] ?? [];\n $root = Yii::getAlias($config['root']);\n\n $links = ($config['links'] ?? null) === 'skip'\n ? LocalAdapter::SKIP_LINKS\n : LocalAdapter::DISALLOW_LINKS;\n\n r... | [
"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 description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Декодирование unicode-заменители в символы
@param $str
@return mixed | [
"static function special_unicode_to_utf8($str)\n {\n $str = preg_replace('#\\\\\\/#', '/', $str);\n return preg_replace_callback(\"/\\\\\\u([[:xdigit:]]{4})/i\", function($matches){\n $ewchar = $matches[1];\n $binwchar = hexdec($ewchar);\n $wchar = chr(($binwchar >>... | [
"final protected function v($name = null) {return dfak($this, function() {\n\t\t$result = dfa($this->_data, 'value', []);\n\t\t/**\n\t\t * 2016-06-29\n\t\t * Что интересно, при смене области действия настроек с глобальной на другую (сайт или магазин)\n\t\t * поле «value» может почему-то содержать не массив,\n\t\t *... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Object initialization
Params:
+values+ :vector of values | [
"def hierarchical_clusterization_2d(no_clusters = 0, distance_method = 0,\n vec = @values, debug = false)\n clusters = []\n\n if vec.length == 1\n hash = { vec[0] => 1 }\n cluster = PairCluster.new(hash)\n clusters.push(cluster)\n clusters\... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the summarization about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
// https://github.com/google/skylark/blob/master/doc/spec.md#string·startswith
// https://github.com/google/skylark/blob/master/doc/spec.md#string·endswith | [
"func string_startswith(fnname string, recv_ Value, args Tuple, kwargs []Tuple) (Value, error) {\n\tvar x Value\n\tvar start, end Value = None, None\n\tif err := UnpackPositionalArgs(fnname, args, kwargs, 1, &x, &start, &end); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// compute effective substring.\n\ts := strin... | [
"function getUrl(version = current) {\n\tconst name = `native-ext-v${version}-${os}-${arch}.${ext}`;\n\treturn `https://github.com/NiklasGollenstede/native-ext/releases/download/v${version}/`+ name;\n}"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Do the coordinator-only part of the restore. | [
"def _restore_coordinator(self):\n \"\"\"\"\"\"\n # Start by ensuring that the speaker is paused as we don't want\n # things all rolling back when we are changing them, as this could\n # include things like audio\n transport_info = self.device.get_current_transport_info()\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 text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Atomically decrements by one the current value.
@return the updated value | [
"public BigInteger decrementAndGet() {\n for (;;) {\n \tBigInteger current = get();\n \tBigInteger next = current.subtract(BigInteger.ONE);\n if (compareAndSet(current, next))\n return next;\n }\n }"
] | [
"private void addRawProbabilistic(final long rawValue) {\n // p(w): position of the least significant set bit (one-indexed)\n // By contract: p(w) <= 2^(registerValueInBits) - 1 (the max register value)\n //\n // By construction of pwMaxMask (see #Constructor()),\n // lsb(pwM... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Performs the binary operation on the supplied values.
@param mixed $left
@param string $operator
@param mixed $right
@return mixed
@throws PinqException | [
"public static function doBinaryOperation($left, $operator, $right)\n {\n if (self::$binaryOperations === null) {\n self::$binaryOperations = [\n self::BITWISE_AND => function ($l, $r) { return $l & $r; },\n self::BITWISE_OR => fu... | [
"public static function ExpectRetrievedValueIsString(\n string $property,\n $value,\n string $class_name\n ) : string {\n /**\n * @psalm-var T\n */\n $value = static::MaybeThrowIfNotType($property, $value, $class_name, 'string');\n\n return $value;\n }"
... | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
Set relay state. | [
"def write_switch(self, module_address, state, callback_fn):\r\n \"\"\"\"\"\"\r\n _LOGGER.info(\"write_switch: setstate,{},{}{}\"\r\n .format(module_address, str(state), chr(13)))\r\n self.subscribe(\"state,\" + module_address, callback_fn)\r\n self.send(\"setstate,{}... | [
"def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.