query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
if the config file path does not exist, this function will initialize the path with a default config file :return
[ "def init_config_file_path_if_empty(self):\n \n\n if os.path.exists(self.cfg_directory_path):\n return\n\n user_choice = 'n'\n if self.no_confirm:\n user_choice = 'y'\n else:\n sys.stdout.write(\n \"Config directory does not exist at...
[ "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 comment about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
Pops up a dialog for opening a single file. Returns a string path or None.
[ "def load(filters=\"*.*\", text='Select a file, FACEFACE!', default_directory='default_directory'):\n \n # make sure the filters contains \"*.*\" as an option!\n if not '*' in filters.split(';'): filters = filters + \";;All files (*)\"\n \n # if this type of pref doesn't exist, we need to make a new ...
[ "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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// WaitForNUnitFiles runs fleetctl list-unit-files to verify the actual number of units // matched with the given expected number. It periodically runs list-unit-files // waiting until list-unit-files actually shows the expected units.
[ "func (nc *nspawnCluster) WaitForNUnitFiles(m Member, expectedUnits int) (map[string][]util.UnitFileState, error) {\n\tvar nUnits int\n\tretStates := make(map[string][]util.UnitFileState)\n\n\tcheckListUnitFiles := func() bool {\n\t\toutListUnitFiles, _, err := nc.Fleetctl(m, \"list-unit-files\", \"--no-legend\", \...
[ "func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\tlog.G(ctx).Warnf(\"task updates not yet supported\")\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...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
A safe Kernel::load, issuing the hooks depending on the results
[ "def safe_load(file, mtime, stderr = $stderr)\n load(file)\n stderr.puts \"#{self.class}: reloaded `#{file}'\"\n file\n rescue LoadError, SyntaxError => ex\n stderr.puts ex\n ensure\n @mtimes[file] = mtime\n end" ]
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Set the Success And Error conditions for the rollout group @param group The Rollout group @param conditions The Rollout Success and Error Conditions
[ "public static void addSuccessAndErrorConditionsAndActions(final JpaRolloutGroup group,\n final RolloutGroupConditions conditions) {\n addSuccessAndErrorConditionsAndActions(group, conditions.getSuccessCondition(),\n conditions.getSuccessConditionExp(), conditions.getSuccessAction()...
[ "@NotNull\n @ApiModelProperty(required = true, value = \"Key-value pairs to add as custom property into alert. You can refer here for example values\")\n public Map<String, String> getDetails() {\n return details;\n }" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Convert keys in object @param array $expandKeys @param mixed $object @return object
[ "private function convertExpandKeysInObjects($expandKeys, $object)\n\t{\n\t\t// only hanlde objects\n\t\tif (!is_object($object))\n\t\t{\n\t\t\treturn $object;\n\t\t}\n\n\t\t// spin over each key replacing the date with new format\n\t\tforeach (array_keys(get_object_vars($object)) as $key)\n\t\t{\n\t\t\tif (array_k...
[ "private function getFormOptionsDeclaration()\n {\n\n // we got a max instances allowed in normality tags\n $formOptions = json_encode( $this->formOptions );\n $formOptions = Php::varExport( $formOptions, true );\n\n $this->class->classComponents[] = new VariableDeclaration(\n ...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Format field data according to whether it is a stream or a string for a form-data request. :param data: The request field data. :type data: str or file-like object.
[ "def _format_data(data):\n # type: (Union[str, IO]) -> Union[Tuple[None, str], Tuple[Optional[str], IO, str]]\n \n if hasattr(data, 'read'):\n data = cast(IO, data)\n data_name = None\n try:\n if data.name[0] != '<' and data.name[-1] != '>':\n ...
[ "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 summarization about Natural Language Processing:", "pos": "Represent the code about Natural Language Processing:", "neg": "Represent the code about programming:" }
This renders the field when viewing a store_locator bundle
[ "public function renderFieldAction(NodeInterface $node, $type, $sub_area = null, $locality = null)\n {\n $type = $type === 'all' ? null : $type;\n $sub_area = $sub_area === 'all' ? null : $sub_area;\n\n /** @var StoreLocatorInterface $storeLocator */\n $storeLocator = $this\n ...
[ "def create(self, **kwargs):\n \n raise exceptions.MethodNotImplemented(method=self.create, url=self.url, details='GUID cannot be duplicated, to create a new GUID use the relationship resource')" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about Natural Language Processing:" }
// no documentation yet
[ "func (r Billing_Currency_ExchangeRate) GetExchangeRate(to *string, from *string, effectiveDate *datatypes.Time) (resp datatypes.Billing_Currency_ExchangeRate, err error) {\n\tparams := []interface{}{\n\t\tto,\n\t\tfrom,\n\t\teffectiveDate,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Billing_Currency_ExchangeRate...
[ "public static void main(String[] args) {\n /*\n * Developers Notes:\n *\n * -No corresponding Junit test class currently\n * provided. Test by eyeball of the output.\n *\n * -Add a menu with Help(About)\n * --> TBD.\n *\n * -Figure out...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Get date time @param string $date @return false|string
[ "public static function getDateTime($date)\n {\n $_date = time();\n\n if (isset($date) && self::isValidDate($date)) {\n $_date = strtotime(preg_replace('/\\(.*?\\)/', '', $date));\n }\n\n return date('Y-m-d H:i:s', $_date);\n }" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Handle the response string received by KafkaProtocol. Ok, we've received the response from the broker. Find the requestId in the message, lookup & fire the deferred with the response.
[ "def handleResponse(self, response):\n \n requestId = KafkaCodec.get_response_correlation_id(response)\n # Protect against responses coming back we didn't expect\n tReq = self.requests.pop(requestId, None)\n if tReq is None:\n # This could happen if we've sent it, are w...
[ "def do_threaded_dispatch(participant, msg)\n\n msg = Rufus::Json.dup(msg)\n #\n # the thread gets its own copy of the message\n # (especially important if the main thread does something with\n # the message 'during' the dispatch)\n\n # Maybe at some point a limit on the number...
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Create an ARP reply (just change what needs to be changed from a request)
[ "def create_ip_arp_reply(srchw, dsthw, srcip, targetip):\n '''\n \n '''\n pkt = create_ip_arp_request(srchw, srcip, targetip)\n pkt[0].dst = dsthw\n pkt[1].operation = ArpOperation.Reply\n pkt[1].targethwaddr = dsthw\n return pkt" ]
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Create a Model for a registered Blueprint @param <T> model Class @param clazz Model class @return Model @throws CreateModelException model failed to create
[ "public <T> T createModel(Class<T> clazz) throws CreateModelException {\n return createModel(clazz, true);\n }" ]
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
Add as many requests as possible up to the current pool limit.
[ "private function addNextRequests()\n {\n $limit = max($this->getPoolSize() - count($this->waitQueue), 0);\n while ($limit--) {\n if (!$this->addNextRequest()) {\n break;\n }\n }\n }" ]
[ "def can_pull(self, initial, scheduled):\n \n if not initial and self.config.is_valid_schedule():\n # if the config has a valid schedule, return True if this is a scheduled run\n return scheduled\n return True" ]
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about Software Development:" }
Initializes the widget. If you override this method, make sure you call the parent implementation first.
[ "public function init()\n {\n parent::init();\n $this->clientOptions = false;\n Html::addCssClass($this->options, $this->size);\n Html::addCssClass($this->options, 'material-icons');\n }" ]
[ "public static HTML embedFlashObject (Panel container, String htmlString)\n {\n // Please note: the following is a work-around for an IE7 bug. If we create a Flash object\n // node *before* attaching it to the DOM tree, IE will silently fail to register\n // the Flash object's callback funct...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// WriteTo implements io.WriterTo interface. It serializes the // meter configuration into the wire format.
[ "func (m *MeterConfig) WriteTo(w io.Writer) (int64, error) {\n\t// Write the list of meter bands to the temporary\n\t// buffer to calculate the total length of the message.\n\tvar buf bytes.Buffer\n\t_, err := m.Bands.WriteTo(&buf)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tlength := uint16(meterConfigLen + bu...
[ "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 sentence about writing:", "pos": "Represent the code about writing:", "neg": "Represent the code about Software development:" }
// Changes produces a list of changes between the specified layer // and its parent layer. If parent is "", then all changes will be ADD changes.
[ "func (a *Driver) Changes(id string, idMappings *idtools.IDMappings, parent string, parentMappings *idtools.IDMappings, mountLabel string) ([]archive.Change, error) {\n\tif !a.isParent(id, parent) {\n\t\treturn a.naiveDiff.Changes(id, idMappings, parent, parentMappings, mountLabel)\n\t}\n\n\t// AUFS doesn't have sn...
[ "function(){\n return {\n classes: [], \n colonSelectors: [],\n data: [],\n group: null,\n ids: [],\n meta: [],\n\n // fake selectors\n collection: null, // a collection to match against\n filter: null, // filter function\n\n ...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
// UpdatePerson updates the person with the given first & last names and age with newPerson. Returns a non-nil error if the update failed, and nil if the update succeeded
[ "func UpdatePerson(db *sql.DB, firstName, lastName string, age uint, newPerson Person) error {\n\t_, err := db.Exec(\n\t\tfmt.Sprintf(\n\t\t\t\"UPDATE %s SET %s=?,%s=?,%s=? WHERE %s=? AND %s=? AND %s=?\",\n\t\t\tPersonTableName,\n\t\t\tPersonFirstNameCol,\n\t\t\tPersonLastNameCol,\n\t\t\tPersonAgeCol,\n\t\t\tPerson...
[ "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 post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
/* Initialize the internal fields from the supplied CIDR mask
[ "private void calculate(String mask) {\n Matcher matcher = cidrPattern.matcher(mask);\n\n if (matcher.matches()) {\n matchAddress(matcher);\n\n /* Create a binary netmask from the number of bits specification /x */\n rangeCheck(Integer.parseInt(matcher.group(5)), 0, NB...
[ "@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 about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Parse the given version string and return either a :class:`Version` object or a LegacyVersion object depending on if the given version is a valid PEP 440 version or a legacy version. If strict=True only PEP 440 versions will be accepted.
[ "def parse(\n version, strict=False # type: str # type: bool\n): # type:(...) -> Union[Version, LegacyVersion]\n \n try:\n return Version(version)\n except InvalidVersion:\n if strict:\n raise\n\n return LegacyVersion(version)" ]
[ "def collect_manifest_dependencies(manifest_data, lockfile_data):\n \"\"\"\"\"\"\n output = {}\n\n for dependencyName, dependencyConstraint in manifest_data.items():\n output[dependencyName] = {\n # identifies where this dependency is installed from\n 'source': 'example-package...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
record an existing port 'parent_port' indicats the which port, if released, will also release the current port
[ "function (port, parent_port) {\n\n\t// check if the port wasn't reported\n\tif (l_ports.hasOwnProperty(port) === false) {\n\t\t\n\t\tLOG.warn('recording used port [' + port + ']...', 'SR.Monitor');\t\n\t\tl_ports[port] = parent_port || port;\n\t}\n}" ]
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
// Validate is called by start to check for bad configuration.
[ "func (config ManifoldConfig) Validate() error {\n\tif config.AgentName == \"\" {\n\t\treturn errors.NotValidf(\"empty AgentName\")\n\t}\n\tif config.APICallerName == \"\" {\n\t\treturn errors.NotValidf(\"empty APICallerName\")\n\t}\n\tif config.FortressName == \"\" {\n\t\treturn errors.NotValidf(\"empty FortressNa...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Get the Pascal Case for a given path @param filePath @returns {string}
[ "function getPascalCase(filePath) {\n var camelCase = getCamelCase(filePath);\n return camelCase.substring(0, 1).toUpperCase() + camelCase.substring(1);\n}" ]
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
添加新的同步依赖,同一个 ID 只会保留一条记录。 @param {String} id 依赖的文件标识(id)
[ "function(id) {\n if (id && (id = id.trim())) {\n\n // js embend 同名.html 而 同名.html 又开启了依赖同名.js,然后就出现了,自己依赖自己了。\n // 所以这里做了 id !== this.id 的判断\n if (id !== this.id && !~this.requires.indexOf(id)) {\n this.requires.push(id);\n }\n\n // 如果在异步依赖中,则需要把它删了。\n var idx;\n if (~(...
[ "protected static void fixResultByRule(List<Vertex> linkedArray)\n {\n\n //--------------------------------------------------------------------\n //Merge all seperate continue num into one number\n mergeContinueNumIntoOne(linkedArray);\n\n //-------------------------------------------...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about text processing:" }
instanceof doesn't seem to work across modules.
[ "function isPromise(v) {\n return v && v.isFulfilled && v.then && v.catch && v.value;\n}" ]
[ "function fromJS(value: any): any {\n if (Array.isArray(value)) {\n return createList(value);\n }\n if (value && value.constructor && value.constructor.meta) {\n // This adds support for tcomb objects which are native JS objects\n // but are not \"plain\", so the above checks fail. Since they\n // be...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Load the node file. @param filePath path of the node file relative to the repository root @return the configuration object @throws IOException
[ "private Config loadNodeFileWithOverrides(Path filePath) throws IOException {\n Config nodeConfig = this.pullFileLoader.loadPullFile(filePath, emptyConfig, false);\n return getNodeConfigWithOverrides(nodeConfig, filePath);\n }" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github description about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
// GetMessageType extracts type description for protobuf message of given type. // // 'typ' is expected to represent a pointer to a protobuf struct, as returned // by proto.MessageType(...). Returns an error otherwise.
[ "func GetMessageType(typ reflect.Type) (*MessageType, error) {\n\ttypeRegistry.m.RLock()\n\tcached := typeRegistry.types[typ]\n\ttypeRegistry.m.RUnlock()\n\tif cached != nil {\n\t\treturn cached, nil\n\t}\n\n\tzero := reflect.Zero(typ) // (*Struct)(nil)\n\tname := proto.MessageName(zero.Interface().(proto.Message))...
[ "def __resolveport(self, definitions):\n \n ref = qualify(self.type, self.root, definitions.tns)\n port_type = definitions.port_types.get(ref)\n if port_type is None:\n raise Exception(\"portType '%s', not-found\" % (self.type,))\n # Later on we will require access to t...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Returns eZTagsKeyword object for given tag ID and locale @static @param int $tagID @param string $locale @param bool $includeDrafts @return eZTagsKeyword
[ "static public function fetch( $tagID, $locale, $includeDrafts = false )\n {\n $fetchParams = array( 'keyword_id' => $tagID, 'locale' => $locale );\n if ( !$includeDrafts )\n $fetchParams['status'] = self::STATUS_PUBLISHED;\n\n return parent::fetchObject( self::definition(), null,...
[ "public function setCurrentSite( $site )\n {\n eZWebDAVContentBackend::appendLogEntry( __FUNCTION__ . '1:' . $site );\n $access = array( 'name' => $site,\n 'type' => eZSiteAccess::TYPE_STATIC );\n\n $access = eZSiteAccess::change( $access );\n eZWebDAVContentBa...
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
// putObjectNoChecksum special function used Google Cloud Storage. This special function // is used for Google Cloud Storage since Google's multipart API is not S3 compatible.
[ "func (c Client) putObjectNoChecksum(ctx context.Context, bucketName, objectName string, reader io.Reader, size int64, opts PutObjectOptions) (n int64, err error) {\n\t// Input validation.\n\tif err := s3utils.CheckValidBucketName(bucketName); err != nil {\n\t\treturn 0, err\n\t}\n\tif err := s3utils.CheckValidObje...
[ "func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
setDateRangeLimits, This sets the currently used date limits.
[ "public void setDateRangeLimits(LocalDate firstAllowedDate, LocalDate lastAllowedDate) {\n if (firstAllowedDate == null && lastAllowedDate == null) {\n throw new RuntimeException(\"DateVetoPolicyMinimumMaximumDate.setDateRangeLimits(),\"\n + \"The variable firstAllowedDate can b...
[ "@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 Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Uploads this device's identity keys to HS. This device must be the one used when logging in.
[ "def upload_identity_keys(self):\n \n device_keys = {\n 'user_id': self.user_id,\n 'device_id': self.device_id,\n 'algorithms': self._algorithms,\n 'keys': {'{}:{}'.format(alg, self.device_id): key\n for alg, key in self.identity_keys.ite...
[ "def connectTo(self, remoteRouteName):\n \n self.remoteRouteName = remoteRouteName\n # This route must not be started before its router is started. If\n # sender is None, then the router is not started. When the router is\n # started, it will start this route.\n if self.r...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
If the named section does not have the value, then try the same key from the "global" section @param section @param key @return
[ "public static String getValueWithGlobalDefault(String section, ConfigConstant key) {\n String value = getValue(section, key);\n return (Strings.isNullOrEmpty(value) ? getGlobalValue(key) : value);\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 comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// PullPubSubOnDevServer is called on dev server to pull messages from PubSub // subscription associated with given publisher. // // Part of the internal interface, doesn't check ACLs.
[ "func (e *engineImpl) PullPubSubOnDevServer(c context.Context, taskManagerName, publisher string) error {\n\t_, sub := e.genTopicAndSubNames(c, taskManagerName, publisher)\n\tmsg, ack, err := pullSubcription(c, sub, \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif msg == nil {\n\t\tlogging.Infof(c, \"No new PubS...
[ "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 post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Pretty printing for a diff, if color then we use a simple color scheme (red for removed lines, green for added lines).
[ "def print_diff(diff, color=True):\n \"\"\"\"\"\"\n import colorama\n\n if not diff:\n return\n\n if not color:\n colorama.init = lambda autoreset: None\n colorama.Fore.RED = ''\n colorama.Back.RED = ''\n colorama.Fore.GREEN = ''\n colorama.deinit = lambda: None...
[ "def colorize_text(self, text):\n \"\"\"\"\"\"\n # As originally implemented, this method acts upon all the contents of\n # the file as a single string using the MULTILINE option of the re\n # package. I believe this was ostensibly for performance reasons, but\n # it has a few sid...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Lookup sighash from 4bytes.directory, create a pseudo api and try to decode it with the parsed abi. May return multiple results as sighashes may collide. :param s: bytes input :return: pseudo abi for method
[ "def get_pseudo_abi_for_input(s, timeout=None, proxies=None):\n \n sighash = Utils.bytes_to_str(s[:4])\n for pseudo_abi in FourByteDirectory.get_pseudo_abi_for_sighash(sighash, timeout=timeout, proxies=proxies):\n types = [ti[\"type\"] for ti in pseudo_abi['inputs']]\n try...
[ "def delete_node_storage(node)\n return if node == BLANK_NODE\n raise ArgumentError, \"node must be Array or BLANK_NODE\" unless node.instance_of?(Array)\n\n encoded = encode_node node\n return if encoded.size < 32\n\n # FIXME: in current trie implementation two nodes can share identical\n ...
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
// GetLocalMspConfigWithType returns a local MSP // configuration for the MSP in the specified // directory, with the specified ID and type
[ "func GetLocalMspConfigWithType(dir string, bccspConfig *factory.FactoryOpts, ID, mspType string) (*msp.MSPConfig, error) {\n\tswitch mspType {\n\tcase ProviderTypeToString(FABRIC):\n\t\treturn GetLocalMspConfig(dir, bccspConfig, ID)\n\tcase ProviderTypeToString(IDEMIX):\n\t\treturn GetIdemixMspConfig(dir, ID)\n\td...
[ "func getEnterpriseResourceIter(context structs.Context, _ *acl.ACL, namespace, prefix string, ws memdb.WatchSet, state *state.StateStore) (memdb.ResultIterator, error) {\n\t// If we have made it here then it is an error since we have exhausted all\n\t// open source contexts.\n\treturn nil, fmt.Errorf(\"context mus...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Setting up rules for uploaded files @param array $rules @return Uploader
[ "public function setRules(array $rules)\n {\n foreach ($rules as $key => $values) {\n\n if ((is_array($values) === true && empty($values) === false) || is_callable($values)) {\n $this->rules[$key] = $values;\n } else {\n $this->rules[$key] = trim($values...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// unquote removes the given quote string (either `'` or `"`) from the given // string if it is wrapped in them.
[ "func unquote(s, quote string) string {\n\tif !strings.HasPrefix(s, quote) && !strings.HasSuffix(s, quote) {\n\t\treturn s\n\t}\n\ts = strings.TrimPrefix(s, quote)\n\ts = strings.TrimSuffix(s, quote)\n\treturn s\n}" ]
[ "function(node)\n {\n // declarations is an array of the comma-separated variable declarations like \"var foo, zerp;\"\n node.declarations.forEach(declaration =>\n {\n // id contains info about the variable being declare.\n var variable_name = declaration.id.name;\n // Skip if...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Parse from a string with the Python literal expression
[ "public Ast parse(String expression)\n\t{\n\t\tAst ast=new Ast();\n\t\tif(expression==null || expression.length()==0)\n\t\t\treturn ast;\n\t\t\n\t\tSeekableStringReader sr = new SeekableStringReader(expression);\n\t\tif(sr.peek()=='#')\n\t\t\tsr.readUntil('\\n'); // skip comment line\n\t\t\n\t\ttry {\n\t\t\tast.ro...
[ "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:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Returns the {@link AsyncProcessFunction}. @throws ClassCastException if this function is synchronous
[ "@SuppressWarnings(\"unchecked\")\n public AsyncProcessFunction<Object, TBase<?, ?>, Object> asyncFunc() {\n return (AsyncProcessFunction<Object, TBase<?, ?>, Object>) func;\n }" ]
[ "@Override\n protected <T1, R extends Completes<?>> R dispatchQuery(BiFunction<P, T1, R> query, T1 routable1) {\n throw new UnsupportedOperationException(\"query protocols are not supported by this router by default\");\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// LoadConfig read env vars and *AppConfig or error
[ "func LoadConfig() (*AppConfig, error) {\n\tvar (\n\t\tconf AppConfig\n\t\terr error\n\t)\n\terr = envconfig.Process(\"digota\", &conf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &conf, nil\n}" ]
[ "func (f *Factory) BindFlags(flags *pflag.FlagSet) {\n\t// any flags defined by external projects (not part of pflags)\n\tflags.AddGoFlagSet(flag.CommandLine)\n\n\t// Merge factory's flags\n\tflags.AddFlagSet(f.flags)\n\n\t// Globally persistent flags across all subcommands.\n\t// TODO Change flag names to consts t...
codesearchnet
{ "query": "Represent the instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Returns all <code>jms-destination</code> elements @return list of <code>jms-destination</code>
[ "public List<JmsDestinationType<WebAppDescriptor>> getAllJmsDestination()\n {\n List<JmsDestinationType<WebAppDescriptor>> list = new ArrayList<JmsDestinationType<WebAppDescriptor>>();\n List<Node> nodeList = model.get(\"jms-destination\");\n for(Node node: nodeList)\n {\n JmsDestinati...
[ "def update_admin_object_resource(name, server=None, **kwargs):\n '''\n \n '''\n if 'jndiName' in kwargs:\n del kwargs['jndiName']\n return _update_element(name, 'resources/admin-object-resource', kwargs, server)" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Note: this function involves making copies of the index in memory. Args: axis: Axis to extract indices. indices: Indices to convert to numerical. Returns: An Index object.
[ "def global_idx_to_numeric_idx(self, axis, indices):\n \n assert axis in [\"row\", \"col\", \"columns\"]\n if axis == \"row\":\n return pandas.Index(\n pandas.Series(np.arange(len(self.index)), index=self.index)\n .loc[indices]\n .values\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 description about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Release any acquired resources.
[ "protected void localRelease()\n {\n if (_repeater)\n DataAccessProviderStack.removeDataAccessProvider(pageContext);\n\n super.localRelease();\n _state.clear();\n\n _defaultSelections = null;\n _formatters = null;\n _match = null;\n _saveBody = null;\n ...
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the Github text about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about Software development:" }
Mutate data by direct query @param array $updateQuery update query @param array $options options @throws \Exception @return boolean
[ "public function mutate($updateQuery, $options = array())\n {\n if(!is_array($updateQuery)) throw new \\Exception('$updateQuery should be an array');\n if(!is_array($options)) throw new \\Exception('$options should be an array');\n\n $default = array(\n 'w' => 1\n );\n ...
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Close all communication process streams.
[ "def close(self):\n \"\"\"\"\"\"\n windll.kernel32.CloseHandle(self.conout_pipe)\n windll.kernel32.CloseHandle(self.conin_pipe)" ]
[ "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 Computer Networking:", "pos": "Represent the Github code about Computer Networking:", "neg": "Represent the Github code about programming:" }
Call prepare() on all DataSources and pass them all collected possible attributes. @private
[ "function prepareDataSources(attrNode, context) {\n Object.keys(attrNode.dataSources).forEach(dataSourceName => {\n const dataSource = attrNode.dataSources[dataSourceName];\n\n // DataSources with inherit=\"true\" may have no type - so no prepare here:\n if (!dataSource.type) return;\n\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 Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns map field getter name.
[ "public static String getMapGetterName(Field field) {\n if (field.isMap()) {\n return GETTER_PREFIX + Formatter.toPascalCase(field.getName()) + MAP_SUFFIX;\n }\n throw new IllegalArgumentException(field.toString());\n }" ]
[ "def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// UnlinkUserRichMenu method
[ "func (client *Client) UnlinkUserRichMenu(userID string) *UnlinkUserRichMenuCall {\n\treturn &UnlinkUserRichMenuCall{\n\t\tc: client,\n\t\tuserID: userID,\n\t}\n}" ]
[ "def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
@param string $string @return string @throws \RuntimeException
[ "public function slug($string) {\n\t\tif ($this->_config['slugger']) {\n\t\t\t$callable = $this->_config['slugger'];\n\t\t\tif (!is_callable($callable)) {\n\t\t\t\tthrow new RuntimeException('Invalid callable passed as slugger.');\n\t\t\t}\n\n\t\t\treturn $callable($string);\n\t\t}\n\n\t\treturn Inflector::slug($st...
[ "static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Run the migrations. @return void
[ "public function up()\n\t{\n\t\tSchema::create(config('countries.table_name'), function (Blueprint $table) {\n\t\t $table->increments('id');\n\t\t $table->string('capital', 255)->nullable();\n\t\t $table->string('citizenship', 255)->nullable();\n\t\t $table->char('country_code', 3)->default('');\n\t\t ...
[ "private function cmdGenerate()\n {\n //check if path exists\n if (!is_dir($this->configKeyPath)) {\n Main::copyDirectoryContents(dirname(__DIR__).'/Config/Devbr/Key', $this->configKeyPath);\n }\n //Now, OPEN_SSL\n $this->createKeys();\n return \"\\n Can, Ope...
codesearchnet
{ "query": "Represent the post about Database management:", "pos": "Represent the code about Database management:", "neg": "Represent the code about programming:" }
Set bottom offset (positive from top, negative from bottom). Will override crop height @param int $value @return ImageCropper
[ "public function setBottom($value)\n\t{\n\t\t$this->bottom = intval($value);\n\t\t$this->height = null;\n\t\treturn $this;\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 text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Replaces references to libraries with full paths to their static versions if the static version is to be found on the library path.
[ "def replace_static_libraries(self, exclusions=None):\n \"\"\"\"\"\"\n if \"stdc++\" not in self.libraries:\n self.libraries.append(\"stdc++\")\n\n if exclusions is None:\n exclusions = []\n\n for library_name in set(self.libraries) - set(exclusions):\n s...
[ "def resolveEntryPoint(entryPoint):\n \n if inVirtualEnv():\n path = os.path.join(os.path.dirname(sys.executable), entryPoint)\n # Inside a virtualenv we try to use absolute paths to the entrypoints.\n if os.path.isfile(path):\n # If the entrypoint is present, Toil must have be...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Attempts to close any unclosed HTML tag. @param string $html HTML content to fix @return string
[ "public static function closeOpenTags($html)\n {\n preg_match_all(\"#<([a-z]+)( .*)?(?!/)>#iU\", $html, $result);\n $openedTags = $result[1];\n preg_match_all(\"#</([a-z]+)>#iU\", $html, $result);\n $closedTags = $result[1];\n $lenOpened = count($openedTags);\n\n if (cou...
[ "public function XML_val($field, $arguments = [], $cache = false)\n {\n $result = $this->obj($field, $arguments, $cache);\n // Might contain additional formatting over ->XML(). E.g. parse shortcodes, nl2br()\n return $result->forTemplate();\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Prints the page list tab content
[ "private function print_page_list_content() {\n global $OUTPUT;\n $page = $this->page;\n\n if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) {\n $fresh = wiki_refresh_cachedcontent($page);\n $page = $fresh['page'];\n }\n\n $pages = wiki_get_page_lis...
[ "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 description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Create choices for supported services
[ "def make_supported_services_choices(self, referencesample):\n \n choices = []\n assigned_services = self.get_assigned_services_uids()\n for uid in self.get_supported_services_uids(referencesample):\n service = api.get_object(uid)\n title = api.get_title(service)\n ...
[ "func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Decode WebService Client Response @param bool $isUncrypted Force message not to be crypted (Used for Ping Only) @return bool
[ "private function decodeResponse($isUncrypted)\n {\n //====================================================================//\n // Unpack NuSOAP Answer\n //====================================================================//\n if (!empty($this->rawIn)) {\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 Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
Get page source for Daxko html page. @param string $url Url of the page. @return string Page source.
[ "protected function getDaxkoPageSource($url) {\n $config = $this->configFactory->get('openy_programs_search.settings');\n\n // @todo Add try/catch.\n $options = ['allow_redirects' => FALSE];\n $res = $this->http->request('GET', $url, $options);\n $cookies = $res->getHeader('Set-Cookie');\n\n $fina...
[ "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 sentence about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code about Software development:" }
Gets the current position within the file being read. @return The current position within the file being read. @throws IOException if an IO error occurs.
[ "@Override\n public synchronized long getPos() throws IOException {\n long pos = channel.position();\n logger.atFine().log(\"getPos: %d\", pos);\n return pos;\n }" ]
[ "function ClientState(client) {\n\n /**\n * The associated client instance.\n *\n * @property client\n * @type Client\n */\n this.client = client;\n\n /**\n * The time (in milliseconds) to wait before the next request\n * may be sent to the API; this value is only updated upon\n * reception of a ...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
@param string $purpose @param string $value @return TokenAlreadyConsumedEvent
[ "public function tokenAlreadyConsumed($purpose, $value)\n {\n $this->eventDispatcher->dispatch(\n TokenEvents::TOKEN_ALREADY_CONSUMED,\n $event = new TokenAlreadyConsumedEvent($purpose, $value)\n );\n\n return $event;\n }" ]
[ "public function handle(PublishThePost $event) {\n $this->sendEmailsFromList->sendEmails($event->data['id']['listID'], $event->data['id']);\n \\Log::info('Lasallecms\\Lasallecmsapi\\Listeners\\TriggerLaSalleCRMList listener completed');\n }" ]
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Resolve the disance prop from either an Int or an Object @return {Object}
[ "function normalizeDistance(distance = 0) {\n if (typeof distance !== 'object') distance = { top: distance, left: distance, right: distance, bottom: distance };\n\n return distance;\n}" ]
[ "function resolve(){\n\t\tLRState::clear_index();\n\t\tLRStation::clear_index();\n\t\t// create Root Set\n\t\t// we SHOULD have a single etransition to an intial state\n\t\treturn LRStateSet::init( $this->etransitions[0], $this->Grammar );\n\t}" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Computer Science:" }
Custom Underscore equality method.
[ "function(b) {\n if (b instanceof Model) {\n if (this.constructor !== b.constructor) return false;\n b = b.attributes;\n }\n return _.isEqual(this.attributes, b);\n }" ]
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Init @param maxPoolSize The maximum pool size
[ "private void init(int maxPoolSize)\n {\n this.maxPoolSize = maxPoolSize;\n\n this.createdCount = new AtomicInteger(0);\n this.destroyedCount = new AtomicInteger(0);\n this.maxCreationTime = new AtomicLong(Long.MIN_VALUE);\n this.maxGetTime = new AtomicLong(Long.MIN_VALUE);\n this.ma...
[ "def getValue(words):\n \"\"\"\"\"\"\n value = 0\n for word in words:\n for letter in word:\n # shared.getConst will evaluate to the dictionary broadcasted by\n # the root Future\n value += shared.getConst('lettersValue')[letter]\n return value" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Natural Language Processing:" }
Inits and runs the PresentsServer bound in the given modules. This blocks until the server is shut down.
[ "public static void runServer (Module... modules)\n {\n Injector injector = Guice.createInjector(modules);\n PresentsServer server = injector.getInstance(PresentsServer.class);\n try {\n // initialize the server\n server.init(injector);\n\n // check to see if...
[ "def _shutdown_broker(self):\n \n if self.broker:\n self.broker.shutdown()\n self.broker.join()\n self.broker = None\n self.router = None\n\n # #420: Ansible executes \"meta\" actions in the top-level process,\n # meaning \"reset_connec...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// like http.StripPrefix, but always leaves an initial slash. (so that our // regexps will work.)
[ "func stripLeaveSlash(prefix string, h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {\n\t\tp := strings.TrimPrefix(req.URL.Path, prefix)\n\t\tif len(p) >= len(req.URL.Path) {\n\t\t\thttp.NotFound(w, req)\n\t\t\treturn\n\t\t}\n\t\tif len(p) > 0 && p[:1] != \"...
[ "def uri_from(url)\n # This will raise an InvalidURIError if the URL is very wrong. It will\n # still pass for strings like \"foo\", though.\n url = URI(url)\n\n # We need to check if the URL was either http://, https:// or ftp://,\n # because these are the only ones we can download from. o...
codesearchnet
{ "query": "Represent the Github sentence about Writing:", "pos": "Represent the Github code about Writing:", "neg": "Represent the Github code:" }
Load built-in plugins distributed along with "nonebot" package.
[ "def load_builtin_plugins() -> int:\n \n plugin_dir = os.path.join(os.path.dirname(__file__), 'plugins')\n return load_plugins(plugin_dir, 'nonebot.plugins')" ]
[ "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 about Technology:", "pos": "Represent the Github code about Technology:", "neg": "Represent the Github code:" }
@param string $mode @return ForeignKeyOnUpdateModeDefiner
[ "protected function onDelete(string $mode) : ForeignKeyOnUpdateModeDefiner\n {\n return new ForeignKeyOnUpdateModeDefiner(\n $this->callback,\n $this->localColumnNames,\n $this->referencedColumnNames,\n $this->referencedTableName,\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github summarization about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Inserts a new page link into the list @param PageLink $link The link to insert @param int $index Optional index to insert the link at (if not the link will be added at the end) @return int The new size
[ "public function addPageLink(PageLink $link, $index = null) {\n if ($index) {\n $this->links->add($index, $link);\n } else {\n $this->links->push($link);\n }\n return $this->links->count();\n }" ]
[ "public static function find($import, int $startRow = null)\n {\n if (!$import instanceof WithLimit) {\n return null;\n }\n\n // When no start row given,\n // use the first row as start row.\n $startRow = $startRow ?? 1;\n\n // Subtract 1 row from the start ro...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
Returns the list of sites to loop over and archive. @return array
[ "public function initWebsiteIds()\n {\n if (count($this->shouldArchiveSpecifiedSites) > 0) {\n $this->logger->info(\"- Will process \" . count($this->shouldArchiveSpecifiedSites) . \" websites (--force-idsites)\");\n\n return $this->shouldArchiveSpecifiedSites;\n }\n\n ...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the Github description about database:", "pos": "Represent the Github code about database:", "neg": "Represent the Github code:" }
{@inheritDoc} Parses shortcodes.
[ "public function renderLayout($content, $layout = null)\n {\n $html = parent::renderLayout($content, $layout);\n\n return $this->shortcodes($html);\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 description about writing:", "pos": "Represent the code about writing:", "neg": "Represent the code:" }
Set the pointer on the bar. With the Value value. @param value float between 0 and 1
[ "public void setValue(float value) {\n\t\tmBarPointerPosition = Math.round((mSVToPosFactor * (1 - value))\n\t\t\t\t+ mBarPointerHaloRadius + (mBarLength / 2));\n\t\tcalculateColor(mBarPointerPosition);\n\t\tmBarPointerPaint.setColor(mColor);\n\t\t// Check whether the Saturation/Value bar is added to the ColorPicker...
[ "def focus_left(pymux):\n \" \"\n _move_focus(pymux,\n lambda wp: wp.xpos - 2, # 2 in order to skip over the border.\n lambda wp: wp.ypos)" ]
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// SetResult sets the Result field's value.
[ "func (s *DescribeTrustedAdvisorCheckResultOutput) SetResult(v *TrustedAdvisorCheckResult) *DescribeTrustedAdvisorCheckResultOutput {\n\ts.Result = 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 description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Renders this link as sensitive
[ "protected function renderSensitive()\n {\n $anchor_tag = new SwatHtmlTag('a');\n $anchor_tag->setContent($this->getText(), $this->content_type);\n $anchor_tag->href = $this->getLink();\n $anchor_tag->title = $this->getTitle();\n $anchor_tag->class = $this->getCSSClassString();...
[ "def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
// ImageList mocks base method
[ "func (m *MockImageAPIClient) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error) {\n\tret := m.ctrl.Call(m, \"ImageList\", ctx, options)\n\tret0, _ := ret[0].([]types.ImageSummary)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\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 summarization:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
the argument says whether there must be a foot node on the aux tree.
[ "final public AuxiliaryTree TreeRoot(boolean requiresFoot) throws ParseException {\r\n /*@bgen(jjtree) TreeRoot */\r\n SimpleNode jjtn000 = new SimpleNode(JJTTREEROOT);\r\n boolean jjtc000 = true;\r\n jjtree.openNodeScope(jjtn000);Tree t;\r\n try {\r\n t = TreeNode();\r\n jjtree.closeNodeScope(jjtn0...
[ "function nodeClosed( ascent ) {\n\n emitNodeClosed( ascent);\n \n return tail( ascent) ||\n // If there are no nodes left in the ascent the root node\n // just closed. Emit a special event for this: \n emitRootClosed(nodeOf(head(ascent)));\n }" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
if any of the action properties that allow substitution are fns, then bind the tokens to the fn, so when executed it will have proper value @returns actions with fns bound
[ "function bindSubtituteFnsWithTokens(actions, tokens) {\n return actions.map(function (action) {\n return Object.keys(action).reduce(function (accum, key) {\n // if it is list of sub keys, and is a fn, then bind with tokens\n if (SUBSTITUTED_KEYS.indexOf(key) !== -1 && typeof action[key] === 'function...
[ "def register (g):\n \n assert isinstance(g, Generator)\n id = g.id()\n\n __generators [id] = g\n\n # A generator can produce several targets of the\n # same type. We want unique occurence of that generator\n # in .generators.$(t) in that case, otherwise, it will\n # be tried twice and we'll...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Write File to the specified directory Lets you write a file @param string $filepath the file name @return bool
[ "public function archive($filepath)\n\t{\n\t\tif ( ! ($fp = @fopen($filepath, 'w+b')))\n\t\t{\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tflock($fp, LOCK_EX);\n\n\t\tfor ($result = $written = 0, $data = $this->get_zip(), $length = strlen($data); $written < $length; $written += $result)\n\t\t{\n\t\t\tif (($result = fwrite($f...
[ "private function cmdGenerate()\n {\n //check if path exists\n if (!is_dir($this->configKeyPath)) {\n Main::copyDirectoryContents(dirname(__DIR__).'/Config/Devbr/Key', $this->configKeyPath);\n }\n //Now, OPEN_SSL\n $this->createKeys();\n return \"\\n Can, Ope...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
// Convert core.SubscribedPlugin to SubscribedPlugin protobuf message
[ "func ToSubPluginMsg(pl core.SubscribedPlugin) *SubscribedPlugin {\n\treturn &SubscribedPlugin{\n\t\tTypeName: pl.TypeName(),\n\t\tName: pl.Name(),\n\t\tVersion: int64(pl.Version()),\n\t\tConfig: ConfigToConfigMap(pl.Config()),\n\t}\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 sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// AddMethod adds new method `name` to VueJS intance or component // using mixins thus will never conflict with Option.SetDataWithMethods
[ "func (o *Option) AddMethod(name string, fn func(vm *ViewModel, args []*js.Object)) *Option {\n\treturn o.addMixin(\"methods\", js.M{\n\t\tname: js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {\n\t\t\tvm := newViewModel(this)\n\t\t\tfn(vm, arguments)\n\t\t\treturn nil\n\t\t}),\n\t})\n}" ]
[ "function transformer (selection) {\n const type = quantum.isSelection(selection) ? selection.type() : undefined\n const entityTransform = transformMap[type] || defaultTransform\n return entityTransform(selection, transformer, meta) // bootstrap to itself to make the transformer accessible to children\n ...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// SetProgressText set qor job's progress text
[ "func (job *QorJob) SetProgressText(str string) error {\n\tjob.mutex.Lock()\n\tdefer job.mutex.Unlock()\n\n\tjob.ProgressText = str\n\tif job.shouldCallSave() {\n\t\treturn job.callSave()\n\t}\n\n\treturn nil\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:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Prepare cURL resource for POST request "oauth/request_token". @param string [$oauth_callback] @param string [$proxy] full proxy URL. e.g. https://111.222.333.444:8080 @return resource cURL @throws TwistException
[ "public function curlPostRequestToken($oauth_callback = '', $proxy = '') {\r\n $oauth_callback = self::validateString('$oauth_callback', $oauth_callback);\r\n $proxy = self::validateString('$proxy', $proxy);\r\n $url = 'https://api.twitter.com/oauth/request_token';\r\n $param...
[ "def do_initial_operations(self):\n \n if not self.request_hc_path_corresponds():\n # the http URI of the request is not the same of the one specified by the admin for the hc proxy,\n # so I do not answer\n # For example the admin setup the http proxy URI like: \"http:...
codesearchnet
{ "query": "Represent the sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Returns normalized file path. @codeCoverageIgnore @deprecated
[ "public static function normalizePath($path) {\n $parts = [];\n $path = str_replace('\\\\', '/', $path);\n $path = preg_replace('/\\/+/', '/', $path);\n $segments = explode('/', $path);\n foreach ($segments as $segment) {\n if ($segment != '.') {\n $test = array_pop($parts);\n if (...
[ "public function handleManipulateAST(ManipulateAST $ManipulateAST): void\n {\n $ManipulateAST->documentAST = ASTHelper::attachDirectiveToObjectTypeFields(\n $ManipulateAST->documentAST,\n PartialParser::directive('@deferrable')\n );\n\n $ManipulateAST->documentAST->setD...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Run a task that returns a future in an outbox context.
[ "@Override\n public <T> T run(long timeout, TimeUnit unit,\n Consumer<Result<T>> task)\n {\n try (OutboxAmp outbox = OutboxAmp.currentOrCreate(this)) {\n ResultFuture<T> future = new ResultFuture<>();\n \n task.accept(future);\n \n return future.get(timeout, unit);\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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
// GherkinDocument:0>Feature:1>Background:2>Step:1>StepArg:0>__alt0:1>DocString:0>#DocStringSeparator:0
[ "func (ctxt *parseContext) matchAt48(line *Line) (newState int, err error) {\n\tif ok, token, err := ctxt.matchDocStringSeparator(line); ok {\n\t\tctxt.build(token)\n\t\treturn 49, err\n\t}\n\tif ok, token, err := ctxt.matchOther(line); ok {\n\t\tctxt.build(token)\n\t\treturn 48, err\n\t}\n\n\t// var stateComment =...
[ "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 summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Parse an array of basic segments. @param array $segments @return array
[ "protected function parseBasicSegments(array $segments)\n {\n // The first segment in a basic array will always be the group, so we can go\n // ahead and grab that segment. If there is only one total segment we are\n // just pulling an entire group out of the array and not a single item.\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
// Exists checks if the given key exists.
[ "func (c *MemoryStore) Exists(key string) (bool, error) {\n\tif _, exists := c.cache.Get(key); exists {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Create a new file download response. @param \SplFileInfo|string $file @param string $name @param array $headers @param string|null $disposition @return BinaryFileResponse
[ "public function download(\n $file,\n string $name = null,\n array $headers = [],\n string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT\n ) : BinaryFileResponse {\n $response = new BinaryFileResponse($file, HttpResponse::HTTP_OK, $headers, true, $disposition);\n\n ...
[ "public function getCopyReference($path)\n {\n //Path cannot be null\n if (is_null($path)) {\n throw new Exceptions\\BoxClientException(\"Path cannot be null.\");\n }\n\n //Get Copy Reference\n $response = $this->postToAPI('/files/copy_reference/get', ['path' => $pat...
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
push back last rollbackpoint into the cache :return:
[ "def rollback(self):\n \n return self.component_cache_actor.save(refreshing=self.rollback_point_refreshing,\n next_action=self.rollback_point_next_action,\n json_last_refresh=self.rollback_point_last_refresh,\n...
[ "def db_check( block_id, opcode, op, txid, vtxindex, checked, db_state=None ):\n \n print \"\\nreference implementation of db_check\\n\"\n return False" ]
codesearchnet
{ "query": "Represent the Github instruction about Database management:", "pos": "Represent the Github code about Database management:", "neg": "Represent the Github code about Blockchain:" }
Open a new browser window. Args: private (bool): Optional parameter to open a private browsing window. Defaults to False. Returns: :py:class:`BrowserWindow`: Opened window.
[ "def open_window(self, private=False):\n \n handles_before = self.selenium.window_handles\n self.switch_to()\n\n with self.selenium.context(self.selenium.CONTEXT_CHROME):\n # Opens private or non-private window\n self.selenium.find_element(*self._file_menu_button_lo...
[ "def interface_required(interface):\n \n def _interface_required(func):\n \"\"\"Internal decorator that wraps around the decorated function.\n\n Args:\n func (function): function being decorated\n\n Returns:\n The wrapper function.\n ...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
// OptSrcSubjectAt tells the source to add a new key to each record whose value // will be <filename>#<record number>.
[ "func OptSrcSubjectAt(key string) SrcOption {\n\treturn func(s *Source) error {\n\t\ts.subjectAt = key\n\t\treturn nil\n\t}\n}" ]
[ "def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// WeekdayWide returns the locales wide weekday given the 'weekday' provided
[ "func (kok *kok) WeekdayWide(weekday time.Weekday) string {\n\treturn kok.daysWide[weekday]\n}" ]
[ "func parseDay(buff []byte, cursor *int, l int) (int, error) {\n\t// XXX : this is a relaxed constraint\n\t// XXX : we do not check if valid regarding February or leap years\n\t// XXX : we only checks that day is in range [01 -> 31]\n\t// XXX : in other words this function will not rant if you provide Feb 31th\n\tr...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about datetime:" }
Create an author vault. @return author_vault
[ "public function get_author_vault() : author_vault {\n return new author_vault(\n $this->db,\n $this->entityfactory,\n $this->legacymapper->get_legacy_data_mapper_for_vault('author')\n );\n }" ]
[ "def includeme(config):\n \n root = config.get_root_resource()\n root.add('nef_polymorphic', '{collections:.+,.+}',\n view=PolymorphicESView,\n factory=PolymorphicACL)" ]
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Register an existing function as a class constructor for usage with {@link Lava.ClassManager#getConstructor}() @param {string} class_path Full class path @param {function} constructor Constructor instance
[ "function(class_path, constructor) {\n\n\t\tif (class_path in this._sources) Lava.t('Class \"' + class_path + '\" is already defined');\n\t\tthis.constructors[class_path] = constructor;\n\n\t}" ]
[ "protected Expression instantiate(Object oldInstance, Encoder out)\n {\n //\n // An implementation instance is actually constructed at decode time by calling\n // ControlBean.ensureControl on the parent bean. This will create a new impl\n // instance and run the impl initializer on i...
codesearchnet
{ "query": "Represent the summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
[renderContent description] @return [type] [description]
[ "protected function renderContent()\n\t{\n\t\t$searchModel = new AddressSearch;\n $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(),$this->module,$this->id);\n\n echo $this->render('@frenzelgmbh/cmentity/widgets/views/_address_grid', [\n 'dataProvider' => $dataProvider,\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 text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
A Controller can time us out if we are silent for too long. This is especially true in JaaS, which has a fairly strict timeout. To prevent timing out, we send a ping every ten seconds.
[ "async def _pinger(self):\n '''\n \n\n '''\n async def _do_ping():\n try:\n await pinger_facade.Ping()\n await asyncio.sleep(10, loop=self.loop)\n except CancelledError:\n pass\n\n pinger_facade = client.PingerFaca...
[ "def _restore_clipboard_selection(self, backup: str):\n \"\"\"\"\"\"\n # Pasting takes some time, so wait a bit before restoring the content. Otherwise the restore is done before\n # the pasting happens, causing the backup to be pasted instead of the desired clipboard content.\n\n # Prog...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Handles redirection for unauthorized access @method @private @param rejectedPermission {String} Rejected access right @param permissionMap {permission.PermPermissionMap} State permission map
[ "function handleUnauthorizedState(rejectedPermission, permissionMap) {\n PermTransitionEvents.broadcastPermissionDeniedEvent();\n\n permissionMap\n .resolveRedirectState(rejectedPermission)\n .then(function (redirect) {\n $location.path(redirect.state).replace();\n ...
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the Github description about PHP:", "pos": "Represent the Github code about PHP:", "neg": "Represent the Github code about Programming:" }
Returns DateTime object. @return \DateTime
[ "public static function getDateTime()\n {\n $dt = \\DateTime::createFromFormat('U.u', microtime(true));\n $dt->setTimezone(new \\DateTimeZone(date('e')));\n\n return $dt;\n }" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Creates an instance of `MSPassportStrategy`. @constructor @api public
[ "function MSPassportStrategy(options) {\n Strategy.call(this);\n this.name = \"mspassport\";\n \n var default_options = {\n protocol : \"querystring\",\n protocolHandler : function() { self.fail(\"protocolHandler must be implemented if protocol === 'custom'\") } \n };\n \n this.options...
[ "public Plugin.Factory.UsingReflection.ArgumentResolver toArgumentResolver() {\n return new Plugin.Factory.UsingReflection.ArgumentResolver.ForIndex.WithDynamicType(index, value);\n }" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Programming:" }
Constructor and Initialisation ------------------------------
[ "public function init() {\n\n\t\tparent::init();\n\n\t\t// Permissions\n\t\t$this->crudPermission\t= CoreGlobal::PERM_ADMIN;\n\n\t\t// Check Layout for Public and Private pages\n\t\tif ( Yii::$app->user->isGuest ) {\n\n\t\t\t$this->layout\t= AdminGlobalCore::LAYOUT_PUBLIC;\n\t\t}\n\n\t\t// Breadcrumbs\n\t\t$this->b...
[ "function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }" ]
codesearchnet
{ "query": "Represent the Github comment about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
Reads data from data array, if not found query array will be used as fallback. @param string $name @param mixed $default @return mixed
[ "public function input(string $name, $default = null)\n {\n return $this->data($name, $this->query($name, $default));\n }" ]
[ "protected function VerifyPLUGName()\n {\n // if plug already set, don't need to set it now.\n if ($this->getOption('plug') != '') {\n return;\n }\n\n //Sets the default plug.\n $size = 512;\n $unit = 'K';//or M\n\n /*4K, 32K, 65K, 512K,\n 1M, ...
codesearchnet
{ "query": "Represent the Github comment about PHP:", "pos": "Represent the Github code about PHP:", "neg": "Represent the Github code:" }