query stringlengths 16 255 | pos list | neg list | task stringclasses 1
value | instruction dict |
|---|---|---|---|---|
/*
(non-Javadoc)
@see javax.persistence.metamodel.ManagedType#getSet(java.lang.String) | [
"@Override\n public SetAttribute<? super X, ?> getSet(String paramName)\n {\n PluralAttribute<? super X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName);\n\n if (isSetAttribute(declaredAttrib))\n {\n return (SetAttribute<X, ?>) declaredAttrib;\n }\n\n ... | [
"@Override\n\tpublic void visit(SQLProperty kriptonProperty) {\n\t\t// @formatter:off\n\t\tFieldSpec fieldSpec = FieldSpec\n\t\t\t\t.builder(String.class, \"COLUMN_\" + columnNameToUpperCaseConverter.convert(kriptonProperty.getName()),\n\t\t\t\t\t\tModifier.PUBLIC, Modifier.STATIC, Modifier.FINAL)\n\t\t\t\t.initial... | codesearchnet | {
"query": "Represent the Github description about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Returns data dictionary from training.pkl | [
"def training_data(self):\n \n\n data = pickle.load(open(os.path.join(self.repopath, 'training.pkl')))\n return data.keys(), data.values()"
] | [
"def requests(self):\n ''''''\n path = pathjoin(self.path, self.name, Request.path)\n response = self.service.send(SRequest('GET', path))\n # a bin behaves as a push-down store --- better to return the requests\n # in order of appearance\n return list(reversed(Request.from_... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
@param TenantInterface|null $tenant
@param TokenStorageInterface|null $tokenStorage
@return void | [
"private function setTenant(?TenantInterface $tenant, ?TokenStorageInterface $tokenStorage): void\n {\n if ($tenant !== null) {\n $this->tenant = $tenant;\n } elseif ($tokenStorage !== null) {\n $token = $tokenStorage->getToken();\n\n if ($token !== null) {\n ... | [
"public function addFromRequest(Type $type, Request $request)\n {\n $key = parent::addFromRequest($type, $request);\n /*\n * @var ExpressKey\n */\n $key->setEntity($this->expressEntity);\n\n return $key;\n }"
] | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software Development:"
} |
// GetFloat returns the value of the specified key as a float64, or returns an error | [
"func (m Metadata) GetFloat(key string) (*float64, error) {\n\tval, ok := m[key]\n\tif !ok {\n\t\treturn nil, ErrMetadataNonexistantKey\n\t}\n\tif val.Type != MetadataValueTypeFloat {\n\t\treturn nil, ErrMetadataUnexpectedValueType\n\t}\n\tout, _ := val.Value.(float64)\n\treturn &out, nil\n}"
] | [
"public static Double toDouble(Number self) {\n // Conversions in which all decimal digits are known to be good.\n if ((self instanceof Double)\n || (self instanceof Long)\n || (self instanceof Integer)\n || (self instanceof Short)\n || (self... | codesearchnet | {
"query": "Represent the sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Print method for devices. | [
"def print_devices(self, devices):\n \n for device in devices:\n print('ID: {} OS: {} IP: {} State: {} ({}) Tags: {}'\n .format(device.id,\n device.operating_system.slug,\n self.get_public_ip(device.ip_addresses),\n ... | [
"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:"
} |
<!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"@SuppressWarnings(\"unchecked\")\r\n\tpublic EList<Double> getOffsetDistances() {\r\n\t\treturn (EList<Double>) eGet(Ifc2x3tc1Package.Literals.IFC_VIRTUAL_GRID_INTERSECTION__OFFSET_DISTANCES, true);\r\n\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 instruction about Text generation:",
"pos": "Represent the code about Text generation:",
"neg": "Represent the code:"
} |
Convert types from GL constants.
@param type The GL constant.
@return The value. | [
"public static JCGLType typeFromGL(\n final int type)\n {\n switch (type) {\n case GL2ES2.GL_BOOL:\n return JCGLType.TYPE_BOOLEAN;\n case GL2ES2.GL_BOOL_VEC2:\n return JCGLType.TYPE_BOOLEAN_VECTOR_2;\n case GL2ES2.GL_BOOL_VEC3:\n return JCGLType.TYPE_BOOLEAN_VECTOR_3;\n ... | [
"def element_type(self):\n \n result = conf.lib.clang_getElementType(self)\n if result.kind == TypeKind.INVALID:\n raise Exception('Element type not available on this type.')\n\n return result"
] | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// notifySignals swallows a bunch of signals that get sent to us when running into
// an error from HAproxy. If we didn't swallow these, the process would potentially
// stop when the signals are propagated by the sub-shell. | [
"func (h *HAproxy) swallowSignals() {\n\t// from HAproxy which propagate.\n\tsigChan := make(chan os.Signal, 10)\n\n\t// Used to stop the goroutine\n\th.sigStopChan = make(chan struct{})\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-sigChan:\n\t\t\t\t// swallow signal\n\t\t\tcase <-h.sigStopChan:\n\t\t\... | [
"def _shutdown_broker(self):\n \n if self.broker:\n self.broker.shutdown()\n self.broker.join()\n self.broker = None\n self.router = None\n\n # #420: Ansible executes \"meta\" actions in the top-level process,\n # meaning \"reset_connec... | codesearchnet | {
"query": "Represent the Github sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Convert any type into an exception
@param $error
@return \Exception|string | [
"public function decorateException($error)\n {\n $application = $this->application;\n\n if (is_callable($error)) {\n $error = $application->getContainer()->call($error, [$application]);\n }\n\n if (is_object($error) && !($error instanceof \\Exception)) {\n $error... | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Set the isolation level for the current transacion and ensure
that it has not changed within the transaction. | [
"protected void setIsolationLevel(int isolationLevel)\n throws IsolationLevelChangeException\n {\n if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())\n {\n Tr.event(tc, \"current isolation level = \"\n + MethodAttribUtils.getIsolat... | [
"def do_threaded_dispatch(participant, msg)\n\n msg = Rufus::Json.dup(msg)\n #\n # the thread gets its own copy of the message\n # (especially important if the main thread does something with\n # the message 'during' the dispatch)\n\n # Maybe at some point a limit on the number... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// fsFAllocate is similar to Fallocate but provides a convenient
// wrapper to handle various operating system specific errors. | [
"func fsFAllocate(fd int, offset int64, len int64) (err error) {\n\te := Fallocate(fd, offset, len)\n\t// Ignore errors when Fallocate is not supported in the current system\n\tif e != nil && !isSysErrNoSys(e) && !isSysErrOpNotSupported(e) {\n\t\tswitch {\n\t\tcase isSysErrNoSpace(e):\n\t\t\terr = errDiskFull\n\t\t... | [
"func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Utility function used to create the curl object with common settings. | [
"protected function createRawCurl($request_method, $url, $body = null, $content_type = null, $jwt = null, $encode_json = false)\n {\n // Create or reuse existing curl handle\n if (null === $this->ch) {\n $this->ch = curl_init();\n }\n\n if ($this->ch === false) {\n ... | [
"public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes)\n {\n // TODO Actually use session\n // Session will be used to provide information about the order of function namespaces to through resolving the function.\n // This is l... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
Reset all cache.
@param string $path
@return \Transit\File | [
"public function reset($path = '') {\n clearstatcache();\n\n $this->_cache = array();\n\n if ($path) {\n $this->_data['name'] = basename($path);\n $this->_path = $path;\n }\n\n return $this;\n }"
] | [
"public function logBanner($additions = null)\n {\n $this->addStatusMessage('FlexiBee '.str_replace('://',\n '://'.$this->user.'@', $this->getApiUrl()).' FlexiPeeHP v'.self::$libVersion.' (FlexiBee '.EvidenceList::$version.') EasePHP Framework v'.\\Ease\\Atom::$frameworkVersion.' '.$additio... | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Uses a regular expression to extract a key
and value from the line.
@param {string} line
@returns {{key: undefined, value: undefined}} | [
"function extractKeyValue (line) {\n var kv = {\n key: undefined,\n value: undefined,\n };\n\n var matches = kvRE.exec(line);\n if (matches !== null && matches.length === 3) {\n kv.key = matches[1];\n kv.value = matches[2];\n }\n\n return kv;\n}"
] | [
"def wrap_embedded_keyvalue(self, data):\n \n if data is not None:\n try:\n data = u'{}'.format(data)\n # variables = re.findall(self._vars_keyvalue_embedded, u'{}'.format(data))\n except UnicodeEncodeError:\n # variables = re.findall(... | codesearchnet | {
"query": "Represent the Github instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Programming:"
} |
// SetVersion sets the tools version associated with
// the given application. | [
"func (c *Client) SetVersion(appName string, v version.Binary) error {\n\tif !names.IsValidApplication(appName) {\n\t\treturn errors.NotValidf(\"application name %q\", appName)\n\t}\n\tvar results params.ErrorResults\n\targs := params.EntitiesVersion{\n\t\tAgentTools: []params.EntityVersion{{\n\t\t\tTag: names.Ne... | [
"@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 Github instruction about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// ResultInt64 sets the result of an SQL function.
// See: sqlite3_result_int64, http://sqlite.org/c3ref/result_blob.html | [
"func (c *SQLiteContext) ResultInt64(i int64) {\n\tC.sqlite3_result_int64((*C.sqlite3_context)(c), C.sqlite3_int64(i))\n}"
] | [
"func Iso88591ToUTF8(db XODB, v0 int, v1 int, v2 pgtypes.Cstring, v3 pgtypes.Internal, v4 int) error {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.iso8859_1_to_utf8($1, $2, $3, $4, $5)`\n\n\t// run query\n\tXOLog(sqlstr)\n\t_, err = db.Exec(sqlstr)\n\treturn err\n}"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Retrieves the size of the file-like object.
Returns:
int: size of the file-like object data.
Raises:
IOError: if the file-like object has not been opened.
OSError: if the file-like object has not been opened. | [
"def get_size(self):\n \n if not self._is_open:\n raise IOError('Not opened.')\n\n if not hasattr(self._file_object, 'get_size'):\n if not self._size:\n current_offset = self.get_offset()\n self.seek(0, os.SEEK_END)\n self._size = self.get_offset()\n self.seek(current_... | [
"def is_pathname_valid(pathname: str) -> bool:\n \n # If this pathname is either not a string or is but is empty, this pathname\n # is invalid.\n try:\n if not isinstance(pathname, str) or not pathname:\n return False\n\n # Strip this pathname's Windows-specific drive specifier ... | codesearchnet | {
"query": "Represent the Github post about File management:",
"pos": "Represent the Github code about File management:",
"neg": "Represent the Github code about programming:"
} |
Cancels all the pending & running requests and releases all the dispatchers. | [
"void release() {\n\t\tif (mCurrentRequests != null) {\n\t\t\tsynchronized (mCurrentRequests) {\n\t\t\t\tmCurrentRequests.clear();\n\t\t\t\tmCurrentRequests = null;\n\t\t\t}\n\t\t}\n\n\t\tif (mDownloadQueue != null) {\n\t\t\tmDownloadQueue = null;\n\t\t}\n\n\t\tif (mDownloadDispatchers != null) {\n\t\t\tstop();\n\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 about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Get the named method from the class
@param c The class to get the method from
@param name The method name
@param argTypes The argument types
@return The method | [
"public static <T> Method getMethod(Class<T> c, String name, Class<?>... argTypes) {\n try {\n return c.getMethod(name, argTypes);\n } catch(NoSuchMethodException e) {\n throw new IllegalArgumentException(e);\n }\n }"
] | [
"def reset ():\n \n global __prefixes_suffixes, __suffixes_to_types, __types, __rule_names_to_types, __target_suffixes_cache\n\n __register_features ()\n\n # Stores suffixes for generated targets.\n __prefixes_suffixes = [property.PropertyMap(), property.PropertyMap()]\n\n # Maps suffixes to types... | codesearchnet | {
"query": "Represent the post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
A single name according to gender parameter | [
"def name(gender = :any)\n case gender\n when :any then rand(0..1) == 0 ? name(:male) : name(:female)\n when :male then fetch_sample(MALE_FIRST_NAMES)\n when :female then fetch_sample(FEMALE_FIRST_NAMES)\n else raise ArgumentError, 'Invalid gender, must be one of :any, :male, :female'\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 instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Array objectivity check
True if array is objective, False if array is sequential or have only number keys
@param $arr
@return bool | [
"protected static function isArrayObject($arr)\n {\n foreach(array_keys($arr) as $key) {\n if (!is_int($key)) {\n return true;\n }\n }\n\n return false;\n }"
] | [
"function run(booleanOrString, anyDataType, functionOrObject, aNumber, anArray) {\n /*\n * if expectations aren't met, args checker will throw appropriate exceptions\n * notifying the user regarding the errors of the arguments.\n * */\n \targs.expect(arguments, ['boolean|string', '*',... | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
r"""Actually lints some file contents.
relative_path_to_file should contain the relative path to the file being
linted from the root source directory. Contents should be a raw string
with \n's. | [
"def lint(relative_path_to_file,\n contents,\n linter_functions,\n **kwargs):\n \n \"\"\"\n lines = contents.splitlines(True)\n\n errors = list()\n for (code, info) in linter_functions.items():\n error = info.function(relative_path_to_file, lines, kwargs)\n if er... | [
"def file_or_token(value):\n \n if isfile(value):\n with open(value) as fd:\n return fd.read().strip()\n\n if any(char in value for char in '/\\\\.'):\n # This chars will never be in a token value, but may be in a path\n # The error message will be handled by the parser\n ... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Execute an action
@param string|Action $action Action classname or object
@param array $options Action options
@return Form | [
"public function action($action, $options = [])\n {\n if ($this->shouldValidate) $this->validate();\n if ($this->shouldCallGuard) $this->guard();\n if ($this->shouldFallThrough) return $this;\n\n if (is_string($action) && !class_exists($action)) {\n throw new Exception(\"{$... | [
"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 post about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
// ------------------------------------------------ | [
"func InitMossStore(config map[string]interface{}, options moss.CollectionOptions) (\n\tmoss.Snapshot, moss.LowerLevelUpdate, store.KVStore, statsFunc, error) {\n\tpath, ok := config[\"path\"].(string)\n\tif !ok {\n\t\treturn nil, nil, nil, nil, fmt.Errorf(\"lower: missing path for InitMossStore config\")\n\t}\n\ti... | [
"public void setHeader(String name, String s) {\n if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15\n logger.logp(Level.FINE, CLASS_NAME,\"setHeader\", \" name --> \" + name + \" value --> \" + PasswordNullifier.nullifyParams(s), \"[\"+this+\"... | codesearchnet | {
"query": "Represent the description about language and writing:",
"pos": "Represent the code about language and writing:",
"neg": "Represent the code about Programming:"
} |
// SetPolicies sets the Policies field's value. | [
"func (s *ListPoliciesOutput) SetPolicies(v []*Policy) *ListPoliciesOutput {\n\ts.Policies = 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 sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
// Draw returns visual representation of the bitboard useful for debugging. | [
"func (b bitboard) Draw() string {\n\ts := \"\\n A B C D E F G H\\n\"\n\tfor r := 7; r >= 0; r-- {\n\t\ts += Rank(r).String()\n\t\tfor f := 0; f < numOfSquaresInRow; f++ {\n\t\t\tsq := getSquare(File(f), Rank(r))\n\t\t\tif b.Occupied(sq) {\n\t\t\t\ts += \"1\"\n\t\t\t} else {\n\t\t\t\ts += \"0\"\n\t\t\t}\n\t\t\ts +=... | [
"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 summarization about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
Specify/get _isStraight flag value
@param bool $flag
@return bool | [
"public function isStraight($flag = null)\n {\n if ($flag !== null) {\n $this->_isStraight = $flag;\n }\n return $this->_isStraight;\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Constructor, attaching JAX-RX to the specified server.
@param s
server instance | [
"public static void register(final Server s) {\n final ServletHolder sh = new ServletHolder(ServletContainer.class);\n sh.setInitParameter(\"com.sun.jersey.config.property.resourceConfigClass\",\n \"com.sun.jersey.api.core.PackagesResourceConfig\");\n sh.setInitParameter(\"com.sun.je... | [
"public H2StreamProcessor startNewInboundSession(Integer streamID) {\n H2StreamProcessor h2s = null;\n h2s = muxLink.createNewInboundLink(streamID);\n return h2s;\n // call the stream processor with the data it needs to then call \"ready\" are the underlying HttpInboundLink\n // (... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Get all generators for the given entity
@param mixed $referenceable the object on which the generator should be
applied
@return null|ReferenceGeneratorInterface | [
"public function findAll(ReferenceableInterface $referenceable) {\n $generators = new ReferenceGeneratorCollection();\n \n foreach( $this->generators->all() as $generator ) {\n if( $generator->canHandle($referenceable) ) {\n $generators->add($generator);\n }... | [
"public function hintJsonStructure($column, $structure)\n {\n if (json_decode($structure) === null) {\n throw new InvalidJsonException();\n }\n\n $this->hintedJsonAttributes[$column] = $structure;\n\n // Run the call to add hinted attributes to the internal json\n //... | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software Development:"
} |
Given a path and options for a format (ext, suffix, prefix), return the corresponding base path | [
"def base_path(main_path, fmt):\n \"\"\"\"\"\"\n if not fmt:\n return os.path.splitext(main_path)[0]\n\n fmt = long_form_one_format(fmt)\n fmt_ext = fmt['extension']\n suffix = fmt.get('suffix')\n prefix = fmt.get('prefix')\n\n base, ext = os.path.splitext(main_path)\n if ext != fmt_e... | [
"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:"
} |
Uses an array of filters and applies them to the query.
@param array $filterArray
@return $this | [
"public function useFilterArray(array $filterArray)\n {\n foreach ($filterArray as $key => $additionalFilter) {\n $this->useFilter($additionalFilter, $key);\n }\n\n return $this;\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 text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
// The following methods are required to implement pflag Value interface.
// Set sets the time quantum value. | [
"func (q *TimeQuantum) Set(value string) error {\n\t*q = TimeQuantum(value)\n\treturn nil\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 summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Load strain GEMPRO with functional genes defined, load sequences to it, save as new GEMPRO | [
"def _load_sequences_to_strain(self, strain_id, force_rerun=False):\n \"\"\"\"\"\"\n gp_seqs_path = op.join(self.model_dir, '{}_gp_withseqs.pckl'.format(strain_id))\n\n if ssbio.utils.force_rerun(flag=force_rerun, outfile=gp_seqs_path):\n gp_noseqs = ssbio.io.load_pickle(self.strain_... | [
"def surface(self, canvas, X, Y, Z, color=None, label=None, **kwargs):\n \n raise NotImplementedError(\"Implement all plot functions in AbstractPlottingLibrary in order to use your own plotting library\")"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Get the session implementation from the manager.
@param \Illuminate\Http\Request $request
@return \Illuminate\Contracts\Session\Session | [
"public function getSession(Request $request)\n {\n return tap($this->manager->driver(), function (Session $session) use ($request) {\n $session->setId($request->cookies->get($session->getName()));\n });\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 sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Merge metadata of run on multiple grid districts
Parameters
----------
meta: list of dict
Metadata of run of each MV grid district
Returns
-------
dict
Single metadata dict including merge metadata | [
"def process_metadata(meta):\n \n mvgds = []\n\n metadata = meta[0]\n\n for mvgd in meta:\n if isinstance(mvgd['mv_grid_districts'], list):\n mvgds.extend(mvgd['mv_grid_districts'])\n else:\n mvgds.append(mvgd['mv_grid_districts'])\n\n metadata['mv_grid_districts']... | [
"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 description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Utility method to obtain {@link ODatabaseDocument} from {@link ODatabase}
@param db {@link ODatabase} to cast from
@return {@link ODatabaseDocument} for a specified {@link ODatabase} | [
"public static ODatabaseDocument castToODatabaseDocument(ODatabase<?> db)\n\t{\n\t\twhile(db!=null && !(db instanceof ODatabaseDocument))\n\t\t{\n\t\t\tif(db instanceof ODatabaseInternal<?>)\n\t\t\t{\n\t\t\t\tdb = ((ODatabaseInternal<?>)db).getUnderlying();\n\t\t\t}\n\t\t}\n\t\treturn (ODatabaseDocument)db;\n\t}"
] | [
"public RepositoryFile getRepositoryFile() throws ResourceException {\n if (_fileRef == null || _fileRef.get() == null) {\n throw new ResourceException(this, \"RepositoryFile '\" + _qualifiedPath\n + \"' is not available since it was not serializable. The RepositoryFileResource ... | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Answers an array of the style extension classes to be applied to the extended object.
@return array | [
"protected function getAppliedStyles()\n {\n $applyStyles = $this->owner->config()->apply_styles;\n \n if (is_array($applyStyles)) {\n return $applyStyles;\n } elseif ($applyStyles == 'none') {\n return [];\n }\n }"
] | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
// Files returns a sorted list of file names in the output. | [
"func (o Output) Files() []string {\n\tf := make([]string, 0, len(o.Data))\n\tfor k := range o.Data {\n\t\tf = append(f, k)\n\t}\n\tsort.Strings(f)\n\treturn f\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 Github sentence about File management:",
"pos": "Represent the Github code about File management:",
"neg": "Represent the Github code:"
} |
Define the callback function.
This function need to send a content feed on standard output.
This callback is usefull to bypass the body in order to optimize performances.
@param string $callback
@return $this | [
"public function setCallback(callable $callback, array $params = [])\n {\n if ($this->hasCallback()) {\n throw new ArchException('Callback already defined');\n }\n $this->callback = $callback;\n $this->callbackParams = $params;\n return $this;\n }"
] | [
"def webhook_handler(request):\n \n body = request.stream.read().decode('utf8')\n print('webhook handler saw:', body)\n api.notify_webhook_received(payload=body)\n\n # nb. protected references are not part of the API.\n # this is just to demonstrate that the asyncid is stored\n print('key store... | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Imports the specified file in the MySql server
@param String $path
@param array $files (optional)
@return boolean | [
"public function importSql($path, $files = array('setup_structure.sql'))\n {\n $status = false;\n $fImport = null;\n if(file_exists($path)) {\n foreach($files as $file) {\n if(file_exists($path.$file)) {\n $fImport = file_get_contents($path.$file)... | [
"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 comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about File management:"
} |
TODO Fill in the iterator. | [
"public Iterator<Runnable> buildIterator() {\n\t\treturn new Iterator<Runnable>() {\n\t\t\t@Override\n\t\t\tpublic boolean hasNext() {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic Runnable next() {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void remove() {\n\t\t\t}\n\t\t};\n... | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Returns the value mapped by {@code name} if it exists and is an int or
can be coerced to an int, or throws otherwise.
@throws JsonException if the mapping doesn't exist or cannot be coerced
to an int. | [
"public Integer getInt(String name, boolean strict) throws JsonException {\n JsonElement el = get(name);\n Integer res = null;\n if (strict && !el.isNumber()) {\n throw Util.typeMismatch(name, el, \"int\", true);\n }\n if (el.isNumber()) {\n res = el.asInt();... | [
"protected boolean parametersMatch(Type requiredParameter, Type beanParameter) {\n if (Types.isActualType(requiredParameter) && Types.isActualType(beanParameter)) {\n /*\n * the required type parameter and the bean type parameter are actual types with identical raw\n * type... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Makes the column name safe for queries.
@return string | [
"private function columnName($column)\n {\n // Select all\n if ($column == '*') {\n return \"`{$this->query['table']}`.*\";\n }\n\n if (strpos($column, '.') === false) {\n $column = $this->query['table'] . \".{$column}\";\n }\n\n // Regular column 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 description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
// Timer returns a timer sub-logger. | [
"func (l *Logger) Timer() *Log {\n\treturn &Log{\n\t\tPackage: l.Name,\n\t\tLevel: \"TIMER\",\n\t\tTime: Now(),\n\t}\n}"
] | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the Github post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
@param object $owner
@param object|array $sample
@param int $size
@param string $type
@return static | [
"public function add($owner, $sample, $size = 1, $type = 'default')\n {\n $size = MANAPHP_COROUTINE ? $size : 1;\n\n $owner_id = spl_object_id($owner);\n\n if (!isset($this->_pool[$owner_id][$type])) {\n $this->_pool[$owner_id][$type] = $queue = new \\SplQueue();\n } else {... | [
"function openTable()\n {\n $this->examples = [];\n $this->markdown = ''; // Clear table\n $this->declareAbstraction = true;\n $this->add('| Visibility | Function |');\n $this->add('|:-----------|:---------|');\n }"
] | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Linear formula to predict ideal position of a marker.
@param int $i index of marker to adjust
@param int $d always -1 or 1
@return float ideal height of marker | [
"private function computeLinear( $i, $d ) {\n\t\t$q = $this->heights[$i];\n\t\t$n = $this->positions[$i];\n\t\treturn ( $q + $d *\n\t\t\t( $this->heights[$i + $d] - $q ) /\n\t\t\t( $this->positions[$i + $d] - $n )\n\t\t);\n\t}"
] | [
"function get_margin_width()\n {\n //ignore image width, use same width as on predefined bullet ListBullet\n //for proper alignment of bullet image and text. Allow image to not fitting on left border.\n //This controls the extra indentation of text to make room for the bullet image.\n ... | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Delete big nodes with many connections from the graph. | [
"def del_big_nodes(self, grater_than=215):\n \"\"\"\"\"\"\n G = self._graph\n it = G.nodes_iter()\n node_paths = []\n node_names = []\n del_nodes = []\n summe = 1\n count = 1\n for node in it:\n l = len(G[node])\n if l > grater_tha... | [
"def delete_node_storage(node)\n return if node == BLANK_NODE\n raise ArgumentError, \"node must be Array or BLANK_NODE\" unless node.instance_of?(Array)\n\n encoded = encode_node node\n return if encoded.size < 32\n\n # FIXME: in current trie implementation two nodes can share identical\n ... | codesearchnet | {
"query": "Represent the comment about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about Software development:"
} |
Handle files upload
file on model is a helper field
@author Wojciech Jurkowski <w.jurkowski@holonglobe.com> | [
"public function upload(FileRequest $request)\n {\n $crudeName = $request->input('crudeName');\n $crude = CrudeInstance::get($crudeName);\n $files = $request->file()['file'];\n $id = $request->input('modelId');\n $errors = [];\n\n if ($crude instanceof \\JanDolata\\Crude... | [
"def helpAbout(self):\n \n\n # Text to be displayed\n about_text = translate('pyBarPlugin',\n \"\"\"<qt>\n <p>Data plotting plug-in for pyBAR.\n </qt>\"\"\",\n 'About')\n\n descr = dict(module_name='pyBarPl... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
get project
Unsuccessful opertaion will cause an LogException.
:type project_name: string
:param project_name: the Project name
:return: GetProjectResponse
:raise: LogException | [
"def get_project(self, project_name):\r\n \r\n headers = {}\r\n params = {}\r\n resource = \"/\"\r\n\r\n (resp, header) = self._send(\"GET\", project_name, None, resource, params, headers)\r\n return GetProjectResponse(resp, header)"
] | [
"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 text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Play a mod or xm track streamed from the specified location
@param module The moudle to play back
@param source The OpenAL source to play the music on
@param start True if the music should be started
@param loop True if the track should be looped | [
"public void play(Module module, int source, boolean loop, boolean start) {\n\t\tthis.source = source;\n\t\tthis.loop = loop;\n\t\tthis.module = module;\n\t\tdone = false;\n\t\t\n\t\tibxm = new IBXM(48000);\n\t\tibxm.set_module(module);\n\t\tsongDuration = ibxm.calculate_song_duration();\n\n\t\tif (bufferNames != n... | [
"def _get_selectable(self):\n '''\n \n '''\n # Save some typing\n cursong = self.loop[self.song][0]\n \n if self.dif_song and len(cursong) > 1:\n # Position is relative to the intro of the track,\n # so we we will get the both the intro and body... | codesearchnet | {
"query": "Represent the post:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Initializes the MetricQueryService.
@param rpcService RpcService to create the MetricQueryService on
@param resourceID resource ID used to disambiguate the actor name | [
"public void startQueryService(RpcService rpcService, ResourceID resourceID) {\n\t\tsynchronized (lock) {\n\t\t\tPreconditions.checkState(!isShutdown(), \"The metric registry has already been shut down.\");\n\n\t\t\ttry {\n\t\t\t\tmetricQueryServiceRpcService = rpcService;\n\t\t\t\tqueryService = MetricQueryService... | [
"private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {\n GetField fields = in.readFields();\n classLoaderIdentifier = (String) fields.get(CLASS_LOADER_IDENTIFIER, null);\n\n // Note that further processing is required in JEEMetadataContextProviderImp... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Check __construct method constraints.
@throws ImmutabilityViolationException | [
"private function checkCallConstraints(): void\n {\n if ($this->alreadyConstructed) {\n throw new ImmutabilityViolationException(\\sprintf(\n 'Class %s constructor was already called',\n static::class\n ));\n }\n\n $stack = \\debug_backtrac... | [
"function validateService($pluginInstance)\n {\n if (! is_object($pluginInstance) )\n throw new \\Exception(sprintf('Can`t resolve to (%s) Instance.', $pluginInstance));\n\n if (!$pluginInstance instanceof aGrantRequest)\n throw new exContainerInvalidServiceType('Invalid Plugi... | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Sets the column count and list of columns to the inputed column list.
:param columns | [<str>, ..] | [
"def setColumns(self, columns):\r\n \r\n self.setColumnCount(len(columns))\r\n self.setHeaderLabels(columns)"
] | [
"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:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Return a random 32 byte secret except the 0 secret since it's not accepted in the contracts | [
"def random_secret() -> Secret:\n \n while True:\n secret = os.urandom(32)\n if secret != constants.EMPTY_HASH:\n return Secret(secret)"
] | [
"def get_finished_record_bytes(cls, tls_version: TlsVersionEnum) -> bytes:\n \n # TODO(AD): The ROBOT poc script uses the same Finished record for all possible client hello (default, GCM,\n # etc.); as the Finished record contains a hashes of all previous records, it will be wrong and will caus... | codesearchnet | {
"query": "Represent the Github description about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code:"
} |
// SetPullStartedAt sets the PullStartedAt field's value. | [
"func (s *SubmitTaskStateChangeInput) SetPullStartedAt(v time.Time) *SubmitTaskStateChangeInput {\n\ts.PullStartedAt = &v\n\treturn s\n}"
] | [
"public List<Pair<UIEvent, Table>> readEvents() throws IOException {\n //TODO eventually we'll support working out the offset for files that were not written in this session\n Preconditions.checkState(endStaticInfoOffset >= 0, \"Cannot read events - have not written end of static info marker\");\n ... | codesearchnet | {
"query": "Represent the description about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software Development:"
} |
Executes the action and outputs the result.
@param ActionContext $actionContext The context in which the result is executed.
The context information includes information about the action that was executed and request information.
@return void | [
"public function execute($actionContext) {\n // make json and exit\n if (($result = json_encode($this->data, $this->options, $this->depth)) === false) {\n throw new \\ErrorException('JSON encode error #' . json_last_error() . ': ' . json_last_error_msg());\n }\n\n $response = ... | [
"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 text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
The function for parsing the JSON response to the vars dictionary. | [
"def parse(self):\n \n\n try:\n\n self.vars['handle'] = self.json['handle'].strip()\n\n except (KeyError, ValueError):\n\n log.debug('Handle missing, json_output: {0}'.format(json.dumps(\n self.json)))\n raise InvalidNetworkObject('Handle is missi... | [
"@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 instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Add a coordinate pair, performing curve simplification if possible.
@param x X coordinate
@param y Y coordinate | [
"public void addAndSimplify(double x, double y) {\n // simplify curve when possible:\n final int len = data.size();\n if (len >= 4) {\n // Look at the previous 2 points\n final double l1x = data.get(len - 4);\n final double l1y = data.get(len - 3);\n final double l2x = data.get(len - 2)... | [
"public static AffineTransformation axisProjection(int dim, int ax1, int ax2) {\n // setup a projection to get the data into the interval -1:+1 in each\n // dimension with the intended-to-see dimensions first.\n AffineTransformation proj = AffineTransformation.reorderAxesTransformation(dim, ax1, ax2);\n ... | codesearchnet | {
"query": "Represent the sentence:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// RemoveIPs provides a mock function with given fields: ctx, []string | [
"func (_m *FacadeInterface) RemoveIPs(ctx datastore.Context, args []string) error {\n\tret := _m.Called(ctx, args)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(datastore.Context, []string) error); ok {\n\t\tr0 = rf(ctx, args)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}"
] | [
"def list_nodes(self):\n \"\"\"\"\"\"\n self.add_environment_file(user='stack', filename='stackrc')\n ret, _ = self.run(\"ironic node-list --fields uuid|awk '/-.*-/ {print $2}'\", user='stack')\n # NOTE(Gonéri): the good new is, the order of the nodes is preserved and follow the one from... | codesearchnet | {
"query": "Represent the description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Technology:"
} |
Sets the size limit of a specific column.
:param column_name: The name of the column to change.
:param size_limit: The max size of the column width. | [
"def set_column_size_limit(self, column_name: str, size_limit: int):\n \n if self._column_size_map.get(column_name):\n self._column_size_map[column_name] = size_limit\n else:\n raise ValueError(f'There is no column named {column_name}!')"
] | [
"function DataModelMigration() {\n /**\n * Gets an array that contains the definition of fields that are going to be added\n * @type {Array}\n */\n this.add = [];\n /**\n * Gets an array that contains a collection of constraints which are going to be added\n * @type {Array}\n */\n ... | codesearchnet | {
"query": "Represent the comment:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Internal non-static method to include configuration.
@param conf
the {@link Configuration} object to merge into the global configuration | [
"private void includeConfigurationInternal(final Configuration conf) {\n\n\t\tif (conf == null) {\n\t\t\tLOG.error(\"Given configuration object is null, ignoring it...\");\n\t\t\treturn;\n\t\t}\n\n\t\tsynchronized (this.confData) {\n\n\t\t\tfinal Iterator<String> it = conf.keySet().iterator();\n\n\t\t\twhile (it.ha... | [
"@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 Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about programming:"
} |
Show the tray icon. | [
"def _show(self):\n \"\"\"\"\"\"\n if not self._icon:\n self._icon = self._create_statusicon()\n widget = self._icon\n widget.set_visible(True)\n self._conn_left = widget.connect(\"activate\", self._activate)\n self._conn_right = widget.connect(\"popup-menu\", se... | [
"def openCurrentItem(self):\n \n logger.debug(\"openCurrentItem\")\n _currentItem, currentIndex = self.getCurrentItem()\n if not currentIndex.isValid():\n return\n\n # Expanding the node will call indirectly call RepoTreeModel.fetchMore which will call\n # BaseRt... | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Observe that they are satisfied by the initial conditions: l = 0 and r = len. | [
"private static int searchForChunkContainingPos(final long[] arr, final long pos, final int l, final int r) {\n // the following three asserts can probably go away eventually, since it is fairly clear\n // that if these invariants hold at the beginning of the search, they will be maintained\n assert l < r;... | [
"def _forney(self, omega, X):\n ''''''\n # XXX Is floor division okay here? Should this be ceiling?\n\n Y = [] # the final result, the error/erasures polynomial (contain the values that we should minus on the received message to get the repaired message)\n Xlength = len(X)\n for l... | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Helper function for parsing the configuration of the combo-box.<p>
@param config the configuration string. | [
"private void parseConfiguration(String config) {\r\n\r\n CmsSelectConfigurationParser parser = new CmsSelectConfigurationParser(config);\r\n m_comboBox = new CmsSelectComboBox(parser.getOptions(), false);\r\n if (parser.getDefaultValue() != null) {\r\n //set the declared value selec... | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
// addUnit adds a single unit to an application already present in the environment. | [
"func (h *bundleHandler) addUnit(change *bundlechanges.AddUnitChange) error {\n\tif h.dryRun {\n\t\treturn nil\n\t}\n\n\tp := change.Params\n\tapplicationName := resolve(p.Application, h.results)\n\tvar err error\n\tvar placementArg []*instance.Placement\n\ttargetMachine := p.To\n\tif targetMachine != \"\" {\n\t\tl... | [
"@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 comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Get headers from $_SERVER.
@param array $server The $_SERVER superglobal variable.
@return array | [
"public static function prepareHeaders(array $server)\n {\n $headers = [];\n\n foreach ($server as $key => $value) {\n if ($value && strpos($key, 'HTTP_') === 0) {\n $name = strtr(substr($key, 5), '_', ' ');\n $name = strtr(ucwords(strtolower($name)), ' ', '... | [
"final public function create()\n {\n\n $self = $this;\n\n $splash = $self->getSplash();\n $sessId = $this->generateId($splash);\n\n session_id($sessId); //Must be called before the sesion start to generate the Id\n session_cache_limiter('none');\n\n session_name(md5($se... | codesearchnet | {
"query": "Represent the Github comment about PHP programming:",
"pos": "Represent the Github code about PHP programming:",
"neg": "Represent the Github code about programming:"
} |
Send photo and text message
@param $photo
@param string $message
@return bool
@throws \Exception | [
"public static function sendPhoto($photo ,$message = ''){\n self::initialize();\n $data = [\n 'message' => $message,\n 'source' => self::$fb->fileToUpload($photo)\n ];\n try {\n $response = self::$fb->post('/me/photos', $data, self::$page_access_token);\n... | [
"public function handle(PublishThePost $event) {\n\n $status = \"Article: \";\n $status .= $event->data['id']['title'];\n $status .= \" \";\n $status .= $event->data['id']['canonical_url'];\n $status .= \" #Laravel\";\n\n $twitter_status = Twitter::postTweet(['status' => $s... | codesearchnet | {
"query": "Represent the Github instruction about PHP programming:",
"pos": "Represent the Github code about PHP programming:",
"neg": "Represent the Github code about Software development:"
} |
Pick the correct default format. | [
"def set_format(self, format):\n \n if self.options.format:\n self.format = self.options.format\n else:\n self.format = \\\n self.config[\"default_format_\" + format]"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// CertPoolFromFile returns an x509.CertPool containing the certificates in the given PEM-encoded file.
// Returns an error if the file could not be read, a certificate could not be parsed, or if the file does not contain any certificates | [
"func CertPoolFromFile(filename string) (*x509.CertPool, error) {\n\tcerts, err := certificatesFromFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpool := x509.NewCertPool()\n\tfor _, cert := range certs {\n\t\tpool.AddCert(cert)\n\t}\n\treturn pool, nil\n}"
] | [
"static String getHostString(InetSocketAddress socketAddress) {\n InetAddress address = socketAddress.getAddress();\n if (address == null) {\n // The InetSocketAddress was specified with a string (either a numeric IP or a host name). If\n // it is a name, all IPs for that name should be tried. If it... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// RefreshPUs is used to resend an update event to the Upstream Policy Resolver in case of an update is needed. | [
"func (m *KubernetesMonitor) RefreshPUs(ctx context.Context, pod *api.Pod) error {\n\tif pod == nil {\n\t\treturn fmt.Errorf(\"pod is nil\")\n\t}\n\n\tpodNamespace := pod.GetNamespace()\n\tpodName := pod.GetName()\n\n\tpuIDs := m.cache.getPUIDsbyPod(podNamespace, podName)\n\n\tfor _, puid := range puIDs {\n\t\tdock... | [
"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 instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
// For a given input string, suggests potential replacements | [
"func (model *Model) Suggestions(input string, exhaustive bool) []string {\n\tmodel.RLock()\n\tsuggestions := model.suggestPotential(input, exhaustive)\n\tmodel.RUnlock()\n\toutput := make([]string, 0, 10)\n\tfor _, suggestion := range suggestions {\n\t\toutput = append(output, suggestion.Term)\n\t}\n\treturn outpu... | [
"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 comment about Natural Language Processing:",
"pos": "Represent the Github code about Natural Language Processing:",
"neg": "Represent the Github code:"
} |
Start an instance.
CLI Examples:
.. code-block:: bash
salt-cloud -a start i-2f733r5n | [
"def start(instance_id, call=None):\n '''\n \n '''\n if call != 'action':\n raise SaltCloudSystemExit(\n 'The stop action must be called with -a or --action.'\n )\n\n log.info('Starting instance %s', instance_id)\n\n params = {\n 'action': 'StartInstances',\n ... | [
"def block(self):\n '''\n \n '''\n st,output = _runcmd(\"/sbin/pfctl -aswitchyard -f -\", self._rules)\n log_debug(\"Installing rules: {}\".format(output))"
] | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Optional. A list of synonyms that can also be used to trigger this
item in dialog.
Generated from protobuf field <code>repeated string synonyms = 2;</code>
@param string[]|\Google\Protobuf\Internal\RepeatedField $var
@return $this | [
"public function setSynonyms($var)\n {\n $arr = GPBUtil::checkRepeatedField($var, \\Google\\Protobuf\\Internal\\GPBType::STRING);\n $this->synonyms = $arr;\n\n return $this;\n }"
] | [
"public function setParameters($var)\n {\n $arr = GPBUtil::checkMapField($var, \\Google\\Protobuf\\Internal\\GPBType::STRING, \\Google\\Protobuf\\Internal\\GPBType::STRING);\n $this->parameters = $arr;\n\n return $this;\n }"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Programming:"
} |
Blockingly yield the socket | [
"def socket(self, blocking=True):\n ''''''\n # If the socket is available, then yield it. Otherwise, yield nothing\n if self._socket_lock.acquire(blocking):\n try:\n yield self._socket\n finally:\n self._socket_lock.release()"
] | [
"function(hljs) {\n return {\n lexemes: /[!#@\\w]+/,\n keywords: {\n keyword: //ex command\n // express version except: ! & * < = > !! # @ @@\n 'N|0 P|0 X|0 a|0 ab abc abo al am an|0 ar arga argd arge argdo argg argl argu as au aug aun b|0 bN ba bad bd be bel bf bl bm bn bo bp br brea brea... | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Gets the decorated content for this decoration object.<p>
@param config the configuration used
@param text the text to be decorated
@param contentLocale the locale of the content to be decorated
@return decorated content | [
"public String getContentDecoration(I_CmsDecoratorConfiguration config, String text, String contentLocale) {\n\n StringBuffer content = new StringBuffer();\n // TODO: we have to handle with word phrases, too\n\n // add the pretext\n if (!config.hasUsed(m_decorationKey) && m_decorationDef... | [
"function (renderer, nodeName) {\n\t\tvar wrapper = this;\n\t\twrapper.element = nodeName === 'span' ?\n\t\t\tcreateElement(nodeName) :\n\t\t\tdoc.createElementNS(SVG_NS, nodeName);\n\t\twrapper.renderer = renderer;\n\t\t/**\n\t\t * A collection of attribute setters. These methods, if defined, are called right befo... | codesearchnet | {
"query": "Represent the Github summarization about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Programming:"
} |
Manipulating the input array, $params, adding new selectorbox items.
@param array $params array of select field options (reference)
@param object $pObj parent object (reference)
@return void | [
"public function addConfigFunctionary(&$params, &$pObj)\n {\n $aID = $params['flexParentDatabaseRow']['pi_flexform']['data']['General']['lDEF']['settings.associationID']['vDEF'];\n\n if (!empty($aID)) {\n $associationRepository = $this->objectManager->get(AssociationRepository::class);\n... | [
"public function updateConfigOptions()\n {\n //search the config menu for our item\n $options = $this->searchMenu($this->name);\n\n //override the config's options\n $this->getConfig()->setOptions($options);\n }"
] | codesearchnet | {
"query": "Represent the Github comment about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
@param string $css
@param string $attr
@return string|null | [
"public function attr_first($css, $attr)\n {\n $nodes = $this->_document->getQuery()->css($css, $this->_node);\n return $nodes ? $nodes->item(0)->getAttribute($attr) : null;\n }"
] | [
"static function init() {return dfcf(function() {\n\t\t$appId = S::s()->appId(); /** @var string|null $appId */\n\t\treturn !$appId ? '' : df_block_output(__CLASS__, 'init', ['appId' => $appId]);\n\t});}"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
Run tests marked with a particular tag and stage | [
"def _run_events(self, tag, stage=None):\n \"\"\"\"\"\"\n\n self._run_event_methods(tag, stage)\n self._run_tests(tag, stage)"
] | [
"def finish_parse(self, last_lineno_seen):\n \"\"\"\"\"\"\n if self.state == self.STATES['step_in_progress']:\n # We've reached the end of the log without seeing the final \"step finish\"\n # marker, which would normally have triggered updating the step. As such we\n #... | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Initializes and return an instance of the given class name.
@access public
@param string $className
@return mixed | [
"public function getInstance($className)\n {\n switch ($className) {\n case '\\\\Zepi\\\\Web\\\\General\\\\Manager\\\\AssetManager':\n if ($this->assetManager === null) {\n $this->assetManager = new $className(\n $this->getDataObjectBacke... | [
"@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 sentence about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
Return symbolic logic for an N-bit Brent-Kung adder. | [
"def brent_kung_add(A, B, cin=0):\n \"\"\"\"\"\"\n if len(A) != len(B):\n raise ValueError(\"expected A and B to be equal length\")\n N = len(A)\n # generate/propagate logic\n gs = [A[i] & B[i] for i in range(N)]\n ps = [A[i] ^ B[i] for i in range(N)]\n # carry tree\n for i in range(f... | [
"def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato... | codesearchnet | {
"query": "Represent the summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Natural Language Processing:"
} |
Send a POST request
@param string $url A valid URL
@param array $params Parameters as key/value pairs
@param array $options Curl options
@return object The Response including header and body
@throws Passioncoder\SimpleCurl\Exception | [
"public function post($url, array $params = null, array $options = array())\n\t{\n\t\treturn $this->request($url, 'POST', $params, $options);\n\t}"
] | [
"final public function getArray()\n {\n $res = $this->getArrayInternal();\n if (!$this->isArray($res) && !$this->isArrayObject($res)) {\n $errorMessage = 'AbstractDriver method _getArray() must return array or ArrayObject.';\n $errorMessage .= ' Make sure you have provided a v... | codesearchnet | {
"query": "Represent the text about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software Development:"
} |
/*
(non-Javadoc)
@see com.arakelian.dao.Dao#delete(com.arakelian.dao.feature.HasId) | [
"@Override\n public void delete(final T value) {\n if (value != null) {\n final String id = value.getId();\n if (!StringUtils.isEmpty(id)) {\n doDelete(id);\n notifyDeleted(value);\n }\n }\n }"
] | [
"private void addRestResourceClasses(Set<Class<?>> resources) {\n resources.add(pl.setblack.airomem.direct.banksample.rest.BankResource.class);\n }"
] | codesearchnet | {
"query": "Represent the Github sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code:"
} |
Create contact information from a description.
@param Description $description The contact description.
@return ContactEntity | [
"public function create(Description $description)\n {\n return new ContactEntity(\n $description->getOptionalProperty('phone'),\n $description->getOptionalProperty('twitter'),\n $description->getOptionalProperty('facebook')\n );\n }"
] | [
"@Operation(name=\"$find-matches\", idempotent=true)\n public Parameters findMatchesAdvanced(\n @OperationParam(name=\"dateRange\") DateRangeParam theDate,\n @OperationParam(name=\"name\") List<StringParam> theName,\n @OperationParam(name=\"code\") TokenAndListParam theEnd) {\n \n Paramet... | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Validates a user input from prompt
@param string $field
@param string $label
@param string $validator
@param string|null $default | [
"protected function validatePrompt($field, $label, $validator, $default = null)\n {\n $input = $this->prompt($label, $default);\n\n if (!$this->isValidInput($input, $field, $validator)) {\n $this->errors();\n $this->validatePrompt($field, $label, $validator, $default);\n ... | [
"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 sentence about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about Software development:"
} |
On error when reading transactions from the stream, try reloading the input
stream. | [
"private void tryReloadingEditLog() throws IOException {\n LOG.info(\"Segment - trying to reload edit log segment\");\n // sleep on error\n sleep(errorSleepTimeout);\n\n // check if a new segment exists\n checkProgress();\n\n // reopen current segment\n setupIngestStreamWithRetries(currentSegme... | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Load `autoload_psr4.php` classes, used by PSR-4 packages
@return int|bool Return total packages loaded, if `autoload_psr4.php`
is not accessible return `false` | [
"public function psr4()\n {\n $i = $this->load($this->composerPath . $this->psrFourName);\n\n if ($i !== false) {\n $this->log[] = 'Imported ' . $i . ' classes from psr4';\n return $i;\n }\n\n $this->log[] = 'Warn: psr4 not found';\n return false;\n }"
... | [
"public function findClasses()\n {\n $files = $this->getFiles($this->searchPath);\n\n // if class are not loaded they will ne be caught by \"declared_classes\"\n $this->loadFiles($files);\n\n return $this->identifyClasses();\n }"
] | codesearchnet | {
"query": "Represent the post about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Programming:"
} |
Returns the bundle post processor name separated by a comma character
@param processor
the post processor
@return the bundle post processor name separated by a comma character | [
"private static String getBundlePostProcessorsName(ChainedResourceBundlePostProcessor processor) {\n\n\t\tString bundlePostProcessor = \"\";\n\t\tif (processor != null) {\n\t\t\tbundlePostProcessor = processor.getId();\n\t\t}\n\n\t\treturn bundlePostProcessor;\n\t}"
] | [
"function formatMailBody(obj, order) {\n var result = \"\";\n if (!order) {\n order = Object.keys(obj);\n }\n \n // loop over all keys in the ordered form data\n for (var idx in order) {\n var key = order[idx];\n result += \"<h4 style='text-transform: capitalize; margin-bottom: 0'>\" + key + \"</h4><... | codesearchnet | {
"query": "Represent the Github text about Documentation:",
"pos": "Represent the Github code about Documentation:",
"neg": "Represent the Github code:"
} |
Performs an HTTP POST on the given URL.
@param url The URL to connect to.
@return The HTTP response as Response object.
@throws URISyntaxException
@throws UnsupportedEncodingException
@throws HttpException | [
"public static Response post(String url)\n throws URISyntaxException, UnsupportedEncodingException, HttpException {\n return postParams(new HttpPost(url), new ArrayList<NameValuePair>(), null, null);\n }"
] | [
"public VoiceFileStatusResult get(String fid)\n throws HTTPException, JSONException, IOException {\n\n long random = SmsSenderUtil.getRandom();\n long now = SmsSenderUtil.getCurrentTime();\n JSONObject body = new JSONObject()\n .put(\"fid\", fid)\n .put(\"sig\",... | codesearchnet | {
"query": "Represent the Github instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about PHP:"
} |
Return the X-Value for a specified value of Y
@param float $yValue Y-Value
@return float X-Value | [
"public function getValueOfXForY($yValue)\n {\n return pow((($yValue + $this->yOffset) / $this->getIntersect()), (1 / $this->getSlope()));\n }"
] | [
"function(theta_p,theta){\n if(arguments.length > 1){\n this.theta = theta;\n this.rootPos = new Vec2D(theta_p);\n } else {\n this.rootPos = new Vec2D();\n this.theta = theta_p;\n }\n //due to lack-of int/float types, no support of theta in deg... | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about mathematics:"
} |
Resolve url - among other things will turn relative url to absolute
@method resolveUrl
@static
@param {String} url Either absolute or relative
@return {String} Resolved, absolute url | [
"function(url) {\n\t\tvar ports = { // we ignore default ports\n\t\t\thttp: 80,\n\t\t\thttps: 443\n\t\t}\n\t\t, urlp = parseUrl(url)\n\t\t;\n\n\t\treturn urlp.scheme + '://' + urlp.host + (urlp.port !== ports[urlp.scheme] ? ':' + urlp.port : '') + urlp.path + (urlp.query ? urlp.query : '');\n\t}"
] | [
"function computeResolved(json, name) {\n var value = json.from;\n name = name || json.name;\n\n var uri = url.parse(value);\n\n // handle the case `from` is a privateRegistryURL\n if ((uri.protocol === 'http:' || uri.protocol === 'https:') &&\n registries.indexOf(uri.h... | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Creates and returns a GET {@link HttpRequest} instance
for the given <tt>path</tt> over the internal hostname.
@param path Path of the request to build.
@return Built GET request.
@throws IOException If any error occurs while creating the GET request. | [
"public HttpRequest getRequest(final String path) throws IOException {\n\t\tfinal GenericUrl url = getURL(path);\n\t\treturn requestFactory.buildGetRequest(url);\n\t}"
] | [
"public PluginEntry[] getCategorizedAvailables() {\n TreeSet<PluginEntry> entries = new TreeSet<>();\n for (Plugin p : getAvailables()) {\n if (p.categories==null || p.categories.length==0)\n entries.add(new PluginEntry(p, getCategoryDisplayName(null)));\n else\n ... | codesearchnet | {
"query": "Represent the Github post about Software development:",
"pos": "Represent the Github code about Software development:",
"neg": "Represent the Github code about App development:"
} |
onKernelRequest
@param GetResponseEvent $event | [
"public function onKernelRequest(GetResponseEvent $event)\n {\n $url = $event->getRequest()->getRequestUri();\n $token = $this->tokenStorage->getToken();\n\n if ($token && $this->isAdminToken($this->providerKey, $token) && $this->adminRouteHelper->isAdminRoute($url)) {\n $locale =... | [
"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 summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Remove default owner for entity.
@return $this | [
"public function withoutDefaultOwner()\n {\n $this->defaultOwner = null;\n if (isset($this->withDefaultOwnerOnCreate)) {\n $this->withDefaultOwnerOnCreate = false;\n }\n\n return $this;\n }"
] | [
"def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Run a shell command and return stdout | [
"def execute(cmd):\n \"\"\"\"\"\"\n proc = Popen(cmd, stdout=PIPE)\n stdout, _ = proc.communicate()\n if proc.returncode != 0:\n raise CalledProcessError(proc.returncode, \" \".join(cmd))\n\n return stdout.decode('utf8')"
] | [
"def finish_parse(self, last_lineno_seen):\n \"\"\"\"\"\"\n if self.state == self.STATES['step_in_progress']:\n # We've reached the end of the log without seeing the final \"step finish\"\n # marker, which would normally have triggered updating the step. As such we\n #... | codesearchnet | {
"query": "Represent the Github description:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
@param \Riak\Client\Core\Query\Crdt\Op\FlagOp $op
@return integer | [
"protected function convertFlag(Op\\FlagOp $op)\n {\n return $op->isEnabled()\n ? ProtoBuf\\MapUpdate\\FlagOp::ENABLE\n : ProtoBuf\\MapUpdate\\FlagOp::DISABLE;\n }"
] | [
"public Map<Prop.Names, String> getProps(Prop.Names[] props) throws CommandExecutionException {\n Prop prop = new Prop(props);\n return prop.parseResponse(sendToArray(\"get_prop\", prop.getRequestArray()));\n }"
] | codesearchnet | {
"query": "Represent the instruction about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Data processing:"
} |
Encrypts a secret key and salt with a public key. | [
"public static byte[] encryptBytes (PublicKey key, byte[] secret, byte[] salt)\n {\n byte[] encrypt = new byte[secret.length + salt.length];\n for (int ii = 0; ii < secret.length; ii++) {\n encrypt[ii] = secret[ii];\n }\n for (int ii = 0; ii < salt.length; ii++) {\n ... | [
"def get_finished_record_bytes(cls, tls_version: TlsVersionEnum) -> bytes:\n \n # TODO(AD): The ROBOT poc script uses the same Finished record for all possible client hello (default, GCM,\n # etc.); as the Finished record contains a hashes of all previous records, it will be wrong and will caus... | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Get controller name.
@return string | [
"public function getDestinationFilePath()\n {\n $path = $this->laravel['components']->getComponentPath($this->getComponentName());\n\n $controllerPath = $this->laravel['components']->config('paths.generator.controller');\n\n return $path . $controllerPath . '/' . $this->getControllerName() .... | [
"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 Github sentence about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
读取文件内容
@param path 文件路径
@param charset 字符集
@return 内容
@throws IORuntimeException IO异常 | [
"public static String readString(String path, Charset charset) throws IORuntimeException {\r\n\t\treturn readString(file(path), charset);\r\n\t}"
] | [
"public static String getAbsolutePath(String path, Class<?> baseClass) {\r\n\t\tString normalPath;\r\n\t\tif (path == null) {\r\n\t\t\tnormalPath = StrUtil.EMPTY;\r\n\t\t} else {\r\n\t\t\tnormalPath = normalize(path);\r\n\t\t\tif (isAbsolutePath(normalPath)) {\r\n\t\t\t\t// 给定的路径已经是绝对路径了\r\n\t\t\t\treturn normalPat... | codesearchnet | {
"query": "Represent the text about Encryption:",
"pos": "Represent the code about Encryption:",
"neg": "Represent the code about text processing:"
} |
Cuts div tag which wraps block starting with "From:". | [
"def cut_from_block(html_message):\n \"\"\"\"\"\"\n # handle the case when From: block is enclosed in some tag\n block = html_message.xpath(\n (\"//*[starts-with(mg:text_content(), 'From:')]|\"\n \"//*[starts-with(mg:text_content(), 'Date:')]\"))\n\n if block:\n block = block[-1]\n... | [
"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 summarization:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Upload file.
@param string $url
@param array $files
@param array $form
@param array $queries
@return ResponseInterface | [
"public function upload($url, array $queries = [], array $files = [], array $form = [])\n {\n $multipart = [];\n\n foreach ($files as $name => $path) {\n if (is_array($path)){\n foreach ($path as $item) {\n $multipart[] = [\n '... | [
"public function playAudio(/* polymorphic */)\n {\n $args = Ensure::Input(func_get_args());\n $url = new URIResource($this->getAudioUrl());\n $data = $args->get(); \n\n /** update add simplicity. playAudio('audioFile') = playAudio(array('audioFile' => 'audioFile')) **/\n if ($args->is_string()) {\n ... | codesearchnet | {
"query": "Represent the description about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about programming:"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.