query stringlengths 16 255 | pos list | neg list | task stringclasses 1 value | instruction dict |
|---|---|---|---|---|
Computes the new parent id for the node being moved.
@return int | [
"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}"
] | [
"final void initDocument(int documentNumber)\n {\n // save masked DTM document handle\n m_docHandle = documentNumber<<DOCHANDLE_SHIFT;\n\n // Initialize the doc -- no parent, no next-sib\n nodes.writeSlot(0,DOCUMENT_NODE,-1,-1,0);\n /... | codesearchnet | {
"query": "Represent the instruction about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
// SetWinSize overwrites the playlist's window size. | [
"func (p *MediaPlaylist) SetWinSize(winsize uint) error {\n\tif winsize > p.capacity {\n\t\treturn errors.New(\"capacity must be greater than winsize or equal\")\n\t}\n\tp.winsize = winsize\n\treturn nil\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 text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Show the sidebar and squish the container to make room for the sidebar.
If hideOthers is true, hide other open sidebars. | [
"function() {\n var options = this.options;\n\n if (options.hideOthers) {\n this.secondary.each(function() {\n var sidebar = $(this);\n\n if (sidebar.hasClass('is-expanded')) {\n sidebar.toolkit('offCanvas', 'hide');\n }\n ... | [
"function showDropdown(position) {\n // If the dropdown is already visible, just return (so the root click handler on html\n // will close it).\n if ($dropdown) {\n return;\n }\n\n Menus.closeAll();\n\n $dropdown = $(renderList())\n .css({\n ... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Decide the fate of the cells | [
"def nextGen(self):\n \n self.current_gen += 1\n self.change_gen[self.current_gen % 3] = copy.copy(self.grid)\n grid_cp = copy.copy(self.grid)\n\n for cell in self.grid:\n y, x = cell\n y1 = (y - 1) % self.y_grid\n y2 = (y + 1) % self.y_grid\n ... | [
"function showIntro() {\n write(\"Welcome to the Recognizer's Sample console application!\");\n write(\"To try the recognizers enter a phrase and let us show you the different outputs for each recognizer or just type 'exit' to leave the application.\");\n write();\n write(\"Here are some examples you co... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Return the kind specified by a given __property__ key.
Args:
key: key whose kind name is requested.
Returns:
The kind specified by key. | [
"def key_to_kind(cls, key):\n \n if key.kind() == Kind.KIND_NAME:\n return key.id()\n else:\n return key.parent().id()"
] | [
"def persistent_id(self, obj):\n \"\"\"\"\"\"\n if isinstance(obj, Element):\n # Here, our persistent ID is simply a tuple, containing a tag and\n # a key\n return obj.__class__.__name__, obj.symbol\n else:\n # If obj does not have a persistent ID, re... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Gets a recursive list of traits used by a class
@param string $class Full class name
@return array | [
"private function getRecursiveTraits($class = null)\n {\n if (null == $class) {\n $class = get_class($this);\n }\n\n $reflection = new \\ReflectionClass($class);\n $traits = array_keys($reflection->getTraits());\n\n foreach ($traits as $trait) {\n $traits ... | [
"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 instruction about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
// SetMaxRecords sets the MaxRecords field's value. | [
"func (s *DescribeSnapshotCopyGrantsInput) SetMaxRecords(v int64) *DescribeSnapshotCopyGrantsInput {\n\ts.MaxRecords = &v\n\treturn s\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 Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about AWS S3:"
} |
Check if the current position of the pointer is valid
@return bool True if the pointer position is valid | [
"public function valid() : bool\n {\n if ($this->pointer >= 0 && $this->pointer < count($this->members)) {\n return true;\n }\n return false;\n }"
] | [
"private void init() {\n // defaults for internal bookkeeping\n index = 0; // internal index always starts at 0\n count = 1; // internal count always starts at 1\n status = null; // we clear status on release()\n item = null; // item w... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Computer Science:"
} |
Creates a new {@link TopicProducer}. The producer accepts arbitrary objects and uses the Jackson object mapper to convert them into
JSON and sends them as a text message. | [
"public TopicProducer<Object> createTopicJsonProducer(final String topic)\n {\n Preconditions.checkState(connectionFactory != null, \"connection factory was never injected!\");\n return new TopicProducer<Object>(connectionFactory, jmsConfig, topic, producerCallback);\n }"
] | [
"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 description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Dynamically add an array of setting items
@param string $owner
@param array $definitions | [
"public function addSettingItems($owner, array $definitions)\n {\n foreach ($definitions as $code => $definition) {\n $this->addSettingItem($owner, $code, $definition);\n }\n }"
] | [
"public function updateConfigOptions()\n {\n //search the config menu for our item\n $options = $this->searchMenu($this->name);\n\n //override the config's options\n $this->getConfig()->setOptions($options);\n }"
] | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Update brand group of parameters. | [
"def update_brand(self) -> None:\n \"\"\"\"\"\"\n self.update(path=URL_GET + GROUP.format(group=BRAND))"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
construct a string of space-delimited control keys based on properties of this class.
@param bool $disconnect
@return string | [
"protected function getControlKey($disconnect = false)\n {\n $key = '';\n\n if ($disconnect) {\n return \"*immed\";\n }\n\n /*\n if(?) *justproc\n if(?) *debug\n if(?) *debugproc\n if(?) *nostart\n if(?) *rpt*/\n\n // Idle timeout s... | [
"def _enter(self):\n \"\"\"\"\"\"\n command = self.command\n logger.log(5, \"Snippet keystroke `Enter`.\")\n # NOTE: we need to set back the actions (mode_off) before running\n # the command.\n self.mode_off()\n self.run(command)"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Need to refactor, fukken complicated conditions. | [
"def check_symbol_to_proc\n return unless method_call.block_argument_names.count == 1\n return if method_call.block_body.nil?\n return unless method_call.block_body.sexp_type == :call\n return if method_call.arguments.count > 0\n\n body_method_call = MethodCall.new(method_call.block_body)\n... | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Helper method to lookup a DAO if it has already been associated with the table-config. Otherwise this returns
null. | [
"public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource,\n\t\t\tDatabaseTableConfig<T> tableConfig) {\n\t\tif (connectionSource == null) {\n\t\t\tthrow new IllegalArgumentException(\"connectionSource argument cannot be null\");\n\t\t}\n\t\tTableConfigConnectionSource key =... | [
"public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l... | codesearchnet | {
"query": "Represent the Github instruction about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about Software development:"
} |
// Provided for compatibility with the Transformer interface. Since Caser has no
// special treatment of bytes, the bytes are converted to and from strings.
// Will treat the entirety of src as ONE variable name. | [
"func (c Caser) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {\n\tnSrc = len(src) // Always read all the bytes of src\n\tresult := c.Bytes(src)\n\tif len(result) > len(dst) {\n\t\terr = transform.ErrShortDst\n\t}\n\tnDst = copy(dst, result)\n\treturn\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 comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Creates (or updates) a new ProjectStatus for the given build and
returns it. | [
"def create_or_update(cls, build):\n \n\n test_summary = build.test_summary\n metrics_summary = MetricsSummary(build)\n now = timezone.now()\n test_runs_total = build.test_runs.count()\n test_runs_completed = build.test_runs.filter(completed=True).count()\n test_runs... | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Static pressure.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: static pressure in hPa | [
"def p44(msg):\n \n d = hex2bin(data(msg))\n\n if d[34] == '0':\n return None\n\n p = bin2int(d[35:46]) # hPa\n\n return p"
] | [
"def create_response_pdu(self, data):\n \n log.debug('Create single bit response pdu {0}.'.format(data))\n bytes_ = [data[i:i + 8] for i in range(0, len(data), 8)]\n\n # Reduce each all bits per byte to a number. Byte\n # [0, 0, 0, 0, 0, 1, 1, 1] is intepreted as binary en is deci... | codesearchnet | {
"query": "Represent the summarization about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about Software development:"
} |
Trace TCP flows.
Keyword arguments:
* fout -- str, output path
* format -- str, output format
* byteorder -- str, output file byte order
* nanosecond -- bool, output nanosecond-resolution file flag | [
"def trace(fout=None, format=None, byteorder=sys.byteorder, nanosecond=False):\n \n str_check(fout or '', format or '')\n return TraceFlow(fout=fout, format=format, byteorder=byteorder, nanosecond=nanosecond)"
] | [
"def _writer_factory(name, format, def_fs, descr):\n \n def basic_writer(data, filename, fs = def_fs, enc = format.encoding):\n \"\"\"Common \"template\" to all write functions.\"\"\"\n if np.ndim(data) <= 1:\n nc = 1\n elif np.ndim(data) == 2:\n nc = data.... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about File management:"
} |
Sets the URL to navigate to when the menu item is invoked.
@param url the url to set. | [
"public void setUrl(final String url) {\n\t\tMenuItemModel model = getOrCreateComponentModel();\n\t\tmodel.url = url;\n\t\tmodel.action = null;\n\t}"
] | [
"public void discardHeaderClick(ClickEvent event) {\n if (event == null) return;\n\n // Example: we use radioset on collapsible header, so stopPropagation() is needed\n // to suppress collapsible open/close behavior.\n // But preventDefault() is not needed, otherwise radios won't switch.... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetSecurityGroupArns sets the SecurityGroupArns field's value. | [
"func (s *Ec2Config) SetSecurityGroupArns(v []*string) *Ec2Config {\n\ts.SecurityGroupArns = v\n\treturn s\n}"
] | [
"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 text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Software development:"
} |
Does not perform {@link PrivilegedAction} unless necessary.
@param javaClass
@param fieldName
@return a field from the class
@throws NoSuchMethodException | [
"static Field lookupField(Class<?> javaClass, String fieldName) throws NoSuchFieldException {\n if (System.getSecurityManager() != null) {\n try {\n return AccessController.doPrivileged(new FieldLookupAction(javaClass, fieldName));\n } catch (PrivilegedActionException e) ... | [
"public @CheckForNull PropertyType getPropertyType(@Nonnull Object instance, @Nonnull String field) {\n // in global.jelly, instance==descriptor\n return instance==this ? getGlobalPropertyType(field) : getPropertyType(field);\n }"
] | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
migrate the retry jobs of a queue
@param string $queue
@return array | [
"protected function migrateRetryJobs($queue)\n {\n $luaScript = <<<LUA\n-- Get all of the jobs with an expired \"score\"...\nlocal val = redis.call('zrangebyscore', KEYS[1], '-inf', ARGV[1])\n\n-- If we have values in the array, we will remove them from the first queue\n-- and add them onto the destinatio... | [
"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 summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Dump the payload to JSON | [
"def jsonify_payload(self):\n \n # Assume already json serialized\n if isinstance(self.payload, string_types):\n return self.payload\n return json.dumps(self.payload, cls=StandardJSONEncoder)"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the instruction about Technology:",
"pos": "Represent the code about Technology:",
"neg": "Represent the code:"
} |
Get system backtrace in formated view
@param bool $trace Custom php backtrace
@param bool $addObject Show objects in result
@return JBDump | [
"public static function trace($trace = null, $addObject = false)\r\n {\r\n if (!self::isDebug()) {\r\n return false;\r\n }\r\n\r\n $_this = self::i();\r\n\r\n $trace = $trace ? $trace : debug_backtrace($addObject);\r\n unset($trace[0]);\r\n\r\n $result = $_thi... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Get a short value from the form, and place it in <code>attribute</code>.
@param name attribute name
@param attribute attribute to put value
@since 1.11.1 | [
"@Api\n\tpublic void getValue(String name, ShortAttribute attribute) {\n\t\tattribute.setValue(toShort(formWidget.getValue(name)));\n\t}"
] | [
"protected function setupObject()\n {\n $this->name = $this->getAttribute(\"name\");\n $this->value = $this->getAttribute(\"value\");\n $this->classname = $this->getAttribute(\"class\");\n\n /*\n * Set some default values if they are not specified.\n * This is especially... | codesearchnet | {
"query": "Represent the sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
Submits the {@link org.apache.gobblin.metrics.GobblinTrackingEvent} to the {@link org.apache.gobblin.metrics.MetricContext}.
@param name Name of the event.
@param additionalMetadata Additional metadata to be added to the event. | [
"public void submit(String name, Map<String, String> additionalMetadata) {\n if(this.metricContext.isPresent()) {\n Map<String, String> finalMetadata = Maps.newHashMap(this.metadata);\n if(!additionalMetadata.isEmpty()) {\n finalMetadata.putAll(additionalMetadata);\n }\n\n // Timestamp... | [
"@Override\n public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException {\n // For MP Metrics 1.0, MetricType.from(Class in) does not support lambdas or proxy classes\n return register(name, metric, new Metadata(name, from(metric)));\n }"
] | codesearchnet | {
"query": "Represent the Github instruction about Data management:",
"pos": "Represent the Github code about Data management:",
"neg": "Represent the Github code about programming:"
} |
// FallbackAddr is a functional option that allows callers of NewInvoice to set
// the Invoice's fallback on-chain address that can be used for payment in case
// the Lightning payment fails | [
"func FallbackAddr(fallbackAddr btcutil.Address) func(*Invoice) {\n\treturn func(i *Invoice) {\n\t\ti.FallbackAddr = fallbackAddr\n\t}\n}"
] | [
"func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Get our daemon script path. | [
"def get_manager_cmd(self):\n \"\"\"\"\"\"\n cmd = os.path.abspath(os.path.join(os.path.dirname(__file__), \"server\", \"notebook_daemon.py\"))\n assert os.path.exists(cmd)\n return cmd"
] | [
"def postloop(self):\n \n cmd.Cmd.postloop(self) # Clean up command completion\n d1_cli.impl.util.print_info(\"Exiting...\")"
] | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
// SetMaxHumanLabeledObjectCount sets the MaxHumanLabeledObjectCount field's value. | [
"func (s *LabelingJobStoppingConditions) SetMaxHumanLabeledObjectCount(v int64) *LabelingJobStoppingConditions {\n\ts.MaxHumanLabeledObjectCount = &v\n\treturn s\n}"
] | [
"private Counter<L> logProbabilityOfRVFDatum(RVFDatum<L, F> example) {\r\n // NB: this duplicate method is needed so it calls the scoresOf method\r\n // with an RVFDatum signature!! Don't remove it!\r\n // JLS: type resolution of method parameters is static\r\n Counter<L> scores = scoresOfRVFDatum(exam... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Create a default {@link FeatureInfoWidget} with a {@link ZoomToObjectAction}
to allow zooming to selected features.
@param mapPresenter The map presenter used by the action(s).
@return A feature info widget with actions. | [
"public FeatureInfoWithActions getFeatureInfoWidgetWithActions(MapPresenter mapPresenter) {\n\t\tFeatureInfoWithActions widgetWithActions = new FeatureInfoWithActions();\n\t\twidgetWithActions.addHasFeature(new ZoomToObjectAction(mapPresenter));\n\n\t\treturn widgetWithActions;\n\t}"
] | [
"function WidgetDef(config, endFunc, out) {\n this.type = config.type; // The widget module type name that is passed to the factory\n this.id = config.id; // The unique ID of the widget\n this.config = config.config; // Widget config object (may be null)\n this.state = config.state; // Widget state obje... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// SetError sets the Error field's value. | [
"func (s *TaskFailedEventDetails) SetError(v string) *TaskFailedEventDetails {\n\ts.Error = &v\n\treturn s\n}"
] | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }"
] | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Access the Monitor Twilio Domain
:returns: Monitor Twilio Domain
:rtype: twilio.rest.monitor.Monitor | [
"def monitor(self):\n \n if self._monitor is None:\n from twilio.rest.monitor import Monitor\n self._monitor = Monitor(self)\n return self._monitor"
] | [
"def plan(self):\n \n import ns1.rest.account\n return ns1.rest.account.Plan(self.config)"
] | codesearchnet | {
"query": "Represent the Github comment about Twilio:",
"pos": "Represent the Github code about Twilio:",
"neg": "Represent the Github code:"
} |
// ExecuteRaw receives, parse and executes raw source template contents
// it's super-simple function without options and funcs, it's not used widely
// implements the EngineRawExecutor interface | [
"func (p *Engine) ExecuteRaw(src string, wr io.Writer, binding interface{}) (err error) {\n\tset := pongo2.NewSet(\"\", pongo2.DefaultLoader)\n\tset.Globals = getPongoContext(p.Config.Globals)\n\ttmpl, err := set.FromString(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn tmpl.ExecuteWriter(getPongoContext(bi... | [
"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:"
} |
Returns a parameter value in the specified array, if not in, returns the
first element instead
@param string $name The parameter name
@param array $array The array to be search
@return mixed The parameter value | [
"public function getInArray($name, array $array)\n {\n $value = $this->get($name);\n return in_array($value, $array) ? $value : $array[key($array)];\n }"
] | [
"public function singlePcmlToParam(\\SimpleXmlElement $dataElement)\n {\n $tagName = $dataElement->getName();\n \n // get attributes of this element.\n $attrs = $dataElement->attributes();\n \n // both struct and data have name, count (optional), usage\n $name = (isset($a... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Sets metainfo properties as JCR properties to node. | [
"private void setJCRProperties(NodeImpl parent, Properties props) throws Exception\n {\n if (!parent.isNodeType(\"dc:elementSet\"))\n {\n parent.addMixin(\"dc:elementSet\");\n }\n\n ValueFactory vFactory = parent.getSession().getValueFactory();\n LocationFactory lFactory = parent.... | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the comment about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about programming:"
} |
Get profiles grouped by account and webproperty
TODO Handle "(403) User does not have any Google Analytics account."
@return array | [
"protected function getGroupedProfiles()\n {\n $this->analytics->requireAuthentication();\n\n $groupedProfiles = [];\n $accounts = $this->analytics->management_accounts->listManagementAccounts();\n foreach ($accounts as $account) {\n $groupedProfiles[$account->getId()]['lab... | [
"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 Github summarization about accounts.authinfo:",
"pos": "Represent the Github code about accounts.authinfo:",
"neg": "Represent the Github code about Natural Language Processing:"
} |
// addValueToMap adds the given value to the map on which the method is run.
// This allows us to merge maps such as {foo: {bar: baz}} and {foo: {baz: faz}}
// into {foo: {bar: baz, baz: faz}}. | [
"func addValueToMap(keys []string, value interface{}, target map[string]interface{}) {\n\tnext := target\n\n\tfor i := range keys {\n\t\t// If we are on last key set or overwrite the val.\n\t\tif i == len(keys)-1 {\n\t\t\tnext[keys[i]] = value\n\t\t\tbreak\n\t\t}\n\n\t\tif iface, ok := next[keys[i]]; ok {\n\t\t\tsw... | [
"function(newValues, oldValues, paths) {\n var name, method, called = {};\n for (var i in oldValues) {\n // note: paths is of form [object, path, object, path]\n name = paths[2 * i + 1];\n method = this.observe[name];\n if (method) {\n var ov = oldValues[i], nv = newVa... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
// Run parses arguments from the command line and passes them to RunCommand. | [
"func (s *Service) Run() {\n\tflag.Usage = s.Usage\n\tflag.Parse()\n\targs := flag.Args()\n\tif len(args) == 0 && s.defaultCommand != \"\" {\n\t\targs = append([]string{s.defaultCommand}, args...)\n\t}\n\tif len(args) == 0 {\n\t\ts.Usage()\n\t\tBootPrintln()\n\t\treturn\n\t}\n\terr := s.RunCommand(args[0], args[1:]... | [
"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 programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
store one item in database | [
"def _put_one(self, item):\n ''' \n '''\n # prepare values\n values = []\n for k, v in item.items():\n if k == '_id':\n continue\n if 'dblite_serializer' in item.fields[k]:\n serializer = item.fields[k]['dblite_serializer']\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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Computes the theta & phi angles of the vector.
@memberof Vec3#
@returns {object} ret
@returns {Number} ret.theta - angle from the xz plane
@returns {Number} ret.phi - angle from the y axis | [
"function() {\n return {\n theta: Math.atan2(this.z, this.x),\n phi: Math.asin(this.y / this.length())\n };\n }"
] | [
"def alignment_matrix_3D(u, v):\n '''\n \n '''\n # normalize both vectors:\n u = normalize(u)\n v = normalize(v)\n # get the cross product of u cross v\n w = np.cross(u, v)\n # the angle we need to rotate\n th = vector_angle(u, v)\n # we rotate around this vector by the angle betwee... | codesearchnet | {
"query": "Represent the Github description about mathematics:",
"pos": "Represent the Github code about mathematics:",
"neg": "Represent the Github code:"
} |
CArray with evenly spaced numbers over a specified interval.
@param $start The starting value of the sequence.
@param $stop The end value of the sequence
@param int $num Number of samples to generate. Default is 50.
@return \CArray | [
"public static function linspace($start, $stop, int $num): \\CArray\n {\n return parent::linspace($start, $stop, $num);\n }"
] | [
"static int getRandomValueFromInterval(\n double randomizationFactor, double random, int currentIntervalMillis) {\n double delta = randomizationFactor * currentIntervalMillis;\n double minInterval = currentIntervalMillis - delta;\n double maxInterval = currentIntervalMillis + delta;\... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// Digests hashes each segment of each key fragment 26 times and returns them.
// Optionally takes the SpongeFunction to use. Default is Kerl. | [
"func Digests(key Trits, spongeFunc ...SpongeFunction) (Trits, error) {\n\tvar err error\n\tfragments := int(math.Floor(float64(len(key)) / KeyFragmentLength))\n\tdigests := make(Trits, fragments*HashTrinarySize)\n\tbuf := make(Trits, HashTrinarySize)\n\n\th := GetSpongeFunc(spongeFunc, kerl.NewKerl)\n\tdefer h.Res... | [
"@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 programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Loading hparams from json; can also start from hparams if specified. | [
"def create_hparams_from_json(json_path, hparams=None):\n \"\"\"\"\"\"\n tf.logging.info(\"Loading hparams from existing json %s\" % json_path)\n with tf.gfile.Open(json_path, \"r\") as f:\n hparams_values = json.load(f)\n # Prevent certain keys from overwriting the passed-in hparams.\n # TODO(trandusti... | [
"def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Technology:"
} |
Sort an collection by values using a user-defined comparison function
@param \Closure $callback
@param bool $save_keys maintain index association
@return static | [
"public function sortBy( \\Closure $callback, bool $save_keys = true )\n\t{\n\t\t$items = $this->items;\n\t\t$save_keys ? uasort($items, $callback) : usort($items, $callback);\n\t\treturn new static($items);\n\t}"
] | [
"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 Github post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Attempts to upload the Docker image for a given tool to
`DockerHub <https://hub.docker.com>`_. | [
"def upload(self, tool: Tool) -> bool:\n \n return self.__installation.build.upload(tool.image)"
] | [
"def create_logstash(self, **kwargs):\n \n logstash = predix.admin.logstash.Logging(**kwargs)\n logstash.create()\n logstash.add_to_manifest(self)\n\n logging.info('Install Kibana-Me-Logs application by following GitHub instructions')\n logging.info('git clone https://githu... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
SET CHECK
@param string $name
@param string $arg
@return $this | [
"public function checks($name, $arg = null) {\n if (empty($arg)) {\n $this->checks[] = $name;\n } else {\n $this->checks[$name] = $arg;\n }\n return $this;\n }"
] | [
"final static function f($op) {return dfcf(function(OP $op) {\n\t\t$c = df_con_hier($m = df_ar(dfpm($op), M::class), __CLASS__); /** @var string $c */ /** @var M $m */\n\t\treturn new $c($m);\n\t}, [dfp($op)]);}"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
From a list of top level trees, return the list of contained class definitions | [
"List<JCClassDecl> listClasses(List<JCCompilationUnit> trees) {\n List<JCClassDecl> result = new ArrayList<>();\n for (JCCompilationUnit t : trees) {\n for (JCTree def : t.defs) {\n if (def.hasTag(JCTree.Tag.CLASSDEF))\n result.add((JCClassDecl)def);\n ... | [
"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 post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
-------------------------------------------------------------------------------------------- | [
"@Override\n\tpublic void configure(Configuration parameters) {\n\n\t\t// enforce sequential configuration() calls\n\t\tsynchronized (CONFIGURE_MUTEX) {\n\t\t\tif (mapreduceInputFormat instanceof Configurable) {\n\t\t\t\t((Configurable) mapreduceInputFormat).setConf(configuration);\n\t\t\t}\n\t\t}\n\t}"
] | [
"public static function run($speech = null)\n\t{\n\t\tif ( ! isset($speech))\n\t\t{\n\t\t\t$speech = 'KILL ALL HUMANS!';\n\t\t}\n\n\t\t$eye = \\Cli::color(\"*\", 'red');\n\n\t\treturn \\Cli::color(\"\n\t\t\t\t\t\\\"{$speech}\\\"\n\t\t\t _____ /\n\t\t\t /_____\\\\\", 'blue').\"\\n\"\n.\\Cli::col... | codesearchnet | {
"query": "Represent the instruction about language and writing:",
"pos": "Represent the code about language and writing:",
"neg": "Represent the code about programming:"
} |
Parses the requested parameter from the given state.<p>
@param state the state
@param paramName the parameter name
@return the parameter value | [
"public static String getParamFromState(String state, String paramName) {\n\n String prefix = PARAM_SEPARATOR + paramName + PARAM_ASSIGN;\n if (state.contains(prefix)) {\n String result = state.substring(state.indexOf(prefix) + prefix.length());\n if (result.contains(PARAM_SEPARA... | [
"@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }"
] | codesearchnet | {
"query": "Represent the text about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about Software development:"
} |
// intIf returns a if cnd is true, otherwise b | [
"func intIf(cnd bool, a, b int) int {\n\tif cnd {\n\t\treturn a\n\t}\n\treturn b\n}"
] | [
"def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Natural Language Processing:"
} |
Create a writer builder for Ebi41InvoiceType.
@return The builder and never <code>null</code> | [
"@Nonnull\n public static EbInterfaceWriter <Ebi41InvoiceType> ebInterface41 ()\n {\n final EbInterfaceWriter <Ebi41InvoiceType> ret = EbInterfaceWriter.create (Ebi41InvoiceType.class);\n ret.setNamespaceContext (EbInterface41NamespaceContext.getInstance ());\n return ret;\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 summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetKey sets the Key field's value. | [
"func (s *GetObjectLegalHoldInput) SetKey(v string) *GetObjectLegalHoldInput {\n\ts.Key = &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 instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
// Range check string's length | [
"func Range(str string, params ...string) bool {\n\tif len(params) == 2 {\n\t\tvalue, _ := ToFloat(str)\n\t\tmin, _ := ToFloat(params[0])\n\t\tmax, _ := ToFloat(params[1])\n\t\treturn InRange(value, min, max)\n\t}\n\n\treturn false\n}"
] | [
"private static String keyToGoWithElementsString(String label, DuplicateGroupedAndTyped elements) {\n /*\n * elements.toString(), which the caller is going to use, includes the homogeneous type (if\n * any), so we don't want to include it here. (And it's better to have it in the value, rather\n * tha... | codesearchnet | {
"query": "Represent the description about 32-bit integers:",
"pos": "Represent the code about 32-bit integers:",
"neg": "Represent the code about programming:"
} |
Add command arguments | [
"def add_arguments(self, parser):\n \"\"\"\"\"\"\n parser.add_argument(self._source_param, **self._source_kwargs)\n parser.add_argument('--base', '-b', action='store',\n help= 'Supply the base currency as code or a settings variable name. '\n 'The default is take... | [
"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 text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Grab values from the $_SERVER global.
@param mixed $index The index that we will be searching for.
@param boolean $xss_clean Whether we want to clean it or not.
@since 1.0.0
@return mixed | [
"public function server(string $index = '', $xss_clean = false)\n {\n return $this->fetchFromArray($_SERVER, $index, $xss_clean);\n }"
] | [
"private function filter($variable, $filter, $options = null)\n {\n\n //gets a specific external variable and filter it\n //determine what variable name is being used here;\n $this->sanitized = true;\n\n //@TODO To trust or not to trust?\n return filter_var($variable, $filter, ... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Get a server by calling {@link AbstractServerPredicate#chooseRandomlyAfterFiltering(java.util.List, Object)}.
The performance for this method is O(n) where n is number of servers to be filtered. | [
"@Override\n public Server choose(Object key) {\n ILoadBalancer lb = getLoadBalancer();\n Optional<Server> server = getPredicate().chooseRoundRobinAfterFiltering(lb.getAllServers(), key);\n if (server.isPresent()) {\n return server.get();\n } else {\n return null... | [
"@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 text about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about Programming:"
} |
Validate that an attribute is greater than another attribute.
@param string $attribute
@param mixed $value
@param array $parameters
@return bool | [
"public function validateGt($attribute, $value, $parameters)\n {\n $this->requireParameterCount(1, $parameters, 'gt');\n\n $comparedToValue = $this->getValue($parameters[0]);\n\n $this->shouldBeNumeric($attribute, 'Gt');\n\n if (is_null($comparedToValue) && (is_numeric($value) && is_n... | [
"protected function setupObject()\n {\n $this->name = $this->getAttribute(\"name\");\n $this->value = $this->getAttribute(\"value\");\n $this->classname = $this->getAttribute(\"class\");\n\n /*\n * Set some default values if they are not specified.\n * This is especially... | codesearchnet | {
"query": "Represent the instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
// SetErrorCode returns source code that sets return parameters. | [
"func (r *Rets) SetErrorCode() string {\n\tconst code = `if r0 != 0 {\n\t\t%s = %sErrno(r0)\n\t}`\n\tif r.Name == \"\" && !r.ReturnsError {\n\t\treturn \"\"\n\t}\n\tif r.Name == \"\" {\n\t\treturn r.useLongHandleErrorCode(\"r1\")\n\t}\n\tif r.Type == \"error\" {\n\t\treturn fmt.Sprintf(code, r.Name, syscalldot())\n... | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }"
] | codesearchnet | {
"query": "Represent the instruction about Natural Language Processing:",
"pos": "Represent the code about Natural Language Processing:",
"neg": "Represent the code about programming:"
} |
// StartPlugins starts all plugins in the correct order. | [
"func (co *Coordinator) StartPlugins() {\n\t// Launch routers\n\tfor _, router := range co.routers {\n\t\tlogrus.Debug(\"Starting \", reflect.TypeOf(router))\n\t\tif err := router.Start(); err != nil {\n\t\t\tlogrus.WithError(err).Errorf(\"Failed to start router of type '%s'\", reflect.TypeOf(router))\n\t\t}\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 post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Get a consumer for a connection. | [
"def consumer(self, conn):\n \"\"\"\"\"\"\n return Consumer(\n connection=conn,\n queue=self.queue.name,\n exchange=self.exchange.name,\n exchange_type=self.exchange.type,\n durable=self.exchange.durable,\n auto_delete=self.exchange.aut... | [
"@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
Returns the generator reactive power variable set. | [
"def _get_qgen_var(self, generators, base_mva):\n \n Qg = array([g.q / base_mva for g in generators])\n\n Qmin = array([g.q_min / base_mva for g in generators])\n Qmax = array([g.q_max / base_mva for g in generators])\n\n return Variable(\"Qg\", len(generators), Qg, Qmin, Qmax)"
] | [
"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:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Associations labels getter.
@param \Cake\Datasource\RepositoryInterface $table Table instance
@return mixed[] | [
"public function getAssociationLabels(RepositoryInterface $table) : array\n {\n /** @var \\Cake\\ORM\\Table */\n $table = $table;\n\n $result = [];\n foreach ($table->associations() as $association) {\n if (!in_array($association->type(), $this->searchableAssociations)) {\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 text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Return matched comments
@param int $page
@return array | [
"public function get_comments($page = '') {\n global $DB, $CFG, $USER, $OUTPUT;\n if (!$this->can_view()) {\n return false;\n }\n if (!is_numeric($page)) {\n $page = 0;\n }\n $params = array();\n $perpage = (!empty($CFG->commentsperpage))?$CFG->... | [
"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 summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// WeekdayWide returns the locales wide weekday given the 'weekday' provided | [
"func (ne *ne_IN) WeekdayWide(weekday time.Weekday) string {\n\treturn ne.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:"
} |
/*!
Returns the objects which have at least one keyword in common
\return an array of eZContentObjectTreeNode instances, or null if the attribute is not stored yet | [
"function relatedObjects()\n {\n $return = false;\n if ( $this->ObjectAttributeID )\n {\n $return = array();\n\n // Fetch words\n $db = eZDB::instance();\n\n $wordArray = $db->arrayQuery( \"SELECT * FROM ezkeyword_attribute_link\n ... | [
"def reset ():\n \n global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache\n\n __register_features ()\n\n # Stores suffixes for generated targets.\n __prefixes_suffixes = [property.PropertyMap(), property.PropertyMap()]\n\n # Maps suffixes to types... | codesearchnet | {
"query": "Represent the Github comment about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
Extract read and write part values to an object for SCALAR, SPECTRUM and IMAGE
@param da
@return array of primitives for SCALAR, array of primitives for SPECTRUM, array of primitives array of primitives
for IMAGE
@throws DevFailed | [
"public static Object extract(final DeviceAttribute da) throws DevFailed {\n\tif (da == null) {\n\t\tthrow DevFailedUtils.newDevFailed(ERROR_MSG_DA);\n\t}\n\treturn InsertExtractFactory.getAttributeExtractor(da.getType()).extract(da);\n }"
] | [
"def fileParameter(self, comp):\n \n for row in range(self.nrows()):\n p = self._parameters[row]\n if p['parameter'] == 'filename':\n # ASSUMES COMPONENT IN ONE SELECTION\n if comp in p['selection']:\n return row"
] | codesearchnet | {
"query": "Represent the Github post about Data parsing:",
"pos": "Represent the Github code about Data parsing:",
"neg": "Represent the Github code about Software development:"
} |
Add values for PromotionIds, return this.
@param promotionIds
New values to add.
@return This instance. | [
"public OrderItem withPromotionIds(String... values) {\r\n List<String> list = getPromotionIds();\r\n for (String value : values) {\r\n list.add(value);\r\n }\r\n return this;\r\n }"
] | [
"@Operation(name=\"$find-matches\", idempotent=true)\n public Parameters findMatchesAdvanced(\n @OperationParam(name=\"dateRange\") DateRangeParam theDate,\n @OperationParam(name=\"name\") List<StringParam> theName,\n @OperationParam(name=\"code\") TokenAndListParam theEnd) {\n \n Paramet... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Parses the element and subelements and parses any HTML enabled text to
its original HTML form for rendering.
:returns: Parsed HTML enabled text content.
:rtype: str | [
"def get_html_content(self):\n \n\n # Extract full element node content (including subelements)\n html_content = ''\n if hasattr(self, 'xml_element'):\n xml = self.xml_element\n content_list = [\"\" if xml.text is None else xml.text]\n\n def to_string(xml... | [
"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 comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Get the list of files changed with the type of change for a given revision.
Results are returned as a structured array.
@param String $rev A valid changeset for this repo
@return array List of file changes | [
"public function getChangedFiles($rev)\n {\n $raw_changes = $this->execute('hg status --change ' . $rev);\n $this->repository_type = 'hg';\n\n $changes = [];\n foreach ($raw_changes as $key => $change) {\n $exploded_change = explode(' ', $change);\n $changes[$key... | [
"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 about Documentation:",
"pos": "Represent the code about Documentation:",
"neg": "Represent the code:"
} |
Returns the loaded behaviors and loads them if not done before
@return array behaviors | [
"public function getBehaviors()\n {\n if (null === $this->behaviors) {\n // find behaviors in composer.lock file\n $lock = $this->findComposerLock();\n\n if (null === $lock) {\n $this->behaviors = [];\n } else {\n $this->behaviors =... | [
"function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co... | codesearchnet | {
"query": "Represent the Github text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
APIMethod: getCentroid
Returns:
{<OpenLayers.Geometry.Point>} The centroid of the collection | [
"function() {\n if (this.components) {\n var len = this.components.length;\n if (len > 0 && len <= 2) {\n return this.components[0].clone();\n } else if (len > 2) {\n var sumX = 0.0;\n var sumY = 0.0;\n var x0 = this... | [
"def node_contained_in_layer_area_validation(self):\n \n # if area is a polygon ensure it contains the node\n if self.layer and isinstance(self.layer.area, Polygon) and not self.layer.area.contains(self.geometry):\n raise ValidationError(_('Node must be inside layer area'))"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Returns bearing from (lat1, lon1) to (lat2, lon2) in degrees
@param lat1
@param lon1
@param lat2
@param lon2
@return | [
"public static final double bearing(double lat1, double lon1, double lat2, double lon2)\r\n {\r\n return Math.toDegrees(radBearing(lat1, lon1, lat2, lon2));\r\n }"
] | [
"def layer_depth( lat, lon, layerID=\"LID-BOTTOM\"):\n \n\n ## Must wrap longitude from 0 to 360 ...\n\n lon1 = np.array(lon)%360.0\n lat1 = np.array(lat)\n\n # ## Must wrap longitude from -180 to 180 ...\n #\n # lon1[np.where(lon1 > 180.0)] = 360.0 - lon1[np.where(lon1 > 180.0)]\n #\n da... | codesearchnet | {
"query": "Represent the post about mathematics:",
"pos": "Represent the code about mathematics:",
"neg": "Represent the code about programming:"
} |
Return the flow rate with only minor losses.
This function applies to both laminar and turbulent flows. | [
"def flow_pipeminor(Diam, HeadLossExpans, KMinor):\n \n #Checking input validity - inputs not checked here are checked by\n #functions this function calls.\n ut.check_range([HeadLossExpans, \">=0\", \"Headloss due to expansion\"],\n [KMinor, \">0\", \"K minor\"])\n return (area_circ... | [
"def get_target_volume(self, etheta=0.0, scaled=False):\n \n # TODO: make this a function of d instead of etheta?\n logger.debug(\"determining target volume at t={}, theta={}\".format(self.time, etheta))\n\n # TODO: eventually this could allow us to \"break\" volume conservation\n ... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about mathematics:"
} |
Parse a run of ordinary characters, or a single character with a special meaning in markdown, as a plain string, adding to inlines. | [
"function(inlines) {\n var m;\n if ((m = this.match(reMain))) {\n inlines.push({ t: 'Str', c: m });\n return m.length;\n } else {\n return 0;\n }\n}"
] | [
"private static String keyToGoWithElementsString(String label, DuplicateGroupedAndTyped elements) {\n /*\n * elements.toString(), which the caller is going to use, includes the homogeneous type (if\n * any), so we don't want to include it here. (And it's better to have it in the value, rather\n * tha... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Assigns value to all unfilled feature variables.
@param value
@return | [
"public SyntacticCategory assignAllFeatures(String value) {\n Set<Integer> featureVars = Sets.newHashSet();\n getAllFeatureVariables(featureVars);\n\n Map<Integer, String> valueMap = Maps.newHashMap();\n for (Integer var : featureVars) {\n valueMap.put(var, value);\n }\n return assignFeatures... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Return true if gate tensor is (almost) unitary | [
"def almost_unitary(gate: Gate) -> bool:\n \"\"\"\"\"\"\n res = (gate @ gate.H).asoperator()\n N = gate.qubit_nb\n return np.allclose(asarray(res), np.eye(2**N), atol=TOLERANCE)"
] | [
"def gaussian_window(t, params):\n \n window = suspect.basis.gaussian(t, 0, 0, params[\"line_broadening\"])\n\n # the above gaussian function returns an area 1 fid, for a windowing\n # function we need to be area preserving (first point must be 1)\n return window / window[0]"
] | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Adds limit and offset to SQL statement.
@param int $limit
@param int $offset
@return void | [
"public function addLimitOffset(int $limit, int $offset): void\n {\n if ($limit === 0 && $offset === 0) {\n return;\n }\n if ($limit === 0 && $offset <> 0) {\n return;\n }\n if ($offset === 0) {\n $this->statement .= ' LIMIT ' . $limit;\n ... | [
"@Override\n\tpublic void showHelp(final Terminal terminal) {\n\t\tterminal.writer().println(\"\\t\" + this.toString() + \": generate sql to access the table.\");\n\t\tterminal.writer().println(\n\t\t\t\t\"\\t\\tex) generate [select/insert/update/delete] [table name]<Enter> : Show sql to access tables according to ... | codesearchnet | {
"query": "Represent the sentence about Data retrieval:",
"pos": "Represent the code about Data retrieval:",
"neg": "Represent the code:"
} |
Finds actions, angles and frequencies for box orbit.
Takes a series of phase-space points from an orbit integration at times t and returns
L = (act,ang,n_vec,toy_aa, pars) -- explained in find_actions() below. | [
"def box_actions(results, times, N_matrix, ifprint):\n \n if(ifprint):\n print(\"\\n=====\\nUsing triaxial harmonic toy potential\")\n\n t = time.time()\n # Find best toy parameters\n omega = toy.findbestparams_ho(results)\n if(ifprint):\n print(\"Best omega \"+str(omega)+\" found in... | [
"def obfn_g1var(self):\n \n \"\"\"\n\n # Use of self.block_sep1(self.AXnr) instead of self.cnst_A1(self.X)\n # reduces number of calls to self.cnst_A0\n return self.var_y1() if self.opt['gEvalY'] else \\\n self.block_sep1(self.AXnr)"
] | codesearchnet | {
"query": "Represent the summarization about mathematics:",
"pos": "Represent the code about mathematics:",
"neg": "Represent the code:"
} |
将map的属性映射到bean对象
@param target
@param properties
@throws BeanMappingException | [
"public void populate(Object target, Map properties) throws BeanMappingException {\n BeanMappingParam param = new BeanMappingParam();\n param.setSrcRef(properties);\n param.setTargetRef(target);\n param.setConfig(this.populateConfig);\n param.setProcesses(BeanMappingEnvironment.ge... | [
"public static XmlTypeConvert resolve(BeanUtils.CustomPropertyDescriptor filed) {\n XmlTypeConvert convert;\n if (filed.isGeneralType() || filed.isBasic()) {\n convert = XmlTypeConverterUtil.converters.get(filed.getTypeName());\n } else if (String.class.equals(filed.getRealType())) {... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// getOrCreateAutopilotConfig is used to get the autopilot config, initializing it if necessary | [
"func (s *Server) getOrCreateAutopilotConfig() *autopilot.Config {\n\tstate := s.fsm.State()\n\t_, config, err := state.AutopilotConfig()\n\tif err != nil {\n\t\ts.logger.Printf(\"[ERR] autopilot: failed to get config: %v\", err)\n\t\treturn nil\n\t}\n\tif config != nil {\n\t\treturn config\n\t}\n\n\tif !ServersMee... | [
"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 description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Set whether or not to display the bank
@param bool $displayBank True if yes, false if no
@return $this The current instance for a fluent interface. | [
"public function setDisplayBank($displayBank = true)\n {\n $this->isBool($displayBank, 'displayBank');\n $this->displayBank = $displayBank;\n\n return $this;\n }"
] | [
"public function fields( $name )\n {\n if( $this->fields instanceof FieldCollection ) {\n $this->fields->field($name); //Sets active field\n }\n return $this->fields; // Is a direct access to the property\n }"
] | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
// fullCompactionStrategy returns a compactionStrategy for higher level generations of TSM files.
// It returns nil if there are no TSM files to compact. | [
"func (e *Engine) fullCompactionStrategy(group CompactionGroup, optimize bool) *compactionStrategy {\n\ts := &compactionStrategy{\n\t\tgroup: group,\n\t\tlogger: e.logger.With(zap.String(\"tsm1_strategy\", \"full\"), zap.Bool(\"tsm1_optimize\", optimize)),\n\t\tfileStore: e.FileStore,\n\t\tcompactor: e.Compa... | [
"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 post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Render the modal template
@since 1.0.0
@see \uix\ui\uix
@access public
@return string HTML of modals templates | [
"public function modal_template() {\n\n\t\t$output = '<script type=\"text/html\" id=\"' . esc_attr( $this->id() ) . '-components\">';\n\t\tforeach ( $this->modals as $modal ) {\n\n\t\t\t$label = $modal->struct['label'];\n\t\t\t$data = $modal->get_data();\n\t\t\t$data_template = $this->drill_in( $da... | [
"protected function configureFormer()\n {\n // Use Bootstrap 3\n Config::set('former.framework', 'TwitterBootstrap3');\n\n // Reduce the horizontal form's label width\n Config::set('former.TwitterBootstrap3.labelWidths', []);\n\n // Change Former's required field HTML\n ... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Convert the input URI into a correctly formatted uri prefix. In the future, may also resolve d2 uris. | [
"public static String resolveUriPrefix(URI serverURI)\n throws URISyntaxException {\n if (RESTLI_SCHEMES.contains(serverURI.getScheme())) {\n return new URI(serverURI.getScheme(), serverURI.getAuthority(), null, null, null).toString() + \"/\";\n }\n\n throw new RuntimeException(\"Unrecognized sch... | [
"def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about Technology:"
} |
Writes the given {@link Object} to the {@link JsonWriter}.
@throws IOException | [
"private static void writeValue(Object value, JsonWriter writer) throws IOException {\n if (value == null) {\n writer.nullValue();\n } else if (value instanceof Number) {\n writer.value((Number) value);\n } else if (value instanceof Boolean) {\n writer.value((Boolean) value);\n } else if ... | [
"@Help(help = \"Find the object of type {#} through the id\")\n public T findById(final String id) throws SDKException {\n return (T) requestGet(id, clazz);\n }"
] | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Creates a procedure.
@param string $name Procedure name
@return $this | [
"public function createProcedure($name)\n {\n $definition = array(\n 'parent' => $this->context,\n 'name' => $name,\n 'sources' => array(),\n 'workers' => array(),\n 'targets' => array(),\n 'children' => array(),\n );\n\n $thi... | [
"final static function f($op) {return dfcf(function(OP $op) {\n\t\t$c = df_con_hier($m = df_ar(dfpm($op), M::class), __CLASS__); /** @var string $c */ /** @var M $m */\n\t\treturn new $c($m);\n\t}, [dfp($op)]);}"
] | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Converts a value from one unit to another.
@param int $to unit to convert to
@param mixed $val value to convert
@return float converted value | [
"protected function convert($to, $val)\n {\n $val = $this->parseValue($val);\n\n return base_convert($val, $this->unit, $to);\n }"
] | [
"function parseFormulaData (nulls, operation, result) {\n /**\n * @description\n * Object containing formula data\n *\n * @typedef {object} carto.dataview.FormulaData\n * @property {number} nulls - Number of null values in the column\n * @property {string} operation - Operation used\n * @property {nu... | codesearchnet | {
"query": "Represent the summarization about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
// SetMaxResults sets the MaxResults field's value. | [
"func (s *ListAlgorithmsInput) SetMaxResults(v int64) *ListAlgorithmsInput {\n\ts.MaxResults = &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 sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
The typed collection type. Contains only elements of the
supplied class.
@see ITypedCollection
@param IType $elementType
@param string $collectionClass
@return CollectionType | [
"public static function collectionOf(IType $elementType, string $collectionClass = ITypedCollection::class) : CollectionType\n {\n $elementTypeString = $elementType->asTypeString();\n\n if (!isset(self::$collections[$collectionClass][$elementTypeString])) {\n self::$collections[$collecti... | [
"public @CheckForNull PropertyType getPropertyType(@Nonnull Object instance, @Nonnull String field) {\n // in global.jelly, instance==descriptor\n return instance==this ? getGlobalPropertyType(field) : getPropertyType(field);\n }"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
-------------------------------------------------------------------------- TODO: move the code below to the core (?) | [
"function computeGameStateOfTaskEnvironment(taskEnvironment) {\n const { pastActions, currentAction } = taskEnvironment;\n const initialState = getInitialGameState(taskEnvironment);\n let currentState = doActionMoves(initialState, pastActions);\n if (currentAction !== null) {\n currentState = doAction(curren... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the comment about writing:",
"pos": "Represent the code about writing:",
"neg": "Represent the code:"
} |
The :meth:`sqlalchemy.crud.updating.upsert_all` function in ORM syntax.
:param engine: an engine created by``sqlalchemy.create_engine``.
:param obj_or_data: single object or list of object | [
"def upsert_all(cls, engine, obj_or_data):\n \n cls.update_all(\n engine=engine,\n obj_or_data=obj_or_data,\n upsert=True,\n )"
] | [
"def get_orm_columns(cls: Type) -> List[Column]:\n \n mapper = inspect(cls) # type: Mapper\n # ... returns InstanceState if called with an ORM object\n # http://docs.sqlalchemy.org/en/latest/orm/session_state_management.html#session-object-states # noqa\n # ... returns Mapper if called with an ... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetBody sets the Body field's value. | [
"func (s *ADMMessage) SetBody(v string) *ADMMessage {\n\ts.Body = &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 post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Cleas the cache of a specific post id
@param integer $postId Post id to clear
@return boolean | [
"public static function clearCache($postId, $post)\n {\n if (wp_is_post_revision($postId) || get_post_status($postId) != 'publish') {\n return false;\n }\n\n wp_cache_delete($postId, self::getKeyGroup());\n wp_cache_delete($post->post_type, self::getKeyGroup());\n\n ... | [
"def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\""
] | codesearchnet | {
"query": "Represent the description about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code about programming:"
} |
Synchronizes the values for the given element path.<p>
@param cms the cms context
@param elementPath the element path
@param skipPaths the paths to skip
@param sourceLocale the source locale | [
"private void synchronizeElement(\n CmsObject cms,\n String elementPath,\n Collection<String> skipPaths,\n Locale sourceLocale) {\n\n if (elementPath.contains(\"/\")) {\n String parentPath = CmsXmlUtils.removeLastXpathElement(elementPath);\n List<I_CmsXmlCont... | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n beginDefaultContext = fields.get(BEGIN_DEFAULT, true);\n\n // Note that further processing is required in JEEMetadataContextProviderImpl.deserializeThreadCo... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// UnmarshalTOML implements toml.UnmarshalerRec. | [
"func (l *Netlist) UnmarshalTOML(fn func(interface{}) error) error {\n\tvar masks []string\n\tif err := fn(&masks); err != nil {\n\t\treturn err\n\t}\n\tfor _, mask := range masks {\n\t\t_, n, err := net.ParseCIDR(mask)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*l = append(*l, *n)\n\t}\n\treturn nil\n}"
] | [
"func (extension EncoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder {\n\treturn decoder\n}"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
See the {@link debug} property for more information.
@access private
@return void | [
"private function _write_log($daily = false, $hourly = false, $backtrace = false) {\n\n // if we are using a callback function to handle logs\n if (is_callable($this->log_path) && !isset($this->log_path_is_function))\n\n // set flag\n $this->log_path_is_function = true;\n\n ... | [
"@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }"
] | codesearchnet | {
"query": "Represent the text about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code:"
} |
Attempts to extract a name of a missing class loader dependency from an exception such as {@link NoClassDefFoundError} or {@link ClassNotFoundException}. | [
"public static String getNameOfMissingClassLoaderDependency(Throwable e) {\n if (e instanceof NoClassDefFoundError) {\n // NoClassDefFoundError sometimes includes CNFE as the cause. Since CNFE has a better formatted class name\n // and may also include classloader info, we prefer CNFE's... | [
"private static Class<?>[] getCallStackViaSecurityManager(final LogNode log) {\n try {\n return new CallerResolver().getClassContext();\n } catch (final SecurityException e) {\n // Creating a SecurityManager can fail if the current SecurityManager does not allow\n // R... | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Serialize to a non-circular Javascript object | [
"function(obj) {\n if (obj instanceof Cell) {\n return {\n inside: obj.inside\n };\n } else {\n return {\n back : serialize(obj.back),\n front : serialize(obj.front),\n plane: obj.plane,\n shp: obj.shp,\n complemented: obj.complemented,\n };\n }... | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Get option for output (cloned option and inner info removed)
@public
@return {Object} | [
"function () {\n var option = clone(this.option);\n\n each(option, function (opts, mainType) {\n if (ComponentModel.hasClass(mainType)) {\n var opts = modelUtil.normalizeToArray(opts);\n for (var i = opts.length - 1; i >= 0; i--) {\n // Remov... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// CreateNonce generates a nonce using the common/crypto package. | [
"func CreateNonce() ([]byte, error) {\n\tnonce, err := crypto.GetRandomNonce()\n\treturn nonce, errors.WithMessage(err, \"error generating random nonce\")\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 post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.