query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
Disable the crash reporter. No reports will be sent or saved. | [
"def disable(self):\n \n if CrashReporter.active:\n CrashReporter.active = False\n # Restore the original excepthook\n sys.excepthook = self._excepthook\n self.stop_watcher()\n self.logger.info('CrashReporter: Disabled')"
] | [
"function startDeamon () {\n // ps aux | grep yourscript\n // kill -s SIGINT [process_id]\n process.stdin.resume()\n process.on('SIGINT', function (err) {\n // An easy way to send the SIGINT signal is with Control-C in most terminal programs.\n // Note:\n // SIGUSR1 is reserved by node.js to start th... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Creates a SQLConsumerException object.
@param errorId
reference to the error identifier
@param e
inner exception
@return SQLConsumerException | [
"public static SQLConsumerException createSQLConsumerException(\n\t\t\tfinal ErrorKeys errorId, final Exception e)\n\t{\n\n\t\treturn new SQLConsumerException(errorId.toString(), e);\n\t}"
] | [
"public void setLog(String log) throws ApplicationException {\n\tif (StringUtil.isEmpty(log, true)) return;\n\tthis.log = log.trim();\n\t// throw new ApplicationException(\"invalid value for attribute log [\"+log+\"]\",\"valid values are\n\t// [application, scheduler,console]\");\n }"
] | codesearchnet | {
"query": "Represent the Github post about API documentation:",
"pos": "Represent the Github code about API documentation:",
"neg": "Represent the Github code about Software development:"
} |
To record the bytes we've skipped, convert the call to read. | [
"@Override\n public long skip(long n) throws IOException {\n byte[] buf = new byte[(int)Math.min(n,64*1024)];\n return read(buf,0,buf.length);\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 text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Bean setter for {@link #address}. | [
"public void setAddress(final String address) {\n\t\tif (this.address == null && address != null && address.contains(\"@\")) {\n\t\t\tthis.address = address;\n\t\t}\n\t}"
] | [
"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 Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about File management:"
} |
Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.
:param options: the options to fix
:type options: dict
:return: the (potentially) fixed options
:rtype: dict | [
"def fix_config(self, options):\n \n opt = \"db_url\"\n if opt not in options:\n options[opt] = \"jdbc:mysql://somehost:3306/somedatabase\"\n if opt not in self.help:\n self.help[opt] = \"The JDBC database URL to connect to (str).\"\n\n opt = \"user\"\n ... | [
"def arg_to_array(func):\n \n def fn(self, arg, *args, **kwargs):\n \"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tuple\n Arguments.\n **kwargs : dict\n Keyword arguments.\n\n Ret... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Parse an opera bookmark file. | [
"def parse_opera (url_data):\n \"\"\"\"\"\"\n from ..bookmarks.opera import parse_bookmark_data\n for url, name, lineno in parse_bookmark_data(url_data.get_content()):\n url_data.add_url(url, line=lineno, name=name)"
] | [
"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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// init initializes global logger, which logs debug level messages to stdout. | [
"func init() {\n\tLog.Out = os.Stdout\n\tif Debug {\n\t\tLog.Level = logger.DebugLevel\n\t}\n}"
] | [
"func (logger *Logger) Log(level Level, v ...interface{}) {\n\t// Don't delete this calling. The calling is used to keep the same\n\t// calldepth for all the logging functions. The calldepth is used to\n\t// get runtime information such as line number, function name, etc.\n\tlogger.log(level, v...)\n}"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Computer Science:"
} |
Generate foreign keys migrations.
@param array $output
@param string $tableName
@param array $new New schema
@param array $old Old schema
@return array Output | [
"protected function getForeignKeysMigrations(array $output, string $tableName, array $new = [], array $old = []): array\n {\n if (empty($new['tables'][$tableName])) {\n return [];\n }\n\n $newTable = $new['tables'][$tableName];\n\n $oldTable = !empty($old['tables'][$tableNa... | [
"public function initialize(array $config) {\n // configuration set?\n $this->check();\n\n // load the file type & schema\n Type::map('unimatrix.file', FileType::class);\n $schema = $this->_table->getSchema();\n\n // go through each field and change the column type to our f... | 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:"
} |
Merges two environments. The properties of the first environment might be overwritten by the second one. | [
"public static Environment merge(Environment env1, Environment env2) {\n\t\tfinal Environment mergedEnv = new Environment();\n\n\t\t// merge tables\n\t\tfinal Map<String, TableEntry> tables = new LinkedHashMap<>(env1.getTables());\n\t\ttables.putAll(env2.getTables());\n\t\tmergedEnv.tables = tables;\n\n\t\t// merge... | [
"function customizer(destination, source) {\n // If we're not working with a plain object, copy the value as is\n // If source is an array, for instance, it will replace destination\n if (!isPlain(source)) {\n return source;\n }\n\n // If the new value is a plain object but the first object value is not\n ... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Vertical "L" connector routing strategy | [
"function VerticalLStrategy(connector)\n{\n\tthis.connector = connector;\n\t\n\tthis.startSegment;\n\tthis.endSegment;\n\t\n\tthis.strategyName = \"vertical_L\";\n\t\n\tthis.isApplicable = function()\n\t{\n\t\tvar sourceMiddle = Math.floor(this.connector.source.left() + this.connector.source.width() / 2);\n\t\tvar ... | [
"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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// validateNodeAffinity tests that the specified nodeAffinity fields have valid data | [
"func validateNodeAffinity(na *core.NodeAffinity, fldPath *field.Path) field.ErrorList {\n\tallErrs := field.ErrorList{}\n\t// TODO: Uncomment the next three lines once RequiredDuringSchedulingRequiredDuringExecution is implemented.\n\t// if na.RequiredDuringSchedulingRequiredDuringExecution != nil {\n\t//\tallErrs... | [
"func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Verify method affiliated to given param
@param object $object
@param string $name
@return string | [
"public static function getSetMethod($object, $name)\n {\n $methodName = 'set' . self::camelize($name);\n\n if (!method_exists($object, $methodName)) {\n throw new Exception(sprintf('The set method for parameter %s is missing', $name));\n }\n\n return $methodName;\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 text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
invokes TouchWorksMagicConstants.ACTION_GET_ENCOUNTER_LIST_FOR_PATIENT action
:return: JSON response | [
"def get_patients_locations(self, patient_id):\n \n doc_xml = \"<docParams><item name='User' value='@@USER@@'/></docParams>\"\n doc_xml = doc_xml.replace(\"@@USER@@\", str(patient_id))\n magic = self._magic_json(\n action=TouchWorksMagicConstants.ACTION_GET_PATIENT_LOCATIONS,\... | [
"public void init(BaseDatabase database, Record record)\n {\n super.init(database, record);\n\n // Call super to set the table property (without calling remote).\n super.setProperty(DBParams.SUPRESSREMOTEDBMESSAGES, DBConstants.TRUE);\n }"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about Software Development:"
} |
Determine the response encoding if specified
@param connection The HTTP connection
@return The response encoding as a string (taken from "Content-Type") | [
"String getResponseEncoding(URLConnection connection) {\n\n String charset = null;\n\n String contentType = connection.getHeaderField(\"Content-Type\");\n if (contentType != null) {\n for (String param : contentType.replace(\" \", \"\").split(\";\")) {\n if (param.star... | [
"def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\""
] | codesearchnet | {
"query": "Represent the summarization about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
just print the current GPS position | [
"def process_gps_position(self, helper, sess):\n \n\n gps_position = helper.get_snmp_value(sess, helper, self.oids['oid_gps_position'])\n\n if gps_position:\n helper.add_summary(gps_position)\n else:\n helper.add_summary(\"Could not retrieve GPS position\")\n ... | [
"def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Get the bounding box (width, height, x and y) for the element | [
"function () {\n\t\tvar wrapper = this,\n\t\t\tbBox = wrapper.bBox,\n\t\t\trenderer = wrapper.renderer,\n\t\t\twidth,\n\t\t\theight,\n\t\t\trotation = wrapper.rotation,\n\t\t\telement = wrapper.element,\n\t\t\tstyles = wrapper.styles,\n\t\t\trad = rotation * deg2rad;\n\n\t\tif (!bBox) {\n\t\t\t// SVG elements\n\t\t... | [
"def _find_regular_images(container, contentsinfo):\n \n\n for pdfimage, xobj in _image_xobjects(container):\n\n # For each image that is drawn on this, check if we drawing the\n # current image - yes this is O(n^2), but n == 1 almost always\n for draw in contentsinfo.xobject_settings:\n ... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Check consul for all data | [
"def ext_pillar(minion_id,\n pillar, # pylint: disable=W0613\n conf):\n '''\n \n '''\n opts = {}\n temp = conf\n target_re = re.compile('target=\"(.*?)\"')\n match = target_re.search(temp)\n if match:\n opts['target'] = match.group(1)\n temp = temp.... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Setter for connection
@param connection
Thread local connection | [
"public static void setConnectionLocal(IConnection connection) {\r\n if (log.isDebugEnabled()) {\r\n log.debug(\"Set connection: {} with thread: {}\", (connection != null ? connection.getSessionId() : null), Thread.currentThread().getName());\r\n try {\r\n StackTraceEleme... | [
"def create(self):\n \n self.queue = self.scheduler.queue.addSubQueue(self.priority, LockEvent.createMatcher(self.context, self.key),\n maxdefault = self.size, defaultQueueClass = CBQueue.AutoClassQueue.initHelper('locker', subqueuelimit = 1))"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// classifyTokens builds a StructuredInput from a tokenized sentence. | [
"func (c classifier) classifyTokens(tokens []string) *dt.StructuredInput {\n\tvar s dt.StructuredInput\n\tvar sections []string\n\tfor _, t := range tokens {\n\t\tvar found bool\n\t\tlower := strings.ToLower(t)\n\t\t_, exists := c[\"C\"+lower]\n\t\tif exists {\n\t\t\ts.Commands = append(s.Commands, lower)\n\t\t\tfo... | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the description about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
// DescribeResourceByTags describe resource by tags
//
// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/tags&describeresourcebytags | [
"func (client *Client) DescribeTags(args *DescribeTagsArgs) (tags []TagItemType, pagination *common.PaginationResult, err error) {\n\targs.Validate()\n\tresponse := DescribeTagsResponse{}\n\terr = client.Invoke(\"DescribeTags\", args, &response)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn response.T... | [
"def streamweigths_get(self, session):\n ''''''\n request = TOPRequest('taobao.wangwang.eservice.streamweigths.get')\n self.create(self.execute(request, session))\n return self.staff_stream_weights"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
处理微信推送过来的消息
@param wxMessage
@return true 代表继续执行别的router,false 代表停止执行别的router | [
"protected WxMpXmlOutMessage service(WxMpXmlMessage wxMessage,\n WxMpService wxMpService,\n WxSessionManager sessionManager,\n WxErrorExceptionHandler exceptionHandler) {\n\n try {\n\n Map<String, Object> context = new HashMap<String, Object>();\n // 如果拦截器不通过\n for (WxMpMessageInter... | [
"function redirectToIndex() {\n var baseURL = window.DEBUG\n ? 'index-debug.html'\n : 'index.html';\n location.href = baseURL + location.hash;\n // 在`Promise`中,抛出异常会使其进入失败状态,\n // 一般来说跳转了就不会有下面的代码执行,这里就是防止进入成功状态\n throw new Error('... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Add Builders and construction variables for zip to an Environment. | [
"def generate(env):\n \"\"\"\"\"\"\n try:\n bld = env['BUILDERS']['Zip']\n except KeyError:\n bld = ZipBuilder\n env['BUILDERS']['Zip'] = bld\n\n env['ZIP'] = 'zip'\n env['ZIPFLAGS'] = SCons.Util.CLVar('')\n env['ZIPCOM'] = zipAction\n env['ZIPCOMPRESSION'] = ... | [
"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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
@param string $customerId
@param array $data
@param array $headers
@throws Exception
@return array|string | [
"public function importForCustomer(string $customerId, array $data, array $headers = [])\n {\n $url = $this->url('subscriptions/customers/%s/import_subscription', $customerId);\n\n return $this->post($url, $data, $headers);\n }"
] | [
"public function file(string $path, string $md5)\n {\n //==============================================================================\n // Create Event Object\n $event = new ObjectFileEvent($this->getWebserviceId(), $path, $md5);\n //============================================... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
// NewMinusDmForStream creates a Minus Directional Movement Indicator (MinusDm) for online usage with a source data stream | [
"func NewMinusDmForStream(priceStream gotrade.DOHLCVStreamSubscriber, timePeriod int) (indicator *MinusDm, err error) {\n\tind, err := NewMinusDm(timePeriod)\n\tpriceStream.AddTickSubscription(ind)\n\treturn ind, err\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Implementation of Info in Logger
@param mixed $message Message to log
@param mixed $args Arguments to message
@access public
@return void | [
"public function info($message, $args=array())\n {\n $backtrace = debug_backtrace();\n $args['FILENAME'] = $backtrace[0]['file'];\n $args['LINENO'] = $backtrace[0]['line'];\n $this->log($message, $args, 'LOG_INFO');\n\n }"
] | [
"public function insert(): self\n {\n /** @var self $data */\n $data = $this;\n\n if(!$this->validate(\"post\", $missing))\n {\n throw new \\Exception(\"[MVQN\\REST\\Endpoints\\Endpoint] Annotations for the '\".get_class($this).\"' class require valid values be set \".\n ... | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
// Close closes the stream, indicating this side is finished
// with the stream. | [
"func (s *Stream) Close() error {\n\terr := s.stream.Close()\n\n\ts.state.Lock()\n\tswitch s.state.v {\n\tcase streamCloseRead:\n\t\ts.state.v = streamCloseBoth\n\t\ts.remove()\n\tcase streamOpen:\n\t\ts.state.v = streamCloseWrite\n\t}\n\ts.state.Unlock()\n\treturn err\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 post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about File management:"
} |
// Used to create a huffman tree by hand
// path: Numeric representation of path to follow
// value: Value for given path
// value_default: Default value set for empty branches / leafs | [
"func addNode(tree huffmanTree, path int, path_len int, value int) huffmanTree {\n\troot := tree\n\tfor path_len > 1 {\n\t\tif tree.IsLeaf() {\n\t\t\t_panicf(\"Trying to add node to leaf\")\n\t\t}\n\n\t\t// get the current bit\n\t\tpath_len--\n\t\tone := path & 1\n\t\tpath = path >> 1\n\n\t\t// add node / leaf\n\t\... | [
"def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys ... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Given a file number, get its name (if any).
@param fileNumber: An C{int} file number.
@return: A C{str} file name or C{None} if a file with that number
has not been added. | [
"def _getFilename(self, fileNumber):\n \n cur = self._connection.cursor()\n cur.execute('SELECT name FROM files WHERE id = ?', (fileNumber,))\n row = cur.fetchone()\n if row is None:\n return None\n else:\n return row[0]"
] | [
"def create(location: str, simpleobjects_found = None, complexobject_attributes_found = None): # -> ObjectNotFoundOnFileSystemError:\n \n if len(complexobject_attributes_found) > 0 or len(simpleobjects_found) > 0:\n return ObjectNotFoundOnFileSystemError('Mandatory object : ' + location + ... | codesearchnet | {
"query": "Represent the post about File management:",
"pos": "Represent the code about File management:",
"neg": "Represent the code:"
} |
A string is decoded by reading the string as bytes using the readBytes
function.
@return The decoded String. | [
"@Override\n public Utf8 readString(Utf8 old) throws IOException {\n ByteBuffer stringBytes = readBytes(null);\n return new Utf8(stringBytes.array());\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 about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Creates and returns a {@link PutObjectRequest} for the instruction file
with the specified suffix. | [
"public PutObjectRequest createPutObjectRequest(S3Object s3Object) {\n if (!s3Object.getBucketName().equals(s3ObjectId.getBucket())\n || !s3Object.getKey().equals(s3ObjectId.getKey())) {\n throw new IllegalArgumentException(\"s3Object passed inconsistent with the instruction file being cre... | [
"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 summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about AWS S3:"
} |
Find directories that match *pattern* in *path* | [
"def finddirs(pattern, path='.', exclude=None, recursive=True):\n \"\"\"\"\"\"\n import fnmatch\n import os\n if recursive:\n for root, dirnames, filenames in os.walk(path):\n for pat in _to_list(pattern):\n for dirname in fnmatch.filter(dirnames, pat):\n ... | [
"function(request, modules_root, options){\n var [path, analysis] = normalize_path(request, modules_root, options.relative_path_root);\n var cache_path = path; // define cachepath as path to file with content. For modules, defines path to package.json\n if(analysis.is_a_module) cache_path = \"m... | codesearchnet | {
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
/// Function insert ////////////////////////////////////////////////////// (seq:Sequence, index:Num[, values...]) ↦ Array Returns a array with the given elements inserted at the given index. | [
"function insert(seq, index) { var values, result\n values = slice(arguments, 2)\n result = copy(seq)\n result.splice.apply(result, [index, 0].concat(values))\n\n return result\n }"
] | [
"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 sentence about SQL:",
"pos": "Represent the Github code about SQL:",
"neg": "Represent the Github code about Natural Language Processing:"
} |
// SerializeDescriptor returns a slice of field descriptors, representing just
// the names and types of fields. | [
"func SerializeDescriptor(fields []Field) []*pb.MetricsDataSet_MetricFieldDescriptor {\n\tret := make([]*pb.MetricsDataSet_MetricFieldDescriptor, len(fields))\n\n\tfor i, f := range fields {\n\t\td := &pb.MetricsDataSet_MetricFieldDescriptor{\n\t\t\tName: proto.String(f.Name),\n\t\t}\n\n\t\tswitch f.Type {\n\t\tcas... | [
"NameAndType nameType(Symbol sym) {\n return new NameAndType(fieldName(sym),\n retrofit\n ? sym.erasure(types)\n : sym.externalType(types), types);\n // if we retrofit, then the NameAndType has been read in as is... | codesearchnet | {
"query": "Represent the Github instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"public IfcSubContractResourceTypeEnum createIfcSubContractResourceTypeEnumFromString(EDataType eDataType,\r\n\t\t\tString initialValue) {\r\n\t\tIfcSubContractResourceTypeEnum result = IfcSubContractResourceTypeEnum.get(initialValue);\r\n\t\tif (result == null)\r\n\t\t\tthrow new IllegalArgumentException(\r\n\t\t\... | [
"protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license... | codesearchnet | {
"query": "Represent the description about Text generation:",
"pos": "Represent the code about Text generation:",
"neg": "Represent the code:"
} |
Add a child process managed by the server.
@param \Lawoole\Contracts\Server\Process $process | [
"public function fork(ProcessContract $process)\n {\n $this->swooleServer->addProcess($process->getSwooleProcess());\n\n $process->bind($this);\n }"
] | [
"def create(self):\n \n self.queue = self.scheduler.queue.addSubQueue(self.priority, LockEvent.createMatcher(self.context, self.key),\n maxdefault = self.size, defaultQueueClass = CBQueue.AutoClassQueue.initHelper('locker', subqueuelimit = 1))"
] | codesearchnet | {
"query": "Represent the summarization about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
Sum volume totals
@param float $total
@param array $item
@param array $order
@return null | [
"protected function sumTotalVolume(&$total, array &$item, array $order)\n {\n $product = &$item['product'];\n\n if (empty($product['width']) || empty($product['height']) || empty($product['length'])) {\n return null;\n }\n\n if ($product['size_unit'] !== $order['size_unit']... | [
"protected function processDetails(Buffer &$buffer, Result &$result)\n {\n parent::processDetails($buffer, $result);\n\n // Add in map\n $result->add('mapname', 'Panau');\n $result->add('dedicated', 'true');\n }"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
return a PaymentInterface Object.
@param string $code
@return PaymentInterface | [
"public function getMethod($code)\n {\n return isset($this->methods[$code]) ? $this->methods[$code] : null;\n }"
] | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the Github instruction about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about programming:"
} |
an image object, will be an XObject in the document, includes description and data | [
"protected function o_image($id, $action, $options = '') {\n if ($action !== 'new') {\n $o = & $this->objects[$id];\n }\n\n switch ($action) {\n case 'new':\n // make the new object\n $this->objects[$id] = array('t'=>'image', 'data'=>&$options['data'], 'info'=>array());\n \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 description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
@param Map $map
@param Rectangle[] $rectangles
@return Rectangle[] | [
"public function collect(Map $map, array $rectangles = [])\n {\n return $this->collectValues($map->getOverlayManager()->getRectangles(), $rectangles);\n }"
] | [
"public Map<Any2<Integer, String>, Any3<Boolean, Integer, String>> getRawMap() {\n return unmodifiableMap(data);\n }"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Perform action on open.
@param ConnectionInterface $conn [description]
@return [type] [description] | [
"public function onOpen(ConnectionInterface $conn)\n {\n $this->conn = $conn;\n\n $this->attach()->throttle()->limit();\n }"
] | [
"@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Load all relations for the model, but constrain the query to the current page.
@param int $perPage
@param int $page
@return $this | [
"public function loadRelationsForPage(int $perPage, int $page = 1): self\n {\n foreach ($this->relations as $name => $constraints) {\n $this->loadRelationForPage($perPage, $page, $name, $constraints);\n }\n\n return $this;\n }"
] | [
"protected function process()\n {\n\n // query whether or not, we've found a new path => means we've found a new category\n if ($this->hasBeenProcessed($path = $this->getValue(ColumnKeys::PATH))) {\n return;\n }\n\n // process the parent instance\n parent::process();... | codesearchnet | {
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
Build and execute the current query
This wil run the local build function and pass the parameters
from the builder object in the handler
@param string $handler
@return mixed | [
"public function run( $handler = null )\n\t{\n\t\tif ( !is_null( $handler ) )\n\t\t{\n\t\t\t$this->handler( $handler );\n\t\t}\n\t\t\n\t\t// if there is a special fetch handler defined pass him all the \n\t\t// needed parameters and retrive the results\n\t\tif ( !is_null( $this->fetch_handler ) )\n\t\t{\n\t\t\t$res... | [
"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 instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Visit regular imports. | [
"def visit_Import(self, node, frame):\n \"\"\"\"\"\"\n if node.with_context:\n self.unoptimize_scope(frame)\n self.writeline('l_%s = ' % node.target, node)\n if frame.toplevel:\n self.write('context.vars[%r] = ' % node.target)\n self.write('environment.get_te... | [
"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 comment:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
存储一个坐标及相关名称
@param $name string
@param $lng float
@param $lat float
@return int 新添加的空间元素数量, 不包括那些已经存在但是被更新的元素。 | [
"public function insert(string $name,float $lng, float $lat): int\n {\n return intval($this->handle->rawCommand('geoadd', [$this->name, $lng, $lat, $name]));\n }"
] | [
"protected static void fixResultByRule(List<Vertex> linkedArray)\n {\n\n //--------------------------------------------------------------------\n //Merge all seperate continue num into one number\n mergeContinueNumIntoOne(linkedArray);\n\n //-------------------------------------------... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about text processing:"
} |
Sign a message using a shared secret key, per
https://github.com/globocom/thumbor/wiki/Libraries
@param string $msg
@param string $secret
@return string | [
"public static function sign($msg, $secret)\n {\n $signature = hash_hmac(\"sha1\", $msg, $secret, true);\n return strtr(\n base64_encode($signature),\n '/+', '_-'\n );\n }"
] | [
"def __set_revlookup_auth_string(self, username, password):\n '''\n \n '''\n auth = b2handle.utilhandle.create_authentication_string(username, password)\n self.__revlookup_auth_string = auth"
] | codesearchnet | {
"query": "Represent the text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Programming:"
} |
Used to toggle the status of a block open_for_writing=1, open for writing, open_for_writing=0, closed | [
"def updateStatus(self, block_name=\"\", open_for_writing=0):\n \n if open_for_writing not in [1, 0, '1', '0']:\n msg = \"DBSBlock/updateStatus. open_for_writing can only be 0 or 1 : passed %s.\"\\\n % open_for_writing \n dbsExceptionHandler('dbsException-invali... | [
"def buffer_leave(self, filename):\n \"\"\"\"\"\"\n self.log.debug('buffer_leave: %s', filename)\n # TODO: This is questionable, and we should use location list for\n # single-file errors.\n self.editor.clean_errors()"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
} |
Public: Reprocess all items from this category | [
"def reprocess_items!\n @path_array = nil\n self.direct_items.each { |item| item.reprocess_child_items! }\n self.children.each { |category| category.reprocess_items! }\n end"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Returns the lists of queries from which this rule (or query) depends on ordered
by their relative dependencies, e.g. if R1 -> A -> B -> C (where the letter are queries)
it will return [C, B, A] | [
"public List<QueryImpl> getDependingQueries() {\n if (dependingQueries == null) {\n dependingQueries = usedQueries == null ? Collections.<QueryImpl>emptyList() : collectDependingQueries(new LinkedList<QueryImpl>());\n }\n return dependingQueries;\n }"
] | [
"def _weave_conflicting_selectors(prefixes, a, b, suffix=()):\n \n # OK, what this actually does: given a list of selector chains, two\n # \"conflicting\" selector chains, and an optional suffix, return a new list\n # of chains like this:\n # prefix[0] + a + b + suffix,\n # prefix[0] + b + a +... | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Convert database value to TimePoint
@inheritDoc | [
"public function convertToPHPValue($value, AbstractPlatform $platform)\n {\n if (!$value || !is_string($value)) {\n return null;\n }\n\n $timepoint = self::getParsingClock()->fromString($value, 'Y-m-d H:i:s');\n\n if (!$timepoint) {\n throw ConversionException::c... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// Iter() returns a channel of type string that you can range over. | [
"func (set WordSet) Iter() <-chan string {\n\tch := make(chan string)\n\tgo func() {\n\t\tfor elem := range set {\n\t\t\tch <- elem\n\t\t}\n\t\tclose(ch)\n\t}()\n\n\treturn ch\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 programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about File management:"
} |
// ListenAndServe is equivalent to http.Server.ListenAndServe with graceful shutdown enabled. | [
"func (srv *Server) ListenAndServe() error {\n\t// Create the listener so we can control their lifetime\n\taddr := srv.Addr\n\tif addr == \"\" {\n\t\taddr = \":http\"\n\t}\n\tconn, err := srv.newTCPListener(addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn srv.Serve(conn)\n}"
] | [
"func main() {\n\t// Add routes to the global handler\n\tgoji.Get(\"/\", Root)\n\t// Fully backwards compatible with net/http's Handlers\n\tgoji.Get(\"/greets\", http.RedirectHandler(\"/\", 301))\n\t// Use your favorite HTTP verbs\n\tgoji.Post(\"/greets\", NewGreet)\n\t// Use Sinatra-style patterns in your URLs\n\t... | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Render the page using the provided Renderer.
If no renderer is given, return the raw content
@param string $rawContent
@param array $attributes
@return string | [
"public function doRender($rawContent, array $attributes = [])\n {\n $renderer = $this->renderer;\n\n if ($renderer === null) {\n $rendered = $rawContent;\n } elseif ($renderer instanceof Renderer) {\n $rendered = $renderer->render($rawContent, $attributes);\n } ... | [
"public function getTemplateFile($filename, $data)\n {\n $data['getRegion'] = function($name) { \n return $this->getRegion($name); \n }; // This is for mustache compatibility\n\n // Push the data into regions and then pass a pointer to this class to the layout\n // $thi... | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Returns if the given element is a model group.<p>
@return <code>true</code> if the given element is a model group | [
"public boolean isModelGroup() {\n\n ModelGroupState state = ModelGroupState.evaluate(\n getIndividualSettings().get(CmsContainerElement.MODEL_GROUP_STATE));\n return state == ModelGroupState.isModelGroup;\n }"
] | [
"private void checkForValid(String paramName, Attribute<? super X, ?> attribute)\n {\n if (attribute == null)\n {\n throw new IllegalArgumentException(\n \"attribute of the given name and type is not present in the managed type, for name:\" + paramName);\n\n }\n... | codesearchnet | {
"query": "Represent the description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
/* (non-Javadoc)
@see net.timewalker.ffmq4.storage.data.impl.AbstractBlockBasedDataStore#close() | [
"@Override\n\tpublic void close()\n {\n \t// Close journal first\n \ttry\n \t{\n \t\tcommitChanges();\n \t\tjournal.close();\n \t}\n \tcatch (DataStoreException e)\n \t{\n \t\tlog.error(\"[\"+descriptor.getName()+\"] Could not properly close store journal\",e);\n \t}\n \t\n \t... | [
"@Override\n\t@Deprecated\n\tpublic DataSource dataSourceByName(String dbName) {\n\t\treturn new com.danidemi.jlubricant.embeddable.BasicDataSource(\n\t\t\t\tdbByName(dbName));\n\t}"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Software Development:"
} |
将对象转换成数组
@param {Object} obj
@param {String=} key
@returns {Boolean | Array} | [
"function object2array(obj, key) {\n if (typeof obj != \"object\") {\n return false;\n }\n if (key && typeof key != \"string\") {\n return false;\n }\n\n var arr = [];\n var index;\n if (key) {\n for (index in obj) {\n if (obj.hasOwnProperty(index)) {\n ... | [
"function Compiler(moduleConfig, moduleCombineConfigs, moduleMapConfigs) {\n this._moduleConfig = moduleConfig;\n this._moduleCombineConfigs = moduleCombineConfigs || this._moduleConfig.combine || {};\n this._moduleMapConfigs = helper.createKVSortedIndex(moduleMapConfigs, 1);\n\n u.each(this._moduleMapC... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
// TranslateInTreeStorageClassParametersToCSI translates InTree Cinder storage class parameters to CSI storage class | [
"func (t *osCinderCSITranslator) TranslateInTreeStorageClassParametersToCSI(scParameters map[string]string) (map[string]string, error) {\n\treturn scParameters, nil\n}"
] | [
"func (e *environ) AdoptResources(ctx context.ProviderCallContext, controllerUUID string, fromVersion version.Number) error {\n\t// This provider doesn't track instance -> controller.\n\treturn nil\n}"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Add underlying common "C compiler" variables that
are used by multiple tools (specifically, c++). | [
"def add_common_cc_variables(env):\n \n if '_CCCOMCOM' not in env:\n env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS'\n # It's a hack to test for darwin here, but the alternative\n # of creating an applecc.py to contain this seems overkill.\n # Maybe someday the Apple pla... | [
"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 Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
transform remote JSON UI entity to local object
:param json_obj: the retrieved Ariane Menu entity to transform
:return: the local object InjectorUITreeEntity | [
"def json_2_injector_ui_tree_menu_entity(json_obj):\n \n LOGGER.debug(\"InjectorUITreeEntity.json_2_injector_ui_tree_menu_entity\")\n return InjectorUITreeEntity(\n uitid=json_obj['id'],\n value=json_obj['value'],\n uitype=json_obj['type'],\n context_... | [
"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:"
} |
// String returns debug-friendly representaton of trace stack | [
"func (s Traces) String() string {\n\tif len(s) == 0 {\n\t\treturn \"\"\n\t}\n\tout := make([]string, len(s))\n\tfor i, t := range s {\n\t\tout[i] = fmt.Sprintf(\"\\t%v:%v %v\", t.Path, t.Line, t.Func)\n\t}\n\treturn strings.Join(out, \"\\n\")\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
make a compound Constraint, which checks whether any inputting constraints passed | [
"public static Constraint anyPassed(Constraint... constraints) {\n return ((name, data, messages, options) -> {\n logger.debug(\"checking any passed for {}\", name);\n\n List<Map.Entry<String, String>> errErrors = new ArrayList<>();\n for(Constraint constraint : constraints) ... | [
"@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 Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
Show the form for editing the specified resource.
@param int $id
@return \Illuminate\Http\Response | [
"public function edit($id)\n {\n $notification = $this->service->find($id);\n return view('admin.notifications.edit')->with('notification', $notification);\n }"
] | [
"public function onDelete()\n {\n $this->validateRequestTheme();\n\n $type = Request::input('templateType');\n\n $this->loadTemplate($type, trim(Request::input('templatePath')))->delete();\n\n /*\n * Extensibility - documented above\n */\n $this->fireSystemEvent... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Programming:"
} |
Returns a formatted authorize URL.
:param \*\*params: Additional keyworded arguments to be added to the
URL querystring.
:type \*\*params: dict | [
"def get_authorize_url(self, **params):\n '''\n \n '''\n\n params.update({'client_id': self.client_id})\n return self.authorize_url + '?' + urlencode(params)"
] | [
"def __store_config(self, args, kwargs):\n \n signature = (\n 'schema',\n 'ignore_none_values',\n 'allow_unknown',\n 'require_all',\n 'purge_unknown',\n 'purge_readonly',\n )\n for i, p in enumerate(signature[: len(args)])... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
Iterate over --oneline log entries.
This parses the output intro a structured form but does not apply
presentation logic to the output - making it suitable for different
uses.
:return: An iterator of (hash, tags_set, 1st_line) tuples. | [
"def _iter_log_inner(debug):\n \n if debug:\n print('Generating ChangeLog')\n\n changelog = run('git log --oneline --decorate', hide=True).stdout.strip().decode('utf-8', 'replace')\n for line in changelog.split('\\n'):\n line_parts = line.split()\n if len(line_parts) < 2:\n ... | [
"def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys ... | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
itemAvailable: not implemented | [
"function (itemPromise, previousHandle, nextHandle) {\n this._itemsManager._versionManager.receivedNotification();\n this._itemsManager._inserted(itemPromise, previousHandle, nextHandle);\n }"
] | [
"function writeTimeBound(type, prmname, boundType, outputType) {\n return utils.parts(type, {\n B : prmname,\n // TODO: is this correct?\n C : boundType+'_'+(type === 'QU' ? 'UBT' : 'LBT')+'(KAF)',\n E : '1MON'\n }, outputType);\n //A=HEXT2014 B=SR-CMN_SR-CMN C=STOR_UBT(KAF) E=1MON F=CAMANCHE R FLOOD... | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// createNewObjectPack is a helper for RepackObjects taking care
// of creating a new pack. It is used so the the PackfileWriter
// deferred close has the right scope. | [
"func (r *Repository) createNewObjectPack(cfg *RepackConfig) (h plumbing.Hash, err error) {\n\tow := newObjectWalker(r.Storer)\n\terr = ow.walkAllRefs()\n\tif err != nil {\n\t\treturn h, err\n\t}\n\tobjs := make([]plumbing.Hash, 0, len(ow.seen))\n\tfor h := range ow.seen {\n\t\tobjs = append(objs, h)\n\t}\n\tpfw, o... | [
"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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Removes optional arguments.
@param array $arguments The arguments. | [
"public static function removeDefaultArguments(&$arguments)\n {\n foreach ($arguments as $key => $argument) {\n if ($argument === self::DEFAULT_ARGUMENT) {\n unset($arguments[$key]);\n }\n }\n }"
] | [
"def setTargets(self, targets):\n \n if not self.verifyArguments(targets) and not self.patterned:\n raise NetworkError('setTargets() requires [[...],[...],...] or [{\"layerName\": [...]}, ...].', targets)\n self.targets = targets"
] | codesearchnet | {
"query": "Represent the instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
{@inheritDoc}
@see jp.co.future.uroborosql.fluent.SqlFluent#param(String, Supplier) | [
"@Override\n\tpublic SqlContext param(final String paramName, final Supplier<Object> supplier) {\n\t\treturn this.param(paramName, supplier != null ? supplier.get() : null);\n\t}"
] | [
"public PythonDataStream add_java_source(SourceFunction<Object> src) {\n\t\treturn new PythonDataStream<>(env.addSource(src).map(new AdapterMap<>()));\n\t}"
] | codesearchnet | {
"query": "Represent the text about API documentation:",
"pos": "Represent the code about API documentation:",
"neg": "Represent the code:"
} |
{@inheritDoc}
@see org.audit4j.core.schedule.TaskScheduler#scheduleWithFixedDelay(java.lang.Runnable,
long) | [
"@Override\n public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long delay) {\n try {\n return this.scheduledExecutor.scheduleWithFixedDelay(decorateTask(task, true), 0, delay,\n TimeUnit.MILLISECONDS);\n } catch (RejectedExecutionException ex) {\n ... | [
"public Timer timer(String name, Iterable<Tag> tags) {\n return Timer.builder(name).tags(tags).register(this);\n }"
] | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
the default rule set for general import an export features | [
"public static MappingRules getDefaultMappingRules() {\n return new MappingRules(MAPPING_NODE_FILTER, MAPPING_EXPORT_FILTER, MAPPING_IMPORT_FILTER,\n new PropertyFormat(PropertyFormat.Scope.value, PropertyFormat.Binary.base64),\n 0, MappingRules.ChangeRule.update);\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 summarization:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
This method is used internally.
Invokes the controller action and loads the corresponding view.
@param string $actionName Specifies a action name to execute.
@param array $parameters A list of the action parameters. | [
"protected function execPageAction($actionName, $parameters)\n {\n $result = null;\n\n if (!$this->actionExists($actionName)) {\n if (Config::get('app.debug', false)) {\n throw new SystemException(sprintf(\n \"Action %s is not found in the controller %s\... | [
"public function initializeArguments()\n {\n $this->registerTagAttribute('enctype', 'string', 'MIME type with which the form is submitted');\n $this->registerTagAttribute('method', 'string', 'Transfer type (GET or POST or dialog)');\n $this->registerTagAttribute('name', 'string', 'Name of fo... | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Fetch information about a container
@param $uuid
@return ContainerResponse | [
"public function show($uuid)\n {\n $response = $this->httpClient->get($this->getResourceUrl($uuid));\n\n return ContainerResponse::createFromHttpResponse($response);\n }"
] | [
"def getDeviceRole(self):\n \"\"\"\"\"\"\n print '%s call getDeviceRole' % self.port\n return self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:NodeType')[0])"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Gets all resources, automating paging through data
Returns:
iterable of object: Iterable of resource objects | [
"def iter(self):\n \n\n page = 1\n fetch_all = True\n url = \"{}/{}\".format(__endpoint__, self.type.RESOURCE)\n\n if 'page' in self.params:\n page = self.params['page']\n fetch_all = False\n\n response = RestClient.get(url, self.params)[self.type.RESO... | [
"def values(*rels):\n '''\n \n '''\n #Action function generator to multiplex a relationship at processing time\n def _values(ctx):\n '''\n Versa action function Utility to specify a list of relationships\n\n :param ctx: Versa context used in processing (e.g. includes the prototyp... | codesearchnet | {
"query": "Represent the text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Validate portal localization.
@throws Exception\PortalDefaultLocalizationNotFoundException
@throws Exception\InvalidPortalDefaultLocalizationException | [
"protected function validateDefaultPortalLocalization()\n {\n // check all portal localizations\n foreach ($this->webspace->getPortals() as $portal) {\n try {\n if (!$this->validateDefaultLocalization($portal->getLocalizations())) {\n // try to load the ... | [
"protected function CanCreate()\n {\n return self::Guard()->Allow(BackendAction::Create(), new Container())\n && self::Guard()->Allow(BackendAction::UseIt(), new ContainerForm());\n }"
] | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Setup the response based on listeners. | [
"protected void setupListeners() {\n\t\taddDrawingListener(new DrawingListener() {\n\t\t\tprivate long time;\n\n\t\t\t@Override\n\t\t\tpublic void onDrawingStart() {\n\t\t\t\tthis.time = System.currentTimeMillis();\n\t\t\t\tgetCorner().setColor(Color.ORANGERED);\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onDraw... | [
"@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 sentence about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Programming:"
} |
//on exit loop through process array and kill everything process.on('exit', function () { processArray.forEach(function (proc) { proc.kill('SIGHUP'); }); }); creates a new phantomjs process | [
"function (options, callbackFn) {\n\n var self = this;\n request.get(options.hostAndPort + '/ping',\n function (error, response) {\n\n if (response && response.statusCode === 200) { //server up\n\n callbackFn && callbackFn.call(self, ... | [
"function(user_opts) {\n\n // Set options\n this.options = _.defaults(user_opts, this.options)\n\n // Set title\n // this.options.title = chalk.bold(this.options.title)\n\n // Without this, we would only get streams once enter is pressed\n process.stdin.setRawMode(true)\n // Resume stdin in the... | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Returns nav TypeDocs
@param TypeDoc $type typedoc to take category from
@param TypeDoc[] $types TypeDocs to filter
@return array | [
"public function getNavTypes($type, $types)\n {\n if ($type === null) {\n return $types;\n }\n\n return $this->filterTypes($types, $this->getTypeCategory($type));\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 about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Configurator.
@param AnConfig $config Property Configuration | [
"public function setConfig(AnConfig $config)\n {\n $identifier = $config->description->getRepository()->getIdentifier();\n\n $config->child = $config->through;\n\n parent::setConfig($config);\n\n $this->_target = AnService::getIdentifier($config->target);\n\n if (!$this->_targe... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
// SetPurpose creates a GroupsSetPurposeCall object in preparation for accessing the groups.setPurpose endpoint | [
"func (s *GroupsService) SetPurpose(channel string, purpose string) *GroupsSetPurposeCall {\n\tvar call GroupsSetPurposeCall\n\tcall.service = s\n\tcall.channel = channel\n\tcall.purpose = purpose\n\treturn &call\n}"
] | [
"def create(self, **kwargs):\n \n raise exceptions.MethodNotImplemented(method=self.create, url=self.url, details='GUID cannot be duplicated, to create a new GUID use the relationship resource')"
] | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Natural Language Processing:"
} |
Convert OpenAIRE grant XML into JSON. | [
"def grantxml2json(self, grant_xml):\n \"\"\"\"\"\"\n tree = etree.fromstring(grant_xml)\n # XML harvested from OAI-PMH has a different format/structure\n if tree.prefix == 'oai':\n ptree = self.get_subtree(\n tree, '/oai:record/oai:metadata/oaf:entity/oaf:proje... | [
"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 text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
or cover a very large span. | [
"private ValFrame slow_table(Vec v1, Vec v2, String[] colnames, boolean dense) {\n\n\n // For simplicity, repeat v1 if v2 is missing; this will end up filling in\n // only the diagonal of a 2-D array (in what is otherwise a 1-D array).\n // This should be nearly the same cost as a 1-D array, since everythi... | [
"def read_description():\n \"\"\"\"\"\"\n try:\n with open(\"README.md\") as r:\n description = \"\\n\"\n description += r.read()\n with open(\"CHANGELOG.md\") as c:\n description += \"\\n\"\n description += c.read()\n return description\n ex... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Store Data.
@param array|AnConfig $file | [
"public function storeFile($file)\n {\n $filename = md5($this->id);\n $data = file_get_contents($file->tmp_name);\n\n if ($this->getFileName() == $this->name) {\n $this->name = $file->name;\n }\n\n $file->append(array(\n 'type' => mime_content_type($file->... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
@param $config
@throws MalformedDriverConfigException | [
"private function setConfig($config)\n {\n $allowedConfigKeys = [\n 'database',\n 'host',\n 'password',\n 'port',\n 'username',\n ];\n\n foreach (array_keys($config) as $key) {\n if (!in_array($key, $allowedConfigKeys)) {\n ... | [
"protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }"
] | codesearchnet | {
"query": "Represent the Github text about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code:"
} |
Accepts:
without parameters
Returns:
list of dictionaries with following fields:
- "description" - str
- "read_access" - int
- "write_access" - int
- "cid" - int
- "owneraddr" - str
- "coinid" - str
Verified: False | [
"async def get(self):\n\t\t\n\t\tlogging.debug(\"\\n\\n All Content debugging --- \")\n\n\t\tpage = self.get_query_argument(\"page\", 1)\n\n\t\tcontents = []\n\n\t\tcoinids = list(settings.bridges.keys())\n\n\t\tlogging.debug(\"\\n\\n Coinids \")\n\t\tlogging.debug(coinids)\n\n\t\tfor coinid in coinids:\n\t\t\tlogg... | [
"async def log_source(self, **params):\n\t\t\n\t\tif params.get(\"message\"):\n\t\t\tparams = json.loads(params.get(\"message\", \"{}\"))\n\t\t\n\t\tif not params:\n\t\t\treturn {\"error\":400, \"reason\":\"Missed required fields\"}\n\n\t\t# Insert new source if does not exists the one\n\n\t\tdatabase = client[sett... | codesearchnet | {
"query": "Represent the Github summarization about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Get header
@param string $header
@return mixed | [
"public function get(string $header)\n {\n return isset($this->all[$header]) ? $this->all[$header] : null;\n }"
] | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the Github sentence about PHP programming:",
"pos": "Represent the Github code about PHP programming:",
"neg": "Represent the Github code about programming:"
} |
Deploy file via package manager.
@param packageFile AEM content package | [
"public void installFile(PackageFile packageFile) {\n File file = packageFile.getFile();\n if (!file.exists()) {\n throw new PackageManagerException(\"File does not exist: \" + file.getAbsolutePath());\n }\n\n try (CloseableHttpClient httpClient = pkgmgr.getHttpClient()) {\n\n // before instal... | [
"@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 description:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Callback from modem, process based on new state | [
"def callback(newstate):\n \"\"\"\"\"\"\n print('callback: ', newstate)\n if newstate == modem.STATE_RING:\n if state == modem.STATE_IDLE:\n att = {\"cid_time\": modem.get_cidtime,\n \"cid_number\": modem.get_cidnumber,\n \"cid_name\": modem.get_cidname... | [
"def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Build a translate mapping that replaces halfwidth and fullwidth forms
with their standard-width forms. | [
"def _build_width_map():\n \n # Though it's not listed as a fullwidth character, we'll want to convert\n # U+3000 IDEOGRAPHIC SPACE to U+20 SPACE on the same principle, so start\n # with that in the dictionary.\n width_map = {0x3000: ' '}\n for i in range(0xff01, 0xfff0):\n char = chr(i)\n ... | [
"def GetDictToFormat(self):\n \"\"\"\"\"\"\n d = {}\n for k, v in self.__dict__.items():\n # TODO: Better handling of unicode/utf-8 within Schedule objects.\n # Concatinating a unicode and utf-8 str object causes an exception such\n # as \"UnicodeDecodeError: 'ascii' codec can't decode byte ... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Get a single item
:param obj_id: int
:return: dict|str | [
"def get(self, obj_id):\n \n response = self._client.session.get(\n '{url}/{id}'.format(\n url=self.endpoint_url, id=obj_id\n )\n )\n return self.process_response(response)"
] | [
"def get_value_from_session(key):\n \n def value_from_session_function(service, message):\n \"\"\"Actual implementation of get_value_from_session function.\n\n :param service: SelenolService object.\n :param message: SelenolMessage request.\n \"\"\"\n return _get_value(messa... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
{@inheritDoc}
@see jcifs.internal.smb2.ServerMessageBlock2#writeBytesWireFormat(byte[], int) | [
"@Override\n protected int writeBytesWireFormat ( byte[] dst, int dstIndex ) {\n int start = dstIndex;\n SMBUtil.writeInt2(33, dst, dstIndex);\n dst[ dstIndex + 2 ] = this.infoType;\n dst[ dstIndex + 3 ] = this.fileInfoClass;\n dstIndex += 4;\n\n int bufferLengthOffset =... | [
"public final AutoBuffer write_impl( AutoBuffer ab ) {\n return ab.put1(_persist).put2(_type).putA1(memOrLoad());\n }"
] | codesearchnet | {
"query": "Represent the text about Java programming:",
"pos": "Represent the code about Java programming:",
"neg": "Represent the code:"
} |
Action for getting preview interface.
@param SS_HTTPRequest $request
@return string | [
"public function preview(SS_HTTPRequest $request)\n {\n $file = File::get()\n ->byID($request->param('FileID'));\n if (!$file) {\n return \"file not found\";\n }\n //TODO: validate file?\n $mapper = new CSVFieldMapper($file->getFullPath());\n $mappe... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
// SetConnectorDefinitionVersionId sets the ConnectorDefinitionVersionId field's value. | [
"func (s *GetConnectorDefinitionVersionInput) SetConnectorDefinitionVersionId(v string) *GetConnectorDefinitionVersionInput {\n\ts.ConnectorDefinitionVersionId = &v\n\treturn s\n}"
] | [
"public final void setTemplateMode(final TemplateMode templateMode) {\n Validate.notNull(templateMode, \"Cannot set a null template mode value\");\n // We re-parse the specified template mode so that we make sure we get rid of deprecated values\n this.templateMode = TemplateMode.parse(templateM... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Collects current page layout | [
"public function onCollectLayout(CollectLayoutEvent $event)\n {\n if (!$this->siteManager->hasContext()) {\n return;\n }\n\n $layoutIds = [];\n $context = $event->getContext();\n $site = $this->siteManager->getContext();\n $theme = $site->getThe... | [
"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:"
} |
Write a short to the byte array at the given offset.
@param array Array to write to
@param offset Offset to write to
@param v data
@return number of bytes written | [
"public static int writeShort(byte[] array, int offset, int v) {\n array[offset + 0] = (byte) (v >>> 8);\n array[offset + 1] = (byte) (v >>> 0);\n return SIZE_SHORT;\n }"
] | [
"public static int byteCount(Slice slice, int offset, int length, int codePointCount)\n {\n requireNonNull(slice, \"slice is null\");\n if (length < 0) {\n throw new IllegalArgumentException(\"length must be greater than or equal to zero\");\n }\n if (offset < 0 || offset +... | codesearchnet | {
"query": "Represent the description about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Sets the given button in the left position and sets that buttons role
to back. Any existing left button will be replaced.
@param button
the new back button | [
"@UiChild(tagname=\"backButton\", limit=1)\n public void setBackButton(JQMButton button) {\n button.setBack(true);\n setLeftButton(button);\n }"
] | [
"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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// Version '2' to '3' config migration adds new fields and re-orders
// previous fields. Simplifies config for future additions. | [
"func migrateV2ToV3() error {\n\tconfigFile := getConfigFile()\n\n\tcv2 := &configV2{}\n\t_, err := Load(configFile, cv2)\n\tif os.IsNotExist(err) {\n\t\treturn nil\n\t} else if err != nil {\n\t\treturn fmt.Errorf(\"Unable to load config version ‘2’. %v\", err)\n\t}\n\tif cv2.Version != \"2\" {\n\t\treturn nil\n\t}... | [
"def set_identifiers(self, data):\n \n for id_info in self._details.identifiers:\n var_name = id_info['var_name']\n self._data[var_name] = data.get(var_name)\n\n # FIXME: This needs to likely kick off invalidating/rebuilding\n # relations.\n # F... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// NewPaths returns the set of filesystem paths that the supplied unit should
// use, given the supplied root juju data directory path. | [
"func NewPaths(dataDir string, applicationTag names.ApplicationTag) Paths {\n\tjoin := filepath.Join\n\tbaseDir := join(dataDir, \"agents\", applicationTag.String())\n\tstateDir := join(baseDir, \"state\")\n\n\tsocket := func(name string, abstract bool) string {\n\t\tpath := join(baseDir, name+\".socket\")\n\t\tif ... | [
"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 Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Get Api endPoint
@param int $websiteId
@param \Dotdigitalgroup\Email\Model\Apiconnector\Client $client
@return string| | [
"public function getApiEndpoint($websiteId, $client)\n {\n //Get from DB\n $apiEndpoint = $this->getApiEndPointFromConfig($websiteId);\n\n //Nothing from DB then fetch from api\n if (!$apiEndpoint) {\n $apiEndpoint = $this->getApiEndPointFromApi($client);\n //Sav... | [
"public function update( models\\Call\\ContactUrl $ContactUrl){\n $rest = $this->getService( self::API_URL . $ContactUrl->getId());\n $rest->PUT( $ContactUrl);\n\n return $rest->getResult( models\\Call\\ContactUrl::class);\n }"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software Development:"
} |
Create detail section with one image.
Args:
title (str): Title to be displayed for detail section.
image: marv image file.
Returns
One detail section. | [
"def image_section(image, title):\n \n # pull first image\n img = yield marv.pull(image)\n if img is None:\n return\n\n # create image widget and section containing it\n widget = {'title': image.title, 'image': {'src': img.relpath}}\n section = {'title': title, 'widgets': [widget]}\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 Github sentence about document management:",
"pos": "Represent the Github code about document management:",
"neg": "Represent the Github code about programming:"
} |
Decodes a LEB128-encoded unsigned integer.
:param BufferedIOBase data: The buffer containing the LEB128-encoded integer to decode.
:return: The decoded integer.
:rtype: int | [
"def leb128_decode(data):\n \n result = 0\n shift = 0\n\n while True:\n character = data.read(1)\n if len(character) == 0:\n raise bitcoin.core.SerializationTruncationError('Invalid LEB128 integer')\n\n b = ord(character)\n resul... | [
"def getSizedInteger(self, data, byteSize, as_number=False):\n \"\"\"\"\"\"\n result = 0\n if byteSize == 0:\n raise InvalidPlistException(\"Encountered integer with byte size of 0.\")\n # 1, 2, and 4 byte integers are unsigned\n elif byteSize == 1:\n result ... | codesearchnet | {
"query": "Represent the Github comment about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about Computer Science:"
} |
Affiche une page statique
@param array $params Paramètres
@return string HTML | [
"public function afficheFaireUnDon($params = array())\n {\n $html = \"\";\n \n $t = new Template('modules/archi/templates/');\n $t->set_filenames(array('faireUnDon'=>'staticFaireUnDon.tpl'));\n $t->assign_vars(\n array(\n \"lang\"=>LANG\n )\n ... | [
"void writeToFile() throws IOException {\r\n\t\t// on clone le counter avant de le sérialiser pour ne pas avoir de problèmes de concurrences d'accès\r\n\t\tfinal Counter counter = this.clone();\r\n\t\t// on n'écrit pas rootCurrentContextsByThreadId en fichier\r\n\t\t// puisque ces données ne seront plus vraies dans... | codesearchnet | {
"query": "Represent the comment about translation:",
"pos": "Represent the code about translation:",
"neg": "Represent the code:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.