query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
:param list[int] data:
[ "def write_all(self, data):\n \n self._set_cursor_x(0)\n self._set_cursor_y(0)\n\n self.DC.on()\n\n self._write(data)" ]
[ "def ystep(self):\n \n \"\"\"\n\n self.Y = self.Pcn(self.AX + self.U)" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Given an extension, determine the icon that should be used @param string $extension @return string Icon filename relative to base url
[ "public static function get_icon_for_extension($extension)\n {\n $extension = strtolower($extension);\n $module = ModuleLoader::getModule('silverstripe/framework');\n\n $candidates = [\n $extension,\n static::get_app_category($extension),\n 'generic'\n ...
[ "def template(self):\n \n\n # First try props\n if self.props.template:\n return self.props.template\n else:\n # Return the wtype of the widget, and we'll presume that,\n # like resources, there's a .html file in that directory\n return self.wt...
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
记录update操作及相关参数 @param array $row 要修改的数据 @param mixed $where 查询条件 @return Statement
[ "public function update(array $row, $where): Statement\n {\n $this->operation = 'update';\n if ($where) {\n $this->where = $where;\n }\n $this->row = $row;\n return $this;\n }" ]
[ "public Select parseSelect(MySqlSelectQueryBlock query) throws SqlParseException {\n\n Select select = new Select();\n /*zhongshu-comment SqlParser类没有成员变量,里面全是方法,所以将this传到WhereParser对象时是无状态的,\n 即SqlParser对象并没有给WhereParser传递任何属性,也不存在WhereParser修改SqlParser的成员变量值这一说\n ...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Returns the String identifying the given CUstream_flags @param n The CUstream_flags @return The String identifying the given CUstream_flags
[ "public static String stringFor(int n)\r\n {\r\n if (n == 0)\r\n {\r\n return \"CU_STREAM_DEFAULT\";\r\n }\r\n String result = \"\";\r\n if ((n & CU_STREAM_NON_BLOCKING) != 0) result += \"CU_STREAM_NON_BLOCKING \";\r\n return result;\r\n }" ]
[ "def get_attribute(self, attribute):\n \n\n # Check that the attribute exists.\n try:\n attr = attributes.AttributesByID[attribute]\n except KeyError:\n return 0, constants.StatusCode.error_nonsupported_attribute\n\n # Check that the attribute is valid for th...
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
// NSPortInfos retrieves the list of child NSPortInfos of the NSGateway
[ "func (o *NSGateway) NSPortInfos(info *bambou.FetchingInfo) (NSPortInfosList, *bambou.Error) {\n\n\tvar list NSPortInfosList\n\terr := bambou.CurrentSession().FetchChildren(o, NSPortInfoIdentity, &list, info)\n\treturn list, err\n}" ]
[ "@Override\n public void init(TCPWriteRequestContext x, H2MuxTCPWriteCallback c) {\n writeReqContext = x;\n muxCallback = c;\n\n // callback will need to know how to get back to this write queue.\n // This means one and only one H2WriteTree per H2InboundLink which has just one true TC...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "public NotificationChain basicSetErlangDistribution(ErlangDistributionType newErlangDistribution, NotificationChain msgs) {\n\t\treturn ((FeatureMap.Internal)getMixed()).basicAdd(BpsimPackage.Literals.DOCUMENT_ROOT__ERLANG_DISTRIBUTION, newErlangDistribution, msgs);\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 summarization about Text generation:", "pos": "Represent the code about Text generation:", "neg": "Represent the code:" }
// SetIntervalMillis sets the IntervalMillis field's value.
[ "func (s *HealthCheckPolicy) SetIntervalMillis(v int64) *HealthCheckPolicy {\n\ts.IntervalMillis = &v\n\treturn s\n}" ]
[ "@PrefMetadata(type = CmsTimeWarpPreference.class)\n public String getTimeWarp() {\n\n long warp = m_settings.getTimeWarp();\n return warp < 0 ? \"\" : \"\" + warp; // if timewarp < 0 (i.e. time warp is not set), use the empty string because we don't want the date selector widget to interpret the n...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Moves the carousel to the slide at `data-slide` for the clicked element if possible. @param {MouseEvent} originalEvent @param {HTMLElement} target
[ "function handleDotClick(originalEvent, target) {\n if (this.isMoving) {\n return;\n }\n const { state: { config, itemsPerSlide } } = this;\n const slide = parseInt(target.getAttribute('data-slide'), 10);\n config.preserveItems = true;\n this.setState('index', slide * itemsPerSlide);\n e...
[ "function getPositionByKey(\n opts: Options,\n // The current value\n containerNode: Node,\n // Key of the node in desired position\n key: string\n): TablePosition {\n return TablePosition.create(opts, containerNode, key);\n}" ]
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
ECMA-262 13.3.2 Variable Statement
[ "function(kind, inFor) {\n var node = this.startNode(_VariableDeclaration);\n var allowIn = !inFor;\n var declarations = this.parseVariableDeclarationList(allowIn);\n\n if (!inFor) {\n this.expectSemicolon();\n }\n\n node.declarations = declarations;\n node.kind = kind;\n ...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Adds a new generator to the generators collection @param MetaDataGeneratorInterface $generator @return self|Controller
[ "public function add(MetaDataGeneratorInterface $generator)\n {\n $generator->setInput($this->getInput())\n ->setOutput($this->getOutput())\n ->setCommand($this->getCommand());\n array_push($this->data, $generator);\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 sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Return controller name. @param Model $model Model using this behavior. @return string Return controller name for breadcrumb.
[ "public function getControllerName(Model $model) {\n\t\t$modelNamePlural = $this->getModelNamePlural($model, false);\n\t\t$controllerName = mb_strtolower(Inflector::underscore($modelNamePlural));\n\n\t\treturn $controllerName;\n\t}" ]
[ "public function getTemplateFile($filename, $data)\n {\n $data['getRegion'] = function($name) { \n return $this->getRegion($name); \n }; // This is for mustache compatibility\n\n // Push the data into regions and then pass a pointer to this class to the layout\n // $thi...
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Add secondary network @param filter the server search criteria @param config secondary network config @return OperationFuture wrapper for list of Server
[ "public OperationFuture<List<Server>> addSecondaryNetwork(ServerFilter filter, AddNetworkConfig config) {\n return addSecondaryNetwork(Arrays.asList(getRefsFromFilter(filter)), config);\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 summarization:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Locate the libsodium C library
[ "def get_libsodium():\n ''''''\n\n __SONAMES = (13, 10, 5, 4)\n # Import libsodium from system\n sys_sodium = ctypes.util.find_library('sodium')\n if sys_sodium is None:\n sys_sodium = ctypes.util.find_library('libsodium')\n\n if sys_sodium:\n try:\n return ctypes.CDLL(sys...
[ "def execPath(self):\n \"\"\"\"\"\"\n vers = self.version.label if self.version else None # executables in Versions folder are stored by baseVersion (modified by game data patches)\n return self.installedApp.exec_path(vers)" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Maps to a property on the winControl.
[ "function (propType) {\n return {\n propType: propType,\n preCtorInit: function property_preCtorInit(element, options, data, displayName, propName, value) {\n options[propName] = value;\n },\n update: function property_update(winjsComponent, propName...
[ "def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Iterate over an objects keyset
[ "function forKeys(obj, f) {\n for (var key in obj) {\n if (obj.hasOwnProperty(key) && typeof obj[key] !== 'function') {\n if (f(key, obj[key])) {\n break;\n }\n }\n }\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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
// Encode encodes metrics into prometheus exposition format bytes.
[ "func (e *Expfmt) Encode(mfs []*dto.MetricFamily) ([]byte, error) {\n\treturn EncodeExpfmt(mfs, e.Format)\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 post about software development:", "pos": "Represent the code about software development:", "neg": "Represent the code:" }
// Delay executes the task, delayed for d duration
[ "func (t *Task) Delay(c *Client, d time.Duration) error {\n\treturn c.Delay(t, d)\n}" ]
[ "function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about File management:" }
Normalized (lowercase) domain part of the email address. @return string
[ "public function getDomain(): string\n {\n $normalizedDomain = idn_to_ascii($this->domain, IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46);\n if ($normalizedDomain === false) {\n throw new FailedToNormalizeDomainException($this->domain);\n }\n\n return $normalizedDo...
[ "def t_ATOM(self, t):\n '\n t.type = PLLexer.reserved.get(t.value, 'ATOM') # Check for reserved words\n return t" ]
codesearchnet
{ "query": "Represent the text about database:", "pos": "Represent the code about database:", "neg": "Represent the code about Regular expressions:" }
Prints the given function to `f`.
[ "def _print_function(self, f, prefix, fullname, func):\n \"\"\"\"\"\"\n heading = prefix + \" `\" + fullname\n if not isinstance(func, property):\n heading += self._generate_signature_for_function(func)\n heading += \"` {#%s}\" % _get_anchor(self._module_to_name, fullname)\n print(heading, file=...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Get the related types that are in the collection, grouped by ContentType key. @internal @return array
[ "public function getGrouped()\n {\n $types = [];\n $elements = $this->toArray();\n /** @var Entity\\Relations $element */\n foreach ($elements as $element) {\n $type = $element->get('to_contenttype');\n $types[$type][] = $element;\n }\n\n return $ty...
[ "def property_(getter: Map[Domain, Range]) -> property:\n \n return property(map_(WeakKeyDictionary())(getter))" ]
codesearchnet
{ "query": "Represent the summarization about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
@param User $user @throws \Exception
[ "protected function saveEntity($user)\n {\n if (!$user instanceof UserInterface) {\n parent::saveEntity($user);\n\n return;\n }\n\n $this->get(UserManagerInterface::class)->save($user);\n\n $action = $this->admin->getCurrentAction();\n $this->addFlash('suc...
[ "public function init()\n {\n $this->response->disableLayout();\n $this->userStore = b8\\Store\\Factory::getStore('User');\n }" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// // DriverTypeSimpleValueOf returns the string format of DriverType
[ "func DriverTypeSimpleValueOf(s string) (DriverType, error) {\n\tobj, err := simpleValueOf(\"driver_type\", DriverType_value, s)\n\treturn DriverType(obj), err\n}" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Get the information of the records.
[ "def get_recordInfo(self, headers, zoneID, zone, records):\n \"\"\"\"\"\"\n if 'None' in records: #If ['None'] in record argument, query all.\n recordQueryEnpoint = '/' + zoneID + '/dns_records&per_page=100'\n recordUrl = self.BASE_URL + recordQueryEnpoint\n recordRequ...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
parse opt1=value1:opt2=value2...
[ "def parse_options(options, arg_split:':', valuesep: '=', opt_default: true, keyed_sep: \"/\")\n\t\t\treturn {} unless options\n\t\t\tparsed_options={}\n\t\t\toptions=options.split(arg_split) unless options.is_a?(Enumerable)\n\t\t\toptions.each do |optvalue|\n\t\t\t\topt,value=DR::SimpleParser.parse_namevalue(optva...
[ "def anim(host, seq, anim, d):\n \n at(host, 'ANIM', seq, [anim, d])" ]
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Updates the attributes associated with the specified certificate. @param updateCertificateRequest the grouped properties for updating a certificate request @return the CertificateBundle if successful.
[ "public CertificateBundle updateCertificate(UpdateCertificateRequest updateCertificateRequest) {\n return updateCertificate(updateCertificateRequest.vaultBaseUrl(), updateCertificateRequest.certificateName(),\n updateCertificateRequest.certificateVersion(), updateCertificateRequest.certificate...
[ "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 summarization:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Get current state of state machine.
[ "public function getState($id)\n\t{\n\t\tif ($id === null || $id === array() || $id === false || $id === '') {\n\t\t\treturn '';\n\t\t}\n\n\t\t$q = $this->createQueryBuilder()\n\t\t\t->select(null)\n\t\t\t->limit(1);\n\n\t\t$this->queryAddStateSelect($q);\n\t\t$this->queryAddPrimaryKeyWhere($q, $id);\n\n\t\t$r = $q...
[ "@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:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
Get available sort order values. @return array
[ "private function getSortOrder()\n {\n return [\n $this->translator->trans(/** @Desc(\"Ascending\") */ 'content_type.sort_field.ascending', [], 'content_type') => Location::SORT_ORDER_ASC,\n $this->translator->trans(/** @Desc(\"Descending\") */ 'content_type.sort_field.descending', [...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Return the Element data tree. @param Request $request @return JsonResponse @Route("/tree", name="tree_tree")
[ "public function treeAction(Request $request)\n {\n $siterootId = $request->get('siteroot_id');\n $tid = $request->get('node');\n $language = $request->get('language');\n\n $treeManager = $this->get('phlexible_tree.tree_manager');\n $elementService = $this->get('phlexible_eleme...
[ "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 Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Build the signature. @param node the XML element that specifies which components to document @param methodDocTree the content tree to which the documentation will be added
[ "public void buildSignature(XMLNode node, Content methodDocTree) {\n methodDocTree.addContent(writer.getSignature(currentMethod));\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:" }
Compress a query by collapsing white space and removing comments @param String $string The SQL string @return String The SQL string without comments
[ "public static function compress($string)\n {\n $result = '';\n\n $tokens = self::tokenize($string);\n\n $whitespace = true;\n foreach ($tokens as $token) {\n // Skip comment tokens\n if ($token[self::TOKEN_TYPE] === self::TOKEN_TYPE_COMMENT || $token[self::TOKEN...
[ "private static String keyToGoWithElementsString(String label, DuplicateGroupedAndTyped elements) {\n /*\n * elements.toString(), which the caller is going to use, includes the homogeneous type (if\n * any), so we don't want to include it here. (And it's better to have it in the value, rather\n * tha...
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
The xmltodict.unparse requires we modify the shape of the input dictionary slightly. Instead of a dict of the form: {'key': ['value1', 'value2']} We must provide: {'key': {'item': ['value1', 'value2']}}
[ "def itemize(data):\n \n if isinstance(data, dict):\n ret = {}\n for key in data:\n ret[key] = itemize(data[key])\n return ret\n elif isinstance(data, list):\n return {'item': [itemize(value) for value in data]}\n else:\n return data" ]
[ "def validate_extra_context(ctx, param, value):\n \"\"\"\"\"\"\n for s in value:\n if '=' not in s:\n raise click.BadParameter(\n 'EXTRA_CONTEXT should contain items of the form key=value; '\n \"'{}' doesn't match that form\".format(s)\n )\n\n # Co...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about Go programming language:" }
Delete several objects and wait end of indexing @param objects an array of objectIDs @param request_options contains extra parameters to send with your query
[ "def delete_objects!(objects, request_options = {})\n res = delete_objects(objects, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n res\n end" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
// GarbageCollect removes dead containers using the specified container gc policy.
[ "func (m *kubeGenericRuntimeManager) GarbageCollect(gcPolicy kubecontainer.ContainerGCPolicy, allSourcesReady bool, evictNonDeletedPods bool) error {\n\treturn m.containerGC.GarbageCollect(gcPolicy, allSourcesReady, evictNonDeletedPods)\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 about Container management:", "pos": "Represent the Github code about Container management:", "neg": "Represent the Github code:" }
// newCursor creates a new Cursor implementation.
[ "func newCursor(data cursorData, endpoint string, db *database, allowDirtyReads bool) (Cursor, error) {\n\tif db == nil {\n\t\treturn nil, WithStack(InvalidArgumentError{Message: \"db is nil\"})\n\t}\n\treturn &cursor{\n\t\tcursorData: data,\n\t\tendpoint: endpoint,\n\t\tdb: db,\n\t\tconn: ...
[ "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:" }
This function create a correct widget object for the header.
[ "def core__generate_widget key, values, module_name\n widget = {}\n widget[:key] = key\n widget[:icon] = values[:icon] ? values[:icon] : 'check-circle'\n widget[:path] = values[:path] ? values[:path] : ''\n widget[:position] = values[:position] ? values[:position] : 999\n widget[:title...
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Are these filters functionally the same? Override this to compare filters. @return true if they are.
[ "public boolean isSameFilter(BaseMessageFilter filter)\n {\n if (filter.getClass().equals(this.getClass()))\n {\n if (filter.isFilterMatch(this))\n ; // return true;? todo (don) You need to figure out how to compare filters\n }\n return false;\n }" ]
[ "def add_device(self, device, container):\n \n # There is a size tag which the JSS manages for us, so we can\n # ignore it.\n if self.findtext(\"is_smart\") == \"false\":\n self.add_object_to_path(device, container)\n else:\n # Technically this isn't true. It...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns the norm of the quaternion norm = w**2 + x**2 + y**2 + z**2
[ "def norm(self):\n \n tmp = self.w**2 + self.x**2 + self.y**2 + self.z**2\n return tmp**0.5" ]
[ "def dot_v2(vec1, vec2):\n \"\"\"\"\"\"\n\n return vec1.x * vec2.x + vec1.y * vec2.y" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about mathematics:" }
// SetRepeatDelayMs sets the RepeatDelayMs optional argument. The // number of milliseconds delay between each repeat. (default: 250).
[ "func (a *SynthesizeScrollGestureArgs) SetRepeatDelayMs(repeatDelayMs int) *SynthesizeScrollGestureArgs {\n\ta.RepeatDelayMs = &repeatDelayMs\n\treturn a\n}" ]
[ "private void init() {\n // defaults for internal bookkeeping\n index = 0; // internal index always starts at 0\n count = 1; // internal count always starts at 1\n status = null; // we clear status on release()\n item = null; // item w...
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Computer Science:" }
Make a file with utf-8 text.
[ "def make_file(abspath, text):\n \n try:\n with open(abspath, \"wb\") as f:\n f.write(text.encode(\"utf-8\"))\n print(\"Made: %s\" % abspath)\n except: # pragma: no cover\n pass" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github text about File management:", "pos": "Represent the Github code about File management:", "neg": "Represent the Github code about programming:" }
Decarator that registers a command that doesn't take any parameters.
[ "def cmd(name, accepts_force=False):\n \n def decorator(func):\n @_cmd(name)\n def command_wrapper(editor, variables):\n force = bool(variables['force'])\n\n if force and not accepts_force:\n editor.show_message('No ! allowed')\n elif accepts_force...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Transforms a string (id) to an object (group). @param Group|ArrayCollection|Group[]|null $group @return string|string[] @throws TransformationFailedException if object (group) is not found.
[ "public function reverseTransform($group)\n {\n if(null === $group) {\n return \"\";\n } elseif ($group instanceof Group) {\n return (string)$group->getId();\n } elseif ($group instanceof ArrayCollection) {\n $result = array();\n foreach($group as ...
[ "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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
// GetPixelColor get pixel color return string
[ "func GetPixelColor(x, y int) string {\n\tcx := C.size_t(x)\n\tcy := C.size_t(y)\n\n\tcolor := C.get_pixel_color(cx, cy)\n\tgcolor := C.GoString(color)\n\tC.free(unsafe.Pointer(color))\n\n\treturn gcolor\n}" ]
[ "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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns null if file already exists. throws if there was unexpected problem
[ "public static FSDataOutputStream tryCreateFile(FileSystem fs, Path file) throws IOException {\n try {\n FSDataOutputStream os = fs.create(file, false);\n return os;\n } catch (FileAlreadyExistsException e) {\n return null;\n } catch (RemoteException e) {\n if( e.unwrapRemoteException()...
[ "private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {\n // Get default form\n in.defaultReadObject();\n\n // Create new Archive\n final String name = this.name;\n final ZipImporter archive = ShrinkWrap.create(ZipImporter.class, name);\n\...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
@param ClassArgumentObject $inputSource @param ClassArgumentObject $matcher @param ServerRequestInterface $httpRequest @return bool
[ "private function evaluate(\n ClassArgumentObject $inputSource,\n ClassArgumentObject $matcher,\n ServerRequestInterface $httpRequest\n ) {\n return $matcher->getInstance()->match(\n $inputSource->getInstance()->getValue($httpRequest, $inputSource->getArgument()),\n ...
[ "public function execute($request)\n {\n RequestNotSupportedException::assertSupports($this, $request);\n\n //$model = ArrayObject::ensureArrayObject($request->getModel());\n\n $this->gateway->execute(new PaymentResponse($request->getModel()));\n }" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about writing:" }
// IsSquare returns if the row count is equal to the column count.
[ "func (m *Matrix) IsSquare() bool {\n\treturn m.stride == (len(m.elements) / m.stride)\n}" ]
[ "public void validateRange(final LmlParser parser) {\n if (min >= max || stepSize > max - min || value < min || value > max || stepSize <= 0f) {\n parser.throwError(\n \"Range widget not properly constructed. Min value has to be lower than max and step size cannot be higher than...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Returns a toolbar object of a view. @return AnControllerToolbarAbstract|null If no toolbar found then null is returned
[ "public function getToolbar()\n {\n $view = $this->_template->getView();\n $toolbar = $view->getState()->toolbar;\n if (!$toolbar) {\n $controller = $this->getController($view->getName());\n $toolbar = $controller->getIdentifier()->name;\n if ($controller->ha...
[ "def getItem(self, index, altItem=None):\n \n if index.isValid():\n item = index.internalPointer()\n if item:\n return item\n\n #return altItem if altItem is not None else self.invisibleRootItem # TODO: remove\n return altItem" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
// ImportMetric receives a metric from another veneur instance
[ "func (w *Worker) ImportMetric(other samplers.JSONMetric) {\n\tw.mutex.Lock()\n\tdefer w.mutex.Unlock()\n\n\t// we don't increment the processed metric counter here, it was already\n\t// counted by the original veneur that sent this to us\n\tw.imported++\n\tif other.Type == counterTypeName || other.Type == gaugeTyp...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Applies a median filter. @param input Input image. Not modified. @param output (Optional) Storage for output image, Can be null. Modified. @param radius Radius of the median blur function. @param <T> Input image type. @return Output blurred image.
[ "public static <T extends ImageBase<T>>\n\tT median(T input, @Nullable T output, int radius , @Nullable WorkArrays work) {\n\t\tif( input instanceof GrayU8) {\n\t\t\treturn (T)BlurImageOps.median((GrayU8) input, (GrayU8) output, radius, (IWorkArrays)work);\n\t\t} else if( input instanceof GrayF32) {\n\t\t\treturn (...
[ "@Override\n\tprotected void processImage(ImageBase image) {\n\t\t// The data type of 'image' was specified in onCreate() function\n\t\t// The line below will compute the gradient and store it in two images. One for the\n\t\t// gradient along the x-axis and the other along the y-axis\n\t\tgradient.process((GrayU8)i...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code:" }
// UploadLayer uploads a specific layer by digest for a repository.
[ "func (r *Registry) UploadLayer(ctx context.Context, repository string, digest reference.Reference, content io.Reader) error {\n\tuploadURL, token, err := r.initiateUpload(ctx, repository)\n\tif err != nil {\n\t\treturn err\n\t}\n\tq := uploadURL.Query()\n\tq.Set(\"digest\", digest.String())\n\tuploadURL.RawQuery =...
[ "@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:" }
// Negotiate is part of the AuthServer interface. // It will never be called.
[ "func (a *AuthServerNone) Negotiate(c *Conn, user string, remotAddr net.Addr) (Getter, error) {\n\tpanic(\"Negotiate should not be called as AuthMethod returned mysql_native_password\")\n}" ]
[ "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 text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
// SetUserId sets the UserId field's value.
[ "func (s *PostContentInput) SetUserId(v string) *PostContentInput {\n\ts.UserId = &v\n\treturn s\n}" ]
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
:param view: a :class:`ObjectView` class or instance
[ "def _check_view_permission(self, view):\n \n security = get_service(\"security\")\n return security.has_permission(current_user, view.permission, self.obj)" ]
[ "def app_to_object(self):\n \"\"\"\"\"\"\n if self.tagClass != Tag.applicationTagClass:\n raise ValueError(\"application tag required\")\n\n # get the class to build\n klass = self._app_tag_class[self.tagNumber]\n if not klass:\n return None\n\n # buil...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Return request user meta data. @param Request $request @return array
[ "protected function getUserData(Request $request)\n {\n $data = [];\n\n foreach ($this->repository->all() as $field) {\n $data[$field->getName()] = $request->get($field->getName());\n }\n\n return $data;\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 summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
Verify a checksum.
[ "private static boolean verifyChecksum(final String hrp, final byte[] values) {\n byte[] hrpExpanded = expandHrp(hrp);\n byte[] combined = new byte[hrpExpanded.length + values.length];\n System.arraycopy(hrpExpanded, 0, combined, 0, hrpExpanded.length);\n System.arraycopy(values, 0, comb...
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Slice the map from [start, end)
[ "def slice(self, start=0, end=0):\n \"\"\"\"\"\"\n tmp = Gauged.map_new()\n if tmp is None:\n raise MemoryError\n if not Gauged.map_concat(tmp, self.ptr, start, end, 0):\n Gauged.map_free(tmp) # pragma: no cover\n raise MemoryError\n return Sparse...
[ "def get_generator(self):\n \n s = self.slice\n gen = drange(s.start, s.stop, s.step) # intialises the generator\n return gen" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
@name LoadBalancer._populateVirtualIps @description Loads the virtualIps into this load balancer instance @param {Object} virtualIps the virtualIps to load
[ "function(virtualIps) {\n\n if (!virtualIps) {\n return;\n }\n\n var self = this;\n\n self.virtualIps = [];\n\n _.each(virtualIps, function(virtualIp) {\n self.virtualIps.push(new rackspace.VirtualIp(virtualIp));\n });\n }" ]
[ "def service_references(self):\n \n services_blue_print = self._scheme_references.get('services')\n if services_blue_print is None:\n raise LookupError('unable to find any services in the config.')\n\n # TODO: this needs to be cleaned up and made solid. maybe when creating the...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Remove RFC822 comments @param string $data Data to strip comments from @return string Comment stripped string
[ "public static function uncomment_rfc822($string)\n\t{\n\t\t$string = (string) $string;\n\t\t$position = 0;\n\t\t$length = strlen($string);\n\t\t$depth = 0;\n\n\t\t$output = '';\n\n\t\twhile ($position < $length && ($pos = strpos($string, '(', $position)) !== false)\n\t\t{\n\t\t\t$output .= substr($string, $positio...
[ "def decrypt payload, armor=false # a RubyMail::Message object\n return unknown_status(@not_working_reason) unless @not_working_reason.nil?\n\n gpg_opts = {:protocol => GPGME::PROTOCOL_OpenPGP}\n gpg_opts = HookManager.run(\"gpg-options\",\n {:operation => \"decrypt\", :option...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about PHP programming:" }
// ExecCommand is a small platform specific wrapper around os/exec.Command
[ "func ExecCommand(name string, arg ...string) *Cmd {\n\tcmd := exec.Command(name, arg...)\n\tcmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}\n\tcmd.Env = env\n\treturn newCmd(cmd)\n}" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// DateRecv calls the stored procedure 'pg_catalog.date_recv(internal) date' on db.
[ "func DateRecv(db XODB, v0 pgtypes.Internal) (time.Time, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.date_recv($1)`\n\n\t// run query\n\tvar ret time.Time\n\tXOLog(sqlstr, v0)\n\terr = db.QueryRow(sqlstr, v0).Scan(&ret)\n\tif err != nil {\n\t\treturn time.Time{}, err\n\t}\n\n\tr...
[ "function completeQuery(err) {\n if (err) return cb(err);\n db.eval(zahd, 2, 'expiring_domains', 'querying_domains',\n expiration, domain, next);\n }" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Test if the <tt>/</tt> character at <tt>offset</tt> starts a block comment, and return the position of the last <tt>/</tt> character. @param query query @param offset start offset @return position of the last <tt>/</tt> character
[ "public static int parseBlockComment(final char[] query, int offset) {\n if (offset + 1 < query.length && query[offset + 1] == '*') {\n // /* /* */ */ nest, according to SQL spec\n int level = 1;\n for (offset += 2; offset < query.length; ++offset) {\n switch (query[offset - 1]) {\n ...
[ "function (link) {\n\n if (link !== null) {\n // ( $1\n // [^\\\\] anything that's not a backslash\n // (?:\\\\\\\\)* an even number (this includes zero) of backslashes\n // )\n // (?= follo...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Get records related to this plugin and user. @param int $userid The user ID @return array An array of records.
[ "protected static function get_records($userid) {\n global $DB;\n\n $sql = \"SELECT *\n FROM {user_info_data} uda\n JOIN {user_info_field} uif ON uda.fieldid = uif.id\n WHERE uda.userid = :userid\n AND uif.datatype = :datatype\";\...
[ "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 instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Sends the pdf to the browser for download. @param string $strFilename The filename @throws \MpdfException
[ "public function sendToBrowser($strFilename = '', $strDest = 'I')\n {\n $strFilename = $strFilename ?: $this->buildFilename();\n\n $this->objPdf->Output($strFilename, $strDest);\n }" ]
[ "public function logBanner($additions = null)\n {\n $this->addStatusMessage('FlexiBee '.str_replace('://',\n '://'.$this->user.'@', $this->getApiUrl()).' FlexiPeeHP v'.self::$libVersion.' (FlexiBee '.EvidenceList::$version.') EasePHP Framework v'.\\Ease\\Atom::$frameworkVersion.' '.$additio...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
判断给定的抽象类, 当其实列化对应的具体对象时, 该对象是否是共享的 @param string $abstract @return boolean
[ "protected function isShared($abstract)\n {\n $abstract = $this->normalize($abstract);\n //存在实列集合中, 肯定是共享的\n if (isset($this->instances[$abstract])) {\n return true;\n }\n if (! isset($this->bindings[$abstract]['shared'])) {\n return false;\n }\n ...
[ "public Select parseSelect(MySqlSelectQueryBlock query) throws SqlParseException {\n\n Select select = new Select();\n /*zhongshu-comment SqlParser类没有成员变量,里面全是方法,所以将this传到WhereParser对象时是无状态的,\n 即SqlParser对象并没有给WhereParser传递任何属性,也不存在WhereParser修改SqlParser的成员变量值这一说\n ...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// ValuesOf same as `ValueOf` but accepts a slice of // somethings and returns a slice of reflect.Value.
[ "func ValuesOf(valuesAsInterface []interface{}) (values []reflect.Value) {\n\tfor _, v := range valuesAsInterface {\n\t\tvalues = append(values, ValueOf(v))\n\t}\n\treturn\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 post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
@param ResetRequest $request @throws UserNotFoundException @return $this|\Illuminate\Http\RedirectResponse
[ "public function passwordResetRequest($id)\n {\n if (! $user = $this->user->find($id)) {\n flash(trans('core::messages.resource.resource not found', ['name' => trans('user::users.title.user')]));\n\n return redirect()->route('backend::user.index');\n }\n\n $code = $this...
[ "public function createRole(RoleAssignment $roleAssignment): UIValue\\User\\Role\n {\n return new UIValue\\User\\Role($roleAssignment);\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about Laravel:", "pos": "Represent the Github code about Laravel:", "neg": "Represent the Github code about Programming:" }
Return the global session id. @return string
[ "public static function getGlobalSessionId() {\n\t\tif(isset($_SERVER['PHPSESSID']))\n\t\t\treturn $_SERVER['PHPSESSID'];\n\t\telseif(isset($_POST['PHPSESSID']))\n\t\t\treturn $_POST['PHPSESSID'];\n\t\telseif(isset($_GET['PHPSESSID']))\n\t\t\treturn $_GET['PHPSESSID'];\n\t}" ]
[ "def getKeySequenceCounter(self):\n \"\"\"\"\"\"\n print '%s call getKeySequenceCounter' % self.port\n keySequence = ''\n keySequence = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:KeyIndex')[0]\n return keySequence" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Creates CircleOptions out of a Feature. @param feature feature to be converted
[ "@Nullable\n static CircleOptions fromFeature(@NonNull Feature feature) {\n if (feature.geometry() == null) {\n throw new RuntimeException(\"geometry field is required\");\n }\n if (!(feature.geometry() instanceof Point)) {\n return null;\n }\n\n CircleOptions options = new CircleOptions()...
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Check if a plan is on a valid line.
[ "def _plan_on_valid_line(self, at_line, final_line_count):\n \"\"\"\"\"\"\n # Put the common cases first.\n if at_line == 1 or at_line == final_line_count:\n return True\n\n # The plan may only appear on line 2 if the version is at line 1.\n after_version = (\n ...
[ "public function getStockQuantity(string $sku) {\n $stock = $this->getStock($sku);\n\n if (empty($stock['status'])) {\n return 0;\n }\n\n // @TODO: For now there is no scenario in which we have quantity in float.\n // We have kept the database field to match what is there in MDC and code\n //...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Notify cfg agent about router added to hosting device.
[ "def router_added_to_hosting_device(self, context, router):\n \"\"\"\"\"\"\n self._notification(context, 'router_added_to_hosting_device',\n [router], operation=None, shuffle_agents=False)" ]
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code about Technology:" }
Generate random timestamp. :param posix: POSIX time. :param kwargs: Kwargs for :meth:`~Datetime.datetime()`. :return: Timestamp.
[ "def timestamp(self, posix: bool = True, **kwargs) -> Union[str, int]:\n \n stamp = self.datetime(**kwargs)\n\n if posix:\n return timegm(stamp.utctimetuple())\n\n return stamp.strftime('%Y-%m-%dT%H:%M:%SZ')" ]
[ "def __set_date(self, value):\n '''\n \n '''\n if not issubclass(value.__class__, date):\n raise ValueError('Invalid date value')\n\n self.__date = value" ]
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// StoreHistoryChart stores the charts data for the given address in cache. The // current best block data is required to determine cache freshness.
[ "func (ac *AddressCache) StoreHistoryChart(addr string, addrChart dbtypes.HistoryChart,\n\tchartGrouping dbtypes.TimeBasedGrouping, cd *dbtypes.ChartsData, block *BlockID) bool {\n\tif block == nil || ac.cap < 1 || ac.capAddr < 1 {\n\t\treturn false\n\t}\n\n\tif int(chartGrouping) >= dbtypes.NumIntervals {\n\t\tlog...
[ "public static function getRankingQueryLimit()\n {\n $configGeneral = Config::getInstance()->General;\n $configLimit = $configGeneral['archiving_ranking_query_row_limit'];\n $limit = $configLimit == 0 ? 0 : max(\n $configLimit,\n $configGeneral['datatable_archiving_maxi...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Return SMCResult object and use search filter to find object :param name: name of element to find :param _filter: filter to use, i.e. tcp_service, host, etc :return: :py:class:`smc.api.web.SMCResult`
[ "def element_as_smcresult_use_filter(name, _filter):\n \n if name:\n element = fetch_meta_by_name(name, filter_context=_filter)\n if element.msg:\n return element\n if element.json:\n return element_by_href_as_smcresult(element.json.pop().get('href'))" ]
[ "def _get_dataobject(self, name, multivalued):\n \"\"\"\"\"\"\n logger.debug(\"Querying server for uncached data object %s\", name)\n # This will retrieve the value and inject it into the cache\n self.update_view_data(properties=[name])\n return self._cache[name][0]" ]
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Converts the specified datetime object into its appropriate protocol value. This is the number of milliseconds from the epoch.
[ "def convertDatetime(t):\n \n epoch = datetime.datetime.utcfromtimestamp(0)\n delta = t - epoch\n millis = delta.total_seconds() * 1000\n return int(millis)" ]
[ "private function to8601Utc(\\DateTimeInterface $dateTime): string\n {\n // Convert to UTC if we can\n if ($dateTime instanceof DateTime) {\n $dateTime->setTimezone(new \\DateTimeZone('UTC'));\n } elseif ($dateTime instanceof \\DateTimeImmutable && $dateTime->getOffset() > 0) {\n ...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Marshall the given parameter object.
[ "public void marshall(SignalExternalWorkflowExecutionInitiatedEventAttributes signalExternalWorkflowExecutionInitiatedEventAttributes,\n ProtocolMarshaller protocolMarshaller) {\n\n if (signalExternalWorkflowExecutionInitiatedEventAttributes == null) {\n throw new SdkClientException(\"I...
[ "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:" }
Helper method for creating a child computation.
[ "def prepare_child_message(self,\n gas: int,\n to: Address,\n value: int,\n data: BytesOrView,\n code: bytes,\n **kwargs: Any) -> Message:\n ...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Makes sure that the two interactions are members of the same pathway. @return non-generative constraint
[ "public static Constraint inSamePathway()\n\t{\n\t\tString s1 = \"Interaction/stepProcessOf/pathwayOrderOf\";\n\t\tString s2 = \"Interaction/pathwayComponentOf\";\n\t\treturn new OR(new MappedConst(new Field(s1, s1, Field.Operation.INTERSECT), 0, 1),\n\t\t\tnew MappedConst(new Field(s2, s2, Field.Operation.INTERSEC...
[ "public void setStaticRoute(NodesMap nm, Map<Link, Boolean> links) {\n routes.put(nm, links); // Only one route between two nodes (replace the old route)\n }" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
@param string $messageKey @param string $value OPTIONAL @return void
[ "protected function _error($messageKey, $value = null)\n {\n if ($messageKey === null) {\n $keys = array_keys($this->_messageTemplates);\n $messageKey = current($keys);\n }\n if ($value === null) {\n $value = $this->_value;\n }\n $this->_m...
[ "public function trace()\n {\n //====================================================================//\n // Safety Check\n if (!isset($this->debug) || !$this->debug) {\n return;\n }\n //====================================================================//\n ...
codesearchnet
{ "query": "Represent the description about PHP programming:", "pos": "Represent the code about PHP programming:", "neg": "Represent the code about programming:" }
Return a normalized representation of a set of document @todo do not pass controller, create an utils service @param array $params @param object $controller @return array
[ "public function getList($params = array(), ServiceManager $sm) \n\t{\n\t\t//var_dump($params); exit();\n\t\t$paginator = $this->getPaginator($params);\n\t\t\n\t\t$data = array();\n\t\tforeach($paginator as $post) {\n\t\t\t$data[] = $this->get($post, $sm); // verificare che cazzo fa sto get!!!!!\n\t\t}\n\n\t\t// De...
[ "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 description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns the string value of the configuration managers @param property the property to retrieve @return the string value of the configuration managers
[ "public String getStringValue(String property) {\n\n\t\tfinal List<JawrConfigManagerMBean> mBeans = getInitializedConfigurationManagers();\n\t\ttry {\n\n\t\t\tif (mBeans.size() == 3) {\n\n\t\t\t\tif (areEquals(getProperty(jsMBean, property), getProperty(cssMBean, property),\n\t\t\t\t\t\tgetProperty(binaryMBean, pro...
[ "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 summarization about Documentation:", "pos": "Represent the code about Documentation:", "neg": "Represent the code:" }
@EXT\Route("/mail/layout/option/form", name="claro_admin_mail_option_form") @EXT\Template @SEC\PreAuthorize("canOpenAdminTool('platform_parameters')") @return \Symfony\Component\HttpFoundation\Response
[ "public function optionMailFormAction()\n {\n $form = $this->formFactory->create(\n new AdminForm\\MailOptionType($this->mailManager->getMailerFrom())\n );\n\n return array('form' => $form->createView());\n }" ]
[ "public function runBefore()\n {\n $this->themeName = Config::getInstance()->get('Eureka\\Global\\Theme\\php\\theme');\n $this->themeLayoutPath = Config::getInstance()->get('Eureka\\Global\\Theme\\php\\layout');\n }" ]
codesearchnet
{ "query": "Represent the summarization about Symfony:", "pos": "Represent the code about Symfony:", "neg": "Represent the code about programming:" }
Set the height of the thumbnails (or the maximum height in case of proportional sizing). @param int|null $height
[ "public function setHeight($height)\n {\n $this->height = null;\n if ($height && is_numeric($height)) {\n $height = (int) $height;\n if ($height > 0) {\n $this->height = $height;\n }\n }\n }" ]
[ "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 comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Says hello to someone @arg name The name of the person to say hello to
[ "public function executeHello(array $args, array $options = array())\n {\n $name = 'unknown';\n if (empty($args)) {\n $dialog = new Dialog($this->console);\n $name = $dialog->ask('What is your name?', $name);\n } else {\n $name = $args[0];\n }\n ...
[ "function receivedMessageWithoutNLP(messageText, senderID, event) {\n // match a greeting intent and send a response,\n if (messageText == \"hi\" || messageText == \"hello\") {\n sendTextMessage(senderID, \"Hello there.\");\n }\n // match an intent to talk to a real human\n else if (messageTex...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Writes samples to file following WAVE format. @param file Recording where to write the header @throws IOException
[ "private static void writeHeader(Path file) throws IOException {\n try (FileChannel fout = FileChannel.open(file, StandardOpenOption.WRITE)) {\n\n long size = fout.size();\n int sampleSize = (int) size - 44;\n\n if (logger.isInfoEnabled()) {\n logger.info(\"Siz...
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Try and load in the next valid frame info. This will skip over skippable frames. @return True if a frame was loaded. False if there are no more frames in the stream. @throws IOException On input stream read exception
[ "private boolean nextFrameInfo() throws IOException {\n while (true) {\n int size = 0;\n do {\n\tfinal int mySize = in.read(readNumberBuff.array(), size, LZ4FrameOutputStream.INTEGER_BYTES - size);\n\tif (mySize < 0) {\n\t return false;\n\t}\n\tsize += mySize;\n } while (size < LZ4FrameOutputStre...
[ "def finish_parse(self, last_lineno_seen):\n \"\"\"\"\"\"\n if self.state == self.STATES['step_in_progress']:\n # We've reached the end of the log without seeing the final \"step finish\"\n # marker, which would normally have triggered updating the step. As such we\n #...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
// Custom marshaller to add the resourceType property, as required by the specification
[ "func (resource *Contract) MarshalJSON() ([]byte, error) {\n\tresource.ResourceType = \"Contract\"\n\t// Dereferencing the pointer to avoid infinite recursion.\n\t// Passing in plain old x (a pointer to Contract), would cause this same\n\t// MarshallJSON function to be called again\n\treturn json.Marshal(*resource)...
[ "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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Load template by template file name. @param string $name @throws Exception @return Template
[ "public function loadTemplate($name)\n {\n $template = new Template();\n $template->app = $this;\n\n if (in_array($name[0], ['.', '/', '\\\\']) || strpos($name, ':\\\\') !== false) {\n return $template->load($name);\n } else {\n $dir = is_array($this->template_di...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
for internal use, after checkFrozen has been called
[ "private UnicodeSet add_unchecked(int start, int end) {\n if (start < MIN_VALUE || start > MAX_VALUE) {\n throw new IllegalArgumentException(\"Invalid code point U+\" + Utility.hex(start, 6));\n }\n if (end < MIN_VALUE || end > MAX_VALUE) {\n throw new IllegalArgumentExcep...
[ "def upgradePrivateApplication3to4(old):\n \n new = old.upgradeVersion(\n PrivateApplication.typeName, 3, 4,\n preferredTheme=old.preferredTheme,\n privateKey=old.privateKey,\n website=old.website,\n customizedPublicPage=old.customizedPublicPage,\n authenticationAppli...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Return an observer @param string $name The name of the observer @return Garp_Util_Observer Or null if not found
[ "public function getObserver($name) {\n return array_key_exists($name, $this->_observers) ? $this->_observers[$name] : null;\n }" ]
[ "private function _init()\n {\n // TODO: check if self::$instance is required here or if we can only set\n // decorated object\n\n // initialize and store the instance of template engine for further access\n self::$instance = Doozr_Loader_Serviceloader::load($this->library, $this->res...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Preprocess the input at the beginning of each step. Args: x: input tensor step: step hparams: model hyper-parameters Returns: preprocessed input.
[ "def step_preprocess(x, step, hparams):\n \n original_channel_size = common_layers.shape_list(x)[-1]\n\n if hparams.add_position_timing_signal:\n x = add_position_timing_signal(x, step, hparams)\n\n if hparams.add_step_timing_signal:\n x = add_step_timing_signal(x, step, hparams)\n\n if ((hparams.add_pos...
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Creates a {@code QueryParameterValue} object with a type of ARRAY, and an array element type based on the given class.
[ "public static <T> QueryParameterValue array(T[] array, Class<T> clazz) {\n return array(array, classToType(clazz));\n }" ]
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(fieldName(sym),\n retrofit\n ? sym.erasure(types)\n : sym.externalType(types), types);\n // if we retrofit, then the NameAndType has been read in as is...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
alter the PHP_CodeSniffer_CLI usage message to match FuelPHPCS @param string $help PHP_CodeSniffer_CLI usage message to alter @return string returns the usage message updated
[ "private function fixHelp($help)\n {\n $help = $this->fixCLIName($help);\n $help = $this->fixStandard($help);\n\n return $help;\n }" ]
[ "public function getHelp()\n {\n $msg = $this->opts->getUsageMessage();\n // Amend the auto-generated help message:\n $options = \"[ options ] [ target ]\\n\"\n . \"Where [ target ] is the name of a section of the configuration\\n\"\n . \"specified by the ini option, or...
codesearchnet
{ "query": "Represent the Github summarization about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code about Software development:" }
// New returns a Resolver with the given version and configuration.
[ "func New(version string, config records.Config) *Resolver {\n\tgeneratorOptions := []records.Option{\n\t\trecords.WithConfig(config),\n\t}\n\trecordGenerator := records.NewRecordGenerator(generatorOptions...)\n\tr := &Resolver{\n\t\tversion: version,\n\t\tconfig: config,\n\t\tready: make(chan struct{}),\n\t\trs...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// resets the states in a concurrency-safe manner
[ "func (h *Health) safeResetStates() {\n\th.statesLock.Lock()\n\tdefer h.statesLock.Unlock()\n\th.states = make(map[string]State, 0)\n}" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// isLeader checks if we are the leader or not, without the protection of lock
[ "func (n *Node) isLeader() bool {\n\tif !n.IsMember() {\n\t\treturn false\n\t}\n\n\tif n.Status().Lead == n.Config.ID {\n\t\treturn true\n\t}\n\treturn false\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 sentence:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
@param string $part @return string
[ "private function processQueryPart($part)\n {\n $queryPart = (string) $part;\n\n if (is_object($part) && $part instanceof self && $part->count() > 1) {\n return $this->preSeparator . $queryPart . $this->postSeparator;\n }\n\n // Fixes DDC-1237: User may have added a where i...
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH. Generated from protobuf field <code>repeated string jar_file_uris = 56;</code> @param string[]|\Google\Protobuf\Internal\RepeatedField $var @return $this
[ "public function setJarFileUris($var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::STRING);\n $this->jar_file_uris = $arr;\n\n return $this;\n }" ]
[ "public function setClientURLs(&$var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::STRING);\n $this->clientURLs = $arr;\n }" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Computer Science:" }
// Callback takes care of Authorize callback
[ "func (c *AuthorizeController) Callback(ctx *app.CallbackAuthorizeContext) error {\n\n\tredirectTo, err := c.app.AuthenticationProviderService().AuthorizeCallback(ctx, ctx.State, ctx.Code)\n\n\t//redirectTo, err := c.Auth.AuthCodeCallback(ctx)\n\tif err != nil {\n\t\treturn jsonapi.JSONErrorResponse(ctx, err)\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 description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Boot the given service provider. @param \Illuminate\Support\ServiceProvider $provider @return mixed
[ "protected function bootProvider(ServiceProvider $provider)\n {\n parent::bootProvider($provider);\n\n if (method_exists($provider, 'booted')) {\n Event::listen('antares.extension: booted', function() use($provider) {\n Event::fire(new LoadServiceProviders());\n ...
[ "protected function registerContainer()\n {\n static::setInstance($this);\n\n $this->instance('app', $this);\n $this->alias('app', static::class);\n $this->alias('app', 'Illuminate\\Container\\Container');\n $this->alias('app', 'Illuminate\\Contracts\\Container\\Container');\n ...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Validate non-optional parameters and return new instance.
[ "public function build(): SetShowDebugBordersRequest\n\t{\n\t\t$instance = new SetShowDebugBordersRequest();\n\t\tif ($this->show === null) {\n\t\t\tthrow new BuilderException('Property [show] is required.');\n\t\t}\n\t\t$instance->show = $this->show;\n\t\treturn $instance;\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 Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
If session namespace by this class is not initialized, initialize session namespace under this class name and move expiration to configured value. @return void
[ "protected function setUpSession () {\n\t\tif ($this->session === NULL) {\n\t\t\t$sessionClass = $this->application->GetSessionClass();\n\t\t\t$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;\n\t\t\t$this->session = $sessionClass::GetNamespace($selfClass);\n\t\t\t$this->session->SetE...
[ "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:" }