query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"@Override\r\n\tpublic EClass getIfcBuildingElementPart() {\r\n\t\tif (ifcBuildingElementPartEClass == null) {\r\n\t\t\tifcBuildingElementPartEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)\r\n\t\t\t\t\t.getEClassifiers().get(59);\r\n\t\t}\r\n\t\treturn ifcBuildingElementPartEClass;\r\... | [
"protected function _init($definition=null)\n {\n\n if (!is_null($definition)) {\n $this->_packageXml = simplexml_load_string($definition);\n } else {\n $packageXmlStub = <<<END\n<?xml version=\"1.0\"?>\n<package>\n <name />\n <version />\n <stability />\n <license... | codesearchnet | {
"query": "Represent the summarization about Text generation:",
"pos": "Represent the code about Text generation:",
"neg": "Represent the code:"
} |
Helper to visit all the children of a node, in order.
@param node The parent node whose children to visit.
@see #visitChildrenAllowingConcurrentModification | [
"protected void visitChildren(ParentNode<? extends N> node) {\n List<? extends N> children = node.getChildren();\n int size = children.size();\n for (int i = 0; i < size; i++) {\n visit(children.get(i));\n }\n }"
] | [
"public void read(final URI filename, final Document doc) {\n currentFile = filename;\n rootScope = null;\n // TODO: use KeyScope implementation that retains order\n KeyScope keyScope = readScopes(doc);\n keyScope = cascadeChildKeys(keyScope);\n // TODO: determine effective... | codesearchnet | {
"query": "Represent the post about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
Return the path to Module $module, or false
if not found
@param string $module Module name or Namespace
@return string|false | [
"public function getPath($module)\n {\n // treat $module as a namespace\n $class = $module.\"\\\\SlenderModule\";\n\n // Try to find class for path\n if (class_exists($class) ) {\n $reflector = new \\ReflectionClass($class);\n $interfaces = $reflector->getInterfa... | [
"public function reduceFilePath($varValue, \\DataContainer $dc)\n {\n $doc = $dc->activeRecord;\n\n $path = \\FilesModel::findByUuid($varValue)->path;\n\n $arrFileNameParts = \\Document::splitFileName(substr($path, strlen(\\DmsConfig::getBaseDirectory(true))));\n\n // TODO (#33): reset the new fileType... | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Parse a API request path from servlet path info.
@param pathInfo
@return the path info parsed into its component parts | [
"protected static final ApiRequestPathInfo parseApiRequestPath(HttpServletRequest request) {\n return ApimanPathUtils.parseApiRequestPath(request.getHeader(ApimanPathUtils.X_API_VERSION_HEADER),\n request.getHeader(ApimanPathUtils.ACCEPT_HEADER),\n request.getPathInfo());\n }... | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Finds languages by specified locale
@param array $params
@return \Illuminate\Database\Eloquent\Collection | [
"public function findByLocale(array $params = [])\n {\n return (empty($params)) ? $this->fetchAll() : $this->makeModel()->whereIn('code', array_values($params))->get();\n }"
] | [
"public function register()\n {\n $this->registerFileConfig();\n $this->registerDatabaseConfig();\n\n // Bind the concrete types\n $this->app->bind('Concrete\\Core\\Config\\Repository\\Repository', 'config');\n $this->app->bind('Illuminate\\Config\\Repository', 'Concrete\\Core\... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
------------------------------------------------------ window management | [
"public void openWindow(final String title, final int width, final int height, final IsWidget content) {\n closeWindow();\n window = new DefaultWindow(title);\n window.setWidth(480);\n window.setHeight(360);\n window.trapWidget(content.asWidget());\n window.setGlassEnabled(... | [
"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 sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// Desc returns the cleaned description. | [
"func (e Event) Desc(lineEndComment bool, indent, startOffset int) string {\n\tif lineEndComment {\n\t\treturn cleanDescription(e.Description, indent, startOffset)\n\t}\n\treturn lowerFirst(cleanDescription(e.Description, indent, startOffset))\n}"
] | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
// ChannelConn creates a net.Conn over a SSH channel. | [
"func (c *remoteConn) ChannelConn(channel ssh.Channel) net.Conn {\n\treturn utils.NewChConn(c.sconn, channel)\n}"
] | [
"func New(*SmartSampleConfig, log.Logger, dtsink) (*SmartSampler, error) {\n\treturn nil, errors.New(\"you are attempting to configure a regular SignalFx Gateway with the config of a Smart Gateway. This is an unsupported configuration\")\n}"
] | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Returns the association of the two words on a scale of 0 to 1.
@return the assocation or {@code null} if either {@code word1} or {@code
word2} are not in the semantic space | [
"protected Double computeAssociation(SemanticSpace sspace, \n String word1, String word2) {\n Vector v1 = sspace.getVector(word1);\n Vector v2 = sspace.getVector(word2);\n if (v1 == null || v2 == null)\n return null;\n \n // Find t... | [
"def classify(self, term, **kwargs):\n \n term = self._normalize(term)\n if dict.__contains__(self, term):\n return self[term][0].keys()[-1]\n # If the term is not in the dictionary, check the classifiers.\n # Returns the first term in the list returned by a classifier.... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Mix starting with x2, mixing mixing, going towards x1. | [
"def mix(x1,\n x2,\n steps,\n is_training,\n min_prob=0.0,\n max_prob=1.0,\n mode=\"lin\",\n simple=False,\n broadcast_last=False):\n \"\"\"\"\"\"\n with tf.name_scope(\"mix\"):\n if not is_training:\n if max_prob >= 1.0:\n return x1\n al... | [
"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 description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Converts a list into a space-separated string and puts it in a dictionary
:param key: Dictionary key to store the list
:param list_: A list of objects
:return: A dictionary key->string or an empty dictionary | [
"def encode_list(key, list_):\n # type: (str, Iterable) -> Dict[str, str]\n \n if not list_:\n return {}\n return {key: \" \".join(str(i) for i in list_)}"
] | [
"def parse(self, root):\n \"\"\"\"\"\"\n #Use the first element in the versions list since there should only be one.\n v = _get_xml_version(root)[0]\n result = {}\n\n for child in root: \n if child.tag in self.versions[v].entries:\n entry = self.v... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Very simplistic compression method that encodes repeating characters into a smaller character,
so '0000000000' becomes '^0j' where the '^' escapes the next two characters, '0' is the
repeating character, and j encodes 10 repetitions. | [
"public static String compressHexString(String inString) {\r\n String in = inString + \"^\"; // Add this onto the end since the last group of\r\n // characters is always dropped... This carat\r\n // will be dropped from the output string.\r\n StringBuilder out = new StringBuilder();\r\n char lastChar... | [
"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 text:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Run a select statement against the database.
@param string $query
@param array $bindings
@param bool $useReadPdo
@return array | [
"public function select($query, $bindings = array(), $useReadPdo = true)\n\t{\n\t\treturn $this->run($query, $bindings, function($me, $query, $bindings) use ($useReadPdo)\n\t\t{\n\t\t\tif ($me->pretending()) return array();\n\n\t\t\t// For select statements, we'll simply execute the query and return an array\n\t\t\... | [
"public static function _fetch_handler( &$query )\n\t{\n\t\t// because the model is an object we force the fetch\n\t\t// arguments to obj so that we can still make use of\n\t\t// the group by and forward key functions\n\t\t$query->fetch_arguments = array( 'obj' );\n\n\t\t// Run the query and assign the reults\n\t\t... | codesearchnet | {
"query": "Represent the summarization about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about programming:"
} |
removing that same alias [alias] of [indice]
more detail see :
* https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
@param indice
@param alias
@return | [
"public String removeAlias(String indice,String alias){\n\t\tString removeAlias = new StringBuilder().append(\"{\\\"actions\\\": [{\\\"remove\\\": {\\\"index\\\":\\\"\").append(indice).append(\"\\\",\\\"alias\\\": \\\"\").append(alias).append(\"\\\"}}]}\").toString();\n\t\treturn this.client.executeHttp(\"_aliases\... | [
"def forwards(self, orm):\n \"\"\n from avocado.core import backup\n backup.safe_load(u'0002_avocado_metadata', backup_path=None,\n using='default')"
] | codesearchnet | {
"query": "Represent the Github description about Elasticsearch:",
"pos": "Represent the Github code about Elasticsearch:",
"neg": "Represent the Github code:"
} |
Set the current value for a channel. | [
"def set_value(self, string_value):\n \n value = self.validate_value(string_value)\n self._value[self._channel._selected] = value"
] | [
"@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 summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Returns an absolute or relative path url given a path | [
"def get_path_url(path, relative=False):\n \n if relative:\n return os.path.relpath(path)\n else:\n return 'file://%s' % os.path.abspath(path)"
] | [
"def template(self):\n \n\n # First try props\n if self.props.template:\n return self.props.template\n else:\n # Return the wtype of the widget, and we'll presume that,\n # like resources, there's a .html file in that directory\n return self.wt... | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// Run starts the specified command and waits for it to complete. | [
"func (c *Command) Run() *ExecResult {\n\n\t// shell, args := shellAndArgs()\n\tvar bout, berr bytes.Buffer\n\tstreams := &Streams{\n\t\tout: &bout,\n\t\terr: &berr,\n\t}\n\tresult := &ExecResult{\n\t\tfullCommand: c.FullCommand(),\n\t\tstreams: streams,\n\t}\n\tcmd, err := c.buildCmd()\n\tif err != nil {\n\t\t... | [
"function errorAndExit(msg, logMe) {\n // @todo Only trigger if `verbosity > 1`\n if (logMe) {\n // Adding some empty lines before error message for readability\n console.log();\n console.log();\n console.log(logMe);\n }\n error(`Error: ${msg}`);\n\n // There's a few ways to handle exiting\n\n // ... | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
count reads mapping to genes using featureCounts
http://subread.sourceforge.net | [
"def count(data):\n \n in_bam = dd.get_work_bam(data) or dd.get_align_bam(data)\n out_dir = os.path.join(dd.get_work_dir(data), \"align\", dd.get_sample_name(data))\n if dd.get_aligner(data) == \"star\":\n out_dir = os.path.join(out_dir, \"%s_%s\" % (dd.get_sample_name(data), dd.get_aligner(data)... | [
"def prt_qualifiers(self, prt=sys.stdout):\n \"\"\"\"\"\"\n # 13 not colocalizes_with (TBD: CHK - Seen in gene2go, but not gafs)\n # 4 not contributes_to (TBD: CHK - Seen in gene2go, but not gafs)\n self._prt_qualifiers(self.associations, prt)"
] | codesearchnet | {
"query": "Represent the summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// GetInfo sends a HEAD request to an object in the Manta service. This function
// does not return a response body. | [
"func (s *ObjectsClient) GetInfo(ctx context.Context, input *GetInfoInput) (*GetInfoOutput, error) {\n\tabsPath := absFileInput(s.client.AccountName, input.ObjectPath)\n\n\theaders := &http.Header{}\n\tfor key, value := range input.Headers {\n\t\theaders.Set(key, value)\n\t}\n\n\treqInput := client.RequestInput{\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 Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// NewRelocationPath returns a new RelocationPath instance | [
"func NewRelocationPath(FromPath string, ToPath string) *RelocationPath {\n\ts := new(RelocationPath)\n\ts.FromPath = FromPath\n\ts.ToPath = ToPath\n\treturn s\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 summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Add images names to droplist.
@param array $configs
@see https://codex.wordpress.org/Plugin_API/Filter_Reference/image_size_names_choose | [
"public function addImagesDroplist($configs)\n {\n // Add image names\n add_filter('image_size_names_choose', function ($sizes) use ($configs) {\n // New sizes array\n $new_sizes = [];\n\n // Iterate on sizes like:\n // @key => [@width, @height, @crop, @d... | [
"private function define_public_hooks() {\n\n\t\t$plugin_public = new Dynamic_Image_Resizer_Public( $this->get_plugin_name(), $this->get_version() );\n\n\t\t$this->loader->add_action( 'max_srcset_image_width', $plugin_public, 'disable_max_srcset_image_width' );\n\t\t$this->loader->add_action( 'image_downsize', $plu... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
<p>getRemoteRealAddr.</p>
@param realIpHeader a {@link java.lang.String} object.
@return a {@link java.lang.String} object. | [
"public String getRemoteRealAddr(String realIpHeader) {\n String host = getProxyRemoteAddr(realIpHeader);\n if (host == null || host.equals(\"unknown\")) {\n host = getRemoteAddr();\n }\n\n return host;\n }"
] | [
"public java.util.Map<String, java.util.List<String>> getParameters() {\n return parameters;\n }"
] | codesearchnet | {
"query": "Represent the post about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about programming:"
} |
/* static functions
FASTAReader.pos2index
convert DNA base position to character index
@param number pos : DNA base position
@param number prelen : header data length
@param number linelen : one line length
@return number : character index | [
"function pos2index(pos, prelen, linelen) {\n return Number(prelen) + Number(pos) -1 + Math.floor( (pos -1)/linelen );\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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Natural Language Processing:"
} |
Convert an array to a serial string, and then write it to a file.
@param string The path to the file to write
@param array The data to decode
@return void | [
"public static function encodeToFile($path, $array)\n {\n $string = json_encode($array);\n\n static::checkLastError();\n\n # Ensure the directory exists\n $directory = pathinfo($path, \\PATHINFO_DIRNAME);\n if (!is_dir($directory)) {\n mkdir($directory, 0775, true);\... | [
"def parse_formula(formula, byte_stream = false)\n # Build the parse tree for the formula\n tokens = reverse(parse(formula))\n\n # Add a volatile token if the formula contains a volatile function.\n # This must be the first token in the list\n #\n tokens.unshift('_vol') if check_volatile(tokens) !... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Check and set a value in the minion datastore
CLI Example:
.. code-block:: bash
salt '*' data.cas <key> <value> <old_value> | [
"def cas(key, value, old_value):\n '''\n \n '''\n store = load()\n if key not in store:\n return False\n\n if store[key] != old_value:\n return False\n\n store[key] = value\n dump(store)\n return True"
] | [
"def _list_nodes(call=None):\n '''\n \n '''\n local = salt.client.LocalClient()\n ret = local.cmd('salt-cloud:driver:vagrant', 'grains.items', '', tgt_type='grain')\n return ret"
] | codesearchnet | {
"query": "Represent the summarization about SaltStack:",
"pos": "Represent the code about SaltStack:",
"neg": "Represent the code about programming:"
} |
JSON serializer for objects not serializable by default json code | [
"def json_datetime_serial(obj):\n \"\"\"\"\"\"\n if isinstance(obj, (datetime, date)):\n serial = obj.isoformat()\n return serial\n\n if ObjectId is not None and isinstance(obj, ObjectId):\n # TODO: try to use bson.json_util instead\n return str(obj)\n\n raise TypeError(\"Typ... | [
"def path(self, path):\n \"\"\"\"\"\"\n\n # pylint: disable=attribute-defined-outside-init\n self._path = copy_.copy(path)\n\n # The provided path is shallow copied; it does not have any attributes\n # with mutable types.\n\n # We perform this check after the initialization... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Show all messages. | [
"def show_messages(self):\n \"\"\"\"\"\"\n if isinstance(self.static_message, MessageElement):\n # Handle sent Message instance\n string = html_header()\n if self.static_message is not None:\n string += self.static_message.to_html()\n\n # Keep... | [
"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:"
} |
// CreateIdentity creates new identity
// key: registrar private key
// cert: registrar enrollment certificate | [
"func (c *fabricCAAdapter) CreateIdentity(key core.Key, cert []byte, request *api.IdentityRequest) (*api.IdentityResponse, error) {\n\n\tlogger.Debugf(\"Creating identity [%s:%s]\", request.ID, request.Affiliation)\n\n\tvar attributes []caapi.Attribute\n\tfor i := range request.Attributes {\n\t\tattributes = append... | [
"func registerFlags(c *cli.Config, f *flag.FlagSet) {\n\tf.StringVar(&c.CertFile, \"cert\", \"\", \"Client certificate that contains the public key\")\n\tf.StringVar(&c.KeyFile, \"key\", \"\", \"private key for the certificate\")\n\tf.StringVar(&c.CABundleFile, \"ca-bundle\", \"\", \"path to root certificate store\... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
// SetFilterName sets the FilterName field's value. | [
"func (s *SubscriptionFilter) SetFilterName(v string) *SubscriptionFilter {\n\ts.FilterName = &v\n\treturn s\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
@param $ago
@param null $endDateTime
@return array | [
"public static function getMonthsAgo($ago, $endDateTime = null)\n {\n return static::getDateTimeRange(\n Carbon::now()->subMonths($ago)->startOfMonth(),\n $endDateTime ?: Carbon::now()->subMonths($ago)->endOfMonth()\n );\n }"
] | [
"final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}"
] | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
@param $sql
@param array $binds
@return mixed | [
"public function prepareSQL($sql, $binds = [])\n {\n $prepare = $this->getConnection()->prepare($sql);\n\n if (!$prepare) {\n throw new Exception('Cannot prepare statement');\n }\n\n $this->bindBinds($prepare, $binds);\n\n $prepare->setFetchMode(\\PDO::FETCH_OBJ);\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 text about PHP programming:",
"pos": "Represent the code about PHP programming:",
"neg": "Represent the code about programming:"
} |
Get the current value of the iterator
@return object | [
"public function getCurrent()\r\n\t{\r\n\t\tif ( ! $this->iterationStarted || is_null( $this->current ) )\r\n\t\t\tthrow new InvalidOperationException();\r\n\t\treturn $this->current->Current;\r\n\t}"
] | [
"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 sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
@method render
@access public
Envia para o browser o código html
@return void | [
"public function render()\n {\n echo '<!DOCTYPE html>', $this->html->value($this->head)->value($this->body)->render();\n }"
] | [
"def associar_assinatura(self, sequencia_cnpj, assinatura_ac):\n \n retorno = super(ClienteSATLocal, self).\\\n associar_assinatura(sequencia_cnpj, assinatura_ac)\n # (!) resposta baseada na redação com efeitos até 31-12-2016\n return RespostaSAT.associar_assinatura(retorn... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Analyzes the specified JavaScript file.
@param dependency the dependency to analyze.
@param engine the engine that is scanning the dependencies
@throws AnalysisException is thrown if there is an error reading the file
file. | [
"@Override\n public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {\n try {\n final byte[] fileContent = IOUtils.toByteArray(new FileInputStream(dependency.getActualFile()));\n final ScannerFacade scanner = new ScannerFacade(jsRepository);\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:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Returns a {@link ClientBootstrap} instance for the named transport. | [
"@Override\n public synchronized ClientBootstrap newClientBootstrap() throws Exception {\n\n ClientSocketChannelFactory clientChannelFactory = this.clientChannelFactory;\n\n if (clientChannelFactory == null) {\n Executor bossExecutor = executorServiceFactory.newExecutorService(\"boss.cli... | [
"protected SchedulerServer getServer(\n Config runtime, IScheduler scheduler, int port) throws IOException {\n\n // create an instance of the server using scheduler class and port\n return new SchedulerServer(runtime, scheduler, port);\n }"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
build a html list out of given message set.
@param messages set of message strings
@return safe html with massages as list | [
"public static SafeHtml messagesToList(final Set<String> messages) {\n final SafeHtmlBuilder sbList = new SafeHtmlBuilder();\n sbList.appendHtmlConstant(\"<ul>\");\n for (final String message : messages) {\n sbList.appendHtmlConstant(\"<li>\");\n sbList.appendEscaped(message);\n sbList.appen... | [
"def render_flow(self, data):\n \n\n self.render_tree(data)\n\n # then reconstruct a new ODT document with the generated content\n for status in self.__save_output():\n yield status"
] | codesearchnet | {
"query": "Represent the Github text about PHP programming:",
"pos": "Represent the Github code about PHP programming:",
"neg": "Represent the Github code about programming:"
} |
Adds ran database queries to the request
@param Request $request
@return Request | [
"public function resolve(Request $request)\n {\n $request->databaseQueries = array_merge($request->databaseQueries, $this->getDatabaseQueries());\n\n return $request;\n }"
] | [
"@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}"
] | codesearchnet | {
"query": "Represent the sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Programming:"
} |
Step the engine forward by one (or more) step. | [
"def step(self, count=1):\n \"\"\"\"\"\"\n return self._client.send(step=sc_pb.RequestStep(count=count))"
] | [
"def _calculate_index_of_coincidence(frequency_map, length):\n \n if length <= 1:\n return 0\n # We cannot error here as length can legitimiately be 1.\n # Imagine a ciphertext of length 3 and a key of length 2.\n # Spliting this text up and calculating the index of coincidence res... | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Reduce the size of this block
:param int new_size: The new size
:return: None | [
"def shrink(self, new_size):\n \n self.size = new_size\n\n if self.sort == 'string':\n self.null_terminated = False # string without the null byte terminator\n self._content[0] = self._content[0][ : self.size]\n\n elif self.sort == 'pointer-array':\n poin... | [
"def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\""
] | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Determine if an attribute exists on the object.
@param string $key
@return bool | [
"public function __isset($key)\r\n\t{\r\n\t\tif (isset($this->$key) && (!is_null($this->$key))) {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\tif (!isset($this->specificationExtensions[$key])) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn !is_null($this->specificationExtensions[$key]);\r\n\t}"
] | [
"def Call(self, Id=0):\n \n o = Call(self, Id)\n o.Status # Test if such a call exists.\n return o"
] | codesearchnet | {
"query": "Represent the Github comment about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about programming:"
} |
// ------------- | [
"func collections(c *cli.Context) error {\n\tformat := c.String(FormatKey)\n\tif format == \"\" {\n\t\tformat = OutputFormatRaw\n\t}\n\n\tvar log flog.Logger\n\tif format == OutputFormatRaw {\n\t\tlog = flog.NewDefaultRawLogger()\n\t} else if format == OutputFormatJSON {\n\t\tlog = flog.NewDefaultJSONLoger()\n\t} e... | [
"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 sentence about language and writing:",
"pos": "Represent the Github code about language and writing:",
"neg": "Represent the Github code:"
} |
Return an array of user recipients for the given monitorName
@param string $monitorName
@return array | [
"protected function _getUserTo($monitorName)\n {\n switch ($monitorName) {\n case 'maintenancemode':\n $roles = $this->util->getDbLookup()->getRolesByPrivilege('pr.maintenance.maintenance-mode');\n if ($roles) {\n $joins = \"JOIN gems__groups ON ... | [
"def _unlinkUser(self):\n \n KEY = \"linked_contact_uid\"\n\n # Nothing to do if no user is linked\n if not self.hasUser():\n return False\n\n user = self.getUser()\n username = user.getId()\n\n # Unset the UID from the User Property\n user.setMembe... | codesearchnet | {
"query": "Represent the sentence about Transaction Management:",
"pos": "Represent the code about Transaction Management:",
"neg": "Represent the code:"
} |
// Locals fetches all variables of a specific type in the current function scope. | [
"func (scope *EvalScope) Locals() ([]*Variable, error) {\n\tif scope.Fn == nil {\n\t\treturn nil, errors.New(\"unable to find function context\")\n\t}\n\n\tvar vars []*Variable\n\tvar depths []int\n\tvarReader := reader.Variables(scope.BinInfo.dwarf, scope.Fn.offset, reader.ToRelAddr(scope.PC, scope.BinInfo.staticB... | [
"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 Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about Software development:"
} |
// groupFieldsByBuckets groups fields by metric buckets which are represented as tags | [
"func (h *HistogramAggregator) groupFieldsByBuckets(\n\tmetricsWithGroupedFields *[]groupedByCountFields,\n\tname string,\n\tfield string,\n\ttags map[string]string,\n\tcounts []int64,\n) {\n\tcount := int64(0)\n\tfor index, bucket := range h.getBuckets(name, field) {\n\t\tcount += counts[index]\n\n\t\ttags[bucketT... | [
"function _parseVertex(line) {\n var vertex = JSON.parse(line);\n assert.ok(_smellsLikeAnElement(vertex));\n // A vertex is an object, i.e. a key,value map.\n // We don't sort the keys of the object, leaving that to jsonStableStringify below.\n // But a vertex values contain `prop... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
Finds the next available parent-localization in which the node has a translation.
@param string[] $availableLocales
@param Localization $localization The localization to start the search for
@return null|Localization | [
"private function findAvailableParentLocalization(array $availableLocales, Localization $localization)\n {\n do {\n if (in_array($localization->getLocale(), $availableLocales)) {\n return $localization;\n }\n\n // try to load parent and stop if there is no p... | [
"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 instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
<p>
A list of SNS topic names that receive status messages from the specified Directory ID.
</p>
@param eventTopics
A list of SNS topic names that receive status messages from the specified Directory ID. | [
"public void setEventTopics(java.util.Collection<EventTopic> eventTopics) {\n if (eventTopics == null) {\n this.eventTopics = null;\n return;\n }\n\n this.eventTopics = new com.amazonaws.internal.SdkInternalList<EventTopic>(eventTopics);\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 comment:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Set columns option value.
@param array $columns
@return $this
@see https://datatables.net/reference/option/columns | [
"public function columns(array $columns)\n {\n $this->collection = new Collection;\n\n foreach ($columns as $key => $value) {\n if (! is_a($value, Column::class)) {\n if (is_array($value)) {\n $attributes = array_merge(\n [\n ... | [
"static public function area($name, $value=null, $settings=[])\n {\n $name || $name = 'row[area_id]';\n if (!isset($settings['modal_url'])) $settings['modal_url'] = Ioc::url('common/data/select/area');\n \n return static::select($name, $value, $settings);\n }"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Programming:"
} |
validate a private field value | [
"def validatePrivate(self, field, value) :\n \"\"\"\"\"\"\n if field not in self.arangoPrivates :\n raise ValueError(\"%s is not a private field of collection %s\" % (field, self))\n\n if field in self._fields :\n self._fields[field].validate(value)\n return True"
] | [
"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 description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Save the list of coordinates which has been reorganized by the X3D meshCreator
@param values | [
"public void setMeshCreatorInputTexCoords(float[] values) {\n meshCreatorInputTexCoords = new float[ values.length ];\n for (int i = 0; i < values.length; i++) {\n meshCreatorInputTexCoords[i] = values[i];\n }\n }"
] | [
"def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Add menu.
@param int $agentId
@param array $buttons
@return bool | [
"public function add($agentId, array $buttons)\n {\n return $this->parseJSON('json', [self::API_CREATE, ['button' => $buttons], JSON_UNESCAPED_UNICODE, ['agentid' => $agentId]]);\n }"
] | [
"static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}"
] | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Install perforce applications and binaries for mac | [
"def _install_p4v_osx(self, url, overwrite=False):\n \n package_exists = False\n root_dir = os.path.expanduser(os.path.join(\"~\", \"Applications\"))\n package_exists = len([x for x in P4V_APPLICATIONS if os.path.exists(os.path.join(root_dir, x))])\n if not package_exists or overw... | [
"def platform\n # If you are declaring a new platform, you will need to tell\n # Train a bit about it.\n # If you were defining a cloud API, you should say you are a member\n # of the cloud family.\n\n # This plugin makes up a new platform. Train (or rather InSpec) only\n # know how t... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
*************************************************************************
Action buttons + pagination infos | [
"function actionButtons($options = array())\n {\n $default_options = [\n 'buttons_group' => 'list',\n 'model_id' => null,\n 'paginate_infos' => false,\n 'paginate_i... | [
"def check_arrange_act_spacing(self) -> typing.Generator[AAAError, None, None]:\n \n yield from self.check_block_spacing(\n LineType.arrange,\n LineType.act,\n 'AAA03 expected 1 blank line before Act block, found {}',\n )"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// newWorkLoop is a standalone goroutine to submit new mining work upon received events. | [
"func (w *worker) newWorkLoop(recommit time.Duration) {\n\tvar (\n\t\tinterrupt *int32\n\t\tminRecommit = recommit // minimal resubmit interval specified by user.\n\t\ttimestamp int64 // timestamp for each round of mining.\n\t)\n\n\ttimer := time.NewTimer(0)\n\t<-timer.C // discard the initial tick\n\n\t//... | [
"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 text about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Purifies the HTML content by removing malicious code.
@param mixed $content the content to be purified.
@return mixed the purified content | [
"public function purify($content)\n\t{\n\t\tif(is_array($content))\n\t\t\t$content=array_map(array($this,'purify'),$content);\n\t\telse\n\t\t\t$content=$this->getPurifier()->purify($content);\n\t\treturn $content;\n\t}"
] | [
"public function open(array $options = [])\n {\n $method = array_get($options, 'method', 'post');\n\n // We need to extract the proper method from the attributes. If the method is\n // something other than GET or POST we'll use POST since we will spoof the\n // actual method since for... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Get a pages count.
@param int $linesNumber The lines number.
@param int $divider The divider.
@return int Returns the pages count in case of success, -1 otherwise. | [
"public static function getPagesCount($linesNumber, $divider) {\n if ($linesNumber < 0 || $divider < 0) {\n return -1;\n }\n $pagesCount = intval($linesNumber / $divider);\n if (0 < ($linesNumber % $divider)) {\n ++$pagesCount;\n }\n return $pagesCount... | [
"public function end()\n {\n # Calculate the Beginning + The maximum amount of results\n $calc = $this->start() + $this->max;\n\n # Only return this if it is not above the total otherwise return our maximum\n # example, 24 + 6 = 30, but with only 26 reselts it will display the total r... | codesearchnet | {
"query": "Represent the comment about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software Development:"
} |
Returns Lines indexed by modes.
@param string $coverageId
@param type $networkId
@param boolean $commercial if true commercial_modes returned, else physical_modes
@return type | [
"public function findAllLinesByMode($coverageId, $networkId)\n {\n $count = 30;\n $result = $this->navitia_sam->getLines($coverageId, $networkId, 1, $count);\n // no line found for this network\n if (empty($result) || !isset($result->lines)) {\n throw new \\Exception(\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 Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Applies all middleware functions registered against the given
event in order to the given document. | [
"def apply(self, event, document, *args, **kwargs):\n \n for fn in self._handler_dict.get(event, []):\n fn(document, *args, **kwargs)"
] | [
"@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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
Creates a const function that evaluates it's argument to given {@code value}.
@param arg a const value
@return a closure object that does {@code _} | [
"public static MatrixFunction asConstFunction(final double arg) {\n return new MatrixFunction() {\n @Override\n public double evaluate(int i, int j, double value) {\n return arg;\n }\n };\n }"
] | [
"public LHS toLHS( CallStack callstack, Interpreter interpreter)\n throws EvalError\n {\n // loosely typed map expression new {a=1, b=2} are treated\n // as non assignment (LHS) to retrieve Map.Entry key values\n // then wrapped in a MAP_ENTRY type LHS for value assignment.\n r... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Returns an SVG element for a box with two surrounding boxes | [
"function getShapeTwo(x,y,options,modules,mod_matrix){\n\n var EOL = '\\r\\n';\n var width = options.width;\n var height = options.height;\n var length = modules.length;\n var style = options.style;\n var xsize = width / (length + 2 * options.padding);\n var ysize = height / (length + 2 * options.padding);\n... | [
"function (element) {\n $.data(element, \"velocity\", {\n /* Store whether this is an SVG element, since its properties are retrieved and updated differently than standard HTML elements. */\n isSVG: Type.isSVG(element),\n /* Keep track of whether the element i... | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Compile creates a template function
@param {string} tmpl - The html template to compile
@param {object} conf - The configuration to override
@return {function} The template function | [
"function compile(tmpl, conf) {\n const c = Object.assign(\n {},\n settings,\n conf,\n );\n\n const template = new LayoutTemplate({\n conf: c,\n tmpl,\n });\n\n return bracket.compile(\n template.compile(),\n template.conf,\n );\n}"
] | [
"function initCreate (args) {\n // method name is moduleNameCreate\n var methodName = `${this.name}Create`\n // method signature is moduleName.methodname\n var methodSignature = `${this.moduleName}.${methodName}`\n // capture model to pass to function\n var model = this\n // add create method t... | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Set the related model object.
@param \Titon\Model\Model $model
@return $this | [
"public function setRelatedModel(Model $model) {\n $this->_relatedModel = $model;\n $this->setRelatedClass(get_class($model));\n\n return $this;\n }"
] | [
"public function init()\n {\n $this->response->disableLayout();\n $this->userStore = b8\\Store\\Factory::getStore('User');\n }"
] | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
// ErrorLogging returns a Decorator which logs an Exchanger's errors to the given
// logger. | [
"func ErrorLogging(l *log.Logger) Decorator {\n\treturn func(ex Exchanger) Exchanger {\n\t\treturn Func(func(m *dns.Msg, a string) (r *dns.Msg, rtt time.Duration, err error) {\n\t\t\tdefer func() {\n\t\t\t\tif err != nil {\n\t\t\t\t\tl.Printf(\"%v: exchanging %#v with %q\", err, m, a)\n\t\t\t\t}\n\t\t\t}()\n\t\t\tr... | [
"@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 summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// SetSampleRate sets the SampleRate field's value. | [
"func (s *Mp2Settings) SetSampleRate(v float64) *Mp2Settings {\n\ts.SampleRate = &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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// InstallWait specifies whether or not to wait for all resources to be ready | [
"func InstallWait(wait bool) InstallOption {\n\treturn func(opts *options) {\n\t\topts.instReq.Wait = wait\n\t}\n}"
] | [
"protected WsMessageRouterImpl getMessageRouter() {\n if (msgRouter == null) {\n // First activation.\n msgRouter = MessageRouterSingleton.singleton;\n\n // Pass the MessageRouter to the TrService via the TrConfigurator.\n TrConfigurator.setMessageRouter(msgRouter)... | codesearchnet | {
"query": "Represent the Github description about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Build the correct API URL given the store URL provided
@since 2.0 | [
"public function build_api_url() {\n\n\t\t$url = parse_url( $this->store_url );\n\n\t\t// default to http if not provided\n\t\t$scheme = isset( $url['scheme'] ) ? $url['scheme'] : 'http';\n\n\t\t// set host\n\t\t$host = $url['host'];\n\n\t\t// add port to host if provided\n\t\t$host .= isset( $url['port'] ) ? ':' .... | [
"def can_access_api(self):\n \n try:\n version_dict = self.get_version()\n except Exception, e:\n msg = 'An exception was raised when connecting to REST API: \"%s\"'\n raise APIException(msg % e)\n else:\n \"\"\"\n This is an example... | codesearchnet | {
"query": "Represent the Github sentence about Sales Channel API:",
"pos": "Represent the Github code about Sales Channel API:",
"neg": "Represent the Github code about Documentation:"
} |
// SetDocument sets the Document field's value. | [
"func (s *CreateJobInput) SetDocument(v string) *CreateJobInput {\n\ts.Document = &v\n\treturn s\n}"
] | [
"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 post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
////////////////////////////////////////////////////////// | [
"@Override\n public void onPlayerPlay(SoundCloudTrack track, int position) {\n int offset = mHeaderView == null ? 0 : 1;\n mPlayedTrackPosition = position + offset;\n notifyDataSetChanged();\n }"
] | [
"public static function ws()\n {\n if (!isset(self::core()->soap)) {\n //====================================================================//\n // WEBSERVICE INITIALISATION\n //====================================================================//\n // Initial... | codesearchnet | {
"query": "Represent the summarization about language and writing:",
"pos": "Represent the code about language and writing:",
"neg": "Represent the code:"
} |
// Validate inspects the fields of the type to determine if they are valid. | [
"func (s *CreateEventSubscriptionInput) Validate() error {\n\tinvalidParams := request.ErrInvalidParams{Context: \"CreateEventSubscriptionInput\"}\n\tif s.SnsTopicArn == nil {\n\t\tinvalidParams.Add(request.NewErrParamRequired(\"SnsTopicArn\"))\n\t}\n\tif s.SubscriptionName == nil {\n\t\tinvalidParams.Add(request.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 text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
If not already created, a new <code>icon</code> element will be created and returned.
Otherwise, the first existing <code>icon</code> element will be returned.
@return the instance defined for the element <code>icon</code> | [
"public IconType<WebFragmentDescriptor> getOrCreateIcon()\n {\n List<Node> nodeList = model.get(\"icon\");\n if (nodeList != null && nodeList.size() > 0)\n {\n return new IconTypeImpl<WebFragmentDescriptor>(this, \"icon\", model, nodeList.get(0));\n }\n return createIcon();\n }... | [
"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 summarization about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code:"
} |
If any scan operations register a failure, sys.exit(1) is called
to allow build to register a failure | [
"def process_failure(project):\n \n if failure:\n lists = get_lists.GetLists()\n report_url = lists.report_url(project)\n if report_url:\n print(report_url)\n sys.exit(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 Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
A user-defined value to be used instead of the value of class
constant `INIT`.
See the main documentation on class |SolverParameter| for more
information. | [
"def alternative_initvalue(self) -> Union[bool, int, float]:\n \n if self._alternative_initvalue is None:\n raise AttributeError(\n f'No alternative initial value for solver parameter '\n f'{objecttools.elementphrase(self)} has been defined so far.')\n e... | [
"def scopes(cls):\n \n # Why do we need this? This should either\n # * Be bubbled to the places where it is used (AcidXBlock).\n # * Be automatic. Look for all members of a type.\n return [cls.USAGE, cls.DEFINITION, cls.TYPE, cls.ALL]"
] | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Switch statement
@return string $this->__cached | [
"private function mswitch()\n\t{\n\t\t$this->__cached = preg_replace($this->usingDirective('switch', true), '<?php switch ($1) : ?>', $this->__cached);\n\t\t$this->__cached = preg_replace($this->usingDirective('endswitch'), '<?php endswitch ;?>', $this->__cached);\n\t}"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github summarization about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
Gets oidc max age from authorization request.
@param context the context
@return the oidc max age from authorization request | [
"@SneakyThrows\n public static Optional<Long> getOidcMaxAgeFromAuthorizationRequest(final WebContext context) {\n val builderContext = new URIBuilder(context.getFullRequestURL());\n val parameter = builderContext.getQueryParams()\n .stream().filter(p -> OidcConstants.MAX_AGE.equals(p.get... | [
"func (r *MintOAuthTokenGrantRPC) validateRequest(c context.Context, req *minter.MintOAuthTokenGrantRequest, caller identity.Identity) (*Rule, error) {\n\t// Dump the whole request and relevant auth state to the debug log.\n\tr.logRequest(c, req, caller)\n\n\t// Reject obviously bad requests.\n\tif err := r.checkRe... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Access control:"
} |
Simulates R.view with a lens_path since we don't have lens functions
:param lens_path: Array of string paths
:param obj: Object containing the given path
:return: The value at the path or None | [
"def fake_lens_path_view(lens_path, obj):\n \n segment = head(lens_path)\n return if_else(\n both(lambda _: identity(segment), has(segment)),\n # Recurse on the rest of the path\n compose(fake_lens_path_view(tail(lens_path)), getitem(segment)),\n # Give up\n lambda _: Non... | [
"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 instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
dao or entity can be null.
@param dao
the dao
@param entity
the entity
@return the string | [
"public static String generateEntityName(SQLiteDaoDefinition dao, SQLiteEntity entity) {\n\t\tString entityName;\n\t\tif (entity == null) {\n\t\t\tM2MEntity m2mEntity = M2MEntity.extractEntityManagedByDAO(dao.getElement());\n\t\t\tentityName = m2mEntity.getSimpleName();\n\t\t} else {\n\t\t\tentityName = entity.getS... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Recursively count the number of nodes in the given tree model,
starting with the given node
@param treeModel The tree model
@param node The node
@return The number of nodes | [
"private static int countNodes(TreeModel treeModel, Object node)\r\n {\r\n int sum = 1;\r\n int n = treeModel.getChildCount(node);\r\n for (int i=0; i<n; i++)\r\n {\r\n sum += countNodes(treeModel, treeModel.getChild(node, i));\r\n }\r\n return sum;\r\n }"
... | [
"function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff... | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
*********************************************************************************** | [
"@Override\n\tpublic void propagate(int evtmask) throws ContradictionException {\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 0; j < n; j++) {\n\t\t\t\tif (g.getMandSuccOrNeighOf(i).contains(j)) {\n\t\t\t\t\tmatrix[i][j].setToTrue(this);\n\t\t\t\t} else if (!g.getPotSuccOrNeighOf(i).contains(j)) {\n\t\t\t... | [
"private void populateMilestone(Row row, Task task)\n {\n task.setMilestone(true);\n //PROJID\n task.setUniqueID(row.getInteger(\"MILESTONEID\"));\n task.setStart(row.getDate(\"GIVEN_DATE_TIME\"));\n task.setFinish(row.getDate(\"GIVEN_DATE_TIME\"));\n //PROGREST_PERIOD\n //SYMBO... | codesearchnet | {
"query": "Represent the Github description about N/A:",
"pos": "Represent the Github code about N/A:",
"neg": "Represent the Github code about Data management:"
} |
// SetName sets the Name field's value. | [
"func (s *ConfigurationSet) SetName(v string) *ConfigurationSet {\n\ts.Name = &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 comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Get the cities from a zipCode
REST: GET /xdsl/eligibility/cities
@param zipCode [required] The zipCode of the city
@deprecated | [
"public ArrayList<OvhCity> eligibility_cities_GET(String zipCode) throws IOException {\n\t\tString qPath = \"/xdsl/eligibility/cities\";\n\t\tStringBuilder sb = path(qPath);\n\t\tquery(sb, \"zipCode\", zipCode);\n\t\tString resp = exec(qPath, \"GET\", sb.toString(), null);\n\t\treturn convertTo(resp, t2);\n\t}"
] | [
"def process(self, candidates):\n \n for c in candidates[:]:\n if c.locator not in self.good_locators:\n # TODO: search string, i.e. find \"EU_Street_Name\" in \"EU_Street_Name.GBR_StreetName\"\n candidates.remove(c)\n\n return candidates"
] | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
根据九宫格添加图片
@param $image
@param int $direction
@param int $opacity
@return bool | [
"public function addImageByDirection($image, $direction = self::Top, $opacity = 50) {\n\t\tlist($x, $y) = $this->getPointByDirection($direction);\n\t\treturn $this->addImage($image, $x, $y, $opacity);\n\t}"
] | [
"static function position($name, $value=null, $settings=[])\n {\n if (!isset($settings['description'])) {\n $settings['description'] = '位置可设为:1到9的数字表示九宫格的位置, 或100|30, 或 center|center, 或100|left';\n }\n \n return static::input('text', $name, $value, $settings);\n }"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Marshall the given parameter object. | [
"public void marshall(ListResourcesForWebACLRequest listResourcesForWebACLRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (listResourcesForWebACLRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protoc... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github summarization about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Method to get the field options.
@return array The field option objects.
@since 11.1 | [
"protected function getOptions()\n {\n $options = array();\n\n foreach ($this->getModuleServices() as $module)\n {\n // Create a new option object based on the <option /> element.\n $tmp = \\JHtml::_(\n 'select.option', $module,\n \\JText::... | [
"private function getApiOptionsDeclaration()\n {\n\n // we got a max instances allowed in normality tags\n $apiOptions = json_encode( $this->apiOptions );\n $apiOptions = Php::varExport( $apiOptions, true );\n\n $this->class->classComponents[] = new VariableDeclaration(\n '... | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Provides a substring with collection name.
@param id
string consisting of concatenation of collection name, /, & _key.
@return collection name (or null if no key delimiter is present) | [
"public static String determineCollectionFromId(final String id) {\n\t\tfinal int delimiter = id.indexOf(KEY_DELIMITER);\n\t\treturn delimiter == -1 ? null : id.substring(0, delimiter);\n\t}"
] | [
"def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)"
] | codesearchnet | {
"query": "Represent the Github comment about Documentation:",
"pos": "Represent the Github code about Documentation:",
"neg": "Represent the Github code:"
} |
DOCUMENT ME!
@param rect DOCUMENT ME!
@param horizontal DOCUMENT ME!
@return DOCUMENT ME! | [
"private Rectangle extendRect(Rectangle rect, boolean horizontal) {\n if (rect == null) {\n return rect;\n }\n\n if (horizontal) {\n rect.x = 0;\n rect.width = table.getWidth();\n } else {\n rect.y = 0;\n\n if (table.getRowCount(... | [
"def emit_end(MEMORY=None):\n \n output = []\n output.extend(AT_END)\n\n if REQUIRES.intersection(MEMINITS) or '__MEM_INIT' in INITS:\n output.append(OPTIONS.heap_start_label.value + ':')\n output.append('; Defines DATA END\\n' + 'ZXBASIC_USER_DATA_END EQU ZXBASIC_MEM_HEAP + ZXBASIC_HEAP_S... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Marshall the given parameter object. | [
"public void marshall(PutItemRequest putItemRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (putItemRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(putItemRequest.getTable... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Load data from Vatsim network.
@return bool | [
"public function loadData()\n {\n try {\n LoggerFactory::$file = $this->config['logFile'];\n LoggerFactory::$level = $this->config['logLevel'];\n $data = $this->getDataSync();\n $data->setDefaults();\n $data->cacheDir = $this->config['cacheDir'];\n ... | [
"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 sentence about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about Software development:"
} |
Defines where to put the dictionary output of the extractor in the doc, but renames
the fields of the extracted output for the document or just filters the keys | [
"def set_output_fields(self, output_fields):\n \"\"\"\"\"\"\n if isinstance(output_fields, dict) or isinstance(output_fields, list):\n self.output_fields = output_fields\n elif isinstance(output_fields, basestring):\n self.output_field = output_fields\n else:\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 Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// Set safely sets a value on the Instance's storage. | [
"func (c *Controller) Set(key, val interface{}) {\n\tc.instance.StorageMu.Lock()\n\tc.instance.Storage[key] = val\n\tc.instance.StorageMu.Unlock()\n}"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github description about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Log things with the global logger. | [
"def log(*args, **kwargs):\n \"\"\"\"\"\"\n level = kwargs.pop('level', logging.INFO)\n logger.log(level, *args, **kwargs)"
] | [
"@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Encryption primitive | [
"def cipher (self, xl, xr, direction):\n \"\"\"\"\"\"\n if direction == self.ENCRYPT:\n for i in range (16):\n xl = xl ^ self.p_boxes[i]\n xr = self.__round_func (xl) ^ xr\n xl, xr = xr, xl\n xl, xr = xr, xl\n xr = xr ^ self... | [
"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 post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Assembles input string, and leave the result in the
MEMORY global object | [
"def assemble(input_):\n \n global MEMORY\n\n if MEMORY is None:\n MEMORY = Memory()\n\n parser.parse(input_, lexer=LEXER, debug=OPTIONS.Debug.value > 2)\n if len(MEMORY.scopes):\n error(MEMORY.scopes[-1], 'Missing ENDP to close this scope')\n\n return gl.has_errors"
] | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Set avatar
@param string $avatar
@return \User\Model\User\Structure | [
"public function setAvatar( $avatar )\n {\n if ( $this->avatar == $avatar )\n {\n return $this;\n }\n\n $this->removeFile( $this->avatar );\n $this->avatar = $this->addFile( $avatar, 'users/avatar.%s.%s' );\n\n return $this;\n }"
] | [
"public function initServices() {\n $this->getFrontController()->getRequestHandler()->addService($entityService = $this->getEntityService());\n \n // wir mappen den users controller auf den in Psc\n $entityService->setControllerClass('User', 'Psc\\CMS\\Controller\\UserEntityController');\n }"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Gets all the one to one relationships for a model in an array keyed by the column name in the source model.
@param $modelClassName
@return OneToOne[] | [
"public static function getAllOneToOneRelationshipsForModelBySourceColumnName($modelClassName)\n {\n $relationships = self::getAllRelationshipsForModel($modelClassName);\n $columnRelationships = [];\n\n foreach ($relationships as $relationship) {\n if ($relationship instanceof One... | [
"public function addConstraints()\n {\n if (static::$constraints)\n {\n // Get the parent node's placeholder.\n $parentNode = $this->query->getQuery()->modelAsNode($this->parent->getTable());\n // Tell the query that we need the morph model and the relationship repr... | codesearchnet | {
"query": "Represent the text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Return the inventory ended items view.
@return \Illuminate\View\View | [
"public function getEnded()\n {\n $items = Auth::user()->items()->where('end_date', '<', time());\n\n $table = new InventoryEnded($items);\n\n return view('mustard::inventory.ended', [\n 'table' => $table,\n 'items' => $table->paginate(),\n ]);\n }"
] | [
"public function handle(PublishThePost $event) {\n $this->sendEmailsFromList->sendEmails($event->data['id']['listID'], $event->data['id']);\n \\Log::info('Lasallecms\\Lasallecmsapi\\Listeners\\TriggerLaSalleCRMList listener completed');\n }"
] | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
return active end value.
@return float | [
"public function GetActiveEndValue()\n {\n $sEndValue = false;\n if (is_array($this->aActiveFilterData) && array_key_exists(self::URL_PARAMETER_FILTER_END_VALUE, $this->aActiveFilterData)) {\n $sEndValue = $this->aActiveFilterData[self::URL_PARAMETER_FILTER_END_VALUE];\n }\n\n ... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// NewBindTransmitter creates a new Bind PDU. | [
"func NewBindTransmitter() Body {\n\tb := newBind(&Header{ID: BindTransmitterID})\n\tb.init()\n\treturn b\n}"
] | [
"@Override\n public void init(TCPWriteRequestContext x, H2MuxTCPWriteCallback c) {\n writeReqContext = x;\n muxCallback = c;\n\n // callback will need to know how to get back to this write queue.\n // This means one and only one H2WriteTree per H2InboundLink which has just one true TC... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Update state of working set
@private | [
"function _updateWorkingSetState() {\n if (MainViewManager.getPaneCount() === 1 &&\n MainViewManager.getWorkingSetSize(MainViewManager.ACTIVE_PANE) === 0) {\n $workingSetViewsContainer.hide();\n $gearMenu.hide();\n } else {\n $workingSetViewsContainer.sh... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Yield samples as dictionaries, keyed by dimensions. | [
"def samples(self):\n \"\"\"\"\"\"\n names = self.series.dimensions\n for n, offset in enumerate(self.series.offsets):\n dt = datetime.timedelta(microseconds=offset * 1000)\n d = {\"ts\": self.ts + dt}\n for name in names:\n d[name] = getattr(self... | [
"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 post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
xdis.marshal.load() but with its dispatch load_code() function replaced
with our decoding version. | [
"def loads(s):\n \n um = xmarshal._FastUnmarshaller(s)\n um.dispatch[xmarshal.TYPE_CODE] = load_code\n return um.load()"
] | [
"def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Helper function to remove resources.
:param path: the path for the unwanted resource
:rtype : the removed object | [
"def remove_resource(self, path):\n \n\n path = path.strip(\"/\")\n paths = path.split(\"/\")\n actual_path = \"\"\n i = 0\n for p in paths:\n i += 1\n actual_path += \"/\" + p\n try:\n res = self.root[actual_path]\n except Key... | [
"def add_reference(self, reftype: str, label: str, target):\n \n\n # The self.data[reftype] dict springs into being during the\n # register_references event handler at startup, which looks in the\n # kb registry for all registered reference names.\n self.data[reftype][label] = tar... | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.