query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
发送模板消息 url和miniprogram都是非必填字段,若都不传则模板无跳转; 若都传,会优先跳转至小程序。 开发者可根据实际需要选择其中一种跳转方式即可。 当用户的微信客户端版本不支持跳小程序时,将会跳转至url @param toUser @param templateId @param url @param miniProgram @param messages @return 消息ID
[ "public long send(String toUser, String templateId, String url, MiniProgram miniProgram, Map<String, Data> messages) {\r\n String sendUrl = WxEndpoint.get(\"url.template.send\");\r\n MessageWrapper messageWrapper = new MessageWrapper();\r\n messageWrapper.setToUser(toUser);\r\n messageWr...
[ "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 description about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code about programming:" }
Get the list of all available capabilities. @return array[] Returns an array containing information about each capability
[ "public function getAvailableCapabilities()\n {\n Piwik::checkUserHasSomeAdminAccess();\n\n $response = array();\n\n foreach ($this->capabilityProvider->getAllCapabilities() as $capability) {\n $response[] = array(\n 'id' => $capability->getId(),\n '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 post about Documentation:", "pos": "Represent the code about Documentation:", "neg": "Represent the code:" }
Return the Ethernet and IP+mask addresses assigned to a given interface on a node.
[ "def getInterfaceAddresses(self, node, interface):\n '''\n \n '''\n intf = self.getNode(node)['nodeobj'].getInterface(interface)\n return intf.ethaddr,intf.ipaddr,intf.netmask" ]
[ "def sanitize(self):\n '''\n \n '''\n super(MapReferralMessage, self).sanitize()\n\n # WARNING: http://tools.ietf.org/html/draft-ietf-lisp-ddt-00\n # does not define this field so the description is taken from\n # http://tools.ietf.org/html/draft-ietf-lisp-24\n ...
codesearchnet
{ "query": "Represent the sentence about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
// SetDestinationSettings sets the DestinationSettings field's value.
[ "func (s *FileGroupSettings) SetDestinationSettings(v *DestinationSettings) *FileGroupSettings {\n\ts.DestinationSettings = 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:" }
Updates an identity @param string $identity @param string $master @param string $label @param string $status @return mixed
[ "public function update($identity, $label = null, $master = null, $status = null)\n {\n\n $params = array();\n if (! is_null($label)) {\n $params['label'] = $label;\n }\n if (! is_null($master)) {\n $params['master'] = $master;\n }\n if (! is_null($...
[ "protected function processDetails(Buffer &$buffer, Result &$result)\n {\n parent::processDetails($buffer, $result);\n\n // Add in map\n $result->add('mapname', 'Panau');\n $result->add('dedicated', 'true');\n }" ]
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Removes all swatch groups.
[ "function removeAllSwatchGroups() {\n for (var i = 0; i < doc.swatchGroups.length; i++) {\n doc.swatchGroups[i].remove();\n }\n}" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetTimeoutType sets the TimeoutType field's value.
[ "func (s *WorkflowExecutionTimedOutEventAttributes) SetTimeoutType(v string) *WorkflowExecutionTimedOutEventAttributes {\n\ts.TimeoutType = &v\n\treturn s\n}" ]
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Generator of secure random tokens. Note that it is best to use an even number for the length. @param int|null $length (defaults to defaultLength) @return string Key
[ "public function generateKey($length = null) {\n\t\tif (!$length) {\n\t\t\t$length = $this->defaultLength;\n\t\t}\n\n\t\tif (version_compare(PHP_VERSION, '7.0.0') >= 0) {\n\t\t\t$function = 'random_bytes';\n\t\t} elseif (extension_loaded('openssl')) {\n\t\t\t$function = 'openssl_random_pseudo_bytes';\n\t\t} else {\...
[ "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 text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
take a list and turn it into a utf-8 encoded byte-string for redis. :param value: list :return: bytes
[ "def encode(cls, value):\n \n try:\n coerced = list(value)\n if coerced == value:\n return json.dumps(coerced).encode(cls._encoding)\n except TypeError:\n pass\n\n raise InvalidValue('not a list')" ]
[ "def GetDictToFormat(self):\n \"\"\"\"\"\"\n d = {}\n for k, v in self.__dict__.items():\n # TODO: Better handling of unicode/utf-8 within Schedule objects.\n # Concatinating a unicode and utf-8 str object causes an exception such\n # as \"UnicodeDecodeError: 'ascii' codec can't decode byte ...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Return the current element. @link http://php.net/manual/en/iterator.current.php @return mixed Can return any type. @since 5.0.0
[ "public function current()\n {\n $keys = array_keys($this->items);\n $var = $this->items[$keys[$this->index]];\n\n return $var;\n }" ]
[ "public function setFetchMode(\n $mode,\n $colClassOrObj = null,\n array $ctorArgs = array()\n )\n {\n //52: $this->_statement->setFetchMode(PDO::FETCH_ASSOC);\n if ($colClassOrObj !== null || !empty($ctorArgs)) {\n throw new PDOException('Second and third paramet...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// SetForce sets the Force field's value.
[ "func (s *ModifyClusterSnapshotInput) SetForce(v bool) *ModifyClusterSnapshotInput {\n\ts.Force = &v\n\treturn s\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 comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Marshall the given parameter object.
[ "public void marshall(RemotePortDetails remotePortDetails, ProtocolMarshaller protocolMarshaller) {\n\n if (remotePortDetails == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(remotePortDeta...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Nested dictionary containing the values of all condition sequences. See the documentation on property |HydPy.conditions| for further information.
[ "def conditions(self) -> Dict[str, Dict[str, Union[float, numpy.ndarray]]]:\n \n conditions = {}\n for subname in NAMES_CONDITIONSEQUENCES:\n subseqs = getattr(self, subname, ())\n subconditions = {seq.name: copy.deepcopy(seq.values)\n for seq i...
[ "def values(*rels):\n '''\n \n '''\n #Action function generator to multiplex a relationship at processing time\n def _values(ctx):\n '''\n Versa action function Utility to specify a list of relationships\n\n :param ctx: Versa context used in processing (e.g. includes the prototyp...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Applies the dynamically computed threshold to each pixel in the image, one block at a time
[ "protected void applyThreshold( T input, GrayU8 output ) {\n\t\tfor (int blockY = 0; blockY < stats.height; blockY++) {\n\t\t\tfor (int blockX = 0; blockX < stats.width; blockX++) {\n\t\t\t\toriginal.thresholdBlock(blockX,blockY,input,stats,output);\n\t\t\t}\n\t\t}\n\t}" ]
[ "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 Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
not included in spd.
[ "def get_ptrm_dec_and_inc(self):\n \"\"\"\"\"\"\n PTRMS = self.PTRMS[1:]\n CART_pTRMS_orig = numpy.array([lib_direct.dir2cart(row[1:4]) for row in PTRMS])\n #B_lab_dir = [self.B_lab_dir[0], self.B_lab_dir[1], 1.] # dir\n tmin, tmax = self.t_Arai[0], self.t_Arai[-1]\n ptrms_...
[ "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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Exposed for unit testing. @private
[ "function () {\n\t eventPluginOrder = null;\n\t for (var pluginName in namesToPlugins) {\n\t if (namesToPlugins.hasOwnProperty(pluginName)) {\n\t delete namesToPlugins[pluginName];\n\t }\n\t }\n\t EventPluginRegistry.plugins.length = 0;\n\t\n\t var eventNameDispatchConfigs = EventPlu...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
Adds a set of comparable objects to this UBTree. @param set the set of comparable objects
[ "public void addSet(final SortedSet<T> set) {\n SortedMap<T, UBNode<T>> nodes = rootNodes;\n UBNode<T> node = null;\n for (T element : set) {\n node = nodes.get(element);\n if (node == null) {\n node = new UBNode<>(element);\n nodes.put(elemen...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Initializes the object according to its class specification and given arguments. @param array $properties The values to give to the properties.
[ "protected function initializeProperties($properties = null)\n {\n $this->getPropertiesInfo();\n\n // Initialize the properties that were defined using the Initialize / InitializeObject annotations\n $initializeValueValidationEnabled = Configuration::isInitializeValuesValidationEnabled();\n ...
[ "private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo...
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
%prog gff *.gff Draw exons for genes based on gff files. Each gff file should contain only one gene, and only the "mRNA" and "CDS" feature will be drawn on the canvas.
[ "def gff(args):\n \n align_choices = (\"left\", \"center\", \"right\")\n p = OptionParser(gff.__doc__)\n p.add_option(\"--align\", default=\"left\", choices=align_choices,\n help=\"Horizontal alignment [default: %default]\")\n p.add_option(\"--noUTR\", default=False, action=\"store_tr...
[ "def gene_names(self):\n \n # Iterate through all the target names in the formatted targets file\n for record in SeqIO.parse(self.targets, 'fasta'):\n # Append all the gene names to the list of names\n self.genes.append(record.id)" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Rollback mocks base method
[ "func (m *MockTransactional) Rollback(arg0 context.Context) error {\n\tret := m.ctrl.Call(m, \"Rollback\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\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 comment about Database management:", "pos": "Represent the Github code about Database management:", "neg": "Represent the Github code about programming:" }
Compute the angle between vector x and y
[ "def angle_between_vectors(x, y):\n \n dp = dot_product(x, y)\n if dp == 0:\n return 0\n xm = magnitude(x)\n ym = magnitude(y)\n return math.acos(dp / (xm*ym)) * (180. / math.pi)" ]
[ "def dihedral(array_of_xyzs):\n \n p1 = array_of_xyzs[0]\n p2 = array_of_xyzs[1]\n p3 = array_of_xyzs[2]\n p4 = array_of_xyzs[3]\n\n vector1 = -1.0 * (p2 - p1)\n vector2 = p3 - p2\n vector3 = p4 - p3\n\n # Normalize vector so as not to influence magnitude of vector\n # rejections\n ...
codesearchnet
{ "query": "Represent the Github sentence about mathematics:", "pos": "Represent the Github code about mathematics:", "neg": "Represent the Github code:" }
Reconnect to the DataSift stream @return void
[ "private function reconnect()\n {\n $auto = $this->_auto_reconnect;\n $this->disconnect();\n $this->auto_reconnect = $auto;\n $this->connect();\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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Programming:" }
Used to generate page hash tag or HTML attribute. by getPageName and getPageHash. Does it by joining page and arguments using the given separator.
[ "function (separator, page, args) {\n\n // By default, we return page name without arguments.\n var ret = page;\n if (typeof args !== 'undefined') {\n if (args && args.length) {\n // Some arguments have been provided, add them.\n if (args.length !== 0) {...
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
@param \Symfony\Component\Form\FormBuilderInterface $builder @return $this
[ "protected function addHiddenInputs(FormBuilderInterface $builder)\n {\n $formData = $this->getClient()->getCreditCardCheckRequest();\n $builder->add(\n self::FIELD_CLIENT_API_CONFIG,\n HiddenType::class,\n [\n 'label' => false,\n 'data...
[ "public function createGrid($gridClassName)\n {\n $gridClass = new \\ReflectionClass($gridClassName);\n\n /* @var \\PedroTeixeira\\Bundle\\GridBundle\\Grid\\GridAbstract $grid */\n $grid = $gridClass->newInstance($this->container);\n $grid->setupGrid();\n\n return $grid;\n }...
codesearchnet
{ "query": "Represent the Github post about Symfony:", "pos": "Represent the Github code about Symfony:", "neg": "Represent the Github code about Software Development:" }
DS method for deactivating this component. @param context
[ "@Deactivate\n protected void deactivate(ComponentContext context) {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {\n Tr.event(this, tc, \"Deactivating\");\n }\n instance.get().compareAndSet(this, null);\n\n if (TraceComponent.isAnyTracingEnabled() && ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Export returns a serialized representation of the model associated // with the API connection. The charms used by the model are also // returned.
[ "func (c *Client) Export() (migration.SerializedModel, error) {\n\tvar empty migration.SerializedModel\n\tvar serialized params.SerializedModel\n\terr := c.caller.FacadeCall(\"Export\", nil, &serialized)\n\tif err != nil {\n\t\treturn empty, errors.Trace(err)\n\t}\n\n\t// Convert tools info to output map.\n\ttools ...
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Compiles a do-instruction into PHTML. @param Node $node the do-node to compile @return string The compiled PHTML @throws Exception
[ "protected function compileDo(Node $node)\n {\n\n $subject = $node->subject;\n\n if (!empty($subject))\n $this->throwException(\n \"Do-loops can't have a subject, they only accept children to repeat.\",\n $node\n );\n\n if (!$node->next() |...
[ "public static function insertTemplatePF ($parser, $template, $spot=''){\n //process additional arguments into a usable array\n $params = array();\n //sanitize the template name\n $template = preg_replace('/[^A-Za-z0-9_\\-]/', '_', $template);\n //this will be stripped out, assuming the skin is based...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Build table containing language matching variables.
[ "private static void buildMatchVariables(\n TypeSpec.Builder type, Map<String, Set<String>> territoryData, LanguageMatchingData data) {\n \n Map<String, Set<String>> territories = flatten(territoryData);\n \n CodeBlock.Builder code = CodeBlock.builder();\n code.add(\"new $T<$T, $T<$T>>() {{\\n\"...
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
calculates the size of given value @param string|array|\Countable|\Iterator|\IteratorAggregate $value @return int
[ "private function sizeOf($value): int\n {\n if (is_string($value)) {\n return strlen($value);\n } elseif (is_array($value) || $value instanceof \\Countable) {\n return count($value);\n }\n\n $traversable = $this->traversable($value);\n $key = $trav...
[ "def property_(getter: Map[Domain, Range]) -> property:\n \n return property(map_(WeakKeyDictionary())(getter))" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Get the resolved form of an installed extension class. @param string|null $id The extension ID or composer name @return ResolvedExtension|null
[ "public function getResolved($id)\n {\n if (isset($this->extensions[$id])) {\n return $this->extensions[$id];\n } elseif (isset($this->composerNames[$id])) {\n $id = (string) $this->composerNames[$id];\n\n return $this->extensions[$id];\n }\n\n return ...
[ "function validateService($pluginInstance)\n {\n if (! is_object($pluginInstance) )\n throw new \\Exception(sprintf('Can`t resolve to (%s) Instance.', $pluginInstance));\n\n if (!$pluginInstance instanceof aGrantRequest)\n throw new exContainerInvalidServiceType('Invalid Plugi...
codesearchnet
{ "query": "Represent the Github comment about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Software development:" }
Connection logic; send requests to the Gdax API.
[ "private function _call($method, $path, $param, $header = false) {\n // Clear connection; Set timeout, and json header.\n $this->curl->resetConnection();\n\n // Set additional headers.\n if ($header) {\n foreach ($header as $name => $value) {\n $this->curl->setHeader($name, $value);\n }...
[ "public H2StreamProcessor startNewInboundSession(Integer streamID) {\n H2StreamProcessor h2s = null;\n h2s = muxLink.createNewInboundLink(streamID);\n return h2s;\n // call the stream processor with the data it needs to then call \"ready\" are the underlying HttpInboundLink\n // (...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Create Component driver. @param string $name @return \Antares\Contracts\Memory\Provider
[ "protected function createComponentDriver($name)\n {\n $config = Arr::get($this->config, \"component.{$name}\", []);\n $cache = $this->getCacheRepository($config);\n return $this->createProvider(new Component($name, $config, $this->app, $cache));\n }" ]
[ "final public static function sinfo(array $params):string\n {\n return (\\iumioFramework\\Core\\Base\\Server\\GlobalServer::getServerInfo($params['name']));\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
The awaiting authorization screen
[ "public function awaitingAuthorization()\n {\n $deliveryExecution = $this->getCurrentDeliveryExecution();\n $deliveryExecutionStateService = $this->getServiceManager()->get(DeliveryExecutionStateService::SERVICE_ID);\n $executionState = $deliveryExecution->getState()->getUri();\n\n $r...
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Extracts the first entry of the list when it is not null and contains values. @param list The list to extract the first entry from, can be null @return The first entry of the list when it is not null or empty, null otherwise
[ "public static <T> T firstEntry(final List<T> list) {\n if (list != null && !list.isEmpty()) {\n return list.get(0);\n } else {\n return null;\n }\n }" ]
[ "function inflate(object) {\n // check if the object is an object and isn't empty\n if (is(object) && !empty(object)) {\n // create a new object for the result\n let result = {};\n\n // for each key in the object\n Object.keys(object).forEach((path) => {\n // get value from the object\n cons...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// Implements asserts that an object is implemented by the specified interface. // // assert.Implements(t, (*MyInterface)(nil), new(MyObject))
[ "func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {\n\tif h, ok := t.(tHelper); ok {\n\t\th.Helper()\n\t}\n\tif assert.Implements(t, interfaceObject, object, msgAndArgs...) {\n\t\treturn\n\t}\n\tt.FailNow()\n}" ]
[ "func MakeFunc(fn func(this *Object, arguments []*Object) interface{}) *Object {\n\treturn Global.Call(\"$makeFunc\", InternalObject(fn))\n}" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Display a warning about installing development code if necesary. @param int $maturity @return string HTML to output.
[ "protected function maturity_warning($maturity) {\n if ($maturity == MATURITY_STABLE) {\n return ''; // No worries.\n }\n\n $maturitylevel = get_string('maturity' . $maturity, 'admin');\n return $this->warning(\n $this->container(get_string('maturitycorewarn...
[ "def _print_help(self):\n \"\"\"\"\"\"\n msg = \"\"\"Commands (type help <command> for details)\n\nCLI: help history exit quit\nSession, General: set load save reset\nSession, Access Control: allowaccess denyaccess clearaccess\nSession, Replication: allowrep denyrep prefe...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
/* ------------------------------------------------------------
[ "public boolean checkSecurityConstraints(String pathInContext,\n HttpRequest request,\n HttpResponse response)\n throws HttpException, IOException\n {\n if (!super.checkSecurityConstraints(pathInContext,reques...
[ "public function description()\n {\n //====================================================================//\n // Stack Trace\n Splash::log()->trace();\n\n //====================================================================//\n // Build & Return Widget Description Array\n ...
codesearchnet
{ "query": "Represent the sentence about N/A:", "pos": "Represent the code about N/A:", "neg": "Represent the code about Software Development:" }
Implement function {f(x) = 1 if x==x', f(x) = 0 if x!= x'}.
[ "def make_oracle(input_qubits, output_qubit, x_bits):\n \"\"\"\"\"\"\n # Make oracle.\n # for (1, 1) it's just a Toffoli gate\n # otherwise negate the zero-bits.\n yield(cirq.X(q) for (q, bit) in zip(input_qubits, x_bits) if not bit)\n yield(cirq.TOFFOLI(input_qubits[0], input_qubits[1], output_qu...
[ "def Gregory(type=float):\n\t\n\treturn seq(type(1), step=2) >> map(lambda x: 1/x) >> alt_sign >> fold(operator.add)" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about mathematics:" }
Changes the Toggle's valueOn, updating facet refinements accordingly. @param newValue valueOn's new value. @param newName an eventual new attribute name.
[ "public void setValueOn(String newValue, @Nullable String newName) {\n if (isChecked()) { // refining on valueOn: facetRefinement needs an update\n searcher.updateFacetRefinement(attribute, valueOn, false)\n .updateFacetRefinement(newName != null ? newName : attribute, newValue,...
[ "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 programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// Get device profiles with the passed query
[ "func (mc MongoClient) getDeviceProfiles(q bson.M) ([]contract.DeviceProfile, error) {\n\ts := mc.session.Copy()\n\tdefer s.Close()\n\n\tvar dps []models.DeviceProfile\n\terr := s.DB(mc.database.Name).C(db.DeviceProfile).Find(q).Sort(\"queryts\").All(&dps)\n\tif err != nil {\n\t\treturn []contract.DeviceProfile{}, ...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about Data processing:", "pos": "Represent the Github code about Data processing:", "neg": "Represent the Github code:" }
Encode the common request envelope
[ "def _encode_message_header(cls, client_id, correlation_id, request_key,\n api_version=0):\n \n return (struct.pack('>hhih',\n request_key, # ApiKey\n api_version, # ApiVersion\n ...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
// resolveStoreResource selects the resource info to use. It decides // between the provided and latest info based on the revision.
[ "func resolveStoreResource(res charmresource.Resource, storeResources map[string]charmresource.Resource, id charmstore.CharmID, client CharmStore) (charmresource.Resource, error) {\n\tstoreRes, ok := storeResources[res.Name]\n\tif !ok {\n\t\t// This indicates that AddPendingResources() was called for\n\t\t// a reso...
[ "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 comment:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
// SetDirectoryName sets the DirectoryName field's value.
[ "func (s *DirectoryConfig) SetDirectoryName(v string) *DirectoryConfig {\n\ts.DirectoryName = &v\n\treturn s\n}" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Initialize CKEditor in textarea field with asset. @return void
[ "protected function initEditor(): void\n {\n $view = $this->getView();\n\n CKEditorAsset::register($view);\n CKEditorAssetAddition::register($view);\n\n $id = $this->options['id'];\n\n $clientOptions = !empty($this->clientOptions) ? Json::encode($this->clientOptions) : '{}';\n\...
[ "public function getViewer($action)\n {\n // Answer Viewer Object (from parent):\n \n if (!$this->isCMSPreview()) {\n return parent::getViewer($action);\n }\n \n // Load Page Requirements (uses theme):\n \n PageController::create(Page::create())-...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Returns mimetypes list @return array
[ "protected function _getMimetypes()\n {\n if(!isset($this->_mimetypes))\n {\n $file = $this->getConfig()->file;\n\n if (is_readable($file)) {\n $this->_mimetypes = json_decode(file_get_contents($file), true);\n }\n }\n\n return $this->_m...
[ "def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// UnmarshalBinary implements encoding.BinaryUnmarshaler. // Preserves the hasher.
[ "func (h *HLL) UnmarshalBinary(data []byte) error {\n\tvar s serializable\n\terr := gob.NewDecoder(bytes.NewReader(data)).Decode(&s)\n\tif err != nil {\n\t\treturn err\n\t}\n\th.P = s.P\n\th.m1 = s.M1\n\th.m2 = s.M2\n\th.alpha = s.Alpha\n\th.format = s.Format\n\th.tempSet = &s.TempSet\n\th.sparseList = &s.SparseLis...
[ "func GobDecode(b []byte) (store Store, err error) {\n\tdec := gob.NewDecoder(bytes.NewBuffer(b))\n\t// no reference because of:\n\t// gob: decoding into local type *memstore.Store, received remote type Entry\n\terr = dec.Decode(&store)\n\treturn\n}" ]
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Load all categories or, depending on the <displayEmpty> option, only those that have blog posts @return mixed
[ "protected function loadCategories()\n {\n $categories = BlogCategory::with('posts_count')->getNested();\n if (!$this->property('displayEmpty')) {\n $iterator = function ($categories) use (&$iterator) {\n return $categories->reject(function ($category) use (&$iterator) {\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 post about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
Gets the user name from the request principal. @param req the servlet request @return the authenticated user, or null if none is authenticated
[ "@Override\n public String getUserName(HttpServletRequest req) {\n Principal princ = null;\n if (req != null && (princ = req.getUserPrincipal()) != null) {\n String userName = princ.getName();\n if (userName != null && !userName.isEmpty()) {\n LOG.debug(\"HTTP r...
[ "function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ...
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
@param string $name @return Group\RadioGroup
[ "public function addRadioGroup(string $name) : Group\\RadioGroup\n {\n $radioGroup = new Group\\RadioGroup($this, $name);\n $this->addComponent($name, $radioGroup);\n\n return $radioGroup;\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// Create a new domain. // // appIdentity is the unique identifier of the Domain's App. hostname is the // full hostname.
[ "func (c *Client) DomainCreate(appIdentity string, hostname string) (*Domain, error) {\n\tparams := struct {\n\t\tHostname string `json:\"hostname\"`\n\t}{\n\t\tHostname: hostname,\n\t}\n\tvar domainRes Domain\n\treturn &domainRes, c.Post(&domainRes, \"/apps/\"+appIdentity+\"/domains\", params)\n}" ]
[ "func (c *NetworkGetCommand) Info() *cmd.Info {\n\targs := \"<binding-name> [--ingress-address] [--bind-address] [--egress-subnets]\"\n\tdoc := `\nnetwork-get returns the network config for a given binding name. By default\nit returns the list of interfaces and associated addresses in the space for\nthe binding, as...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Parses a <summary> tag and adds it the Executable parent instance. :arg parser: an instance of DocParser to create the DocElement with.
[ "def _parse_summary(tag, parser, parent):\n \n summary = DocElement(tag, parser, parent)\n parent.docstring.append(summary)" ]
[ "def _type_description(self):\n \"\"\"\"\"\"\n #This is a little tricker because the docstring is housed\n #inside of the module that contains the actual executable.\n #These TypeExecutables are just pointers.\n iexec = self._element.target\n if iexec is not None:\n ...
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Set the current frame @param current The current frame
[ "public void setExternalFrame(Shape current) {\r\n\t\tthis.current = current;\r\n\t\tnext = (Shape) shapes.get(0);\r\n\t\toffset = 0;\r\n\t}" ]
[ "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 Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// HostKeyFile returns a functional option that adds HostSigners to the server // from a PEM file at filepath.
[ "func HostKeyFile(filepath string) Option {\n\treturn func(srv *Server) error {\n\t\tpemBytes, err := ioutil.ReadFile(filepath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tsigner, err := gossh.ParsePrivateKey(pemBytes)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tsrv.AddHostKey(signer)\n\n\t\tretur...
[ "func (c *agentConf) AddFlags(f *gnuflag.FlagSet) {\n\t// TODO(dimitern) 2014-02-19 bug 1282025\n\t// We need to pass a config location here instead and\n\t// use it to locate the conf and the infer the data-dir\n\t// from there instead of passing it like that.\n\tf.StringVar(&c.dataDir, \"data-dir\", util.DataDir,...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Decode from dataset on new checkpoint.
[ "def continuous_decode_on_train_data(self):\n \"\"\"\"\"\"\n for _ in next_checkpoint(self._hparams.model_dir,\n self._decode_hparams.decode_timeout_mins):\n self.decode(dataset_split=tf.estimator.ModeKeys.TRAIN)" ]
[ "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 instruction about Data processing:", "pos": "Represent the code about Data processing:", "neg": "Represent the code about Software development:" }
These attributes "partially" instantiate a template for align, with a set of constants
[ "void align_static(Bindings bindings1) {\n bindings1.addAttribute(VAR_CONSUMED_NAME, prim(ROLE_IMG));\n bindings1.addAttribute(VAR_CONSUMED_NAME, prim(ROLE_HDR));\n bindings1.addAttribute(VAR_CONSUMED_NAME, prim(ROLE_IMG_REF));\n bindings1.addAttribute(VAR_CONSUMED_NAME, prim(ROLE_HDR_RE...
[ "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 Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
convert str to dict format USAGE: rdict = str2dict(rawstr) :param rawstr: raw configuration string of element
[ "def str2dict(self, rawstr):\n \n kw_list = []\n sp1 = rawstr.split(':')\n kw_name = sp1[0].strip().upper()\n kw_desc = sp1[1:]\n sp2 = kw_desc[0].replace(',', ';;', 1).split(';;')\n kw_type = sp2[0].strip()\n try:\n kw_vals = sp2[1].replace(\",\", ...
[ "def append_line(self, new_line):\n \"\"\"\"\"\"\n # TODO: The user still has to write the raw line, this is error prone.\n self._write(('PGM', [Integer, String]), self.idx, new_line)" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Boot the plugin. @param string $base_path @param array $options @throws Exception if plugin is loaded
[ "public static function boot( $base_path, array $options = [] ) {\n $name = plugin_basename( $base_path );\n\n if ( isset( static::$instances[$name] ) ) {\n throw new Exception( sprintf( 'Cannot boot `%s` again', $name ) );\n }\n\n $instance = new static( $base_path, $options ...
[ "protected function configureApp ()\n {\n $this->envData['APP_ENV'] = $this->choice (\"Choose environment. [local|production]\", ['local', 'production'], 0);\n $this->envData['APP_KEY'] = \"\";\n $this->envData['APP_DEBUG'] = $this->confirm (\"Enable debugging?\", 'yes') ? \"true\" : \"f...
codesearchnet
{ "query": "Represent the summarization about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software development:" }
/* (non-Javadoc) @see Structures.AbbvGapsHMMEvaluator#initEvalParams(Structures.Acronym)
[ "@Override\n\tprotected void initEvalParams() {\n\t\t_sParam = new BackwardEvalParam(_acronym._shortForm);\n\t\t_lParam = new BackwardEvalParam(_acronym._longForm);\n\t\t_partialWordParam = null;\n\t}" ]
[ "protected List<List<Row<I>>> incorporateCounterExample(DefaultQuery<I, D> ce) {\n return ObservationTableCEXHandlers.handleClassicLStar(ce, table, oracle);\n }" ]
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Generates a number field for a model attribute. @param CModel $model the data model. @param string $attribute the attribute. @param array $htmlOptions additional HTML attributes. @return string the generated input field. @see TbHtml::activeNumberField
[ "public function numberField($model, $attribute, $htmlOptions = array())\n {\n return $this->createInput(TbHtml::INPUT_TYPE_NUMBER, $model, $attribute, $htmlOptions);\n }" ]
[ "protected function configureFormer()\n {\n // Use Bootstrap 3\n Config::set('former.framework', 'TwitterBootstrap3');\n\n // Reduce the horizontal form's label width\n Config::set('former.TwitterBootstrap3.labelWidths', []);\n\n // Change Former's required field HTML\n ...
codesearchnet
{ "query": "Represent the instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Helper function for point conversion
[ "def to_debug_point(self, point: Union[Unit, Point2, Point3]) -> common_pb.Point:\n \n if isinstance(point, Unit):\n point = point.position3d\n return common_pb.Point(x=point.x, y=point.y, z=getattr(point, \"z\", 0))" ]
[ "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 Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns a ClassFileReader instance of a given path.
[ "public static ClassFileReader newInstance(Path path) throws IOException {\n if (!Files.exists(path)) {\n throw new FileNotFoundException(path.toString());\n }\n\n if (Files.isDirectory(path)) {\n return new DirectoryReader(path);\n } else if (path.getFileName().toS...
[ "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 text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Operation create Create New DiscountPromotion @throws \\ApiException on non-2xx response @throws \InvalidArgumentException @return \\Resources\\DiscountPromotion
[ "public function create()\n {\n $instance = self::createDiscountPromotion($this);\n $this->setId($instance->getId());\n return $instance;\n }" ]
[ "public function update( models\\Call\\ContactNumber $ContactNumber){\n $rest = $this->getService( self::API_NUMBER . $ContactNumber->getId());\n $rest->PUT( $ContactNumber);\n\n return $rest->getResult( models\\Call\\ContactNumber::class);\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about PHP:", "pos": "Represent the Github code about PHP:", "neg": "Represent the Github code about programming:" }
Called from the JSP that is used for the AJAX requests to OpenCms.<p>
[ "public void displayDialog() {\n\n if (DIALOG_CHANGEITEMTITLE.equals(getParamAction())) {\n // build the JSON object for the current item with changed title property\n changeItemTitle(getJsp().getRequest().getParameter(PARAM_ITEMPATH));\n } else if (DIALOG_CHANGEITEMLINKURL.equal...
[ "@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 instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatefulSetStatus.
[ "func (in *StatefulSetStatus) DeepCopy() *StatefulSetStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(StatefulSetStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}" ]
[ "func (resource *Bundle) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"Bundle\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to Bundle), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)\n}" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Clear all coupons in session. @param Event $event @param $eventName @param EventDispatcherInterface $dispatcher
[ "public function clearAllCoupons(Event $event, $eventName, EventDispatcherInterface $dispatcher)\n {\n // Tell coupons to clear any data they may have stored\n $this->couponManager->clear();\n\n $this->getSession()->setConsumedCoupons(array());\n\n $this->updateOrderDiscount($event, $...
[ "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 Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
input: 'S0102-67202009000300001' output: 'S0102-6720(09)000300001'
[ "def fbpe_key(code):\n \n\n begin = code[0:10]\n year = code[12:14]\n end = code[14:]\n\n return '%s(%s)%s' % (begin, year, end)" ]
[ "protected function parseTransactionAccount()\n {\n $results = [];\n // YYMMDD[MMDD]2a[1!a]15d1!a3!c16x[//16x][34x]\n // eg.: :61:1203290329DD20000,00NTRF1004688128 //6128522200250001\n // Reference for the Account Owner (16x): 1004688128\n // Reference of the Account Serv...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Delete a directory recursively. This method will delete all files and subdirectories. @param dir Directory to delete @return If no error occurs, true is returned. false otherwise.
[ "public static void deleteDirOnExit(final File dir) {\n if (dir.isDirectory()) {\n final String[] children = dir.list();\n for (int i = 0; i < children.length; i++) {\n deleteDirOnExit(new File(dir, children[i]));\n }\n }\n\n // The directory is n...
[ "function MobileServiceSyncTable(tableName, client) {\n Validate.isString(tableName, 'tableName');\n Validate.notNullOrEmpty(tableName, 'tableName');\n\n Validate.notNull(client, 'client');\n\n /**\n * Gets the name of the local table.\n * \n * @returns {string} The name of the table.\n ...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Appends a tag that creates an unordered list. The unordered part means that the items in the list are not in any particular order. @param style the style of the unordered list @return this.
[ "public XHTMLText appendOpenUnorderedListTag(String style) {\n text.halfOpenElement(UL);\n text.optAttribute(STYLE, style);\n text.rightAngleBracket();\n return this;\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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// Emojify "emojifies" the input source. // Note that the input byte slice will be modified if needed. // See http://www.emoji-cheat-sheet.com/
[ "func Emojify(source []byte) []byte {\n\temojiInit.Do(initEmoji)\n\n\tstart := 0\n\tk := bytes.Index(source[start:], emojiDelim)\n\n\tfor k != -1 {\n\n\t\tj := start + k\n\n\t\tupper := j + emojiMaxSize\n\n\t\tif upper > len(source) {\n\t\t\tupper = len(source)\n\t\t}\n\n\t\tendEmoji := bytes.Index(source[j+1:upper...
[ "def get_query_from_request(self, name):\n \n query = self.request.get(name, \"{}\")\n # json.loads does unicode conversion, which will fail in the catalog\n # search for some cases. So we need to convert the strings to utf8\n # https://github.com/senaite/senaite.core/issues/443\n...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
// SetName sets the Name field's value.
[ "func (s *Account) SetName(v string) *Account {\n\ts.Name = &v\n\treturn s\n}" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Start a transaction in the database. @param callable $cb @return QueryBuilder
[ "public function transition(callable $cb)\n {\n $where = $this->where;\n\n $data = $this->get();\n\n if (call_user_func_array($cb, [$data]) === true) {\n $this->where = $where;\n }\n\n return $this;\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 instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
A collection of `TimeEvent`s. Generated from protobuf field <code>repeated .google.devtools.cloudtrace.v2.Span.TimeEvent time_event = 1;</code> @param \Google\Cloud\Trace\V2\Span_TimeEvent[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "public function setTimeEvent($var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::MESSAGE, \\Google\\Cloud\\Trace\\V2\\Span_TimeEvent::class);\n $this->time_event = $arr;\n\n return $this;\n }" ]
[ "public function setSupportedBy($var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::ENUM, \\Google\\Cloud\\Dlp\\V2\\InfoTypeSupportedBy::class);\n $this->supported_by = $arr;\n\n return $this;\n }" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Prepare the render operation environment settings @param codeType @param locale @param usrCtx @return the engine instance itself
[ "public final RythmEngine prepare(ICodeType codeType, Locale locale, Map<String, Object> usrCtx) {\n renderSettings.init(codeType).init(locale).init(usrCtx);\n return this;\n }" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
undelete the parity file together with the src file.
[ "@Override\n public boolean undelete(Path f, String userName) throws IOException {\n List<Codec> codecList = Codec.getCodecs();\n Path[] parityPathList = new Path[codecList.size()];\n\n for (int i=0; i<parityPathList.length; i++) {\n parityPathList[i] = new Path(codecList.get(i).parityDirectory, \n ...
[ "def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Technology:" }
Attempt to pluralize a string. @param string $singular @return string
[ "private function pluralize($singular)\n {\n if (null === $this->pluralizer) {\n return $singular;\n }\n\n return call_user_func($this->pluralizer, $singular);\n }" ]
[ "func (m *Strings) ToRawInfo() interface{} {\n\tinfo := yaml.MapSlice{}\n\tif m == nil {\n\t\treturn info\n\t}\n\t// &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:}\n\treturn info\n}" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Display a list of all registered events
[ "def sourcess_list(self, *args):\n \"\"\"\"\"\"\n\n from pprint import pprint\n\n sources = {}\n sources.update(self.authorized_events)\n sources.update(self.anonymous_events)\n\n for source in sources:\n pprint(source)" ]
[ "protected function addSynchronizationInformation()\n {\n $this->html->pInfo($this->_(\n 'Check source for new surveys, changes in survey status and survey deletion. Can also perform maintenance on some sources, e.g. by changing the number of attributes.'\n ));\n $this...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Data synchronization:" }
@param mixed $data @param TypeMetadataInterface $type @param ContextInterface $context @return \DateTimeInterface
[ "private function deserialize($data, TypeMetadataInterface $type, ContextInterface $context)\n {\n $class = $type->getName();\n\n if (!method_exists($class, 'createFromFormat')) {\n throw new \\InvalidArgumentException(sprintf(\n 'The method \"%s\" does not exist on \"%s\"...
[ "public static function DaftObjectRepositoryByDaftObject(\n SuitableForRepositoryType $object,\n ...$args\n ) : DaftObjectRepository {\n /**\n * @psalm-var class-string<TDbObj>\n */\n $className = get_class($object);\n\n return static::DaftObjectRepositoryByType($...
codesearchnet
{ "query": "Represent the Github text about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code about programming:" }
// Except set all bits except given index to 1, the except bits set to 0
[ "func (s *Bitset) Except(index ...uint) *Bitset {\n\ts.SetAll()\n\tfor _, i := range index {\n\t\ts.Unset(i)\n\t}\n\n\treturn s\n}" ]
[ "public void fastClear(int index) {\n assert index >= 0 && index < numBits;\n int wordNum = index >> 6;\n int bit = index & 0x03f;\n long bitmask = 1L << bit;\n bits[wordNum] &= ~bitmask;\n // hmmm, it takes one more instruction to clear than it does to set... any\n ...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Execute the console command. @return mixed
[ "public function fire()\n {\n $permissionKey = snake_case($this->argument('permission'));\n $lockdown = $this->lockdown;\n $values = [\n 'permission' => $permissionKey\n ];\n\n try {\n $permission = $lockdown->findPermissionByKey...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Add action to a URL. @since 160608 ReST utils. @param string $action Action identifier. @param mixed|null $data Action data (optional). @param string|null $url Input URL (optional). @return string URL w/ an action.
[ "public function urlAdd(string $action, $data = null, string $url = null): string\n {\n if ($this->viaApi($action)) {\n $action = $this->addApiVersion($action);\n }\n $url = $this->urlRemove($url ?: $this->bestUrl($action));\n\n // $url = $this->c::removeUrlQueryArgs(['utm_...
[ "public function insert(): self\n {\n /** @var self $data */\n $data = $this;\n\n if(!$this->validate(\"post\", $missing))\n {\n throw new \\Exception(\"[MVQN\\REST\\Endpoints\\Endpoint] Annotations for the '\".get_class($this).\"' class require valid values be set \".\n ...
codesearchnet
{ "query": "Represent the Github instruction about text processing:", "pos": "Represent the Github code about text processing:", "neg": "Represent the Github code about Software development:" }
ObjectListInterface interface: Splices the internal container - this will however reset the internal pointer.
[ "public function splice($offset, $length = 0, $replacement = null)\n\t{\n\t\treturn array_splice($this->list, $offset, $length, $replacement);\n\t}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the text about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
A simplified version of pc_calculate_condition(). Please refer to the documentation of Simplified CCalls above. Limitation: symbolic flags are not supported for now.
[ "def pc_calculate_condition_simple(state, cond, cc_op, cc_dep1, cc_dep2, cc_ndep, platform=None):\n \n\n if state.solver.symbolic(cond):\n raise SimError(\"Hit a symbolic 'cond' in pc_calculate_condition. Panic.\")\n\n v = flag_concretize(state, cond)\n\n # Extract the operation\n cc_op = flag...
[ "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 text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
<p>isAnnotationPresentOnField</p> @param annotation a {@link java.lang.Class} object. @param <T> the type @return a boolean.
[ "public <T extends Annotation> boolean isAnnotationPresentOnField( Class<T> annotation ) {\n return CreatorUtils.isAnnotationPresent( annotation, fields );\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:" }
// Round rounds z down to n digits of precision and returns z. The result is // undefined if z is not finite. No rounding will occur if n <= 0. The result of // Round will always be within the interval [⌊10**x⌋, z] where x = the precision // of z.
[ "func (z *Big) Round(n int) *Big {\n\tctx := z.Context\n\tctx.Precision = n\n\treturn ctx.Round(z)\n}" ]
[ "def _RoundTowardZero(value, divider):\n \"\"\"\"\"\"\n # For some languanges, the sign of the remainder is implementation\n # dependent if any of the operands is negative. Here we enforce\n # \"rounded toward zero\" semantics. For example, for (-5) / 2 an\n # implementation may give -3 as the result with the ...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Create PHPixie request from server request. If the server request is not specified it will be created from globals @param Request\ServerRequest $serverRequest @return HTTP\Request
[ "public function request($serverRequest = null)\n {\n if ($serverRequest === null) {\n $serverRequest = $this->sapiServerRequest();\n }\n return $this->builder->request($serverRequest);\n }" ]
[ "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 instruction:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
addons:attach ADDON_NAME attach add-on resource to an app --as ATTACHMENT_NAME # (optional) name for add-on attachment --confirm APP_NAME # overwrite existing add-on attachment with same name
[ "def attach\n unless addon_name = args.shift\n error(\"Usage: heroku addons:attach ADDON_NAME\\nMust specify add-on resource to attach.\")\n end\n addon = resolve_addon!(addon_name)\n\n requires_preauth\n\n attachment_name = options[:as]\n\n msg = attachment_name ?\n \"At...
[ "protected function showHelp($msg = '', $code = 0)\n {\n $usage = Cli::color('USAGE:', 'brown');\n $commands = Cli::color('COMMANDS:', 'brown');\n $sOptions = Cli::color('SPECIAL OPTIONS:', 'brown');\n $pOptions = Cli::color('PUBLIC OPTIONS:', 'brown');\n $version = Cli::color(...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about PHP programming:" }
Inserts file chunk. @param string $data chunk binary content.
[ "private function insertChunk($data)\n {\n $chunkDocument = [\n 'files_id' => $this->_documentId,\n 'n' => $this->chunkCount,\n 'data' => new Binary($data, Binary::TYPE_GENERIC),\n ];\n\n hash_update($this->_hashContext, $data);\n\n $this->collection->...
[ "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 summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
/* (non-Javadoc) @see org.deckfour.xes.util.XsDateTimeConversion#parseXsDateTime(java.lang. String)
[ "public Date parseXsDateTime(String xsDateTime) {\n\t\t// Try Java 7 parsing method\n\t\tif (IS_JAVA7) {\n\t\t\t// Use with ParsePosition to avoid throwing and catching a lot of exceptions, if our parsing method does not work\n\t\t\tDate parsedDate = getDateFormat().parse(xsDateTime, new ParsePosition(0));\n\t\t\ti...
[ "public String makePlainCaptureQueryUrl(String url) {\n\t\t// TOOD: want \"2014*\" instead of \"20140101000000-20141231115959*\"\n\t\treturn wbRequest.getAccessPoint().makeCaptureQueryUrl(url,\n\t\t\twbRequest.getStartTimestamp(), wbRequest.getEndTimestamp());\n\t}" ]
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
单表插入添加数据 @param string $field @param mixed $value @return $this
[ "public function addColumn($field, $value)\r\n {\r\n if (!isset($this->query['columns'])) {\r\n $this->query['columns'] = [];\r\n }\r\n $this->query['columns'][$field] = $value;\r\n return $this;\r\n }" ]
[ "public static SqlInfo getSqlInfoSimply(String nsAtZealotId, Object paramObj) {\n String[] arr = nsAtZealotId.split(ZealotConst.SP_AT);\n if (arr.length != LEN) {\n throw new ValidFailException(\"nsAtZealotId参数的值必须是xml文件中的 nameSpace + '@@' + zealotId 节点的值,\"\n + \"如:'stu...
codesearchnet
{ "query": "Represent the summarization about PHP programming:", "pos": "Represent the code about PHP programming:", "neg": "Represent the code about Software Development:" }
Gets an immutable {@linkplain GVRBitmapTexture texture} with the specified color, returning a cached instance if possible. @param color An Android {@link Color}. @return And immutable instance of {@link GVRBitmapTexture}.
[ "public GVRBitmapTexture getSolidColorTexture(int color) {\n GVRBitmapTexture texture;\n synchronized (mColorTextureCache) {\n texture = mColorTextureCache.get(color);\n Log.d(TAG, \"getSolidColorTexture(): have cached texture for 0x%08X: %b\", color, texture != null);\n ...
[ "@Nullable\n public Bitmap updateBitmap(String id, @Nullable Bitmap bitmap) {\n ImageAssetManager bm = getImageAssetManager();\n if (bm == null) {\n Log.w(L.TAG, \"Cannot update bitmap. Most likely the drawable is not added to a View \" +\n \"which prevents Lottie from getting a Context.\");\n ...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Retrieves the schema with the given schema_id from the registry and returns it as a `dict`.
[ "def get_schema(self, schema_id):\n \n res = requests.get(self._url('/schemas/ids/{}', schema_id))\n raise_if_failed(res)\n return json.loads(res.json()['schema'])" ]
[ "def cast_to_python(self, value):\n \"\"\"\"\"\"\n # v2.x does not provide a distinction between users and groups at the field selection level, can only return\n # UserGroup instances instead of specific User or Group instances\n if value is not None:\n value = UserGroup(self....
codesearchnet
{ "query": "Represent the Github description about AWS Route 53:", "pos": "Represent the Github code about AWS Route 53:", "neg": "Represent the Github code:" }
Creates a new deployment for the path. If the path is a directory the content will be deployed exploded using the file system location. @param content the path containing the content @return the deployment
[ "public static Deployment of(final Path content) {\n final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam(\"content\", content));\n return new Deployment(deploymentContent, null);\n }" ]
[ "function(request, modules_root, options){\n var [path, analysis] = normalize_path(request, modules_root, options.relative_path_root);\n var cache_path = path; // define cachepath as path to file with content. For modules, defines path to package.json\n if(analysis.is_a_module) cache_path = \"m...
codesearchnet
{ "query": "Represent the Github post about Image compression:", "pos": "Represent the Github code about Image compression:", "neg": "Represent the Github code:" }
Do a single operation @param string $token The token string @param mixed $left The left operand. If it is an object, its state may be destroyed. @param mixed $right The right operand @throws Error @return mixed The operation result
[ "private static function doOperation( $token, $left, $right ) {\n\t\tif ( in_array( $token, [ 'in', 'not-in', 'within', 'not-within' ] ) ) {\n\t\t\tif ( !$right instanceof Range ) {\n\t\t\t\t$right = new Range( $right );\n\t\t\t}\n\t\t}\n\t\tswitch ( $token ) {\n\t\t\tcase 'or':\n\t\t\t\treturn $left || $right;\n\t...
[ "public function stringify($string, $return_array = false)\n {\n // Makes sure that it's not empty and it's not a 0, 1, 2 etc...\n if (empty($string) && !is_numeric($string)) {\n return;\n // If the string is actually a closure, execute the closure and return it.\n } el...
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Returns Root Mean Squared Error for all output layers in this network.
[ "def RMSError(self):\n \n tss = 0.0\n size = 0\n for layer in self.layers:\n if layer.type == 'Output':\n tss += layer.TSSError()\n size += layer.size\n return math.sqrt( tss / size )" ]
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code:" }
// DeployResources uploads the bytes for the given files to the server and // creates pending resource metadata for the all resource mentioned in the // metadata. It returns a map of resource name to pending resource IDs.
[ "func DeployResources(\n\tapplicationID string,\n\tchID charmstore.CharmID,\n\tcsMac *macaroon.Macaroon,\n\tfilesAndRevisions map[string]string,\n\tresources map[string]charmresource.Meta,\n\tconn base.APICallCloser,\n) (ids map[string]string, err error) {\n\n\tif len(filesAndRevisions)+len(resources) == 0 {\n\t\t/...
[ "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 Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
/* (non-Javadoc) @see com.impetus.kundera.client.ClientBase#onPersist(com.impetus.kundera.metadata .model.EntityMetadata, java.lang.Object, java.lang.Object, java.util.List)
[ "@Override\n protected void onPersist(EntityMetadata entityMetadata, Object entity, Object id, List<RelationHolder> rlHolders)\n {\n Object connection = getConnection();\n // Create a hashset and populate data into it\n //\n\n Pipeline pipeLine = null;\n try\n {\n ...
[ "@Override\n public void serialize(List<org.audit4j.core.dto.Field> auditFields, Object object,\n String objectName, DeIdentify deidentify) {\n visited.clear();\n String text = toString(object, deidentify);\n auditFields.add(new org.audit4j.core.dto.Field(objectName, text, object....
codesearchnet
{ "query": "Represent the Github comment about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
Flips all bits: 1 --> 0 and 0 --> 1
[ "public void flip() {\n int fromIndex=0, toIndex=size();\n if (fromIndex == toIndex)\n return;\n\n int startWordIndex = wordIndex(fromIndex);\n int endWordIndex = wordIndex(toIndex);\n\n long firstWordMask = WORD_MASK << fromIndex;\n long lastWordMask = WORD_M...
[ "static int equal(byte b, byte c) {\n int ub = b;\n int uc = c;\n int x = ub ^ uc; /* 0: yes; 1..255: no */\n int y = x; /* 0: yes; 1..255: no */\n y -= 1; /* 4294967295: yes; 0..254: no */\n y >>>= 31; /* 1: yes; 0: no */\n return y;\n }" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Convert memory to a human readable string for the console. @param int $mem In bytes @return string
[ "protected function memoryToString($mem)\n {\n $abs = abs($mem);\n if ($abs < 1024) {\n return \"$mem Bytes\";\n } elseif ($abs < 1048576) {\n return round($mem / 1024, 2).\" KB\";\n } else {\n return round($mem / 1048576, 2).\" MB\";\n }\n }...
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the text about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
// Compare compares two lists and returns the difference
[ "func (l paramsList) Compare(Y paramsList) paramsList {\n\tm := make(map[*Param]int)\n\n\tfor _, y := range Y {\n\t\tm[y]++\n\t}\n\n\tvar ret paramsList\n\tfor _, x := range l {\n\t\tif m[x] > 0 {\n\t\t\tm[x]--\n\t\t\tcontinue\n\t\t}\n\t\tret = append(ret, x)\n\t}\n\n\treturn ret\n}" ]
[ "def _check_graph(self, graph):\n \"\"\"\"\"\"\n if graph.num_vertices != self.size:\n raise TypeError(\"The number of vertices in the graph does not \"\n \"match the length of the atomic numbers array.\")\n # In practice these are typically the same arrays using the s...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Given a bbox that contains a given point, return the (x, y) displacement necessary to make the bbox not overlap the point.
[ "def overlap_bbox_and_point(bbox, xp, yp):\n \"\"\"\"\"\"\n cx, cy = get_midpoint(bbox)\n\n dir_x = np.sign(cx-xp)\n dir_y = np.sign(cy-yp)\n\n if dir_x == -1:\n dx = xp - bbox.xmax\n elif dir_x == 1:\n dx = xp - bbox.xmin\n else:\n dx = 0\n\n if dir_y == -1:\n dy...
[ "def get_next_triangle(mesh, T, plane, intersection, dist_tol):\n \n if intersection[0] == INTERSECT_EDGE:\n tris = mesh.triangles_for_edge(intersection[2])\n elif intersection[0] == INTERSECT_VERTEX:\n tris = mesh.triangles_for_vert(intersection[2])\n else:\n assert False, 'Invalid...
codesearchnet
{ "query": "Represent the Github sentence about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }