query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Configure event data. Currently used for 'created', 'modified', 'removed', 'invalidated' events.
[ "private void configureEvent(CacheEntryListenerInvocation listenerInvocation,\n EventImpl<K, V> e, K key, V value, Metadata metadata, boolean pre, InvocationContext ctx,\n FlagAffectedCommand command, V previousValue, Metadata previousMetadata) {\n ke...
[ "def forward_dashboard_event(self, dashboard, job_data, event, job_num):\n \n # possible events:\n # - action.submit\n # - action.cancel\n # - status.pending\n # - status.running\n # - status.finished\n # - status.retry\n # - status.failed...
codesearchnet
{ "query": "Represent the instruction about Technology:", "pos": "Represent the code about Technology:", "neg": "Represent the code about Software Development:" }
get the variable list as an array @return array of key=value assignment strings @throws BuildException if any variable is misconfigured
[ "public function getVariables()\n {\n if ($this->variables->count() === 0) {\n return null;\n }\n return array_map(\n function ($env) {\n return $env->getContent();\n },\n $this->variables->getArrayCopy()\n );\n }" ]
[ "def get_value(self, context):\n \"\"\"\"\"\"\n if self.value:\n return expressions.eval_string(self.value, context)\n else:\n # Empty input raises cryptic EOF syntax err, this more human\n # friendly\n raise ValueError('!py string expression is empty...
codesearchnet
{ "query": "Represent the Github instruction about Documentation:", "pos": "Represent the Github code about Documentation:", "neg": "Represent the Github code:" }
Sort the collection by return values from the iterator
[ "public static function sortBy($collection = null, $iterator = null, $sort_flag = null)\n {\n $results = array();\n foreach ($collection as $k => $item) {\n if (is_callable($iterator)) {\n $results[$k] = $iterator($item);\n }\n if (is_object($item)) {...
[ "@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:" }
Allows you to add a new link to a downloadable product. @param string $productId @param array $resource @param string $resourceType @param string $store @param string $identifierType @return ActionInterface
[ "public function add($productId, $resource, $resourceType, $store = null, $identifierType = null)\n {\n return $this->__createAction('product_downloadable_link.add', func_get_args());\n }" ]
[ "public static function add($handle, $type, $args, $pkg = false)\n {\n $category = Category::getByHandle($handle);\n $controller = $category->getController();\n if (!($controller instanceof LegacyCategory)) {\n throw new \\Exception(t('You cannot use the legacy attribute add metho...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Stops producers and consumers on a given destination. This has no effect on durable subscriptions. @param destName @throws MessagingException
[ "public void stop(String destName) throws MessagingException {\n try {\n // Look for an existing destination for the given destination\n //\n JMSDestination jmsDest =\n jmsDestinations.get(destName);\n if (jmsDest != null) {\n // C...
[ "@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 text about Messaging:", "pos": "Represent the code about Messaging:", "neg": "Represent the code about Programming:" }
Binds to {@code Value.int64Array(values, pos, length)}
[ "public R toInt64Array(@Nullable long[] values, int pos, int length) {\n return handle(Value.int64Array(values, pos, length));\n }" ]
[ "AtomSymbol alignTo(SymbolAlignment alignment) {\n return new AtomSymbol(element, adjuncts, annotationAdjuncts, alignment, hull);\n }" ]
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Saves the JSON archive of processed pull requests.
[ "def _save_archive(self):\n \n import json\n from utility import json_serial\n with open(self.archpath, 'w') as f:\n json.dump(self.archive, f, default=json_serial)" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// BuildLogicalPlan used to build logical plan from ast.Node.
[ "func BuildLogicalPlan(ctx sessionctx.Context, node ast.Node, is infoschema.InfoSchema) (Plan, error) {\n\tctx.GetSessionVars().PlanID = 0\n\tctx.GetSessionVars().PlanColumnID = 0\n\tbuilder := &PlanBuilder{\n\t\tctx: ctx,\n\t\tis: is,\n\t\tcolMapper: make(map[*ast.ColumnNameExpr]int),\n\t}\n\tp, err :...
[ "@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:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// MySQL returns a string representing a suite of MySQL commands // recreating the Dataset into a table.
[ "func (d *Dataset) MySQL(table string) *Exportable {\n\treturn d.sql(table, typeMySQL)\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 about Data processing:", "pos": "Represent the code about Data processing:", "neg": "Represent the code:" }
Grabs changeset information for the given build. @param build a Build @param changeSet the build JSON object @param commitIds the commitIds @param revisions the revisions
[ "private void addChangeSet(Build build, JSONObject changeSet, Set<String> commitIds, Set<String> revisions) { \n String scmType = getString(changeSet, \"kind\");\n Map<String, RepoBranch> revisionToUrl = new HashMap<>();\n\n // Build a map of revision to module (scm url). This is not alw...
[ "public static OriginIdElement addOriginId(Message message) {\n OriginIdElement originId = new OriginIdElement();\n message.addExtension(originId);\n // TODO: Find solution to have both the originIds stanzaId and a nice to look at incremental stanzaID.\n // message.setStanzaId(originId.g...
codesearchnet
{ "query": "Represent the post about Documentation:", "pos": "Represent the code about Documentation:", "neg": "Represent the code about Software development:" }
create array with noise data to display
[ "function(dimensions) {\n var simplex = new gamejs.math.noise.Simplex(Math);\n var surfaceData = [];\n for (var i=0;i<dimensions[0];i++) {\n surfaceData[i] = [];\n for (var j=0;j<dimensions[1];j++) {\n var val = simplex.get(i/50, j/50) * 255;\n surfaceData[i][j] = val;\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 post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Creates StreamableHashMap populated with the same values as the provided Map.
[ "public static <K, V> StreamableHashMap<K, V> newMap (Map<? extends K, ? extends V> map)\n {\n return new StreamableHashMap<K, V>(map);\n }" ]
[ "@Override\n public <T> Streamlet<T> applyOperator(IStreamletOperator<R, T> operator) {\n checkNotNull(operator, \"operator cannot be null\");\n\n // By default, NoneStreamGrouping stategy is used. In this stategy, tuples are forwarded\n // from parent component to a ramdon one of all the instances of the...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Programming:" }
// Value gets the value of the Firebase reference.
[ "func (fb *Firebase) Value(v interface{}) error {\n\t_, bytes, err := fb.doRequest(\"GET\", nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.Unmarshal(bytes, v)\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:", "pos": "Represent the code:", "neg": "Represent the code:" }
Build a tcpdump like hexadecimal view :param x: a Packet :param dump: define if the result must be printed or returned in a variable :returns: a String only when dump=True
[ "def hexdump(x, dump=False):\n \n s = \"\"\n x = bytes_encode(x)\n x_len = len(x)\n i = 0\n while i < x_len:\n s += \"%04x \" % i\n for j in range(16):\n if i + j < x_len:\n s += \"%02X \" % orb(x[i + j])\n else:\n s += \" \"\n ...
[ "def file_or_token(value):\n \n if isfile(value):\n with open(value) as fd:\n return fd.read().strip()\n\n if any(char in value for char in '/\\\\.'):\n # This chars will never be in a token value, but may be in a path\n # The error message will be handled by the parser\n ...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Each role can have a numerical level as well; this is useful if you want to check someone has a higher role than someone else. Deprecated by WordPress @param int $level @param string $operator Possibilities: < <= = > >= @return bool
[ "public function level($level, $operator = '>=')\n\t{\n\t\tif (!$this->user())\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\t$userCaps = array_keys($this->getUser()->allcaps);\n\n\t\tforeach ($userCaps as $cap)\n\t\t{\n\t\t\t// get just the first, higher\n\t\t\tif (substr($cap, 0, 6) === 'level_')\n\t\t\t{\n\t\t\t\tret...
[ "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 Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
apply the base fields to other views if configured to do so.
[ "private static Map<String, Set<String>> expand(Map<String, Set<String>> viewToPropNames) {\n\n Set<String> baseProps = viewToPropNames.get(PropertyView.BASE_VIEW);\n\n if (baseProps == null) {\n baseProps = ImmutableSet.of();\n }\n\n if (!SquigglyConfig.isFilterImplicitlyIncl...
[ "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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
[ "@XmlElementDecl(namespace = \"http://www.ibm.com/websphere/wim\", name = \"localityName\")\n public JAXBElement<String> createLocalityName(String value) {\n return new JAXBElement<String>(_LocalityName_QNAME, String.class, null, value);\n }" ]
[ "@SuppressWarnings(\"unchecked\")\n public Map<String, Field> getValueAsMap() {\n return (Map<String, Field>) type.convert(getValue(), Type.MAP);\n }" ]
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
获取getter方法 @param clazz 类 @param field 属性 @return getter方法
[ "public static Method getGetterMethod(Class<?> clazz, Field field) {\n return getMethod(clazz, getGetterMethodName(field));\n }" ]
[ "private static function appRun(){\n // echo \"runing\";\n // 当有get参数传递时 获取get参数\n if(isset($_GET['s'])){\n // 更加\"/\"将get参数分割成数组\n $info = explode('/',$_GET['s']);\n\n // 获取模块名称 转换成小写\n $m = strtolower($info[0]);\n // 获取控制器名称 转换成小写\n ...
codesearchnet
{ "query": "Represent the summarization about text processing:", "pos": "Represent the code about text processing:", "neg": "Represent the code:" }
Transform sequences into reverse complements.
[ "def reverse_complement_sequences(records):\n \n logging.info('Applying _reverse_complement_sequences generator: '\n 'transforming sequences into reverse complements.')\n for record in records:\n rev_record = SeqRecord(record.seq.reverse_complement(),\n ...
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
write tuple data to cassandra
[ "private void writeColumnsFromTuple(ByteBuffer key, Tuple t, int offset) throws IOException\n {\n ArrayList<Mutation> mutationList = new ArrayList<Mutation>();\n for (int i = offset; i < t.size(); i++)\n {\n if (t.getType(i) == DataType.BAG)\n writeColumnsFromBag(ke...
[ "def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Execute the job. @return User
[ "public function handle()\n {\n $user = $this->dbTransaction(function () {\n if (array_key_exists('password', $this->attributes)) {\n $this->attributes['password'] = bcrypt($this->attributes['password']);\n }\n $this->user->fill($this->attributes);\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the comment about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
/* (non-Javadoc) @see com.fs.commons.desktop.validation.Validator#validate(com.fs.commons.desktop. validation.Problems, java.lang.String, java.lang.Object)
[ "@Override\n\tpublic boolean validate(final Problems problems, final String compName, final String model) {\n\t\tfinal ParsePosition p = new ParsePosition(0);\n\t\ttry {\n\t\t\tNumberFormat.getNumberInstance(this.locale == null ? Locale.getDefault() : this.locale).parse(model, p);\n\t\t\tif (model.length() != p.get...
[ "@SuppressWarnings(\"unchecked\")\n public static StackFinder getInstance() {\n if (finder == null) {\n AccessController.doPrivileged(new PrivilegedAction() {\n public Object run() {\n finder = new StackFinder();\n return null;\n ...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Set file handle @param string $mode Mode for file opening @return resource
[ "private function setHandle($mode)\n {\n $this->closeExistingHandle();\n\n $this->handle = fopen($this->file, $mode);\n\n return $this->handle;\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 comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Convert HOCON input into a JSON output :return: JSON string representation :type return: basestring
[ "def _find_substitutions(cls, item):\n \n if isinstance(item, ConfigValues):\n return item.get_substitutions()\n\n substitutions = []\n elements = []\n if isinstance(item, ConfigTree):\n elements = item.values()\n elif isinstance(item, list):\n ...
[ "def _type_description(self):\n \"\"\"\"\"\"\n #This is a little tricker because the docstring is housed\n #inside of the module that contains the actual executable.\n #These TypeExecutables are just pointers.\n iexec = self._element.target\n if iexec is not None:\n ...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Draw guide Returns ------- out : matplotlib.offsetbox.Offsetbox A drawing of this legend
[ "def draw(self):\n \n obverse = slice(0, None)\n reverse = slice(None, None, -1)\n nbreak = len(self.key)\n themeable = self.theme.figure._themeable\n\n # When there is more than one guide, we keep\n # record of all of them using lists\n if 'legend_title' not ...
[ "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 summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
Computes hash of \Skrz\Meta\Fixtures\Protobuf\ClassWithEmbeddedMessageProperty @param object $object @param string|resource $algoOrCtx @param bool $raw @return string|void
[ "public static function hash($object, $algoOrCtx = 'md5', $raw = FALSE)\n\t{\n\t\tif (is_string($algoOrCtx)) {\n\t\t\t$ctx = hash_init($algoOrCtx);\n\t\t} else {\n\t\t\t$ctx = $algoOrCtx;\n\t\t}\n\n\t\tif (isset($object->x)) {\n\t\t\thash_update($ctx, 'x');\n\t\t\tEmbeddedMeta::hash($object->x, $ctx);\n\t\t}\n\n\t\...
[ "func (m *NamedMethod) ToRawInfo() interface{} {\n\tinfo := yaml.MapSlice{}\n\tif m.Name != \"\" {\n\t\tinfo = append(info, yaml.MapItem{Key: \"name\", Value: m.Name})\n\t}\n\t// &{Name:value Type:Method StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}\n\treturn info\n}"...
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Programming:" }
Creates in instance from the given JSON array. @param jsonArray Array to read values from. @return New instance.
[ "public static EscEvents create(final JsonArray jsonArray) {\n final List<EscEvent> events = new ArrayList<>();\n for (final JsonValue jsonValue : jsonArray) {\n if (jsonValue.getValueType() != JsonValue.ValueType.OBJECT) {\n throw new IllegalArgumentException(\n ...
[ "@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }" ]
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Executes a campaign @param campaign the campaign to execute.
[ "public boolean execute(Campaign campaign) {\n boolean campaignResult = true;\n currentCampaign = campaign;\n campaignStartTimeStamp = new Date();\n try {\n createReport();\n\n for (CampaignRun run : currentCampaign.getRuns()) {\n if (TestEngine.isAbo...
[ "function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ...
codesearchnet
{ "query": "Represent the Github summarization about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Software development:" }
Execute the console command. @return mixed
[ "public function handle()\n {\n $topicName = trim($this->argument('topic'));\n\n $prefix = trim($this->option('prefix'));\n $max = trim($this->option('max'));\n $next = trim($this->option('next'));\n\n /**\n * @var Client\n */\n $client = $this->mns;\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Return the formatted string as HTML.
[ "def html_format(data, out, opts=None, **kwargs):\n '''\n \n '''\n ansi_escaped_string = string_format(data, out, opts, **kwargs)\n return ansi_escaped_string.replace(' ', '&nbsp;').replace('\\n', '<br />')" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
// Convert_core_PodAttachOptions_To_v1_PodAttachOptions is an autogenerated conversion function.
[ "func Convert_core_PodAttachOptions_To_v1_PodAttachOptions(in *core.PodAttachOptions, out *v1.PodAttachOptions, s conversion.Scope) error {\n\treturn autoConvert_core_PodAttachOptions_To_v1_PodAttachOptions(in, out, s)\n}" ]
[ "func NewProtoWrapperWithSerializer(db keyval.CoreBrokerWatcher, serializer keyval.Serializer) *ProtoWrapper {\n\t// OBSOLETE, use NewProtoWrapper\n\treturn NewProtoWrapper(db, serializer)\n}" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
com/dyuproject/protostuff/parser/ProtoParser.g:90:1: annotation_entry[Proto proto] : AT var ( LEFTPAREN annotation_keyval[proto, annotation] ( COMMA annotation_keyval[proto, annotation] )* RIGHTPAREN )? ;
[ "public final ProtoParser.annotation_entry_return annotation_entry(Proto proto) throws RecognitionException {\n ProtoParser.annotation_entry_return retval = new ProtoParser.annotation_entry_return();\n retval.start = input.LT(1);\n\n Object root_0 = null;\n\n Token AT17=null;\n To...
[ "def t_ATOM(self, t):\n '\n t.type = LDLfLexer.reserved.get(t.value, 'ATOM') # Check for reserved words\n return t" ]
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Regular expressions:" }
Retrieves the name of an enumeration value by number. Args: number (int): number. Returns: str: name of the enumeration value or None if no corresponding enumeration value was found.
[ "def GetName(self, number):\n \n value = self._data_type_definition.values_per_number.get(number, None)\n if not value:\n return None\n\n return value.name" ]
[ "def _validate_none_or_type(t):\n \n def _validate(setting):\n \"\"\"\n Check the setting to make sure it's the right type.\n\n Args:\n setting (object): The setting to check.\n\n Returns:\n object: The unmodified object if it's the proper type.\n\n Rai...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software Engineering:" }
Call this before setting DetailEstimate or ToDo on a workitem. @param workitem DetailEstimate or ToDo will be set for. @throws IllegalStateException If setting DetailEstimate is not allowed at this level.
[ "void preventTrackingLevelAbuse(Workitem workitem) {\n TrackingLevel level = getTrackingLevel(workitem);\n\n if (workitem instanceof PrimaryWorkitem) {\n\n if (level == TrackingLevel.SecondaryWorkitem) {\n throw new IllegalStateException(\"You cannot set DetailEstimate \"\n ...
[ "public void setValue(Object value) {\n\n if(LOGGER.isInfoEnabled() && !(value instanceof java.io.Serializable))\n LOGGER.info(\"Warning: setting a filter value tiat is not serializable. The Filter object is serializable and should contain only serializable state\");\n\n _value = value;\n ...
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
for some reason, seek path
[ "function createSeekPathSrc(target) {\n return (\n '\"use strict\";\\n' + //go fast sauce!\n target.map(function (e, i) {\n return ' var k'+i+' = Buffer.from('+ JSON.stringify(e) +');' //strings only!\n }).join('\\n') + '\\n'+\n \" return function (buffer, start) {\\n\"+\n target.map(function...
[ "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 instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
Find windzone from map.
[ "def get_windzone(conn, geometry):\n ''\n # TODO@Günni\n if geometry.geom_type in ['Polygon', 'MultiPolygon']:\n coords = geometry.centroid\n else:\n coords = geometry\n sql = \"\"\"\n SELECT zone FROM oemof_test.windzones\n WHERE st_contains(geom, ST_PointFromText('{wkt}'...
[ "protected function parentId()\n\t{\n\t\tswitch ( $this->position )\n\t\t{\n\t\t\tcase 'root':\n\t\t\t\treturn null;\n\n\t\t\tcase 'child':\n\t\t\t\treturn $this->target->getKey();\n\n\t\t\tdefault:\n\t\t\t\treturn $this->target->getParentId();\n\t\t}\n\t}" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Computer Science:" }
Loads the SwiftMailer configuration. @param array $config A configuration array @param ContainerBuilder $container A ContainerBuilder instance
[ "protected function loadSwiftMailer(array $config, ContainerBuilder $container)\n {\n $def = new Definition($container->getParameter('snc_redis.swiftmailer_spool.class'));\n $def->setPublic(false);\n $def->addMethodCall('setRedis', array(new Reference(sprintf('snc_redis.%s', $config['swiftma...
[ "public function createContainer()\n {\n # Create the container\n $container = new Container;\n\n # If we have auto-wire option on ...\n if (($this->options['autowire'] ?? false)) {\n # Add reflection delegate, so auto-wiring is possible\n $container->delegate( new ReflectionContainer );\n ...
codesearchnet
{ "query": "Represent the Github sentence about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
// GetAllType gets all the errors that are the same type as v. // // The order of the return value is the same as described in GetAll.
[ "func GetAllType(err error, v interface{}) []error {\n\tvar result []error\n\n\tvar search string\n\tif v != nil {\n\t\tsearch = reflect.TypeOf(v).String()\n\t}\n\tWalk(err, func(err error) {\n\t\tvar needle string\n\t\tif err != nil {\n\t\t\tneedle = reflect.TypeOf(err).String()\n\t\t}\n\n\t\tif needle == search {...
[ "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 instruction about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about programming:" }
// NewServicePrincipalTokenFromCertificate creates a ServicePrincipalToken from the supplied pkcs12 bytes.
[ "func NewServicePrincipalTokenFromCertificate(oauthConfig OAuthConfig, clientID string, certificate *x509.Certificate, privateKey *rsa.PrivateKey, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) {\n\tif err := validateOAuthConfig(oauthConfig); err != nil {\n\t\treturn nil, err\n\...
[ "public static boolean forgetIDTokensForServer(URL serverURL, TokenStore tokenStore) {\n OpenIDConnectAuthorizer authorizer = new OpenIDConnectAuthorizer(null, tokenStore);\n authorizer.setRemoteURL(serverURL);\n // Deliberately don't set auth.localUUID. This will leave kSecAttrAccount unset in...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about language and writing:" }
get ids based on key map @return type
[ "public function ids()\n {\n $keyMap = $this->getHandler()->getKeyMap();\n $return = [];\n foreach ($keyMap as $name => $values) {\n $return = array_add($return, $name, $values['id']);\n }\n return $return;\n }" ]
[ "def search_prod_type_tags(self, ins, type, tags, pipeline):\n ''''''\n return StoredProduct(id=100, content='null.fits', tags={})" ]
codesearchnet
{ "query": "Represent the instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Load the .mlaunch_startup file that exists in each datadir. Handles different protocol versions.
[ "def _load_parameters(self):\n \n datapath = self.dir\n\n startup_file = os.path.join(datapath, '.mlaunch_startup')\n if not os.path.exists(startup_file):\n return False\n\n in_dict = json.load(open(startup_file, 'rb'))\n\n # handle legacy version without version...
[ "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 post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
(PHP 5 &gt;= 5.0.0)<br/> Return the key of the current element @link http://php.net/manual/en/iterator.key.php @return mixed scalar on success, or null on failure.
[ "public function key()\n {\n if (isset($this->keys[$this->pos])) {\n return $this->keys[$this->pos];\n }\n return null;\n }" ]
[ "protected static function intervalHasTime(DateInterval $interval)\n {\n // The array_key_exists and get_object_vars are used as a workaround to check microsecond support.\n // Both isset and property_exists will fail on PHP 7.0.14 - 7.0.21 due to the following bug:\n // https://bugs.php.net...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software Development:" }
Insert an item after a key
[ "def insert_after(self, key, new_item, instance=0):\n \"\"\"\"\"\"\n self._insert_item(key, new_item, instance, True)" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Install one individual package
[ "def _install_indv_pkg(self, pkg_name, pkg_file):\n '''\n \n '''\n self.ui.status('... installing {0}'.format(pkg_name))\n formula_tar = tarfile.open(pkg_file, 'r:bz2')\n formula_ref = formula_tar.extractfile('{0}/FORMULA'.format(pkg_name))\n formula_def = salt.utils...
[ "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 description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Add appropriate new criteria options to the form @param object $mform moodle form
[ "public function get_options(&$mform) {\n global $DB;\n $none = false;\n $availablebadges = null;\n\n $mform->addElement('header', 'first_header', $this->get_title());\n $mform->addHelpButton('first_header', 'criteria_' . $this->criteriatype, 'badges');\n\n // Determine if ...
[ "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 sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// NearestPeer returns a single peer that is nearest to the given ID
[ "func (rt *RoutingTable) NearestPeer(id ID) peer.ID {\n\tpeers := rt.NearestPeers(id, 1)\n\tif len(peers) > 0 {\n\t\treturn peers[0]\n\t}\n\n\tlog.Debugf(\"NearestPeer: Returning nil, table size = %d\", rt.Size())\n\treturn \"\"\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 instruction about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about File management:" }
Load a YAML file of parameters into scope. @param string $path Path to YAML file.
[ "public function merge_yml( $path, $current_alias = null ) {\n\t\t$yaml = self::load_yml( $path );\n\t\tif ( ! empty( $yaml['_']['inherit'] ) ) {\n\t\t\t$this->merge_yml( $yaml['_']['inherit'], $current_alias );\n\t\t}\n\t\t// Prepare the base path for absolutized alias paths\n\t\t$yml_file_dir = $path ? dirname( $...
[ "def spec(self):\n \"\"\"\"\"\"\n from ambry_sources.sources import SourceSpec\n\n d = self.dict\n d['url'] = self.url\n\n # Will get the URL twice; once as ref and once as URL, but the ref is ignored\n\n return SourceSpec(**d)" ]
codesearchnet
{ "query": "Represent the Github comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Установка значений свойств в контексте объекта @param array $settings - массив свойства в формате 'имя' => 'значение' @return array
[ "protected function initObject(array $settings): array\n {\n $settings += static::$settings ?? [];\n foreach ($settings as $name => &$value) {\n $propertyName = null;\n if (property_exists($this, $name)) {\n $propertyName = $name;\n unset($setting...
[ "final function handle() {\n\t\ttry {\n\t\t\tif ($this->m()->s()->log()) {\n\t\t\t\t$this->log();\n\t\t\t}\n\t\t\t$this->_e->validate();\n\t\t\tif ($c = $this->strategyC()) { /** @var string|null $c */\n\t\t\t\tStrategy::handle($c, $this);\n\t\t\t}\n\t\t}\n\t\t/** 2017-09-15 @uses NotForUs is thrown from @see \\Df\...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Authorize application to use a grant password type. @param Request $request @param ApiApplication $application @return JsonResponse
[ "public function renewAccessToken(Request $request, ApiApplication $application)\n {\n $this->assertJsonRequestFormat($request);\n\n $account = $this->getApiAccountRepository()\n ->findByUserAndApplication($this->getAuthenticatedUser(), $application);\n if (null === $account) {\n ...
[ "function newService()\n {\n ### Attain Login Continue If Has\n /** @var iHttpRequest $request */\n $request = \\IOC::GetIoC()->get('/HttpRequest');\n $tokenAuthIdentifier = new IdentifierHttpToken;\n $tokenAuthIdentifier\n ->setRequest($request)\n ->setT...
codesearchnet
{ "query": "Represent the Github description about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Position can be either 'before' or 'after'
[ "public function addButton($label, $options = array())\n {\n $position = 'after';\n if (is_string($options)) {\n $position = $options;\n } else {\n if (isset($options['position'])) {\n $position = $options['position'];\n }\n }\n i...
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Sets the context response. @return AnCommandContext
[ "public function getCommandContext()\n {\n $context = parent::getCommandContext();\n $context->viewer = $this->_state->viewer;\n\n return $context;\n }" ]
[ "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:" }
Split the hash into its calculated hash and salt. @param string $hash The hash to split. @return string[] An array in the form [$hash, $hashFunc, $salt].
[ "private function splitHash($hash) {\n $parts = @unserialize($hash, ['allowed_classes' => false]);\n\n if (!is_array($parts)) {\n $result = ['', '', ''];\n } else {\n $parts += ['hash' => '', 'hashFunc' => '', 'salt' => ''];\n\n if (!$parts['hashFunc']) {\n ...
[ "private static function costEncrypt(int $cost, string $salt, string $pass): string\n {\n // Pack the cost value into a 4 byte string\n $packed = pack('N', $cost);\n\n // Encrypt the string with the Otp stream cipher\n return Otp::crypt($packed, ($pass . $salt), self::ALGO);\n }" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Select redirect data @param string $key @param bool $isDelete = false @return mixed
[ "public function select(String $key, Bool $isDelete = false)\n {\n return $this->selectData($key, $isDelete);\n }" ]
[ "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 sentence about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about programming:" }
Executes parent method parent::render(), creates oxorder and oxlist objects, passes it's data to Smarty engine and returns name of template file "user_remark.tpl". @return string
[ "public function render()\n {\n parent::render();\n\n $soxId = $this->getEditObjectId();\n $sRemoxId = \\OxidEsales\\Eshop\\Core\\Registry::getConfig()->getRequestParameter(\"rem_oxid\");\n if (isset($soxId) && $soxId != \"-1\") {\n $oOrder = oxNew(\\OxidEsales\\Eshop\\Appl...
[ "public function insertInsertTagMD( $objPage, $objLayout, $objPageRegular)\n {\n // set vary header for browsers to avoid caching in Proxies for different browsers\n header('Vary: User-Agent', false);\n \n // add mobiledetectioncss class to page css class\n $objPage->cssClass = $...
codesearchnet
{ "query": "Represent the comment about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
r"""Show inputs files in the repository. <PATHS> Files to show. If no files are given all input files are shown.
[ "def inputs(ctx, client, revision, paths):\n \n \"\"\"\n from renku.models.provenance import ProcessRun\n\n graph = Graph(client)\n paths = set(paths)\n nodes = graph.build(revision=revision)\n\n commits = {node.commit for node in nodes}\n candidates = {(node.commit, node.path)\n ...
[ "def get_parser(parser):\n \n parser.description = textwrap.dedent(\"\"\"\n Segment the .po files in LOCALE(s) based on the segmenting rules in\n config.yaml.\n\n Note that segmenting is *not* idempotent: it modifies the input file, so\n be careful that you don't run it twice on th...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Serializes a JsonElement to string. @param element A Gson element. @return SanitizedContent containing the object rendered as a json string.
[ "public static SanitizedContent serializeElement(JsonElement element) {\n // NOTE: Because JsonElement doesn't have any particular mechanism preventing random classes\n // from impersonating it, this low-tech check prevents at least obvious misuse.\n Preconditions.checkArgument(\n element instanceof...
[ "private static void selectJsonRow(CqlSession session) {\n\n // Reading the whole row as a JSON object\n Statement stmt =\n selectFrom(\"examples\", \"json_jsr353_row\")\n .json()\n .all()\n .whereColumn(\"id\")\n .in(literal(1), literal(2))\n .bui...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
/* * * * * * * Drag & Drop Related Functions * * * * * *
[ "function getValidChildrenTypes( desc, client ) {\n var node = client.getNode( desc.id );\n var validChildTypes = {};\n\n // figure out what the allowable range is\n var validChildren = node.getValidChildrenTypesDetailed(null, true);\n Object.keys( validChildre...
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Is it time to upgrade?
[ "public function maybeUpgrade() {\n\t\t$taxonomy_version = get_option( 'pressbooks_taxonomy_version', 0 );\n\t\tif ( $taxonomy_version < self::VERSION ) {\n\t\t\t$this->upgrade( $taxonomy_version );\n\t\t\tupdate_option( 'pressbooks_taxonomy_version', self::VERSION );\n\t\t}\n\t}" ]
[ "public function postCommit(\n InputInterface $input,\n OutputInterface $output,\n ParameterBagInterface $configuration\n ): void {\n // Yes we can send a notification to slack fx?\n // Then we would just add some configuration with slack channel, username etc etc\n // A...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Sets the value to be returned by {@link org.inferred.freebuilder.processor.property.Property#getType()}. @return this {@code Builder} object @throws NullPointerException if {@code type} is null
[ "public org.inferred.freebuilder.processor.property.Property.Builder setType(TypeMirror type) {\n this.type = Objects.requireNonNull(type);\n _unsetProperties.remove(Property.TYPE);\n return (org.inferred.freebuilder.processor.property.Property.Builder) this;\n }" ]
[ "public static Type forField(Field field) {\n LettuceAssert.notNull(field, \"Field must not be null\");\n return forTypeProvider(new FieldTypeProvider(field));\n }" ]
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
/* (non-Javadoc) @see com.ibm.ws.sib.processor.runtime.SIMPControllable#getId()
[ "public String getId()\n {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())\n {\n SibTr.entry(tc, \"getId\");\n SibTr.exit(tc, \"getId\", \"\"+aoStream.getID());\n }\n return \"\"+aoStream.getID() + \":\" + tick;\n }" ]
[ "@SuppressWarnings(\"unchecked\")\n public static StackFinder getInstance() {\n if (finder == null) {\n AccessController.doPrivileged(new PrivilegedAction() {\n public Object run() {\n finder = new StackFinder();\n return null;\n ...
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
The cookie string suitable for use in an HTTP header
[ "def to_s\n ret = \"\"\n ret << @name << \"=\" << @value\n ret << \"; \" << \"Version=\" << @version.to_s if @version > 0\n ret << \"; \" << \"Domain=\" << @domain if @domain\n ret << \"; \" << \"Expires=\" << @expires if @expires\n ret << \"; \" << \"Max-Age=\" << @max_age.to_s if @...
[ "public static String getDefaultMediaType(ResultType expectedType) {\n ResponseFormat format = (expectedType != null) ? defaultTypeFormats.get(expectedType) : null;\n \n // If the expected type is unknown, we should let the server decide, otherwise we could\n // wind up requesting a response type that d...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// SetNextToken sets the NextToken field's value.
[ "func (s *ListThingsInThingGroupOutput) SetNextToken(v string) *ListThingsInThingGroupOutput {\n\ts.NextToken = &v\n\treturn s\n}" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
// Validate validates the value against the list of enumerations
[ "func (c *EnumConstraint) Validate(v interface{}) (err error) {\n\tif pdebug.Enabled {\n\t\tg := pdebug.Marker(\"EnumConstraint.Validate (%s)\", v).BindError(&err)\n\t\tdefer g.End()\n\t}\n\tfor _, e := range c.enums {\n\t\tif e == v {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.New(\"value is not in enumeration...
[ "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 description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Convert a type reference to a lightweight type reference. @param typeRef - reference to convert. @param services - services used for the conversion @return the lightweight type reference.
[ "public static LightweightTypeReference toLightweightTypeReference(\n\t\t\tJvmTypeReference typeRef, CommonTypeComputationServices services) {\n\t\treturn toLightweightTypeReference(typeRef, services, false);\n\t}" ]
[ "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 Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Cache resource specific information :param resourceid: Resource id as string :param info: Dict to push :return: Nothing
[ "def push_resource_cache(resourceid, info):\n \n if not resourceid:\n raise ResourceInitError(\"Resource id missing\")\n if not DutInformationList._cache.get(resourceid):\n DutInformationList._cache[resourceid] = dict()\n DutInformationList._cache[resourceid] = merg...
[ "def cast_to_python(self, value):\n \"\"\"\"\"\"\n # v2.x does not provide a distinction between users and groups at the field selection level, can only return\n # UserGroup instances instead of specific User or Group instances\n if value is not None:\n value = UserGroup(self....
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Add a cell style to the content container and register the font face @param ffcStyle the cell style or the text style @return true if the style was created or updated
[ "public boolean addStylesFontFaceContainerStyle(final FontFaceContainerStyle ffcStyle) {\n final FontFace fontFace = ffcStyle.getFontFace();\n if (fontFace != null) {\n this.fontFaces.add(fontFace);\n }\n return this.addStylesStyle(ffcStyle);\n }" ]
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Get diff between dirty and fresh model attributes. @param \Illuminate\Database\Eloquent\Model $model The Eloquent model. @return void
[ "protected function getDiff($model)\n {\n $dirty = $model->getDirty();\n $fresh = $model->fresh() ? $model->fresh()->toArray() : []; \n $after = json_encode($dirty);\n $before = json_encode(array_intersect_key($fresh, $dirty));\n\n return compact('before', 'after');\n }" ]
[ "public function boot()\n {\n $manager = new Manager;\n\n // If you have to customize the manager instance, like setting a custom serializer,\n // I strongly suggest you to create your own service provider and add you manager configuration action here\n // Here some example if you wan...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
Get the list of filters for this message header. Override this to implement another (tree?) filter. @param messageHeader The message header to get the list for. @return The list of filters.
[ "public Iterator getFilterList(BaseMessageHeader messageHeader)\n {\n Iterator iterator = null;\n Object[][] mxString = messageHeader.getNameValueTree();\n NameValue node = this;\n int iIndex = -1;\n while (node != null)\n {\n Iterator nodeIterator = node.getF...
[ "public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l...
codesearchnet
{ "query": "Represent the comment about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Removes the commerce discount where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the commerce discount that was removed
[ "@Override\n\tpublic CommerceDiscount removeByUUID_G(String uuid, long groupId)\n\t\tthrows NoSuchDiscountException {\n\t\tCommerceDiscount commerceDiscount = findByUUID_G(uuid, groupId);\n\n\t\treturn remove(commerceDiscount);\n\t}" ]
[ "def delete(self, instance):\n \n \n #TODO: Really drop the database based on a policy set in `instance.parameters`.\n #\n # We need :\n # - Set a policy in parameters of the instance (eg: policy-on-delete : retain|drop => default to retain)\n # - t...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about AWS Auto Scaling:" }
Calcs the bonding size of given mesh. @param mesh Mesh to calc its bouding size. @return The bounding size for x, y and z axis.
[ "public static float[] getBoundingSize(GVRMesh mesh) {\n final float [] dim = new float[3];\n final float [] vertices = mesh.getVertices();\n final int vsize = vertices.length;\n float minx = Integer.MAX_VALUE;\n float miny = Integer.MAX_VALUE;\n float minz = Integer.MAX_VA...
[ "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 sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Sets the AWS Key Management System parameters used to encrypt the object on server side.
[ "public void setSSEAwsKeyManagementParams(SSEAwsKeyManagementParams params) {\n if (params != null && this.sseCustomerKey != null) {\n throw new IllegalArgumentException(\n \"Either SSECustomerKey or SSEAwsKeyManagementParams must not be set at the same time.\");\n }\n ...
[ "def from_bucket(cls, connection, bucket):\n \"\"\"\"\"\"\n if bucket is None:\n raise errors.NoContainerException\n\n # It appears that Amazon does not have a single-shot REST query to\n # determine the number of keys / overall byte size of a bucket.\n return cls(conne...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about AWS S3:" }
Returns the names of all the columns used in a patsy formula. Parameters ---------- formula : str, iterable, or dict Any formula construction supported by ``str_model_expression``. Returns ------- columns : list of str
[ "def columns_in_formula(formula):\n \n if formula is None:\n return []\n\n formula = str_model_expression(formula, add_constant=False)\n columns = []\n\n tokens = map(\n lambda x: x.extra,\n tz.remove(\n lambda x: x.extra is None,\n _tokens_from_patsy(patsy....
[ "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:" }
// SwarmInit indicates an expected call of SwarmInit
[ "func (mr *MockSwarmAPIClientMockRecorder) SwarmInit(ctx, req interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SwarmInit\", reflect.TypeOf((*MockSwarmAPIClient)(nil).SwarmInit), ctx, req)\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 summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Register the given schema class. @throws water.exceptions.H2OFailException if there is a name collision, if the type parameters are bad, or if the version is bad
[ "private static void register(Schema schema) {\n Class clz = schema.getClass();\n synchronized(clz) {\n String clzname = clz.getSimpleName();\n\n // Was there a race to get here? If so, return.\n Class<? extends Schema> existing = schemas.get(clzname);\n if (existing != null) {\n i...
[ "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:" }
ExtensionRepositoryManager
[ "private void updateRepositories()\n {\n // Get values\n Stream<ExtensionRepositoryEntry> entryStream = this.repositoryMap.values().stream();\n\n // Sort\n entryStream = entryStream.sorted();\n\n // Convert to list of ExtensionRepository\n this.repositories = entryStream...
[ "public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about File management:" }
Compare two strings in constant time to prevent timing attacks. @param string $string_a Initial string @param string $string_b String to compare initial string to @return bool True if strings are the same, false if not
[ "public function stringCompare($string_a, $string_b)\n\t{\n\t\t$diff = strlen($string_a) ^ strlen($string_b);\n\n\t\tfor ($i = 0; $i < strlen($string_a) && $i < strlen($string_b); $i++)\n\t\t{\n\t\t\t$diff |= ord($string_a[$i]) ^ ord($string_b[$i]);\n\t\t}\n\n\t\treturn $diff === 0;\n\t}" ]
[ "public function containsValue($value): bool {\n\n /**\n * @var string $arrayIndex\n * @var SinglyLinkedList $list\n */\n foreach ($this->bucket as $arrayIndex => $list) {\n /* $list is the first element in the bucket. The bucket\n * can contain max $maxS...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Return the mapped context class @param string $contextName @return string
[ "protected function getMappedContext($contextName)\n {\n $this->checkMappedContext($contextName);\n $mappingList = $this->getMappingList();\n\n return $mappingList[$contextName];\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 text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Reconstruct word indices in case of word removals. Vocabulary does not handle empty indices when words are removed, hence it need to be told explicity about when to reconstruct them.
[ "def reconstruct_indices(self):\n \n del self.i2f, self.f2i\n self.f2i, self.i2f = {}, {}\n\n for i, w in enumerate(self.words):\n self.f2i[w] = i\n self.i2f[i] = w" ]
[ "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 summarization:", "pos": "Represent the code:", "neg": "Represent the code:" }
<!-- begin-user-doc --> <!-- end-user-doc --> @generated
[ "public EClass getIfcAnnotationSymbolOccurrence() {\r\n\t\tif (ifcAnnotationSymbolOccurrenceEClass == null) {\r\n\t\t\tifcAnnotationSymbolOccurrenceEClass = (EClass) EPackage.Registry.INSTANCE\r\n\t\t\t\t\t.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(19);\r\n\t\t}\r\n\t\treturn ifcAnnotationSymbolOc...
[ "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 comment about Text generation:", "pos": "Represent the code about Text generation:", "neg": "Represent the code:" }
Checks if any element in the set contains the term. @param terms changed terms @return true if any changed terms contains a desired substring
[ "private boolean termsContainDesired(Set<String> terms)\n\t{\n\t\tif (terms.isEmpty()) return false;\n\t\tif (featureSubstring.length == 0) return true;\n\n\t\tfor (String term : terms)\n\t\t{\n\t\t\tfor (String sub : featureSubstring)\n\t\t\t{\n\t\t\t\tif (term.contains(sub)) return true;\n\t\t\t}\n\t\t}\n\t\tretu...
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
Consistently calculate file name hashes. @param $template_file @param $block_index @return string
[ "public static function hashInlineFileName($template_file, $block_index)\n {\n // Work around path inconsistencies on Windows/XAMPP.\n if (DIRECTORY_SEPARATOR === '\\\\') {\n $template_file = str_replace('\\\\', '/', $template_file);\n }\n\n return md5($template_file . $blo...
[ "def _input_as_parameter(self, data):\n \n self.Parameters['-i'].on(data)\n # access data through self.Parameters so we know it's been cast\n # to a FilePath\n input_filepath = self.Parameters['-i'].Value\n input_file_dir, input_filename = split(input_filepath)\n inp...
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Gets the input stream for the file. @param api The discord api instance. @return The input stream for the file.
[ "public CompletableFuture<InputStream> asInputStream(DiscordApi api) {\n CompletableFuture<InputStream> future = new CompletableFuture<>();\n try {\n if (fileAsBufferedImage != null) {\n ByteArrayOutputStream os = new ByteArrayOutputStream();\n ImageIO.write(fi...
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the comment about File management:", "pos": "Represent the code about File management:", "neg": "Represent the code about programming:" }
Verify a integer value (integer string) @return Validator
[ "public function int()\n {\n return $this->markErrorIf(!is_numeric($this->value) || strval(intval($this->value)) != strval($this->value) );\n }" ]
[ "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 comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Regular expressions:" }
// EnqueueString is a helper function for Enqueue that accepts a // value as a string rather than a byte slice.
[ "func (q *Queue) EnqueueString(value string) (*Item, error) {\n\treturn q.Enqueue([]byte(value))\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 sentence about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about programming:" }
Returns a Dirichlet PDF function
[ "def pdf(alphas):\n ''''''\n alphap = alphas - 1\n c = np.exp(gammaln(alphas.sum()) - gammaln(alphas).sum())\n def dirichlet(xs):\n '''N x K array'''\n return c * (xs**alphap).prod(axis=1)\n return dirichlet" ]
[ "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 Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Natural Language Processing:" }
Handle authentication attempt @param bool $executeNow should we execute now? @param string $username @param string $password @param string $toRoute redirect to this route on success @return string|null error message
[ "public function handleAttempt($executeNow, $username, $password, $toRoute)\n {\n if ($executeNow) {\n try {\n if ($this->attempt($username, $password)) {\n Base::instance()->reroute($toRoute);\n }\n } catch (Exception $e) {\n ...
[ "public static function current()\n {\n if (static::$_current === null) {\n if ($token = AuthToken::current()) {\n //\n // TODO: (known bug)\n // When accessing $token->auth inside an observer other than `auth`,\n // the table name of ...
codesearchnet
{ "query": "Represent the Github sentence about PHP:", "pos": "Represent the Github code about PHP:", "neg": "Represent the Github code about Software development:" }
Alters the current matrix at index <i>(i,j)</i> to be equal to <i>A<sub>i,j</sub> = A<sub>i,j</sub> + value</i> @param i the row, starting from 0 @param j the column, starting from 0 @param value the value to add to the matrix coordinate
[ "public void increment(int i, int j, double value)\n {\n if(Double.isNaN(value) || Double.isInfinite(value))\n throw new ArithmeticException(\"Can not add a value \" + value);\n set(i, j, get(i, j)+value);\n }" ]
[ "def _create_features(self, constraints):\n \"\"\"\"\"\"\n affine_warp_constraints = constraints\n if not isinstance(affine_warp_constraints, AffineWarpConstraints):\n affine_warp_constraints = AffineWarpConstraints(affine_warp_constraints)\n mask = affine_warp_constraints.mask\n psi = _create_a...
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Gets the raw image data from an overlay. Overlay image data is always returned as RGBA data, 4 bytes per pixel. If the buffer is not large enough, width and height will be set and VROverlayError_ArrayTooSmall is returned.
[ "def getOverlayImageData(self, ulOverlayHandle, pvBuffer, unBufferSize):\n \n\n fn = self.function_table.getOverlayImageData\n punWidth = c_uint32()\n punHeight = c_uint32()\n result = fn(ulOverlayHandle, pvBuffer, unBufferSize, byref(punWidth), byref(punHeight))\n return r...
[ "private void refreshBuffer() throws IOException {\n if (output == null) {\n // We're writing to a single buffer.\n throw new OutOfSpaceException();\n }\n\n // Since we have an output stream, this is our buffer\n // and buffer offset == 0\n output.write(buffer, 0, position);\n position =...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about writing:" }
Append a derivation level to an existing path
[ "public static ImmutableList<ChildNumber> append(List<ChildNumber> path, ChildNumber childNumber) {\n return ImmutableList.<ChildNumber>builder().addAll(path).add(childNumber).build();\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 post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Set the lower bound for the source value to match this entry. @param float $sourceValue A float value. @throws \InvalidArgumentException If $sourceValue is not a float.
[ "public function setSourceValue($sourceValue)\n {\n if (is_float($sourceValue)) {\n $this->sourceValue = $sourceValue;\n } else {\n $msg = \"SourceValue must be a float value, '\" . gettype($sourceValue) . \"' given.\";\n throw new InvalidArgumentException($msg);\n ...
[ "function validatePriority (priority) {\n var type = typeOf(priority);\n\n if (type.hasValue && !type.isNumber) {\n throw ono('Invalid arguments. Expected a priority number.');\n }\n}" ]
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Calculates the `Information ratio <https://www.investopedia.com/terms/i/informationratio.asp>`_ (or `from Wikipedia <http://en.wikipedia.org/wiki/Information_ratio>`_).
[ "def calc_information_ratio(returns, benchmark_returns):\n \n diff_rets = returns - benchmark_returns\n diff_std = np.std(diff_rets, ddof=1)\n\n if np.isnan(diff_std) or diff_std == 0:\n return 0.0\n\n return np.divide(diff_rets.mean(), diff_std)" ]
[ "def display(self):\n \n print('Stats for %s from %s - %s' % (self.name, self.start, self.end))\n if type(self.rf) is float:\n print('Annual risk-free rate considered: %s' % (fmtp(self.rf)))\n print('Summary:')\n data = [[fmtp(self.total_return), fmtn(self.daily_sharpe)...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
SDK2.5 signature for back compatibility
[ "public ManagedEntity findByUuid(Datacenter datacenter, String uuid, boolean vmOnly) throws RuntimeFault, RemoteException {\r\n return findByUuid(datacenter, uuid, vmOnly, null);\r\n }" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Add key SnpEff stats to the general stats table
[ "def general_stats(self):\n \n\n headers = OrderedDict()\n headers['Change_rate'] = {\n 'title': 'Change rate',\n 'scale': 'RdYlBu-rev',\n 'min': 0,\n 'format': '{:,.0f}'\n }\n headers['Ts_Tv_ratio'] = {\n 'title': 'Ts/Tv',\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 comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
// MaxInt8N returns the largest int8 in the set provided. // If no values are provided, MaxInt8 returns 0.
[ "func MaxInt8N(v ...int8) int8 {\n\tswitch len(v) {\n\tcase 0:\n\t\treturn 0\n\tcase 1:\n\t\treturn v[0]\n\tcase 2:\n\t\treturn MaxInt8(v[0], v[1])\n\tdefault:\n\t\tl := len(v) / 2\n\t\treturn MaxInt8N(MaxInt8N(v[:l]...), MaxInt8N(v[l:]...))\n\t}\n}" ]
[ "private void addRawProbabilistic(final long rawValue) {\n // p(w): position of the least significant set bit (one-indexed)\n // By contract: p(w) <= 2^(registerValueInBits) - 1 (the max register value)\n //\n // By construction of pwMaxMask (see #Constructor()),\n // lsb(pwM...
codesearchnet
{ "query": "Represent the instruction about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about programming:" }
Reloads user selected Components. :return: Method success. :rtype: bool :note: May require user interaction.
[ "def reload_components_ui(self):\n \n\n selected_components = self.get_selected_components()\n\n self.__engine.start_processing(\"Reloading Components ...\", len(selected_components))\n reload_failed_components = []\n for component in selected_components:\n if component...
[ "def Call(self, Id=0):\n \n o = Call(self, Id)\n o.Status # Test if such a call exists.\n return o" ]
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Returns a Collection of the keys @return Collection
[ "public function keys()\n {\n $count = $this->count()->toNative();\n $keysArray = new \\SplFixedArray($count);\n\n foreach ($this->items as $key => $item) {\n $keysArray->offsetSet($key, $item->getKey());\n }\n\n return new Collection($keysArray);\n }" ]
[ "public List<Symbol> getSymbolList(final String param) {\n return get(param, new StringToSymbolList(\",\"),\n new AlwaysValid<List<Symbol>>(),\n \"comma-separated list of strings\");\n }" ]
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Documentation:" }
Generate splits of the data.
[ "def example_splits(url_file, all_files):\n \"\"\"\"\"\"\n\n def generate_hash(inp):\n \"\"\"Generate a sha1 hash to match the raw url to the filename extracted.\"\"\"\n h = hashlib.sha1()\n h.update(inp)\n return h.hexdigest()\n\n all_files_map = {f.split(\"/\")[-1]: f for f in all_files}\n\n urls ...
[ "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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// WordCount returns number of words in a string. // // Word is defined as a locale dependent string containing alphabetic characters, // which may also contain but not start with `'` and `-` characters.
[ "func WordCount(str string) int {\n\tvar r rune\n\tvar size, n int\n\n\tinWord := false\n\n\tfor len(str) > 0 {\n\t\tr, size = utf8.DecodeRuneInString(str)\n\n\t\tswitch {\n\t\tcase isAlphabet(r):\n\t\t\tif !inWord {\n\t\t\t\tinWord = true\n\t\t\t\tn++\n\t\t\t}\n\n\t\tcase inWord && (r == '\\'' || r == '-'):\n\t\t\...
[ "def get_head(name, line, releases):\n \n if not line:\n return False\n # if this line begins with an invalid starting character, return early.\n # invalid characters are those used by various markup languages to introduce a new\n # new list item\n for char in INVALID_LINE_START:\n #...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
return null if not found
[ "public static String getPageDoc(ITypeBinding type, AcceptableLocales locales) {\n return getPageDoc(type.getAnnotations(), locales);\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:" }
// IsUnflushed implements the BlockServer interface for BlockServerMemory.
[ "func (b *BlockServerMemory) IsUnflushed(ctx context.Context, tlfID tlf.ID,\n\t_ kbfsblock.ID) (bool, error) {\n\tb.lock.RLock()\n\tdefer b.lock.RUnlock()\n\n\tif b.m == nil {\n\t\treturn false, errBlockServerMemoryShutdown\n\t}\n\n\treturn false, nil\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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }