query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
@param string $attribute @param string|null $value @return static
[ "public function attribute($attribute, $value = null)\n {\n $element = clone $this;\n\n $element->attributes->setAttribute($attribute, (string) $value);\n\n return $element;\n }" ]
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Remove all values or values for a key from a request. @param string $request_key @param string|null $key @return void
[ "protected function clearFromRequest( $request_key, $key = null ) {\n\t\t$this->validateStore();\n\n\t\t$keys = $key === null ? array_keys( $this->flashed[ $request_key ] ) : [$key];\n\t\tforeach ( $keys as $k ) {\n\t\t\tunset( $this->flashed[ $request_key ][ $k ] );\n\t\t}\n\t}" ]
[ "public function insert(): self\n {\n /** @var self $data */\n $data = $this;\n\n if(!$this->validate(\"post\", $missing))\n {\n throw new \\Exception(\"[MVQN\\REST\\Endpoints\\Endpoint] Annotations for the '\".get_class($this).\"' class require valid values be set \".\n ...
codesearchnet
{ "query": "Represent the Github summarization about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about Software development:" }
セッションに値が存在するか調べます。 @param mixed $name 検索する名前 @return bool 値が存在する場合はtrue 存在しない場合はfalse
[ "public static function Exists ($name) {\n\t\tstatic::Start();\n\t\tif (!static::IsSessionActive()) {\n\t\t\tthrow CoreException::RaiseSystemError('セッションが開始されていないため、セッションを利用できません。');\n\t\t}\n\t\tif (is_array($name)) {\n\t\t\treturn Arrays::ExistsLowest($_SESSION, $name);\n\t\t} else {\n\t\t\treturn isset($_SESSION[...
[ "func (m *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\t// NOTE ucon内部のルーティングは一元的にこの関数から行う\n\t// Handlerを細分化しhttp.ServeMuxに登録すると、OPTIONSのhandleがうまくできなくなる\n\t// このため、Handlerはucon全体で1つとし、OPTIONSも通常のMethodと同じようにHandlerを設定し利用する\n\t// OPTIONSを適切にhandleするため、全てのHandlerに特殊なHookを入れるよりマシである\n\n\tm.router.S...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
// AlternativesAsExactEqual returns true if the two options are equal. // In case of one option being nil, the value of the other must be nil as well // or be set to the default value of this option.
[ "func AlternativesAsExactEqual(o1, o2 *AlternativesAsExactOption) bool {\n\tif o1 != nil {\n\t\treturn o1.Equal(o2)\n\t}\n\tif o2 != nil {\n\t\treturn o2.Equal(o1)\n\t}\n\treturn true\n}" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
@param string $url @param string|\Closure|MiddlewareInterface|Router $callback @throws RouterException @return Route
[ "public function patch(string $url, $callback): Route\n {\n $route = new Route(['PATCH'], $url, $callback);\n $this->addRoute($route);\n\n return $route;\n }" ]
[ "public function updateApiMethodAnnotations()\n {\n $updater = new ClassAnnotationUpdater(\n $this->reflection,\n $this->getMethodAnnotations(),\n $this->getDefaultDocComment(),\n '/^\\* @method (\\\\\\\\Aws\\\\\\\\Result|\\\\\\\\GuzzleHttp\\\\\\\\Promise\\\\\\\...
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about NLP:" }
Set to start the web server to monitor port, the default is 9000 @param port web server port, default is 9000 @return blade
[ "public Blade listen(int port) {\n Assert.greaterThan(port, 0, \"server port not is negative number.\");\n this.environment.set(ENV_KEY_SERVER_PORT, port);\n return this;\n }" ]
[ "protected function showHelp($msg = '', $code = 0)\n {\n $usage = Cli::color('USAGE:', 'brown');\n $commands = Cli::color('COMMANDS:', 'brown');\n $sOptions = Cli::color('SPECIAL OPTIONS:', 'brown');\n $pOptions = Cli::color('PUBLIC OPTIONS:', 'brown');\n $version = Cli::color(...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about PHP programming:" }
Call an API with given options. @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements: the data deserialized from response body (could be nil), response status code and response headers.
[ "def call_api(http_method, path, opts = {})\n request = build_request(http_method, path, opts)\n response = request.run\n\n if @config.debugging\n @config.logger.debug \"HTTP response body ~BEGIN~\\n#{response.body}\\n~END~\\n\"\n end\n\n unless response.success?\n if response...
[ "def call(parcel)\n # 1. Execute interactor\n response_kind, response_message, response_headers = interactor.call parcel\n\n # 2. Extract a possible version embedded in the response_kind.\n # This is sugar syntax for kind and version.\n if response_kind\n kind_part, version_part = ...
codesearchnet
{ "query": "Represent the Github text about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Compare a tests expected and result stdout Sets the result of the comparison to out_result in the test test - A test object that has been run Returns nothing
[ "def cmp_out(test)\n test.out_result = FileUtils.cmp(test.expected_out_path, \n test.result_out_path)\n end" ]
[ "def run_objective(objective, _name, raw_output, output_files, threads)\n # output is a, array: [raw_output, output_files].\n # output_files is a hash containing the absolute paths\n # to file(s) output by the target in the format expected by the\n # objective function(s), with keys as the keys ...
codesearchnet
{ "query": "Represent the Github text about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code:" }
Check if path has write access
[ "def is_writable(path):\r\n \"\"\"\"\"\"\r\n try:\r\n testfile = tempfile.TemporaryFile(dir=path)\r\n testfile.close()\r\n except OSError as e:\r\n if e.errno == errno.EACCES: # 13\r\n return False\r\n return True" ]
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
@param string $name @param null $else @return mixed|null
[ "public function exists(string $name, $else = null)\n {\n return isset($this->items[$name]) ?\n $this->items[$name] : $else;\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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
read file specified via 'file_path' and return its content - raises an ConuException if there is an issue accessing the file :param file_path: str, path to the file to read :return: str (not bytes), content of the file
[ "def read_file(self, file_path):\n \n try:\n with open(self.cont_path(file_path)) as fd:\n return fd.read()\n except IOError as ex:\n logger.error(\"error while accessing file %s: %r\", file_path, ex)\n raise ColinException(\n \"The...
[ "def _get_headers(self, resource):\n \n\n # If the resource is a file we just open it up with the csv\n # reader (after being sure we're reading from the beginning\n # of the file\n if type(resource) == file:\n resource.seek(0)\n reader = csv.reader(resource)...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Programming:" }
Директива @endspaceless @return string|null @throws \Exception
[ "public function endSpaceless()\n {\n if ($this->isEnabled()) {\n\n $buffer = ob_get_clean();\n $expelled_tags = implode('|', config('spaceless.expelled_tags', []));\n\n // Все пробелы/переносы конвертируются в одинарный\n $regexp = '~(?>[^\\S]\\s*|\\s{2,})(?=[^...
[ "private function nameFull() {return dfc($this, function() {return\n\t\t$this->isTop()\n\t\t? df_trim_text_right($this->getName(), '[value]')\n\t\t// Анонимные филдсеты не добавляют своё имя в качестве префикса имён полей.\n\t\t: (!$this->_anonymous ? $this->getId() : $this->_parent->nameFull())\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github description about software development:", "pos": "Represent the Github code about software development:", "neg": "Represent the Github code about programming:" }
@param string $text @param string $type @return $this|self
[ "public function writeError(string $text, string $type = self::ERROR_ERROR) : self\n {\n $this->getErrorOutput()->writeln(sprintf($type, $text));\n\n return $this;\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 Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Return a rows.Table created from imported XLSX file. workbook_kwargs will be passed to openpyxl.load_workbook
[ "def import_from_xlsx(\n filename_or_fobj,\n sheet_name=None,\n sheet_index=0,\n start_row=None,\n start_column=None,\n end_row=None,\n end_column=None,\n workbook_kwargs=None,\n *args,\n **kwargs\n):\n \n\n workbook_kwargs = workbook_kwargs or {}\n if \"read_only\" not in wor...
[ "def read_hdf (self, key, **kwargs):\n \n # This one needs special handling because of the \"key\" and path input.\n import pandas\n return pandas.read_hdf (text_type (self), key, **kwargs)" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Populate the rest of the fields required to INSERT a new email_messages record @param array $data @return array
[ "public function populateCreateFields($data) {\n\n $data['user_id'] = Auth::user()->id;\n $data['priority_id'] = null;\n $data['from_email_address'] = $this->request->input('from_email_address');\n $data['from_name'] = $this->request->input('from_name');\n ...
[ "def QA_fetch_index_list_adv(collections=DATABASE.index_list):\n '''\n \n '''\n index_list_items = QA_fetch_index_list(collections)\n if len(index_list_items) == 0:\n print(\"QA Error QA_fetch_index_list_adv call item for item in collections.find() return 0 item, maybe the DATABASE.index_list ...
codesearchnet
{ "query": "Represent the Github post about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code about programming:" }
Marshall the given parameter object.
[ "public void marshall(ExportJobResource exportJobResource, ProtocolMarshaller protocolMarshaller) {\n\n if (exportJobResource == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(exportJobResou...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// Network returns the network prefix or network address for a given network.
[ "func (ipv6 IPv6Addr) Network() IPAddr {\n\treturn IPv6Addr{\n\t\tAddress: IPv6Address(ipv6.NetworkAddress()),\n\t\tMask: ipv6.Mask,\n\t}\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 instruction about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Fast read access mode. @param path the properties file path. @return the read {@link FeatureCollection}. @throws Exception
[ "public static SimpleFeatureCollection readJsonfile( String path ) throws Exception {\n\n OmsJsonFeatureReader reader = new OmsJsonFeatureReader();\n reader.file = path;\n reader.readFeatureCollection();\n\n return reader.geodata;\n }" ]
[ "@Help(help = \"Create the object of type {#}\")\n public T create(final T object) throws SDKException {\n return (T) requestPost(object);\n }" ]
codesearchnet
{ "query": "Represent the text about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code:" }
Get or set any selectbox option. If no value is specified, will act as a getter. @param {HTMLElement} target @param {String} name @param {Object} value
[ "function (target, name, value) {\r\n\t\t\tvar inst = this._getInst(target);\r\n\t\t\tif (!inst) {\r\n\t\t\t\treturn FALSE;\r\n\t\t\t}\r\n\t\t\t//TODO check name\r\n\t\t\tinst[name] = value;\r\n\t\t\t$.data(target, PROP_NAME, inst);\r\n\t\t}" ]
[ "function makeEventDispatcher(obj) {\n $.extend(obj, {\n on: on,\n off: off,\n one: one,\n trigger: trigger,\n _EventDispatcher: true\n });\n // Later, on() may add _eventHandlers: Object.<string, Array.<{event:string, namespace:?string,\n ...
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
This is the entry point method.
[ "public void onModuleLoad() {\n RestRequestBuilder.setDefaultApplicationPath( \"rest\" );\n\n final Button sendGetButton = new Button( \"GET\" );\n final Button sendPostButton = new Button( \"POST\" );\n final Button sendPostPathButton = new Button( \"POST + Path\" );\n final Text...
[ "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 summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
sizeOfInstanceWithUnsafe is safe against this miscounting
[ "public static long sizeOfInstance(Class<?> type) {\n long size = SPEC.getObjectHeaderSize() + sizeOfDeclaredFields(type);\n while ((type = type.getSuperclass()) != Object.class && type != null)\n size += roundTo(sizeOfDeclaredFields(type), SPEC.getSuperclassFieldPadding());\n return...
[ "NameAndType nameType(Symbol sym) {\n return new NameAndType(sym.name, sym.externalType(types), types);\n // the NameAndType is generated from a symbol reference, and the\n // adjustment of adding an additional this$n parameter needs to be made.\n }" ]
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Get Resource Url for DeleteAccountCard @param accountId Unique identifier of the customer account. @param cardId Unique identifier of the card associated with the customer account billing contact. @return String Resource Url
[ "public static MozuUrl deleteAccountCardUrl(Integer accountId, String cardId)\r\n\t{\r\n\t\tUrlFormatter formatter = new UrlFormatter(\"/api/commerce/customer/accounts/{accountId}/cards/{cardId}\");\r\n\t\tformatter.formatUrl(\"accountId\", accountId);\r\n\t\tformatter.formatUrl(\"cardId\", cardId);\r\n\t\treturn n...
[ "function(apiClient) {\n this.apiClient = apiClient || Configuration.default.getDefaultApiClient() || ApiClient.instance;\n\n\n this.setApiClient = function(apiClient) {\n this.apiClient = apiClient;\n };\n\n this.getApiClient = function() {\n return this.apiClient;\n };\n\n\n /**\n ...
codesearchnet
{ "query": "Represent the Github instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// readAtLeastOneByte wraps an io.Reader so that reading cannot return (0, nil). // It returns io.ErrNoProgress if the underlying r.Read method returns (0, nil) // too many times in succession.
[ "func readAtLeastOneByte(r io.Reader, b []byte) (int, error) {\n\tfor i := 0; i < 100; i++ {\n\t\tn, err := r.Read(b)\n\t\tif n != 0 || err != nil {\n\t\t\treturn n, err\n\t\t}\n\t}\n\treturn 0, io.ErrNoProgress\n}" ]
[ "func (f *FailUnknownPaymentHash) Decode(r io.Reader, pver uint32) error {\n\terr := ReadElement(r, &f.amount)\n\tswitch {\n\t// This is an optional tack on that was added later in the protocol. As\n\t// a result, older nodes may not include this value. We'll account for\n\t// this by checking for io.EOF here which...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Instantiate/provision a class instance @param string $name Name of an interface/class/alias to instantiate. @param array $args Optional arguments to pass to the object. @return mixed @throws InjectionException If a cyclic dependency is detected.
[ "public function make($name, array $args = [])\n {\n list($className, $normalizedClass) = $this->resolveAlias($name);\n\n if (isset($this->inProgressMakes[$normalizedClass])) {\n throw new InjectionException(\n $this->inProgressMakes,\n sprintf(\n ...
[ "public function getSection($key)\n {\n if (false === $this->hasSection($key)) {\n throw new ConfigException(sprintf('\"%s\" is not a section', $key));\n }\n\n // do not return the parent object if we were subclassed, but an actual\n // \"Config\" object to avoid copying in...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Iterates the array in a symmetric order, from middle to outwards @param array {Array} Array to be iterated @param callback {Function} Function to be called for each item @return A new array created with value returned by callback
[ "function centericMap(array, callback) {\n var retArray = [],\n length,\n left, right;\n\n if(array) {\n length = array.length - 1;\n left = length >> 1;\n\n while(left >= 0) {\n retArray[left] = callback(array[left]);\n right = length - left;\n if(right !== left) {\n retA...
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Call all of the after callbacks with check result. @param \Illuminate\Contracts\Auth\Authenticatable $user @param string $ability @param array $arguments @param bool $result @return bool|null
[ "protected function callAfterCallbacks($user, $ability, array $arguments, $result)\n {\n foreach ($this->afterCallbacks as $after) {\n if (! $this->canBeCalledWithUser($user, $after)) {\n continue;\n }\n\n $afterResult = $after($user, $ability, $result, $arg...
[ "abstract public function __construct(Request $request, Translator $translator, View $view, GridContract $grid);\n\n /**\n * Extend decoration.\n *\n * @param callable $callback\n *\n * @return $this\n */\n public function extend(callable $callback = null)\n {\n // Run the ...
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Generates an array of relationship key pairs, where the keys are fields on the origin model, and values are fields on the lniked model.
[ "protected function _keys($keys) {\n\t\tif (!$keys) {\n\t\t\treturn [];\n\t\t}\n\t\t$config = $this->_config;\n\t\t$hasType = ($config['type'] === 'hasOne' || $config['type'] === 'hasMany');\n\t\t$related = Libraries::locate('models', $config[$hasType ? 'from' : 'to']);\n\n\t\tif (!class_exists($related)) {\n\t\t\t...
[ "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 text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Group all array items by the given key. @param array|object[]|mixed $collection @param string $key @param bool $useDotSyntax @return array
[ "public static function toKeyGroup($collection, $key, $useDotSyntax = false)\n {\n $keyGroupArray = [];\n foreach ($collection as $item) {\n $itemArray = is_array($item) ? $item : (method_exists($item, 'toArray') ? $item->toArray() : []);\n $keyValue = self::get($itemArray, $k...
[ "protected static function getField(\n ParticleInterface $particle,\n FieldsCargo $cargo,\n string $name,\n array $args = []\n )/*: mixed*/\n {\n $name = Utils::findFieldName($cargo, $name);\n return $particle->attributes()->$name; // test with null.\n }" ]
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Write a proc.yaml for the container and return the container path
[ "def _write_buildproc_yaml(build_data, env, user, cmd, volumes, app_folder):\n \n\n buildproc = ProcData({\n 'app_folder': str(app_folder),\n 'app_name': build_data.app_name,\n 'app_repo_url': '',\n 'app_repo_type': '',\n 'buildpack_url': '',\n 'buildpack_version': ''...
[ "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 Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Technology:" }
Add the CSRF token to the response cookies. @param Request $request @param Response $response @return Response
[ "protected function addCookieToResponse( $request, $response )\n\t{\n\t\t$config = Config::get( 'session' );\n\t\t$response->headers->setCookie( new Cookie( 'XSRF-TOKEN', $request->session()->token(), time() + 60 * 120, $config['path'], $config['domain'], $config['secure'], false ) );\n\n\t\treturn $response;\n\t}"...
[ "protected function beforeHandleRequest(HTTPRequest $request)\n {\n //Set up the internal dependencies (request, response)\n $this->setRequest($request);\n //Push the current controller to protect against weird session issues\n $this->pushCurrent();\n $this->setResponse(new HTT...
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
// ToAvro converts dosa entity definition to avro schema
[ "func ToAvro(namePrefix string, ed *dosa.EntityDefinition) ([]byte, error) {\n\tfields := make([]*Field, len(ed.Columns))\n\tfor i, c := range ed.Columns {\n\t\tprops := make(map[string]string)\n\t\tprops[dosaTypeKey] = c.Type.String()\n\t\t// TODO add tags\n\t\tfields[i] = &Field{\n\t\t\tName: c.Name,\n\t\t\...
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
@param $template @return mixed
[ "protected function getZonesByTemplate($template)\n {\n $zones = $this->templates[$template]['zones'];\n\n foreach ($zones as $key => $zone) {\n $temp = array_map([$this, 'jsString'], $zone['restricted_types']);\n $zones[$key]['restricted_types'] = '['.implode(',', $temp).']';...
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github instruction about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code about programming:" }
Parses the persist clause. @param persistClause the persist clause @param persistDetails the persist details @return the map @throws KunderaException the kundera exception
[ "private Map<String, Object> parsePersistClause(String persistClause, Map<String, Object> persistDetails)\n throws KunderaException\n {\n Pattern pattern = Pattern.compile(\"^([^.]+)\\\\.(?:([^.]+)\\\\.([^.]+)|\\\\[([^\\\\]]+)\\\\])$\");\n Matcher matcher = pattern.matcher(persistClause)...
[ "private void checkSchemaFields(ZooClassDef schema, Collection<ZooClassDef> cachedSchemata, \n\t\t\tSet<String> missingSchemas) {\n\t\t//do this only now, because only now we can check which field types\n\t\t//are really persistent!\n\t\t//TODO check for field types that became persistent only now -> error!!\n\t\t/...
codesearchnet
{ "query": "Represent the Github post about API documentation:", "pos": "Represent the Github code about API documentation:", "neg": "Represent the Github code about Software development:" }
Creates a timestamp from the equivalent long value. This conversion takes account of the time zone and any daylight savings time. @param timestamp timestamp expressed as a long integer @return new Date instance
[ "public static Date getTimestampFromLong(long timestamp)\n {\n TimeZone tz = TimeZone.getDefault();\n Date result = new Date(timestamp - tz.getRawOffset());\n\n if (tz.inDaylightTime(result) == true)\n {\n int savings;\n\n if (HAS_DST_SAVINGS == true)\n {\n s...
[ "@PrefMetadata(type = CmsTimeWarpPreference.class)\n public String getTimeWarp() {\n\n long warp = m_settings.getTimeWarp();\n return warp < 0 ? \"\" : \"\" + warp; // if timewarp < 0 (i.e. time warp is not set), use the empty string because we don't want the date selector widget to interpret the n...
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
// Recursive traversal of the commit graph, generating a linear history of the // path.
[ "func walkGraph(result *[]*object.Commit, seen *map[plumbing.Hash]struct{}, current *object.Commit, path string) error {\n\t// check and update seen\n\tif _, ok := (*seen)[current.Hash]; ok {\n\t\treturn nil\n\t}\n\t(*seen)[current.Hash] = struct{}{}\n\n\t// if the path is not in the current commit, stop searching....
[ "@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 summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Get the widget for the distance. @return array|null
[ "private function getRangeWidget()\n {\n if ('selection' === $this->get('rangemode')) {\n // Get all range options.\n $rangeOptions = [];\n\n foreach (StringUtil::deserialize($this->get('range_selection'), true) as $rangeItem) {\n $rangeOptions[$rangeItem['r...
[ "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:" }
$ oq plot 'hcurves?kind=mean&imt=PGA&site_id=0'
[ "def make_figure_hcurves(extractors, what):\n \n import matplotlib.pyplot as plt\n fig = plt.figure()\n got = {} # (calc_id, kind) -> curves\n for i, ex in enumerate(extractors):\n hcurves = ex.get(what)\n for kind in hcurves.kind:\n got[ex.calc_id, kind] = hcurves[kind]\n ...
[ "def _init_prtfmt(self, key=\"fmta\"):\n \"\"\"\"\"\"\n prtfmt = self.gosubdag.prt_attr[key]\n return prtfmt.replace(\"{NS}\", \"{NS} {hdr1usr01:2} {num_usrgos:>4} uGOs\")" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Get API logical id from API event properties. Handles case where API id is not specified or is a reference to a logical id.
[ "def _get_api_id(self, event_properties):\n \n api_id = event_properties.get(\"RestApiId\")\n if isinstance(api_id, dict) and \"Ref\" in api_id:\n api_id = api_id[\"Ref\"]\n return api_id" ]
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
inverse hyperbolic sine transformation
[ "def inh(table):\n \n t = []\n for i in table:\n t.append(np.ndarray.tolist(np.arcsinh(i)))\n return t" ]
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Natural Language Processing:" }
Parses an HTTP header line. @param string $header The HTTP header line. @return array
[ "private function parseHeader($header)\n {\n list($key, $value) = explode(\": \", trim($header), 2);\n return array(strtolower($key), $value);\n }" ]
[ "def initialize(self, id=None, text=None):\n self.id = none_or(id, int)\n \n\n self.text = none_or(text, str)\n \"\"\"\n Username or IP address of the user at the time of the edit : str | None\n \"\"\"" ]
codesearchnet
{ "query": "Represent the Github text about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code about programming:" }
// Delete an event by ID. Readings are not deleted as this should be handled by the contract layer // 404 - Event not found // 503 - Unexpected problems
[ "func (c *Client) DeleteEventById(id string) (err error) {\n\tconn := c.Pool.Get()\n\tdefer conn.Close()\n\n\terr = deleteEvent(conn, id)\n\tif err != nil {\n\t\tif err == redis.ErrNil {\n\t\t\treturn db.ErrNotFound\n\t\t}\n\t\treturn err\n\t}\n\n\treturn nil\n}" ]
[ "func (r *controller) Update(ctx context.Context, t *api.Task) error {\n\t// TODO(stevvooe): While assignment of tasks is idempotent, we do allow\n\t// updates of metadata, such as labelling, as well as any other properties\n\t// that make sense.\n\treturn nil\n}" ]
codesearchnet
{ "query": "Represent the text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Reject {@code null}, empty, and blank strings with a good exception type and message.
[ "static String checkStringArgument(String s, String name) {\n checkNotNull(s, name);\n checkArgument(!s.trim().isEmpty(), \"'\" + name + \"' must not be blank. Was: '\" + s + \"'\");\n return s;\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 post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
A helper to move the chidren of a group.
[ "def _move_group_helper(self, group):\n \"\"\"\"\"\"\n\n for i in group.children:\n self.groups.remove(i)\n i.level = group.level + 1\n self.groups.insert(self.groups.index(group) + 1, i)\n if i.children:\n self._move_group_helper(i)" ]
[ "public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }" ]
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:572:1: xpathExpressionList returns [java.util.List<String> exprs] : f= expression ( COMMA s= expression )* ;
[ "public final java.util.List<String> xpathExpressionList() throws RecognitionException {\n\t\tjava.util.List<String> exprs = null;\n\n\n\t\tParserRuleReturnScope f =null;\n\t\tParserRuleReturnScope s =null;\n\n\t\t exprs = new java.util.ArrayList<String>();\n\t\ttry {\n\t\t\t// src/main/resources/org/drools/compile...
[ "Rule xyDescriptor() {\n return NodeSequence(\n xyType(),\n push(new XYNode()),\n ZeroOrMore(Sequence(xyElement(), Newline()))\n );\n }" ]
codesearchnet
{ "query": "Represent the comment about Documentation:", "pos": "Represent the code about Documentation:", "neg": "Represent the code about language and writing:" }
extend origin mbg the ability for generating comments
[ "private void extendCG(Configuration config, List<Context> contexts) {\n // just use the extended comment generator\n\n PluginConfiguration pluginConfiguration = new PluginConfiguration();\n pluginConfiguration.setConfigurationType(CommentsWavePlugin.class.getTypeName());\n addToContext(contexts, plugin...
[ "def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh...
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// BeginActions marks the actions represented by the passed in Tags as running.
[ "func (f *Facade) BeginActions(args params.Entities) params.ErrorResults {\n\tactionFn := common.AuthAndActionFromTagFn(f.accessMachine, f.backend.ActionByTag)\n\treturn common.BeginActions(args, actionFn)\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 comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Returns a stopwatch that has been started and will automatically record its result to the dynamic timer specified by the given config. The timer uses a TimeUnit of milliseconds.
[ "public static Stopwatch start(String name, TagList list, TimeUnit unit) {\n final MonitorConfig config = new MonitorConfig.Builder(name).withTags(list).build();\n return INSTANCE.get(config, unit).start();\n }" ]
[ "@PrefMetadata(type = CmsTimeWarpPreference.class)\n public String getTimeWarp() {\n\n long warp = m_settings.getTimeWarp();\n return warp < 0 ? \"\" : \"\" + warp; // if timewarp < 0 (i.e. time warp is not set), use the empty string because we don't want the date selector widget to interpret the n...
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Wipes clean the entire cache's keys. @return bool True on success and false on failure.
[ "public function clear()\n {\n $result = true;\n $dir = new \\DirectoryIterator($this->path);\n foreach ($dir as $file) {\n $extension = pathinfo($file->getFilename(), PATHINFO_EXTENSION);\n if (!$file->isDot() && $extension === 'ser') {\n if (!@unlink($t...
[ "public function item()\n {\n if (!empty($this->response['data'])) {\n return new Fluent($this->resource, $this->response['data']);\n }\n\n // On a valid response that does not have a data field, we can assume that\n // the request is an update/delete type of request that d...
codesearchnet
{ "query": "Represent the Github post about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about Software development:" }
set the justification to left, center/middle or right. The values from the enumerated type are from X3D's <FontStyle> justify setting. @param justify
[ "public void setJustification(justifyTypes justify) {\n if (justify == justifyTypes.BEGIN) mTextView.setGravity(Gravity.LEFT);\n else if (justify == justifyTypes.MIDDLE) mTextView.setGravity(Gravity.CENTER);\n else if (justify == justifyTypes.END) mTextView.setGravity(Gravity.RIGHT);\n ...
[ "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 post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Returns the port used for requests to the Solr server plugin.tx_solr.solr.port Applies stdWrap on the configured setting @param int $defaultIfEmpty @param string $scope read or write, read by default @return int
[ "public function getSolrPort($defaultIfEmpty = 8983, $scope = 'read')\n {\n $scopePath = 'plugin.tx_solr.solr.' . $scope . '.port';\n $fallbackPath = 'plugin.tx_solr.solr.port';\n\n return (int)$this->getValueByPathWithFallbackOrDefaultValueAndApplyStdWrap($scopePath, $fallbackPath, $default...
[ "public function initializeArguments()\n {\n $this->registerArgument('action', 'string', 'Target action');\n $this->registerArgument('arguments', 'array', 'Arguments', false, []);\n $this->registerArgument('controller', 'string', 'Target controller. If NULL current controllerName is used');\...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Marshall the given parameter object.
[ "public void marshall(GetBotVersionsRequest getBotVersionsRequest, ProtocolMarshaller protocolMarshaller) {\n\n if (getBotVersionsRequest == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(ge...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Return Clef user info.
[ "def _get_user_info(self, access_token):\n \"\"\"\"\"\"\n info_response = self._call('GET', self.info_url, params={'access_token': access_token})\n user_info = info_response.get('info')\n return user_info" ]
[ "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 text:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Replaces the default Tornado error page with a Django-styled one
[ "def _on_error_page_write_error(self, status_code, **kwargs):\n \"\"\"\"\"\"\n\n if oz.settings.get('debug'):\n exception_type, exception_value, tback = sys.exc_info()\n is_breakpoint = isinstance(exception_value, oz.error_pages.DebugBreakException)\n\n frames = oz.err...
[ "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 Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns the text display of the specified level for the Sentry. @param integer $level The message level, e.g. [[LEVEL_ERROR]], [[LEVEL_WARNING]]. @return string
[ "public static function getLevelName($level)\n {\n static $levels = [\n Logger::LEVEL_ERROR => 'error',\n Logger::LEVEL_WARNING => 'warning',\n Logger::LEVEL_INFO => 'info',\n Logger::LEVEL_TRACE => 'debug',\n Logger::LEVEL_PROFILE_BEGIN => 'debug',\n...
[ "public function getParam($name)\n {\n //if (in_array($name, self::$_textParamNames)) {\n if (in_array($name, $this->_textParamNames)) {\n return $this->_textParams[$name];\n } else {\n throw new CPS_Exception(array(array('long_message' => 'Invalid response parameter', 'code' => ERROR_CODE_INVAL...
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Set up a repository. This does not test the connection. @param string $repository_name Name of repo to setup. @return Repository|bool
[ "public function setup( $repository_name = null ) {\n\t\tif ( empty( $this->config['repositories'] ) ) {\n\t\t\tLog::instance()->write( 'No repositories in configuration.', 1 );\n\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( empty( $repository_name ) ) {\n\t\t\t$repository_name = $this->getDefault();\n\t\t}\n\n\t\tif ( ...
[ "def delete(self, instance):\n \n \n #TODO: Really drop the database based on a policy set in `instance.parameters`.\n #\n # We need :\n # - Set a policy in parameters of the instance (eg: policy-on-delete : retain|drop => default to retain)\n # - t...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about AWS Auto Scaling:" }
Generate a spectrogram using a method function Each time bin of the resulting spectrogram is a PSD estimate using a single FFT
[ "def spectrogram(timeseries, method_func, **kwargs):\n \n from ...spectrogram import Spectrogram\n\n # get params\n sampling = timeseries.sample_rate.to('Hz').value\n nproc = kwargs.pop('nproc', 1)\n nfft = kwargs.pop('nfft')\n noverlap = kwargs.pop('noverlap')\n nstride = nfft - noverlap\n\...
[ "def gaussian_window(t, params):\n \n window = suspect.basis.gaussian(t, 0, 0, params[\"line_broadening\"])\n\n # the above gaussian function returns an area 1 fid, for a windowing\n # function we need to be area preserving (first point must be 1)\n return window / window[0]" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
LeanMapper: Access object properties to get a item value @param LeanMapper\Entity $item @param mixed $key @return mixed
[ "public function getLeanMapperEntityProperty(LeanMapper\\Entity $item, $key)\n\t{\n\t\t$properties = explode('.', $key);\n\t\t$value = $item;\n\n\t\twhile ($property = array_shift($properties)) {\n\t\t\tif (!isset($value->{$property})) {\n\t\t\t\tif ($this->datagrid->strict_entity_property) {\n\t\t\t\t\tthrow new D...
[ "public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)\n {\n // @todo: Is it possible to store a default value in the DB?\n $fieldDef->defaultValue = new FieldValue();\n $fieldDef->defaultValue->data = array('text' => null);\n }" ]
codesearchnet
{ "query": "Represent the instruction about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Determines all dependencies for the data set and sorts it so least dependant are first. @return Bag
[ "public function sort()\n {\n $deps = $this->all();\n $sorted = $this->sortDeps($deps);\n\n return $this->dependency->getSorted($sorted);\n }" ]
[ "@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Checks if current position is valid @link http://php.net/manual/en/iterator.valid.php @return boolean true on success or false on failure.
[ "public function valid()\n {\n // initialize/refresh cursor\n if ($this->cursor != 0 && !isset($this->elements[$this->index])) {\n $this->scan();\n }\n\n return isset($this->elements[$this->index]);\n }" ]
[ "public function read($session_id)\n {\n $result = '';\n\n if ($this->getTable()->isConnected())\n {\n $row = $this->_table->select($session_id, KDatabase::FETCH_ROW);\n\n if (!$row->isNew()) {\n $result = $row->data;\n }\n }\n\n ...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
return the correct offset based on set order supplied, entity, none @return mixed
[ "public function getOffset()\n {\n if (!is_null($this->suppliedOffset)) {\n return $this->suppliedOffset;\n } elseif (!is_null($this->entityOffset)) {\n return $this->entityOffset;\n }\n return false;\n }" ]
[ "def _init_objcolor(self, node_opts, **kwu):\n \"\"\"\"\"\"\n objgoea = node_opts.kws['dict'].get('objgoea', None)\n # kwu: go2color go2bordercolor dflt_bordercolor key2col\n return Go2Color(self.gosubdag, objgoea, **kwu)" ]
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Returns whether the CMS should perform any service providing. @return bool
[ "public function shouldCmsRegister()\n {\n if (null !== $this->shouldRegister) {\n // @codeCoverageIgnoreStart\n return $this->shouldRegister;\n // @codeCoverageIgnoreEnd\n }\n\n if ( ! $this->isCmsEnabled()) {\n $this->shouldRegister = false;\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 description about NLP:", "pos": "Represent the code about NLP:", "neg": "Represent the code about Programming:" }
Retorna o atendimento em andamento do usuario informado. @param int|Usuario $usuario @param int|Unidade $unidade @return Atendimento
[ "public function atendimentoAndamento($usuario, $unidade = null)\n {\n $status = [\n self::CHAMADO_PELA_MESA,\n self::ATENDIMENTO_INICIADO,\n ];\n try {\n $qb = $this->storage\n ->getManager()\n ->createQueryBuilder()\n ...
[ "def bloquear_sat(retorno):\n \n resposta = analisar_retorno(forcar_unicode(retorno),\n funcao='BloquearSAT')\n if resposta.EEEEE not in ('16000',):\n raise ExcecaoRespostaSAT(resposta)\n return resposta" ]
codesearchnet
{ "query": "Represent the Github summarization about Software Development:", "pos": "Represent the Github code about Software Development:", "neg": "Represent the Github code:" }
Convert a local file path to a absolute path file protocol URL.
[ "def path_to_URL(path, escape=True):\r\n \"\"\"\"\"\"\r\n # We do not use urllib's builtin pathname2url() function since:\r\n # - it has been commented with 'not recommended for general use'\r\n # - it does not seem to work the same on Windows and non-Windows platforms\r\n # (result starts with ...
[ "def cache_dir(script)\n # prefix object ID with a text constant to make a legal directory name\n # in case object id is negative (Ubuntu, etc.). this method will be called\n # more than once and must return the same directory each time for a given\n # script instantiation.\n path = File.no...
codesearchnet
{ "query": "Represent the instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software development:" }
Create a SVG rectangle @param x X coordinate @param y Y coordinate @param w Width @param h Height @return new element
[ "public Element svgRect(double x, double y, double w, double h) {\n return SVGUtil.svgRect(document, x, y, w, h);\n }" ]
[ "function(props) {\n props = defaultValue(props, {});\n\n this.title = props.title;\n\n /**\n * Gets or sets the list of items, ordered from bottom to top, with properties:\n * * `color`: CSS color description,\n * * `lineColor`: CSS color description,\n * * `multipleColors`: An array of CSS color descri...
codesearchnet
{ "query": "Represent the description about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Link a emitter configurable range to a named component @param range The configurable range from the emitter @param name The name of the component to link to
[ "protected void link(Range range, String name) {\r\n\t\tlink(range, (MinMaxPanel) named.get(name));\r\n\t}" ]
[ "def _reflex_rule_process(self, wf_action):\n \n # Check out if the analysis has any reflex rule bound to it.\n # First we have get the analysis' method because the Reflex Rule\n # objects are related to a method.\n a_method = self.getMethod()\n if not a_method:\n ...
codesearchnet
{ "query": "Represent the summarization about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Set the standard property for the encoding charset. @param aMarshaller The marshaller to set the property. May not be <code>null</code>. @param sEncoding the value to be set
[ "public static void setEncoding (@Nonnull final Marshaller aMarshaller, @Nullable final String sEncoding)\n {\n _setProperty (aMarshaller, Marshaller.JAXB_ENCODING, sEncoding);\n }" ]
[ "private void validateString(Class<?> clazz) throws SerializerException {\n if (null != clazz && !clazz.isAssignableFrom(String.class)) {\n throw new SerializerException(\"String serializer is able to work only with data types assignable from java.lang.String\");\n }\n }" ]
codesearchnet
{ "query": "Represent the summarization about Encryption:", "pos": "Represent the code about Encryption:", "neg": "Represent the code about Software development:" }
Download the repositories for all of the firmware_module_type records and update them using the `module.json` files from the repositories themselves. Currently only works for git repositories.
[ "def update_module_types():\n \n local_url = config[\"local_server\"][\"url\"]\n server = Server(local_url)\n db = server[FIRMWARE_MODULE_TYPE]\n temp_folder = mkdtemp()\n for _id in db:\n if _id.startswith(\"_\"):\n continue\n obj = db[_id]\n new_obj = update_recor...
[ "def determine_target_roots(self, goal_name):\n \n if not self.context.target_roots:\n print('WARNING: No targets were matched in goal `{}`.'.format(goal_name), file=sys.stderr)\n\n # For the v2 path, e.g. `./pants list` is a functional no-op. This matches the v2 mode behavior\n # of e.g. `./pants ...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// NetConnLookup extracts an IP from the remote address in the // net.Conn. A single net.Conn should be passed to Address.
[ "func NetConnLookup(conn net.Conn) (net.IP, error) {\n\tif conn == nil {\n\t\treturn nil, errors.New(\"whitelist: no connection\")\n\t}\n\n\tnetAddr := conn.RemoteAddr()\n\tif netAddr == nil {\n\t\treturn nil, errors.New(\"whitelist: no address returned\")\n\t}\n\n\taddr, _, err := net.SplitHostPort(netAddr.String(...
[ "@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 summarization about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
1回のみ実行を許可するワンタイムトークンを発行します<br> このトークンはスタミナの回復処理など、有効期間内だからといって何度も実行されたくない処理を1度だけ許可したい場合に発行します。<br> <br> @param request リクエストパラメータ @return 結果
[ "public CreateTimeOnetimeTokenResult createTimeOnetimeToken(CreateTimeOnetimeTokenRequest request) {\n\n\t\tObjectNode body = JsonNodeFactory.instance.objectNode()\n\t\t\t\t.put(\"scriptName\", request.getScriptName());\n\n\t\tHttpPost post = createHttpPost(\n\t\t\t\tGs2Constant.ENDPOINT_HOST + \"/onetime/time/toke...
[ "func (m *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\t// NOTE ucon内部のルーティングは一元的にこの関数から行う\n\t// Handlerを細分化しhttp.ServeMuxに登録すると、OPTIONSのhandleがうまくできなくなる\n\t// このため、Handlerはucon全体で1つとし、OPTIONSも通常のMethodと同じようにHandlerを設定し利用する\n\t// OPTIONSを適切にhandleするため、全てのHandlerに特殊なHookを入れるよりマシである\n\n\tm.router.S...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// NewGetHeadersCmd returns a new instance which can be used to issue a // getheaders JSON-RPC command. // // NOTE: This is a btcsuite extension ported from // github.com/decred/dcrd/dcrjson.
[ "func NewGetHeadersCmd(blockLocators []string, hashStop string) *GetHeadersCmd {\n\treturn &GetHeadersCmd{\n\t\tBlockLocators: blockLocators,\n\t\tHashStop: hashStop,\n\t}\n}" ]
[ "func (s *NeutrinoClient) GetBlock(hash *chainhash.Hash) (*wire.MsgBlock, error) {\n\t// TODO(roasbeef): add a block cache?\n\t// * which evication strategy? depends on use case\n\t// Should the block cache be INSIDE neutrino instead of in btcwallet?\n\tblock, err := s.CS.GetBlock(*hash)\n\tif err != nil {\n\t\tr...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Programming:" }
Match the version. @param string $version @param string $type @return array The list of $version and $patchVersion
[ "protected static function matchVersion($version, $type)\n {\n $patchVersion = true;\n\n if (\\in_array($type, array('dev', 'snapshot'), true)) {\n $type = 'dev';\n $patchVersion = false;\n } elseif ('a' === $type) {\n $type = 'alpha';\n } elseif (\\in...
[ "def execPath(self):\n \"\"\"\"\"\"\n vers = self.version.label if self.version else None # executables in Versions folder are stored by baseVersion (modified by game data patches)\n return self.installedApp.exec_path(vers)" ]
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// NewSetLifecycleEventsEnabledArgs initializes SetLifecycleEventsEnabledArgs with the required arguments.
[ "func NewSetLifecycleEventsEnabledArgs(enabled bool) *SetLifecycleEventsEnabledArgs {\n\targs := new(SetLifecycleEventsEnabledArgs)\n\targs.Enabled = enabled\n\treturn args\n}" ]
[ "@Override\n public void generatePluginConfig(String serverName, File writeDirectory) {\n // Pass true to utilityRequest since this method will be called from the pluginUtility\n // or by the GeneratePluginConfigListener not by a call to the mbean.\n generatePluginConfig(null,serverName,true...
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Create a <Parameter> element :param name: The name of the custom parameter :param value: The value of the custom parameter :param kwargs: additional attributes :returns: <Parameter> element
[ "def parameter(self, name=None, value=None, **kwargs):\n \n return self.nest(Parameter(name=name, value=value, **kwargs))" ]
[ "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 instruction about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Cancels a reservation. @param string $rno Reservation number. @throws KlarnaException @return bool True, if the cancellation was successful.
[ "public function cancelReservation($rno)\n {\n $this->_checkRNO($rno);\n\n $digestSecret = self::digest(\n $this->colon($this->_eid, $rno, $this->_secret)\n );\n $paramList = array(\n $rno,\n $this->_eid,\n $digestSecret\n );\n\n ...
[ "protected function checkPaymentTransactionStatus(PaymentTransaction $paymentTransaction)\n {\n if (!$paymentTransaction->isFinished())\n {\n throw new ValidationException('Only finished payment transaction can be used for create-card-ref-id');\n }\n\n if (!$paymentTransact...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Executes a query that returns data @param $sql @return array|string
[ "protected function fetch($sql)\n {\n try {\n try {\n $stm = Connect::getConn()->prepare($sql);\n } catch (Exception $e) {\n static::$response[\"status\"] = \"error\";\n static::$response[\"response\"] = $e->getMessage();\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the summarization about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code:" }
Method to create on Statement out of the different parts. @return StringBuilder containing the SQL statement @throws EFapsException on error
[ "protected String createSQLStatement()\n throws EFapsException\n {\n\n final SQLSelect select = new SQLSelect()\n .column(0, \"ID\")\n .from(getMainType().getMainTable().getSqlTable(), 0);\n for (final OneSelect oneSel : this.allSelects) {\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 text about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
@param Request $request @param string $namespace @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
[ "public function settingsAction(Request $request, $namespace = null)\n {\n $admin = $this->getAdmin();\n\n $admin->checkAccess('settings');\n\n if (null === $namespace) {\n $namespace = $admin->getSettingsNamespace();\n }\n\n $manager = $this->getSettingsManager();\n...
[ "public function objectMethods($builder)\n {\n $array = $this->getParameters();\n if (empty($array)) {\n throw new InvalidArgumentException('Please, define your rules for validation.');\n }\n $this->cleanupParameters();\n\n $this->builder = $builder;\n $this->...
codesearchnet
{ "query": "Represent the sentence about Symfony:", "pos": "Represent the code about Symfony:", "neg": "Represent the code:" }
// SetBatchStrategy sets the BatchStrategy field's value.
[ "func (s *CreateTransformJobInput) SetBatchStrategy(v string) *CreateTransformJobInput {\n\ts.BatchStrategy = &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 sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
// Returns the inspect container response, the sandbox metadata, and network namespace mode
[ "func (ds *dockerService) getPodSandboxDetails(podSandboxID string) (*dockertypes.ContainerJSON, *runtimeapi.PodSandboxMetadata, error) {\n\tresp, err := ds.client.InspectContainer(podSandboxID)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tmetadata, err := parseSandboxName(resp.Name)\n\tif err != nil {\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:" }
Parses <EventPort> @param node: Node containing the <EventPort> element @type node: xml.etree.Element
[ "def parse_event_port(self, node):\n \n\n if 'name' in node.lattrib:\n name = node.lattrib['name']\n else:\n self.raise_error(('<EventPort> must specify a name.'))\n\n if 'direction' in node.lattrib:\n direction = node.lattrib['direction']\n else:\...
[ "def dtdEntity(self, name):\n \n ret = libxml2mod.xmlGetDtdEntity(self._o, name)\n if ret is None:raise treeError('xmlGetDtdEntity() failed')\n __tmp = xmlEntity(_obj=ret)\n return __tmp" ]
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
@param string|object $uri @param array $headers @param array|string $datas @param array $files @throws HttpAdapterException @return ResponseInterface
[ "public function put($uri, array $headers = [], $datas = [], array $files = [])\n {\n return $this->send($uri, InternalRequestInterface::METHOD_PUT, $headers, $datas, $files);\n }" ]
[ "public function file(string $path, string $md5)\n {\n //==============================================================================\n // Create Event Object\n $event = new ObjectFileEvent($this->getWebserviceId(), $path, $md5);\n //============================================...
codesearchnet
{ "query": "Represent the Github sentence about PHP:", "pos": "Represent the Github code about PHP:", "neg": "Represent the Github code about Software development:" }
Set <code>this</code> to the union of <code>this</code> and the given point <code>p</code>. @param p the point @return this
[ "public AABBf union(Vector3fc p) {\n return union(p.x(), p.y(), p.z(), this);\n }" ]
[ "def intersection(self, other):\n \n #NOTE: This is a work around \n # Python 3 return as the result of set.intersection a new set instance.\n # Python 2 however returns as a the result a ClusterShell.RangeSet.RangeSet instance.\n # ORIGINAL CODE: return self._wrap_set_op(set.inte...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Generate a random insult from datahamster
[ "def insult(rest):\n\t\"\"\n\t# not supplying any style will automatically redirect to a random\n\turl = 'http://autoinsult.datahamster.com/'\n\tins_type = random.randrange(4)\n\tins_url = url + \"?style={ins_type}\".format(**locals())\n\tinsre = re.compile('<div class=\"insult\" id=\"insult\">(.*?)</div>')\n\tresp...
[ "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:" }
Read individual weights from the load cells in grams. Returns ------- weight : float The sensor weight in grams.
[ "def individual_weights(self):\n \n weights = self._raw_weights()\n if weights.shape[1] == 0:\n return np.zeros(weights.shape[0])\n elif weights.shape[1] < self._ntaps:\n return np.mean(weights, axis=1)\n else:\n return weights.dot(self._filter_coe...
[ "def arg_to_array(func):\n \n def fn(self, arg, *args, **kwargs):\n \"\"\"Function\n\n Parameters\n ----------\n arg : array-like\n Argument to convert.\n *args : tuple\n Arguments.\n **kwargs : dict\n Keyword arguments.\n\n Ret...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
set cURL default option on Guzzle client @param string $key @param bool $value @codeCoverageIgnore
[ "public function setCurlDefaultOption($key, $value) {\n $this->blocktrailClient->setCurlDefaultOption($key, $value);\n $this->dataClient->setCurlDefaultOption($key, $value);\n }" ]
[ "public function antiLight(array $req): void\n {\n $this->isConfigDebug ? print('anti light') : null;\n $this->log(configDefault('anti/light', 'log', 'anti', 'light'), $req);\n }" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Compute the Levenshtein distance; the number of inserted, deleted or substituted characters. @param diffs LinkedList of Diff objects. @return Number of changes.
[ "public int diff_levenshtein(LinkedList<Diff> diffs) {\n int levenshtein = 0;\n int insertions = 0;\n int deletions = 0;\n for (Diff aDiff : diffs) {\n switch (aDiff.operation) {\n case INSERT:\n insertions += aDiff.text.length();\n bre...
[ "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 text:", "pos": "Represent the code:", "neg": "Represent the code about Natural Language Processing:" }
Search for a UsrList like '' with a given value, for a user @param User $user @param type $name @return \Doctrine\Common\Collections\ArrayCollection
[ "public function findUserListLike(User $user, $name)\n {\n $dql = 'SELECT l FROM Phraseanet:UsrList l\n JOIN l.owners o\n WHERE o.user = :usr_id AND l.name LIKE :name';\n\n $params = [\n 'usr_id' => $user->getId(),\n 'name' => $name . '%'\n ];\...
[ "function newService()\n {\n ### Attain Login Continue If Has\n /** @var iHttpRequest $request */\n $request = \\IOC::GetIoC()->get('/HttpRequest');\n $tokenAuthIdentifier = new IdentifierHttpToken;\n $tokenAuthIdentifier\n ->setRequest($request)\n ->setT...
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Serve original file (source). @param string $source path to source file @param array $options (optional) options for serving @throws ServeFailedException if source is not an image or mime type cannot be determined
[ "public static function serveOriginal($source, $options)\n {\n $contentType = ImageMimeTypeGuesser::lenientGuess($source);\n if (is_null($contentType)) {\n throw new ServeFailedException('Rejecting to serve original (mime type cannot be determined)');\n } elseif ($contentType === ...
[ "public function initializeArguments()\n {\n $this->registerArgument('path', 'string', 'Location of the resource, can be either a path relative to the Public resource directory of the package or a resource://... URI', false, null);\n $this->registerArgument('package', 'string', 'Target package key....
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Wavy underline content in a rectangle or quadrilateral.
[ "def addSquigglyAnnot(self, rect):\n \"\"\"\"\"\"\n CheckParent(self)\n\n val = _fitz.Page_addSquigglyAnnot(self, rect)\n\n if not val: return\n val.thisown = True\n val.parent = weakref.proxy(self)\n self._annot_refs[id(val)] = val\n\n return val" ]
[ "def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(wh...
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
构建" IS NULL "和" IS NOT NULL "需要的SqlInfo信息. @param fieldText 数据库字段的文本 @return SqlInfo信息
[ "public SqlInfo buildIsNullSql(String fieldText) {\n this.suffix = StringHelper.isBlank(this.suffix) ? ZealotConst.IS_NULL_SUFFIX : this.suffix;\n join.append(prefix).append(fieldText).append(this.suffix);\n return sqlInfo.setJoin(join);\n }" ]
[ "public Select parseSelect(MySqlSelectQueryBlock query) throws SqlParseException {\n\n Select select = new Select();\n /*zhongshu-comment SqlParser类没有成员变量,里面全是方法,所以将this传到WhereParser对象时是无状态的,\n 即SqlParser对象并没有给WhereParser传递任何属性,也不存在WhereParser修改SqlParser的成员变量值这一说\n ...
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Load theme routes.
[ "public function map()\n {\n $themeName = ltrim(\n str_replace(themes_path(), '', realpath(__DIR__.'/../../')),\n '\\/'\n );\n\n Route::middleware('web')\n ->namespace($this->namespace)\n ->group(themes_path($themeName.'/routes.php'));\n }" ]
[ "protected function parentId()\n\t{\n\t\tswitch ( $this->position )\n\t\t{\n\t\t\tcase 'root':\n\t\t\t\treturn null;\n\n\t\t\tcase 'child':\n\t\t\t\treturn $this->target->getKey();\n\n\t\t\tdefault:\n\t\t\t\treturn $this->target->getParentId();\n\t\t}\n\t}" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code about Computer Science:" }
Marshall the given parameter object.
[ "public void marshall(EngineVersion engineVersion, ProtocolMarshaller protocolMarshaller) {\n\n if (engineVersion == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(engineVersion.getName(), 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 summarization about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
/* (non-Javadoc) @see io.joynr.capabilities.CapabilitiesStore#add(io.joynr. capabilities .DiscoveryEntry)
[ "@Override\n public synchronized void add(DiscoveryEntry discoveryEntry) {\n logger.debug(\"adding discovery entry: {}\", discoveryEntry);\n if (!(discoveryEntry instanceof GlobalDiscoveryEntryPersisted)) {\n return;\n }\n GlobalDiscoveryEntryPersisted globalDiscoveryEntry ...
[ "private void addRestResourceClasses(Set<Class<?>> resources) {\n resources.add(pl.setblack.airomem.direct.banksample.rest.BankResource.class);\n }" ]
codesearchnet
{ "query": "Represent the Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns the list of available templates. :returns: list of template names
[ "def gitignore_templates(self):\n \n url = self._build_url('gitignore', 'templates')\n return self._json(self._get(url), 200) or []" ]
[ "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 text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// Receive waits for the response promised by the future and returns the result // of the move operation.
[ "func (r FutureMoveResult) Receive() (bool, error) {\n\tres, err := receiveFuture(r)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// Unmarshal result as a boolean.\n\tvar moveResult bool\n\terr = json.Unmarshal(res, &moveResult)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn moveResult, nil\n}" ]
[ "function onChunk(count) {\n // If chunk read has no bytes than there is nothing left, so end a\n // collection.\n if (count === 0) return next(end)\n\n // Move a offset `position` with `count` towards the end unless\n // position was a `null` in which case we just keep it (`null` means\n ...
codesearchnet
{ "query": "Represent the instruction about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about File management:" }
Returns a Jmol script to set the default orientation for a structure @return Jmol script
[ "@Override\n\tpublic String getDefaultOrientation() {\n\t\tStringBuilder s = new StringBuilder();\n\t\ts.append(setCentroid());\n\n\t\tQuat4d q = new Quat4d();\n\t\tq.set(helixAxisAligner.getRotationMatrix());\n\n\t\t// set orientation\n\t\ts.append(\"moveto 0 quaternion{\");\n\t\ts.append(jMolFloat(q.x));\n\t\ts.a...
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
MoveToNext @param XPathNavigator $nav @return bool
[ "protected function MoveToNext( $nav )\r\n\t{\r\n\t\t$result = $nav->MoveToNextAttribute();\r\n\r\n\t\tif ( $result && $this->skip( $nav ) )\r\n\t\t{\r\n\t\t\treturn $this->MoveToNext( $nav );\r\n\t\t}\r\n\r\n\t\treturn $result;\r\n\t}" ]
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Get extensions defined by application developer. @return array
[ "protected function getExtensions()\n {\n if (file_exists(realpath(__DIR__.'/../../../../../config/twig.php'))) {\n $this->config = require realpath(__DIR__.'/../../../../../config/twig.php');\n } else {\n $this->config = require realpath(__DIR__.'/../../config/twig.php');\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the sentence about database:", "pos": "Represent the code about database:", "neg": "Represent the code:" }
// NewMustRunAs provides a strategy that requires the container to run as a specific UID.
[ "func NewMustRunAs(options *securityapi.RunAsUserStrategyOptions) (RunAsUserSecurityContextConstraintsStrategy, error) {\n\tif options == nil {\n\t\treturn nil, fmt.Errorf(\"MustRunAs requires run as user options\")\n\t}\n\tif options.UID == nil {\n\t\treturn nil, fmt.Errorf(\"MustRunAs requires a UID\")\n\t}\n\tre...
[ "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 description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
@param null $values @param int $depth @param bool $withToArray @return Object
[ "public function toObject($values = null, $depth = 6, $withToArray = true)\n {\n $array = $this->toArray($values, $depth, $withToArray);\n foreach ($array as $key => $val) {\n $array[$key] = new Obj($val);\n }\n\n return new Obj($array);\n }" ]
[ "public static function castDimensions(Image\\Dimensions $dimensions, array $a, Stub $stub, $isNested, $filter = 0)\n {\n $stub->class .= sprintf(' \"%s\"', (string) $dimensions);\n\n return $a;\n }" ]
codesearchnet
{ "query": "Represent the Github summarization about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }