query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
// updateMinDistance computes the distance from a point X to a line segment AB, // and if either the distance was less than the given minDist, or alwaysUpdate is // true, the value and whether it was updated are returned.
[ "func updateMinDistance(x, a, b Point, minDist s1.ChordAngle, alwaysUpdate bool) (s1.ChordAngle, bool) {\n\tif d, ok := interiorDist(x, a, b, minDist, alwaysUpdate); ok {\n\t\t// Minimum distance is attained along the edge interior.\n\t\treturn d, true\n\t}\n\n\t// Otherwise the minimum distance is to one of the en...
[ "public double compare(String v1, String v2) {\n // FIXME: it should be possible here to say that, actually, we\n // didn't learn anything from comparing these two values, so that\n // probability is set to 0.5.\n\n if (comparator == null)\n return 0.5; // we ignore properties with no comparator\n\...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Fit Preprocessing to X. Parameters ---------- sequence : array-like, [sequence_length, n_features] A multivariate timeseries. y : None Ignored Returns ------- self
[ "def fit(self, X, y=None):\n \n return self.partial_fit(np.concatenate(X, axis=0))" ]
[ "def arg_to_array(func):\n \n def fn(self, arg, *args, **kwargs):\n \"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tuple\n Arguments.\n **kwargs : dict\n Keyword arguments.\n\n Ret...
codesearchnet
{ "query": "Represent the Github summarization about Natural Language Processing:", "pos": "Represent the Github code about Natural Language Processing:", "neg": "Represent the Github code about programming:" }
@typedef {Object} Renderer @property {any} engine @property {(e: any, s: string, l: any, o: any) => string} render @this {webpack.loader.LoaderContext} @param {string|((s: string, l: any, o: any) => string)} eng @returns {Renderer}
[ "function getRenderer(eng) {\n if (!eng) {\n throw new Error(\n NAME + ': option \"engine\" must be a non-zero-length string or a function')\n }\n\n if (typeof eng === 'function') {\n return {\n engine: null,\n render: customRenderFn.call(this, eng)\n }\n }\n\n try {\n var engine = r...
[ "function _fn (context, object) {\n return context.customElement(_name, _attributes, _fnBody, context, object);\n }" ]
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Returns true if the specified processor must be created to process XML.
[ "private boolean isProcessXMLNeeded(InjectionProcessorProvider<?, ?> provider)\n {\n final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();\n if (isTraceOn && tc.isEntryEnabled())\n Tr.entry(tc, \"isProcessXMLNeeded: \" + provider);\n\n List<Class<? extends JNDIEnvironmen...
[ "@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 description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// Drag drag the mouse
[ "func Drag(x, y int, args ...string) {\n\tvar button C.MMMouseButton = C.LEFT_BUTTON\n\n\tcx := C.size_t(x)\n\tcy := C.size_t(y)\n\n\tif len(args) > 0 {\n\t\tbutton = CheckMouse(args[0])\n\t}\n\n\tC.drag_mouse(cx, cy, button)\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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Programming:" }
**************************************************************
[ "public OutputStream extractData(\n final ClientHttpResponse response\n )\n throws IOException\n {\n IoUtil.copy( response.getBody(), _output );\n\n return _output;\n }" ]
[ "function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD...
codesearchnet
{ "query": "Represent the summarization about N/A:", "pos": "Represent the code about N/A:", "neg": "Represent the code:" }
<p>Adds provided {@link ApolloCall} that is currently in progress.</p> <p><b>Note</b>: This method needs to be called right before an apolloCall is executed.</p>
[ "void registerCall(@NotNull ApolloCall call) {\n checkNotNull(call, \"call == null\");\n Operation operation = call.operation();\n if (operation instanceof Query) {\n registerQueryCall((ApolloQueryCall) call);\n } else if (operation instanceof Mutation) {\n registerMutationCall((ApolloMutation...
[ "private void removeContext(final String contextID) {\n\n synchronized (this.contextStack) {\n\n if (!contextID.equals(this.contextStack.peek().getIdentifier())) {\n throw new IllegalStateException(\"Trying to close context with id `\" + contextID +\n \"`. But the top context has id `\" +\...
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Returns the subdirectory in `userdata` which acts as the root of the user-specific filesystem in Steam (aka all user-specific files are stored under this directory)
[ "def user_specific_data_directory(user_context):\n \"\"\"\"\"\"\n return os.path.join(\n user_context.steam.userdata_directory,\n user_context.user_id\n )" ]
[ "def _unzip_file(filepath):\n \n\n temp_dir = tempfile.mkdtemp()\n\n if os.name == 'posix':\n os.chmod(temp_dir, 0o755)\n\n LOG.info(\"Decompressing %s\", filepath)\n\n unzip(filepath, temp_dir)\n\n # The directory that Python returns might have symlinks. The Docker File sharing settings wi...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Convert a key into a property name. @param key The property key. @return A camel case property name.
[ "function getName(key) {\n if(key == '_') return key;\n if(this.conf.transform) {\n if(typeof(this.conf.transform.name) == 'function') {\n return this.conf.transform.name.call(this, key);\n }\n }\n if(this.conf.prefix) {\n key = key.replace(this.conf.prefix + '_', '');\n }\n // guard against sil...
[ "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 comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Handles COMMIT command: Commits specified transaction.
[ "def commit(self, frame):\n \n if not frame.transaction:\n raise ProtocolError(\"Missing transaction for COMMIT command.\")\n\n if not frame.transaction in self.engine.transactions:\n raise ProtocolError(\"Invalid transaction: %s\" % frame.transaction)\n\n for tfram...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Parse TableStyle object @param node [Nokogiri::XML:Element] node to parse @return [TableStyle] result of parsing
[ "def parse(node)\n node.attributes.each do |key, value|\n case key\n when 'styleId'\n @id = value.value.to_s\n when 'styleName'\n @name = value.value.to_s\n when 'val'\n @value = value.value.to_s\n end\n end\n\n node.xpath('*').each do |st...
[ "def parseLines(self):\n \"\"\"\"\"\"\n inAst = parse(''.join(self.lines), self.inFilename)\n # Visit all the nodes in our tree and apply Doxygen tags to the source.\n self.visit(inAst)" ]
codesearchnet
{ "query": "Represent the Github summarization about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Displays messages in this message display The CSS class of each message is determined by the message being displayed.
[ "public function display()\n {\n if (!$this->visible) {\n return;\n }\n\n if ($this->getMessageCount() === 0) {\n return;\n }\n\n parent::display();\n\n $wrapper_div = new SwatHtmlTag('div');\n $wrapper_div->id = $this->id;\n $wrapper_...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Expand an adpod placement into a set of request objects according to the total adpod duration and the range of duration seconds. Sets minduration/ maxduration video property according to requireExactDuration configuration
[ "function createAdPodRequest(tags, adPodBid) {\n const { durationRangeSec, requireExactDuration } = adPodBid.mediaTypes.video;\n\n const numberOfPlacements = getAdPodPlacementNumber(adPodBid.mediaTypes.video);\n const maxDuration = utils.getMaxValueFromArray(durationRangeSec);\n\n const tagToDuplicate = tags.fi...
[ "def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
从Session中读取用户信息 {@inheritDoc} @see \asbamboo\security\user\token\UserTokenInterface::getUser()
[ "public function getUser(): UserInterface\n {\n $serialize_user = $this->Session->get($this->session_key);\n if($serialize_user){\n $user = unserialize($serialize_user);\n }else{\n // 如果用户没有登录,session标记为未登录用户\n $user = new AnonymousUse...
[ "public function initServices() {\n $this->getFrontController()->getRequestHandler()->addService($entityService = $this->getEntityService());\n \n // wir mappen den users controller auf den in Psc\n $entityService->setControllerClass('User', 'Psc\\CMS\\Controller\\UserEntityController');\n }" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Initializer of pager objects from request query parameters. @param Request $request @throws PagerOverrideException
[ "public function initialize(Request $request)\n {\n // prevent reinit\n if (!$this->request) {\n $this->request = $request;\n $pagers = $this->decodeHttpQuery();\n // prevent pager override\n if (array_intersect_key($pagers, $this->pagers)) {\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the text about PHP:", "pos": "Represent the code about PHP:", "neg": "Represent the code:" }
Determines whether this plugin is active. This plugin is only active if TensorBoard sampled any text summaries. Returns: Whether this plugin is active.
[ "def is_active(self):\n \n if not self._multiplexer:\n return False\n\n if self._index_cached is not None:\n # If we already have computed the index, use it to determine whether\n # the plugin should be active, and if so, return immediately.\n if any(self._index_cached.values()):\n ...
[ "function(terria) {\n CatalogMember.call(this, terria);\n\n this._enabledDate = undefined;\n this._shownDate = undefined;\n this._loadForEnablePromise = undefined;\n this._lastLoadInfluencingValues = undefined;\n\n // The catalog item to show in the Now Viewing when this item is enabled, instead of this item....
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Set up the courses grades data for the report. @param bool $studentcoursesonly Only show courses that the user is a student of. @return array of course grades information
[ "public function setup_courses_data($studentcoursesonly) {\n global $USER, $DB;\n\n $coursesdata = array();\n $numusers = $this->get_numusers(false);\n\n foreach ($this->courses as $course) {\n if (!$course->showgrades) {\n continue;\n }\n\n ...
[ "protected function showsTopParentsOnly()\n {\n $relation = $this->getModelInformation()->list->default_top_relation;\n\n // If the default is to restrict to top-level only,\n // or the reverse with a user-initiated reversal (relation = false):\n // Restrict the query to top level.\n\...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
Returns the string representation of the code that reads a primitive array property. @param ref The reference. @param source The type of the reference. @param property The property to read. @return The code.
[ "private static String readPrimitiveArrayProperty(String ref, TypeDef source, Property property) {\n StringBuilder sb = new StringBuilder();\n Method getter = getterOf(source, property);\n sb.append(\"Arrays.asList(\")\n .append(ref).append(\".\").append(getter.getName()).append(\"(...
[ "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 post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "public String convertIfcDuctSegmentTypeEnumToString(EDataType eDataType, Object instanceValue) {\r\n\t\treturn instanceValue == null ? null : instanceValue.toString();\r\n\t}" ]
[ "protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license...
codesearchnet
{ "query": "Represent the description about Text generation:", "pos": "Represent the code about Text generation:", "neg": "Represent the code:" }
Read bits and interpret as a big-endian signed int.
[ "def _readintbe(self, length, start):\n \"\"\"\"\"\"\n if length % 8:\n raise InterpretError(\"Big-endian integers must be whole-byte. \"\n \"Length = {0} bits.\", length)\n return self._readint(length, start)" ]
[ "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 Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
/* * Start The DHCP Server */
[ "func (s *Server) ListenAndServe() error {\n\tvar err error\n\n\tconnection, err := net.ListenPacket(\"udp4\", s.laddr.String())\n\tif err != nil {\n\t\tlog.Printf(\"Debug: Error Returned From ListenPacket On \\\"%s\\\" Because of \\\"%s\\\"\\n\", s.laddr.String(), err.Error())\n\t\treturn err\n\t}\n\ts.connection ...
[ "@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 instruction:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Randomly shuffle the elements in a list @param <E> the type of elements in this list. @param list a list of objects to shuffle.
[ "public static <E> void shuffle(List<E> list) {\n int swapPlace = -1;\n \n for(int i = 0; i < list.size(); i++) { \n swapPlace = (int) (Math.random() * (list.size() - 1));\n TrivialSwap.swap(list, i, swapPlace);\n }\n\t}" ]
[ "function () {\n __objCount++;\n /**\n * Counter to be used as an index in each map. Is incremented each time a new entry is added to the object.\n * @protected\n * @type Number\n */\n this._nextIndex = 0;\n /**\n ...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
@param SqlWalker $sqlWalker @return string
[ "public function getSql(SqlWalker $sqlWalker)\n {\n return sprintf(\"CAST(%s AS %s)\",\n $this->first->dispatch($sqlWalker),\n $this->second\n );\n }" ]
[ "@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Visualizes halogen bonds.
[ "def show_halogen(self):\n \"\"\"\"\"\"\n grp = self.getPseudoBondGroup(\"HalogenBonds-%i\" % self.tid, associateWith=[self.model])\n grp.lineWidth = 3\n for i in self.plcomplex.halogen_bonds:\n b = grp.newPseudoBond(self.atoms[i[0]], self.atoms[i[1]])\n b.color = s...
[ "def getPostStates(self):\n '''\n \n '''\n self.aNrmNow = self.mNrmNow - self.cNrmNow\n self.aLvlNow = self.aNrmNow*self.pLvlNow # Useful in some cases to precalculate asset level\n return None" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
/* Extends AbstractProcessingItem
[ "@Override\n\tprotected ProcessingItem addInputStream(Stream inputStream, PartitioningScheme scheme) {\n\t\tSamzaSystemStream stream = ((SamzaStream) inputStream).addDestination(new StreamDestination(this,this.getParallelism(),scheme));\n\t\tthis.inputStreams.add(stream);\n\t\treturn this;\n\t}" ]
[ "@Override\n public void perform() throws PortalException {\n // push the change into the PLF\n if (nodeId.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) {\n // remove the parm edit\n ParameterEditManager.removeParmEditDirective(nodeId, name, person);\n }\n // pu...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Фильтр: диапазон чисел @param $form_field @param $label @param null $db_field
[ "function addFilterRangeNumeric($form_field, $label, $db_field = null) {\r\n if(!$db_field) {\r\n $db_field = $form_field;\r\n }\r\n $gr = $this->form->putTbGroup($form_field)\r\n ->setLabel($label);\r\n $gr->putTbInt('from')\r\n ->setLabel('С')\r\n ...
[ "private function nameFull() {return dfc($this, function() {return\n\t\t$this->isTop()\n\t\t? df_trim_text_right($this->getName(), '[value]')\n\t\t// Анонимные филдсеты не добавляют своё имя в качестве префикса имён полей.\n\t\t: (!$this->_anonymous ? $this->getId() : $this->_parent->nameFull())\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// NewDefaultRoleBinding creates a new controller
[ "func NewDefaultRoleBindingsController(roleBindingInformer rbacinformers.RoleBindingInformer, namespaceInformer coreinformers.NamespaceInformer, roleBindingClient rbacclient.RoleBindingsGetter) *DefaultRoleBindingController {\n\tc := &DefaultRoleBindingController{\n\t\troleBindingClient: roleBindingClient,\n\n\t\tr...
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Handle a new update. Fetches new data from the client, then compares it to the previous lookup. Returns: (bool, new_data): whether changes occurred, and the new value.
[ "def handle(self, client, subhooks=()):\n \n new_data = self.fetch(client)\n\n # Holds the list of updated fields.\n updated = {}\n\n if not subhooks:\n # We always want to compare to previous values.\n subhooks = [self.name]\n\n for subhook in subhook...
[ "def reflect_filter(sources, model, cache=None):\n '''\n '''\n targets = [reflect(source, model, cache=cache) for source in sources]\n # Some objects may not be available in target DB (not published), so we\n # have to exclude None from the list.\n return [target for target in targets if target is...
codesearchnet
{ "query": "Represent the Github instruction about Data processing:", "pos": "Represent the Github code about Data processing:", "neg": "Represent the Github code about programming:" }
The actor's main work loop
[ "def _run(self):\n ''''''\n \n while self._is_running:\n yield from self._task()\n\n # Signal that the loop has finished.\n self._run_complete.set_result(True)" ]
[ "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 Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Checks if the unit is an SCV that is currently building.
[ "def is_constructing_scv(self) -> bool:\n \n return self.orders and self.orders[0].ability.id in {\n AbilityId.TERRANBUILD_ARMORY,\n AbilityId.TERRANBUILD_BARRACKS,\n AbilityId.TERRANBUILD_BUNKER,\n AbilityId.TERRANBUILD_COMMANDCENTER,\n AbilityId...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// This is the thread that handles our real clone class // Constructor for the clone class. Note that we create // the pipe that connects our frontend to the // backend agent:
[ "func New() (clone *Clone) {\n\tclone = &Clone{}\n\tclone.pipe, _ = zmq.NewSocket(zmq.PAIR)\n\tpipename := fmt.Sprint(\"inproc://pipe\", pipe_nmb)\n\tpipe_nmb++\n\tclone.pipe.Bind(pipename)\n\tgo clone_agent(pipename)\n\treturn\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 description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Replace existing cls.reset() method with a new one which also calls reset() on any clones.
[ "def add_new_reset_method(cls):\n \n orig_reset = cls.reset\n\n def new_reset(self, seed=None):\n logger.debug(f\"Calling reset() on {self} (seed={seed})\")\n orig_reset(self, seed)\n for c in self._dependent_generators:\n c.reset_dependent_generator(seed)\n return se...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Construct a model.QuerySpec from model.MapperSpec.
[ "def _get_query_spec(cls, params):\n \"\"\"\"\"\"\n entity_kind = params[cls.ENTITY_KIND_PARAM]\n filters = params.get(cls.FILTERS_PARAM)\n app = params.get(cls._APP_PARAM)\n ns = params.get(cls.NAMESPACE_PARAM)\n\n return model.QuerySpec(\n entity_kind=cls._get_raw_entity_kind(entity_kind)...
[ "def property_(getter: Map[Domain, Range]) -> property:\n \n return property(map_(WeakKeyDictionary())(getter))" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Marshall the given parameter object.
[ "public void marshall(TimerStartedEventAttributes timerStartedEventAttributes, ProtocolMarshaller protocolMarshaller) {\n\n if (timerStartedEventAttributes == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMars...
[ "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 post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Retrieve foreign keys for the table @param string $table @return array
[ "public function getFks($table): array\n\t{\n\t\t$returnRows = [];\n\n\t\tforeach(parent::getFks($table) as $row)\n\t\t{\n\t\t\t$returnRows[] = [\n\t\t\t\t'child_column' => $row['from'],\n\t\t\t\t'parent_table' => $row['table'],\n\t\t\t\t'parent_column' => $row['to'],\n\t\t\t\t'update' => $row['on_update'],\n\t\t\t...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the sentence about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
// MigrateServices provides a mock function with given fields: ctx, request
[ "func (_m *FacadeInterface) MigrateServices(ctx datastore.Context, request dao.ServiceMigrationRequest) error {\n\tret := _m.Called(ctx, request)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(datastore.Context, dao.ServiceMigrationRequest) error); ok {\n\t\tr0 = rf(ctx, request)\n\t} else {\n\t\tr0 = ret.Error...
[ "@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 summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
Pluck an array of values from an array. @param array $array @param string $value @param string $key @return array
[ "public static function pluck( $array, $value, $key = NULL )\r\n {\r\n $result = [ ];\r\n\r\n foreach ( $array as $item )\r\n {\r\n $itemValue = is_object( $item ) ? $item->{$value} : $item[ $value ];\r\n\r\n if ( is_null( $key ) )\r\n {\r\n $r...
[ "public function getDetail($name)\n {\n Assert::oneOf($name, array_keys($this->details), 'ParsedKey::getDetail() expected one of: %2$s. Got: %s');\n\n return $this->details[$name];\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about PHP programming:" }
getPomm Return the Pomm instance. @access protected @return Pomm @throws CliException
[ "protected function getPomm()\n {\n if ($this->pomm === null) {\n if (!file_exists($this->config_file)) {\n throw new CliException(sprintf(\"Could not load configuration '%s'.\", $this->config_file));\n }\n\n $this->pomm = require $this->config_file;\n\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 aGrantRequest)\n throw new exContainerInvalidServiceType('Invalid Plugi...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Set the {@link FaultMessageResolver} to use. @param faultMessageResolver the fault message resolver to use @return a new builder instance. @see WebServiceTemplate#setFaultMessageResolver(FaultMessageResolver)
[ "public WebServiceTemplateBuilder setFaultMessageResolver(\n\t\t\tFaultMessageResolver faultMessageResolver) {\n\t\treturn new WebServiceTemplateBuilder(this.detectHttpMessageSender,\n\t\t\t\tthis.interceptors,\n\t\t\t\tappend(this.internalCustomizers,\n\t\t\t\t\t\tnew FaultMessageResolverCustomizer(faultMessageRes...
[ "@SneakyThrows\n public BaseHttpServletRequestXMLMessageDecoder getInstance(final HttpMethod method) {\n val decoder = get(method);\n return (BaseHttpServletRequestXMLMessageDecoder) BeanUtils.cloneBean(decoder);\n }" ]
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:" }
Display usefull stats about the workers. Note: The workers status is conveniently stored by ResqueStatus. @return void @see ResqueStatus\ResqueStatus::isSchedulerWorker() @see ResqueStatus\ResqueStatus::getPausedWorker()
[ "public function stats()\n {\n $ResqueStatus = $this->ResqueStatus;\n\n $workers = CakeResque::getWorkers();\n\n // List of all queues\n $queues = array_unique(CakeResque::getQueues());\n\n // List of queues monitored by a worker\n $activeQueues = [];\n foreach ($...
[ "protected function loadCronBatch(\\Gems_Task_TaskRunnerBatch $batch)\n {\n $batch->addMessage(sprintf($this->_(\"Starting %s mail jobs\"), $this->project->getName()));\n $batch->addTask('Mail\\\\AddAllMailJobsTask');\n\n // Check for unprocessed tokens, \n $tracker = $this->loader->getT...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Set the debugging flag. @param debugF The new debug setting.
[ "public void setDebug(boolean debugF) {\r\n this.debug = debugF;\r\n if (this.tarIn != null) {\r\n this.tarIn.setDebug(debugF);\r\n } else if (this.tarOut != null) {\r\n this.tarOut.setDebug(debugF);\r\n }\r\n }" ]
[ "def Call(self, Id=0):\n \n o = Call(self, Id)\n o.Status # Test if such a call exists.\n return o" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Several button type property values are not allowed
[ "function isForbiddenType(sType) {\n\t\t\t\tvar aTypes = [ButtonType.Up, ButtonType.Back, ButtonType.Unstyled];\n\t\t\t\treturn aTypes.indexOf(sType) !== -1;\n\t\t\t}" ]
[ "function (element) {\n $.data(element, \"velocity\", {\n /* Store whether this is an SVG element, since its properties are retrieved and updated differently than standard HTML elements. */\n isSVG: Type.isSVG(element),\n /* Keep track of whether the element i...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Check if the server is reachable @param baseUrl The url of the server to test @param connectTimeout connection timeout @param timeUnit connection timeout unit @return true if reachable otherwise false. @throws IOException if an error occurs
[ "public static boolean isServerReachable(String baseUrl, long connectTimeout, TimeUnit timeUnit) throws IOException {\n OkHttpClient client = new OkHttpClient();\n client.setConnectTimeout(connectTimeout, timeUnit);\n return isServerReachable(baseUrl, client);\n }" ]
[ "function ClientState(client) {\n\n /**\n * The associated client instance.\n *\n * @property client\n * @type Client\n */\n this.client = client;\n\n /**\n * The time (in milliseconds) to wait before the next request\n * may be sent to the API; this value is only updated upon\n * reception of a ...
codesearchnet
{ "query": "Represent the description about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
Pass through to provider SequenceRuleLookupSession.use_comparative_sequence_rule_view
[ "def use_comparative_sequence_rule_view(self):\n \"\"\"\"\"\"\n self._object_views['sequence_rule'] = COMPARATIVE\n # self._get_provider_session('sequence_rule_lookup_session') # To make sure the session is tracked\n for session in self._get_provider_sessions():\n try:\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 text:", "pos": "Represent the code:", "neg": "Represent the code:" }
@param string $assetType @param string $assetHandle @return Asset
[ "public function getAsset($assetType, $assetHandle)\n {\n return isset($this->assets[$assetType][$assetHandle]) ? $this->assets[$assetType][$assetHandle] : null;\n }" ]
[ "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 Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Collects all the information contained in the concurrent R structures in every context and returns a single R structure with all their content. @return R
[ "public R getRelationships() {\n R r = new R(factory.getTotalConcepts(), factory.getTotalRoles());\n \n // Collect subsumptions from context index\n for (IntIterator it = contextIndex.keyIterator(); it.hasNext();) {\n int key = it.next();\n Context ctx = contextInde...
[ "public LHS toLHS( CallStack callstack, Interpreter interpreter)\n throws EvalError\n {\n // loosely typed map expression new {a=1, b=2} are treated\n // as non assignment (LHS) to retrieve Map.Entry key values\n // then wrapped in a MAP_ENTRY type LHS for value assignment.\n r...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Creates an unmodifiable view of a SortedSet. @param self a SortedSet @return an unmodifiable view of the SortedSet @see java.util.Collections#unmodifiableSortedSet(java.util.SortedSet) @see #asUnmodifiable(java.util.List) @since 2.5.0
[ "public static <T> SortedSet<T> asUnmodifiable(SortedSet<T> self) {\n return Collections.unmodifiableSortedSet(self);\n }" ]
[ "@ReplacedBy(\"com.google.common.collect.Iterators#concat() or com.google.common.collect.Iterables#concat()\")\n public static <T> Iterator<T> getMetaIterator (Iterable<Iterator<T>> metaIterable)\n {\n return new MetaIterator<T>(metaIterable);\n }" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Create the underlying widget.
[ "def create_widget(self):\n \n d = self.declaration\n self.widget = WebView(self.get_context(), None, d.style)" ]
[ "def surface(self, canvas, X, Y, Z, color=None, label=None, **kwargs):\n \n raise NotImplementedError(\"Implement all plot functions in AbstractPlottingLibrary in order to use your own plotting library\")" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Determine if the provided value length is less or equal to a specific value. Usage: '<index>' => 'max_len,240' @param string $field @param array $input @param null $param @return mixed
[ "protected function validate_max_len($field, $input, $param = null)\n {\n if (!isset($input[$field])) {\n return;\n }\n\n if (function_exists('mb_strlen')) {\n if (mb_strlen($input[$field]) <= (int) $param) {\n return;\n }\n } else {\n ...
[ "protected function _matchColumnString($column)\n {\n $matches = [];\n if (!preg_match('/^([\\w\\.]+)(:(\\w*))?(:(.*))?$/', $column, $matches)) {\n throw new InvalidConfigException(\\Yii::t('skeeks/cms',\n \"Invalid column configuration for '{column}'. The column must be s...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software Development:" }
Find the longest suffix among the ones specified and perform the required action.
[ "def replace_suffixes_2(self, word):\n \n has_vowel = False\n\n if word.endswith('eed'):\n if len(word) >= self.r1:\n word = word[:-3] + 'ee'\n return word\n\n elif word.endswith('eedly'):\n if len(word) >= self.r1:\n word = ...
[ "def _calculate_index_of_coincidence(frequency_map, length):\n \n if length <= 1:\n return 0\n # We cannot error here as length can legitimiately be 1.\n # Imagine a ciphertext of length 3 and a key of length 2.\n # Spliting this text up and calculating the index of coincidence res...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Set the last modified time to the current time @return bool Success status
[ "public function touch()\n\t{\n\t\t$data = $this->cache->get($this->name);\n\n\t\tif ($data !== false)\n\t\t{\n\t\t\treturn $this->cache->set($this->name, $data, MEMCACHE_COMPRESSED, (int) $this->options['extras']['timeout']);\n\t\t}\n\n\t\treturn false;\n\t}" ]
[ "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 comment about NLP:", "pos": "Represent the code about NLP:", "neg": "Represent the code about programming:" }
The module in which the Global is defined. Python equivalent of the CLIPS defglobal-module command.
[ "def module(self):\n \n modname = ffi.string(lib.EnvDefglobalModule(self._env, self._glb))\n defmodule = lib.EnvFindDefmodule(self._env, modname)\n\n return Module(self._env, defmodule)" ]
[ "public LHS toLHS( CallStack callstack, Interpreter interpreter)\n throws EvalError\n {\n // loosely typed map expression new {a=1, b=2} are treated\n // as non assignment (LHS) to retrieve Map.Entry key values\n // then wrapped in a MAP_ENTRY type LHS for value assignment.\n r...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
// newCall creates a *Call. It requires the method type in order to support // unexported methods.
[ "func newCall(t TestHelper, receiver interface{}, method string, methodType reflect.Type, args ...interface{}) *Call {\n\tt.Helper()\n\n\t// TODO: check arity, types.\n\tmargs := make([]Matcher, len(args))\n\tfor i, arg := range args {\n\t\tif m, ok := arg.(Matcher); ok {\n\t\t\tmargs[i] = m\n\t\t} else if arg == n...
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// CreateLink creates a new child Link under the Domain
[ "func (o *Domain) CreateLink(child *Link) *bambou.Error {\n\n\treturn bambou.CurrentSession().CreateChild(o, child)\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Ensures that expired and not yet released resources are not returned by default.<p>
[ "private void ensureExpiration() {\n\n boolean expirationDateSet = false;\n boolean releaseDateSet = false;\n if (getFilterQueries() != null) {\n for (String fq : getFilterQueries()) {\n if (fq.startsWith(CmsSearchField.FIELD_DATE_EXPIRED + \":\")) {\n ...
[ "func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}" ]
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
// SetErrorMessage sets the ErrorMessage field's value.
[ "func (s *Workspace) SetErrorMessage(v string) *Workspace {\n\ts.ErrorMessage = &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 description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Writer that keeps track of when it hasn't seen a newline yet, will auto-insert newlines except when lines start with a carriage return.
[ "@Override\n public void write(char[] cbuf, int off, int len) throws IOException {\n if(len <= 0) {\n return;\n }\n // if we havn't last seen a newline, and don't get a CR, insert a newline.\n if(charsSinceNewline > 0) {\n if(cbuf[off] != CARRIAGE_RETURN) {\n super.write(NEWLINEC, 0, N...
[ "def DocToHelp(doc):\n \"\"\"\"\"\"\n\n # Get rid of starting and ending white space. Using lstrip() or even\n # strip() could drop more than maximum of first line and right space\n # of last line.\n doc = doc.strip()\n\n # Get rid of all empty lines.\n whitespace_only_line = re.compile('^[ \\t]+$', re.M)\n ...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Returns (datetime, tz offset in minutes) or (None, None).
[ "def parse_datetime(s): #source: http://stackoverflow.com/questions/2211362/how-to-parse-xsddatetime-format\n \"\"\"\"\"\"\n m = re.match(r\"\"\" ^\n (?P<year>-?[0-9]{4}) - (?P<month>[0-9]{2}) - (?P<day>[0-9]{2})\n T (?P<hour>[0-9]{2}) : (?P<minute>[0-9]{2}) : (?P<second>[0-9]{2})\n (?P<m...
[ "def _results(r):\n \"\"\"\n x, funcalls, iterations, flag = r\n return results(x, funcalls, iterations, flag == 0)" ]
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Override _clone to preserve additional information needed by MultilingualModelQuerySet.
[ "def _clone(self, klass=None, **kwargs):\n \n clone = super(MultilingualModelQuerySet, self)._clone(klass, **kwargs)\n clone._default_language = getattr(self, '_default_language', None)\n return clone" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
@param array $variables { @var string $full_name @var string $first @var string $last }
[ "protected function addRecipient(string $headerName, string $address, array $variables): self\n {\n $compiledAddress = $this->parseAddress($address, $variables);\n\n if ('h:reply-to' === $headerName) {\n $this->message[$headerName] = $compiledAddress;\n } elseif (isset($this->mess...
[ "public function init()\n {\n // Get options\n $filter_slug = $this->currentPage;\n\n // Check sections\n if (!empty($this->options['sections']) && is_array($this->options['sections'])) {\n foreach ($this->options['sections'] as $sectionSlug => $sectionName) {\n ...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// NewIntFlag creates a new IntFlag
[ "func NewIntFlag(fl cli.IntFlag) *IntFlag {\n\treturn &IntFlag{IntFlag: fl, set: nil}\n}" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
===========================================================================
[ "@Override\n\tpublic void visitArrayAccess(Expr.ArrayAccess expr, Boolean consumed) {\n\t\tvisitExpression(expr.getFirstOperand(),false);\n\t\tvisitExpression(expr.getSecondOperand(),false);\n\t\tif(!consumed) {\n\t\t\texpr.setMove();\n\t\t}\n\t}" ]
[ "def closeEvent(self, event):\n \n\n self.save_config(self.gui_settings['gui_settings'])\n self.script_thread.quit()\n self.read_probes.quit()\n event.accept()\n\n print('\\n\\n======================================================')\n print('================= Closin...
codesearchnet
{ "query": "Represent the Github text about language and writing:", "pos": "Represent the Github code about language and writing:", "neg": "Represent the Github code:" }
// WriteTo is not currently implemented on this platform.
[ "func (p *packetConn) WriteTo(b []byte, addr net.Addr) (int, error) {\n\treturn 0, ErrNotImplemented\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 text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
document : selection_set fragment_list
[ "def p_document_shorthand_with_fragments(self, p):\n \n p[0] = Document(definitions=[Query(selections=p[1])] + p[2])" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns the body's real scrollTop, discarding any window banding in Safari. @return {number}
[ "function() {\n Garnish.getBodyScrollTop._scrollTop = document.body.scrollTop;\n\n if (Garnish.getBodyScrollTop._scrollTop < 0) {\n Garnish.getBodyScrollTop._scrollTop = 0;\n }\n else {\n Garnish.getBodyScrollTop._maxScrollTop = Garnish.$bod.outerHeight() - Garnish....
[ "function (v) {\n this._scrollDistance = Math.max(0, Math.min(this._getMaxScrollDistance(), v));\n // Mark that the scroll distance has changed so that after the view is checked, the CSS\n // transformation can move the header.\n this._scrollDistanceChanged = true;\n ...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Get returns the response corresponding to key if present.
[ "func (c cache) Get(key string) (resp []byte, ok bool) {\n\titem, err := redis.Bytes(c.Do(\"GET\", cacheKey(key)))\n\tif err != nil {\n\t\treturn nil, false\n\t}\n\treturn item, true\n}" ]
[ "function (err, collection) {\n if (err) {\n return callback(err);\n }\n\n // ensure that the collection option is present before starting a run\n if (!_.isObject(collection)) {\n return callback(new Error(COLLECTION_L...
codesearchnet
{ "query": "Represent the sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Set default field value @return void
[ "protected function setDefaultValue() : void\n {\n if (empty($this->defaultOptions['default'])) {\n return;\n }\n\n // If we have a default value from configuration, pass it through\n // processing for magic/dynamic values like dates and usernames.\n $eventName = (st...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
<p>Make other entries include reversing if it's need when save.</p> @param pAddParam additional param @param pEntity entity @param pRequestData Request Data @param pIsNew if entity was new @throws Exception - an exception
[ "@Override\n public final void makeOtherEntries(final Map<String, Object> pAddParam,\n final BeginningInventory pEntity, final IRequestData pRequestData,\n final boolean pIsNew) throws Exception {\n String actionAdd = pRequestData.getParameter(\"actionAdd\");\n if (\"makeAccEntries\".equals(actionAdd...
[ "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 summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
// Setup prepares the Requester for benchmarking.
[ "func (r *redisRequester) Setup() error {\n\tconn, err := redis.Dial(\"tcp\", r.url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.conn = conn\n\treturn nil\n}" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Creates a new websocket servlet context handler. @param webSocketHandlers webSocketHandlers @param webSocketIdleTimeoutMillis webSocketIdleTimeoutMillis @return a new websocket servlet context handler or 'null' if creation failed.
[ "public static ServletContextHandler create(Map<String, WebSocketHandlerWrapper> webSocketHandlers,\n Optional<Integer> webSocketIdleTimeoutMillis) {\n ServletContextHandler webSocketServletContextHandler = null;\n if (webSocketHandlers != null) {\n ...
[ "@Override\n\tpublic synchronized void addConnector(Connector connector) {\n\n if( log.isDebugEnabled() ) {\n log.debug(\"Adding connector (\" + connector.getInfo() + \")\");\n }\n\n // Make sure we have a Container to send requests to\n if (engines.length < 1)\n th...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Manually triggers synchronization of all stored `WebAclRule` objects with the Fedora. @see setAutocommit()
[ "public function save() {\n foreach ($this->resRules as $i) {\n $i->save($this->res->getAclUrl());\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 text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
>>> message = "SOS" >>> _encode_to_binary_string(message, on='1', off='0') '101010001110111011100010101' >>> message = " SOS" >>> _encode_to_binary_string(message, on='1', off='0') '0000000101010001110111011100010101'
[ "def _encode_to_binary_string(message, on, off):\n \n def to_string(i, s):\n if i == 0 and s == off:\n return off * 4\n return s\n return ''.join(to_string(i, s) for i, s in enumerate(_encode_binary(message, on=on, off=off)))" ]
[ "private function formatInformation($matrix_content, $fi_x, $fi_y)\n {\n $mask_number = $this->getMaskNumber($matrix_content);\n\n $format_information_value = (($this->getEccCharacter() << 3) | $mask_number);\n $format_information_array = [\n \"101010000010010\", \"101000100100...
codesearchnet
{ "query": "Represent the instruction about Python programming:", "pos": "Represent the code about Python programming:", "neg": "Represent the code about programming:" }
one-line classes don't get a suite in the parse tree so we add one to normalize the tree
[ "def fixup_parse_tree(cls_node):\n \n for node in cls_node.children:\n if node.type == syms.suite:\n # already in the preferred format, do nothing\n return\n\n # !%@#! oneliners have no suite node, we have to fake one up\n for i, node in enumerate(cls_node.children):\n ...
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
// RawScan implements the RawKV interface.
[ "func (mvcc *MVCCLevelDB) RawScan(startKey, endKey []byte, limit int) []Pair {\n\tmvcc.mu.Lock()\n\tdefer mvcc.mu.Unlock()\n\n\titer := mvcc.db.NewIterator(&util.Range{\n\t\tStart: startKey,\n\t}, nil)\n\n\tvar pairs []Pair\n\tfor iter.Next() && len(pairs) < limit {\n\t\tkey := iter.Key()\n\t\tvalue := iter.Value()...
[ "@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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
creates the tab buttons (which are radio buttons)
[ "def _create_buttons\n $log.debug \"XXX: INSIDE create_buttons col_offset #{@col_offset} \"\n v = Variable.new\n r = @button_row # @row + 1\n col = @col + @col_offset\n @tabs.each_with_index { |t, i| \n txt = t.text\n @buttons << TabButton.new(nil) do \n variable v\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 text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Parses a MSIE Cache File (MSIECF) file-like object. Args: parser_mediator (ParserMediator): mediates interactions between parsers and other components, such as storage and dfvfs. file_object (dfvfs.FileIO): file-like object.
[ "def ParseFileObject(self, parser_mediator, file_object):\n \n msiecf_file = pymsiecf.file()\n msiecf_file.set_ascii_codepage(parser_mediator.codepage)\n\n try:\n msiecf_file.open_file_object(file_object)\n except IOError as exception:\n parser_mediator.ProduceExtractionWarning(\n ...
[ "def _ProcessDirectory(self, mediator, file_entry):\n \n self.processing_status = definitions.STATUS_INDICATOR_COLLECTING\n\n if self._processing_profiler:\n self._processing_profiler.StartTiming('collecting')\n\n for sub_file_entry in file_entry.sub_file_entries:\n if self._abort:\n br...
codesearchnet
{ "query": "Represent the sentence about File management:", "pos": "Represent the code about File management:", "neg": "Represent the code about File management:" }
Create Service @return Authenticator
[ "function newService()\n {\n ### Attain Login Continue If Has\n /** @var iHttpRequest $request */\n $request = \\IOC::GetIoC()->get('/HttpRequest');\n $tokenAuthIdentifier = new IdentifierHttpToken;\n $tokenAuthIdentifier\n ->setRequest($request)\n ->setT...
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Fixup paths added in .pth file that point to the virtualenv instead of the system site packages. In depth: .PTH can execute arbitrary code, which might manipulate the PATH or sys.path :return:
[ "def fixup_paths():\n \n original_paths = os.environ.get('PATH', \"\").split(os.path.pathsep)\n original_dirs = set(added_dirs)\n yield\n\n # Fix PATH environment variable\n current_paths = os.environ.get('PATH', \"\").split(os.path.pathsep)\n if original_paths != current_paths:\n change...
[ "def determine_target_roots(self, goal_name):\n \n if not self.context.target_roots:\n print('WARNING: No targets were matched in goal `{}`.'.format(goal_name), file=sys.stderr)\n\n # For the v2 path, e.g. `./pants list` is a functional no-op. This matches the v2 mode behavior\n # of e.g. `./pants ...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Makes the debug pretty for output also adds the option to place a title :) @param integer|string|array|bool|object $var @param string $title @param bool $return @return bool
[ "public static function dump($var, $title = false, $return = false) {\n // capture on return\n if($return)\n ob_start();\n\n // start pre, got title?\n echo '<pre style=\"'. implode(';', self::$pre) .'\">';\n if($title)\n echo '<span style=\"'. implode(';', s...
[ "def insert_line lineno=@current_index\n prompt = \"Insert: \"\n maxlen = 80\n #config={}; \n #config[:default] = line\n #ret, str = rb_getstr(@form.window, $error_message_row, $error_message_col, prompt, maxlen, config)\n ret, str = input_string prompt\n #ret, str = rb_getstr(@f...
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// updateIssues just calls updateIssues utility function // using the client and config as contained in this issueTracker.
[ "func (tracker *issueTracker) updateIssues(\n\tissues []*github.Issue,\n\tupdateFunc issueUpdateFunc,\n\trollbackFunc issueUpdateFunc,\n) ([]*github.Issue, action.Action, error) {\n\n\tvar (\n\t\tclient = tracker.newClient()\n\t\towner = tracker.config.GitHubOwner\n\t\trepo = tracker.config.GitHubRepository\n\t)...
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Returns the event priority map. @return array
[ "public function getEventPriorityMap()\n {\n if (null !== $this->eventPriorityMap) {\n return $this->eventPriorityMap;\n }\n\n return $this->eventPriorityMap = $this->buildEventPriorityMap();\n }" ]
[ "def getKeySequenceCounter(self):\n \"\"\"\"\"\"\n print '%s call getKeySequenceCounter' % self.port\n keySequence = ''\n keySequence = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:KeyIndex')[0]\n return keySequence" ]
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// Register registers a plugin Factory by name. This // is expected to happen during app startup.
[ "func (ps *Plugins) Register(name string, plugin Factory) {\n\tps.lock.Lock()\n\tdefer ps.lock.Unlock()\n\tif ps.registry != nil {\n\t\t_, found := ps.registry[name]\n\t\tif found {\n\t\t\tklog.Fatalf(\"Admission plugin %q was registered twice\", name)\n\t\t}\n\t} else {\n\t\tps.registry = map[string]Factory{}\n\t}...
[ "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 sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Checks whether or not a given node is a property descriptor. @param {ASTNode} node - A node to check. @returns {boolean} `true` if the node is a property descriptor.
[ "function isPropertyDescriptor(node) {\n // Object.defineProperty(obj, \"foo\", {set: ...})\n if (isArgumentOfMethodCall(node, 2, \"Object\", \"defineProperty\") ||\n isArgumentOfMethodCall(node, 2, \"Reflect\", \"defineProperty\")\n ) {\n return true;\n }\n\n // Object.defineProperties...
[ "function Variable(name, scope) {\n /** \n * The variable name, as given in the source code.\n * @member {String} Variable#name \n */\n this.name = name;\n /**\n * List of defining occurrences of this variable (like in 'var ...'\n * statements or as para...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
This is called once at AS boot time during deployment aspect parsing; this provided map is copied. @param contextProperties
[ "public void setContextProperties(Map<String, String> contextProperties)\n {\n if (contextProperties != null) {\n this.contextProperties = new HashMap<String, String>(4);\n this.contextProperties.putAll(contextProperties);\n }\n }" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
/* Private methods
[ "function indexTriple(g, { subject, predicate, object }) {\n if (!workingPredicates.includes(predicate)) return;\n if (!(isIri(subject) && isIri(predicate)) || g[subject] && g[subject][predicate] && g[subject][predicate].includes(object)) return;\n\n upsert(g, subject, predicate, object);\n\n g.nTriples++;\n\n ...
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Create new item @param array $data @return [type]
[ "public function create($data)\n {\n $response = $this->restClient->post($this->endpoint, $data);\n return $response['body'];\n }" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// GenerateTimestamp generates a new timestamp given a previous (optional) timestamp // We can't just load the previous timestamp, because it may have been signed by a different // timestamp key (maybe from a previous root version)
[ "func (rb *repoBuilder) GenerateTimestamp(prev *data.SignedTimestamp) ([]byte, int, error) {\n\tswitch {\n\tcase rb.repo.cryptoService == nil:\n\t\treturn nil, 0, ErrInvalidBuilderInput{msg: \"cannot generate timestamp without a cryptoservice\"}\n\tcase rb.IsLoaded(data.CanonicalTimestampRole):\n\t\treturn nil, 0, ...
[ "func tagUserCredentials(conf agent.Config) (string, string, error) {\n\tusername := conf.Tag().String()\n\tvar password string\n\t// TODO(perrito) we might need an accessor for the actual state password\n\t// just in case it ever changes from the same as api password.\n\tapiInfo, ok := conf.APIInfo()\n\tif ok {\n\...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// prepareCipherSpec sets the encryption and MAC states // that a subsequent changeCipherSpec will use.
[ "func (hc *halfConn) prepareCipherSpec(version uint16, cipher interface{}, mac macFunction) {\n\thc.version = version\n\thc.nextCipher = cipher\n\thc.nextMac = mac\n}" ]
[ "def get_finished_record_bytes(cls, tls_version: TlsVersionEnum) -> bytes:\n \n # TODO(AD): The ROBOT poc script uses the same Finished record for all possible client hello (default, GCM,\n # etc.); as the Finished record contains a hashes of all previous records, it will be wrong and will caus...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// Digits generates a string of N random digits, padded with zeros if necessary.
[ "func Digits(digits int) string {\n\tmax := int(math.Pow10(digits)) - 1\n\tnum := privateRand.Intn(max)\n\tformat := fmt.Sprintf(\"%%0%dd\", digits)\n\treturn fmt.Sprintf(format, num)\n}" ]
[ "def _calculate_index_of_coincidence(frequency_map, length):\n \n if length <= 1:\n return 0\n # We cannot error here as length can legitimiately be 1.\n # Imagine a ciphertext of length 3 and a key of length 2.\n # Spliting this text up and calculating the index of coincidence res...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// SetDescription sets the Description field's value.
[ "func (s *DevicePool) SetDescription(v string) *DevicePool {\n\ts.Description = &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 summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Check the conformity of +object+ recursively. This method returns either false OR true, if +mode+ is :none or :warning, or raises an CheckFailed, if +mode+ was :error.
[ "def check(object, mode = @mode)\n checked = {}\n result = true\n errors = CheckFailed.new\n each do |message|\n begin\n message.check(object, checked)\n rescue CheckError => e\n case mode\n when :error\n errors << e\n when :warning\n ...
[ "def get_value(self, context):\n \"\"\"\"\"\"\n if self.value:\n return expressions.eval_string(self.value, context)\n else:\n # Empty input raises cryptic EOF syntax err, this more human\n # friendly\n raise ValueError('!py string expression is empty...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Get stats for a site @return Stats
[ "public function getStats()\n {\n $service = $this->getService();\n\n // stats for a site\n $response = $service->request('stats', 'GET', NULL, $this->getParams());\n\n $responseArray = $this->getResponseArray($response);\n\n if (!$this->isError()) {\n $this->_data =...
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Remove an ability from the model. @param mixed $ability @param mixed|null $model @return \Silber\Bouncer\Conductors\RemovesAbilities|$this
[ "public function disallow($ability = null, $model = null)\n {\n if (is_null($ability)) {\n return new RemovesAbilities($this);\n }\n\n (new RemovesAbilities($this))->to($ability, $model);\n\n return $this;\n }" ]
[ "public function applyFilters($filters, FilterFactory $filterFactory, ConditionAwareRepository $repository)\n {\n // @see Ipunkt\\LaravelJsonApi\\Services\\FilterApplier\\FilterApplier\n \\FilterApplier::applyFiltersToRepository($filters, $filterFactory, $repository);\n }" ]
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
// ParseBlockCryptKeyServerHalf returns a BlockCryptKeyServerHalf // containing the given hex-encoded data, or an error.
[ "func ParseBlockCryptKeyServerHalf(s string) (BlockCryptKeyServerHalf, error) {\n\tbuf, err := hex.DecodeString(s)\n\tif err != nil {\n\t\treturn BlockCryptKeyServerHalf{}, errors.WithStack(err)\n\t}\n\tvar serverHalf BlockCryptKeyServerHalf\n\terr = serverHalf.UnmarshalBinary(buf)\n\tif err != nil {\n\t\treturn Bl...
[ "def get_finished_record_bytes(cls, tls_version: TlsVersionEnum) -> bytes:\n \n # TODO(AD): The ROBOT poc script uses the same Finished record for all possible client hello (default, GCM,\n # etc.); as the Finished record contains a hashes of all previous records, it will be wrong and will caus...
codesearchnet
{ "query": "Represent the text about Blockchain:", "pos": "Represent the code about Blockchain:", "neg": "Represent the code:" }
// Validate inspects the fields of the type to determine if they are valid.
[ "func (s *DeleteActivityInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"DeleteActivityInput\"}\n\tif s.ActivityArn == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"ActivityArn\"))\n\t}\n\tif s.ActivityArn != nil && len(*s.ActivityArn) < 1 {\n\t\tinvalidParams.Add(reque...
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Get the list of status to update in $statusCollection Only indexes in $statusCollection are returned @param array $statusCollection @param array $formData @return array
[ "protected function getStatusIndexesToUpdate(array $statusCollection, array $formData)\n {\n $formStatuses = $formData['statuses'];\n $originalStatusesMap = $this->generateStatusesPropertiesMap($statusCollection);\n\n $newPropertiesIndexes = $this->getStatusIndexesWithNewProperty($originalSt...
[ "public List<Audit> getAllNotifications(JPAEntity entity) {\n\t\treturn _auditService.findByEntityHostnameMessage(entity.getId(), null, \"Triggering event value:\");\n\t}" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Documentation:" }
after : after(el, newEl) Inserts a new element `newEl` just after `el`. var after = require('dom101/after'); var newNode = document.createElement('div'); var button = document.querySelector('#submit'); after(button, newNode);
[ "function after (el, newEl) {\n if (typeof newEl === 'string') {\n return el.insertAdjacentHTML('afterend', newEl)\n } else {\n var next = el.nextSibling\n if (next) {\n return el.parentNode.insertBefore(newEl, next)\n } else {\n return el.parentNode.appendChild(newEl)\n }\n }\n}" ]
[ "function(msg) {\n if(!this.fieldContainer) { return; }\n if(!this.msgEl) {\n this.msgEl = inputEx.cn('div', {className: 'inputEx-message'});\n try{\n var divElements = this.divEl.getElementsByTagName('div');\n this.divEl.insertBefore(this.msgEl, divElements[(divEl...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about Localization:" }
// filterNewBackends filters out backends which already exists from the given // map (i.e. keeps only new backends).
[ "func (l *lbmapCache) filterNewBackends(backends map[BackendAddrID]ServiceValue) map[BackendAddrID]ServiceValue {\n\tl.mutex.RLock()\n\tdefer l.mutex.RUnlock()\n\n\tnewBackends := map[BackendAddrID]ServiceValue{}\n\n\tfor addrID, b := range backends {\n\t\tif _, found := l.backendIDByAddrID[addrID]; !found {\n\t\t\...
[ "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 description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Determines if Element is equal to arg, supports nodeNames & CSS2+ selectors @method is @param {Mixed} obj Element @param {String} arg Property to query @return {Boolean} True if a match
[ "function ( obj, arg ) {\n\t\tif ( regex.selector_is.test( arg ) ) {\n\t\t\tutility.id( obj );\n\t\t\treturn ( element.find( obj.parentNode, obj.nodeName.toLowerCase() + arg ).filter( function ( i ) {\n\t\t\t\treturn ( i.id === obj.id );\n\t\t\t}).length === 1 );\n\t\t}\n\t\telse {\n\t\t\treturn new RegExp( arg, \"...
[ "function makeEventDispatcher(obj) {\n $.extend(obj, {\n on: on,\n off: off,\n one: one,\n trigger: trigger,\n _EventDispatcher: true\n });\n // Later, on() may add _eventHandlers: Object.<string, Array.<{event:string, namespace:?string,\n ...
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Renders before a step. @param object : BehatHTMLFormatter object @return string : HTML generated
[ "public function renderBeforeStep($obj)\n {\n $print = array();\n foreach ($this->rendererList as $name => $renderer) {\n $print[$name] = $renderer->renderBeforeStep($obj);\n }\n\n return $print;\n }" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }