query
stringlengths
16
255
pos
list
neg
list
task
stringclasses
1 value
instruction
dict
Does the raytracing. @return {@link RayTraceResult} with <code>typeOfHit</code> <b>BLOCK</b> if a ray hits a block in the way, or <b>MISS</b> if it reaches <code>dest</code> without any hit
[ "public RayTraceResult trace()\n\t{\n\t\tRayTraceResult mop = null, firstHit = null;\n\t\tdouble tX, tY, tZ, min;\n\t\tint count = 0;\n\t\tboolean ret = false;\n\n\t\tint currentX = blockSrc.getX();\n\t\tint currentY = blockSrc.getY();\n\t\tint currentZ = blockSrc.getZ();\n\n\t\twhile (!ret && count++ <= MAX_BLOCKS...
[ "function _detectPreciseCollisionsFromCollisions(collisions) {\n return collisions.filter(collision => {\n // TODO:\n // - Use temporal bisection with discrete sub-time steps to find time of collision (use\n // x-vs-y-specific intersection detection methods).\n // - Make sure the collision object...
codesearchnet
{ "query": "Represent the sentence about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code about Computer Science:" }
/* Lists Nitro partners
[ "function processResponse(obj) {\n\tfor (var p in obj.nitro.results.items) {\n\t\tvar partner = obj.nitro.results.items[p];\n\t\tconsole.log(partner.pid+','+partner.name+','+(partner.description||'No description'));\n\t}\n\tvar dest = {};\n\tif ((obj.nitro.pagination) && (obj.nitro.pagination.next)) {\n\t\tdest.que...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Delete array of load balancer pool @param loadBalancerPool array of load balancer pool @return OperationFuture wrapper for load balancer pool list
[ "public OperationFuture<List<LoadBalancerPool>> delete(LoadBalancerPool... loadBalancerPool) {\n return delete(Arrays.asList(loadBalancerPool));\n }" ]
[ "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 Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about AWS Auto Scaling:" }
Set the return format. @param string $format @return self
[ "public function format(string $format) : self\n {\n if (! in_array($format, self::VALID_FORMATS)) {\n throw new Exception('Invalid format provided to path.');\n }\n\n $this->format = $format;\n\n return $this;\n }" ]
[ "def get_pointer_mapping(self):\n \"\"\"\"\"\"\n r = request.GetPointerMapping(display = self.display)\n return r.map" ]
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
// formats a number so that it is displayed as the smallest string possible
[ "func resultErrorFormatJSONNumber(n json.Number) string {\n\n\tif int64Value, err := n.Int64(); err == nil {\n\t\treturn fmt.Sprintf(\"%d\", int64Value)\n\t}\n\n\tfloat64Value, _ := n.Float64()\n\n\treturn fmt.Sprintf(\"%g\", float64Value)\n}" ]
[ "def formatDecimalMark(value, decimalmark='.'):\n \n # We have to consider the possibility of working with decimals such as\n # X.000 where those decimals are important because of the precission\n # and significant digits matters\n # Using 'float' the system delete the extre desimals with 0 as a valu...
codesearchnet
{ "query": "Represent the post about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Get Path Attribute for the Image @param string $path @return \AvoRed\Framework\Image\LocalFile $localImage
[ "public function getPathAttribute($path)\n {\n if (null === $this->attributes['path'] || empty($this->attributes['path'])) {\n return;\n }\n\n $symlink = config('avored-framework.symlink_storage_folder');\n $relativePath = $this->attributes['path'];\n $localImage = n...
[ "protected final function AddCssClassField()\n {\n $name = 'CssClass';\n $this->AddField(Input::Text($name, $this->Content()->GetCssClass()), false, Trans(\"Core.ContentForm.$name\"));\n }" ]
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
// NewTranslator instantiates a new Translator for Google's Translate API.
[ "func NewTranslator(apiKey string) translator.Translator {\n\tauthenticator := newAuthenticator(apiKey)\n\trouter := newRouter()\n\n\treturn &api{\n\t\tlp: newLanguageProvider(authenticator, router),\n\t\ttp: newTranslationProvider(authenticator, router),\n\t}\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 description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Formatted Message to send to Polyglot. Connection messages are sent automatically from this module so this method is used to send commands to/from Polyglot and formats it for consumption
[ "def send(self, message):\n \n if not isinstance(message, dict) and self.connected:\n warnings.warn('payload not a dictionary')\n return False\n try:\n message['node'] = self.profileNum\n self._mqttc.publish(self.topicInput, json.dumps(message), retai...
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// LayerURLs returns several URLs for a specific layer.
[ "func (i *Image) LayerURLs(id string) []string {\n\tvar urls []string\n\tfor _, ep := range i.endpoints {\n\t\turls = append(urls, fmt.Sprintf(\"%s://%s/v1/images/%s/layer\", i.scheme, ep, id))\n\t}\n\treturn urls\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 description:", "pos": "Represent the code:", "neg": "Represent the code:" }
Translate an assign statement. This updates the version number of the underlying assigned variable. @param stmt @param wyalFile @throws ResolutionError
[ "private Context translateAssign(WyilFile.Stmt.Assign stmt, Context context) {\n\t\tTuple<WyilFile.LVal> lhs = stmt.getLeftHandSide();\n\t\tTuple<WyilFile.Expr> rhs = stmt.getRightHandSide();\n\t\tWyilFile.LVal[][] lvals = new LVal[rhs.size()][];\n\t\tExpr[][] rvals = new Expr[rhs.size()][];\n\t\t// First, generate...
[ "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:" }
Short description for function. Long description (if any) ... @return unknown Return description (if any) ...
[ "public function timer_diff()\n {\n $PAGELOADTIME = microtime();\n $PAGELOADTIME = explode(' ', $PAGELOADTIME);\n $PAGELOADTIME = $PAGELOADTIME[1] + $PAGELOADTIME[0];\n $now = $PAGELOADTIME;\n $TIMEDIFF = ($now - $this->basetime);\n\n return $TIMEDIFF;\n }" ]
[ "function hook_code($hook_short_name, $parameters_string) {\n $parameters = explode(', ', $parameters_string);\n $parameters_doc_lines = array();\n foreach ($parameters as $parameter) {\n $parameters_doc_lines[] = \" * @param $parameter\\n\" .\n \" * TODO: document thi...
codesearchnet
{ "query": "Represent the Github post about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Calculate vector result from two list operands with given mathematical operation.
[ "def _calculate_vector(self, operation, left, right):\n \n result = []\n if len(right) == 1:\n right = _to_numeric(right[0])\n for iteml in left:\n iteml = _to_numeric(iteml)\n result.append(self.binops_math[operation](iteml, right))\n ...
[ "def rs_calc_syndromes(msg, nsym, fcr=0, generator=2):\n '''\n '''\n # Note the \"[0] +\" : we add a 0 coefficient for the lowest degree (the constant). This effectively shifts the syndrome, and will shift every computations depending on the syndromes (such as the errors locator polynomial, errors evaluato...
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code about Natural Language Processing:" }
Retrieve GECOS field info and return it in dictionary form
[ "def _get_gecos(name, root=None):\n '''\n \n '''\n if root is not None and __grains__['kernel'] != 'AIX':\n getpwnam = functools.partial(_getpwnam, root=root)\n else:\n getpwnam = functools.partial(pwd.getpwnam)\n gecos_field = salt.utils.stringutils.to_unicode(\n getpwnam(_qu...
[ "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 sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
The number of columns of the sliced array. The 'parent' parameter can be a QModelIndex. It is ignored since the number of columns does not depend on the parent.
[ "def columnCount(self, parent=None):\n \n if self._separateFieldOrientation == Qt.Horizontal:\n return self._nCols * len(self._fieldNames)\n else:\n return self._nCols" ]
[ "def _check_graph(self, graph):\n \"\"\"\"\"\"\n if graph.num_vertices != self.size:\n raise TypeError(\"The number of vertices in the graph does not \"\n \"match the length of the atomic numbers array.\")\n # In practice these are typically the same arrays using the s...
codesearchnet
{ "query": "Represent the Github sentence:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Creates a Request. @param Request $request The current Request instance @param string $path A path (an absolute path (/foo), an absolute URL (http://...), or a route name (foo)) @return Request A Request instance
[ "public function createRequest(Request $request, $path)\n {\n $newRequest = Request::create($this->generateUri($request, $path), 'get', [], $request->cookies->all(), [], $request->server->all());\n\n static $setSession;\n\n if (null === $setSession) {\n $setSession = \\Closure::bi...
[ "@Route(method= HttpMethod.GET, uri=\"/{id}\")\n public Result get(@Parameter(\"id\") String id) {\n // The value of id is computed from the {id} url fragment.\n return ok(id);\n }" ]
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Programming:" }
Sets the dirty status of a single property. @param string $property the field to set or check status for @param bool $isDirty true means the property was changed, false means it was not changed. Defaults to true. @return $this
[ "public function setDirty($property, $isDirty = true)\n {\n if ($isDirty === false) {\n unset($this->_dirty[$property]);\n\n return $this;\n }\n\n $this->_dirty[$property] = true;\n unset($this->_errors[$property], $this->_invalid[$property]);\n\n return $...
[ "public function validate(&$values, $action) {\n $this->errors = array();\n $this->values = $values;\n $valid = true;\n foreach ($this->rules as $rule) {\n $forActions = isset($rule['on']) ? explode(',', $rule['on']) : array();\n array_walk($forActions, function (&$...
codesearchnet
{ "query": "Represent the Github comment about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Create all database tables.
[ "def create_all(graph):\n \n head = get_current_head(graph)\n if head is None:\n Model.metadata.create_all(graph.postgres)\n stamp_head(graph)" ]
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the comment about Database Management:", "pos": "Represent the code about Database Management:", "neg": "Represent the code:" }
// SetGatewayARN sets the GatewayARN field's value.
[ "func (s *DeleteGatewayInput) SetGatewayARN(v string) *DeleteGatewayInput {\n\ts.GatewayARN = &v\n\treturn s\n}" ]
[ "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 description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
// Password prompts the user to provide a password. The value provided by the // user is masked. // // If confirm is true the user will be prompted to supply the password again.
[ "func Password(confirm bool, override *string) (string, error) {\n\tpreferences, err := prefs.NewPreferences()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tlabel := \"Password\"\n\tif override != nil {\n\t\tlabel = *override\n\t}\n\n\tif !ui.Attached() {\n\t\treturn \"\", errs.ErrTerminalRequired\n\t}\n\n\tpr...
[ "function spawnPrng() {\n var ctx = forge.prng.create(prng_aes);\n\n /**\n * Gets random bytes. If a native secure crypto API is unavailable, this\n * method tries to make the bytes more unpredictable by drawing from data that\n * can be collected from the user of the browser, eg: mouse movement.\n *\n ...
codesearchnet
{ "query": "Represent the post about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Register/Unregister an event handler for a id. @param string $id An unique id for the handler. @param EventHandler $handler The handler. Pass null to remove from register.
[ "public function registerEventHandler($id, $handler)\n {\n if ($handler === null) {\n unset($this->handlerMap[$id]);\n } else {\n $this->handlerMap[$id] = $handler;\n }\n }" ]
[ "function WidgetDef(config, endFunc, out) {\n this.type = config.type; // The widget module type name that is passed to the factory\n this.id = config.id; // The unique ID of the widget\n this.config = config.config; // Widget config object (may be null)\n this.state = config.state; // Widget state obje...
codesearchnet
{ "query": "Represent the description about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
Search for a connection to or from this port by name.
[ "def get_connection_by_name(self, name):\n ''''''\n with self._mutex:\n for conn in self.connections:\n if conn.name == name:\n return conn\n return None" ]
[ "def process_source(source)\n if source == \"00\"\n logger.warn(\"Connection has been aborted by the service provider because of an error by the service user (client side).\")\n elsif source == \"02\"\n logger.warn(\"Connection has been aborted by the service provider because of an error by ...
codesearchnet
{ "query": "Represent the text:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
// SetLicenseAcquisitionUrl sets the LicenseAcquisitionUrl field's value.
[ "func (s *HlsContentProtection) SetLicenseAcquisitionUrl(v string) *HlsContentProtection {\n\ts.LicenseAcquisitionUrl = &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:" }
@param $bundle @return Translation[]
[ "public function getKeysByBundle($bundle)\n {\n $em = $this->getEntityManager();\n\n $queryBuilder = $em->createQueryBuilder();\n $queryBuilder->select('t')\n ->from('TranslationsApiBundle:Translation', 't')\n ->where('t.bundle = :bundle')\n ->setParameter('b...
[ "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 description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Get the error messages as human readable message
[ "public function getErrorMessage()\n {\n $messages = array();\n foreach ($this->errors as $error) {\n if (isset($this->errorMessages[$error])) {\n $messages[] = $this->errorMessages[$error];\n } else{\n $messages[] = $error;\n }\n ...
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the Github summarization about Natural Language Processing:", "pos": "Represent the Github code about Natural Language Processing:", "neg": "Represent the Github code:" }
Get axis settings options including ticks, x- and y-labels and limits.
[ "def _process_axsettings(self, hist, lims, ticks):\n \n axis_settings = dict(zip(self.axis_settings, [None, None, (None if self.overlaid else ticks)]))\n return axis_settings" ]
[ "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:" }
@param int $val @return int
[ "protected function crossSum(int $val): int\n {\n $reducer = function (int $sum, string $char): int {\n return $sum + (int) $char;\n };\n\n return array_reduce(str_split((string) $val), $reducer, 0);\n }" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
IDE information @return void
[ "protected function ide()\n {\n foreach ($this->readdmesg() as $line) {\n if (preg_match('/^(.*) at (pciide|wdc|atabus|atapibus)[0-9]+ (.*): <(.*)>/', $line, $ar_buf)\n || preg_match('/^(.*) at (pciide|wdc|atabus|atapibus)[0-9]+ /', $line, $ar_buf)) {\n $dev = new H...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
@param \Spryker\Install\Stage\Section\SectionInterface $section @param array $definition @return void
[ "protected function setExcluded(SectionInterface $section, array $definition)\n {\n if (isset($definition[static::CONFIG_EXCLUDED]) && $definition[static::CONFIG_EXCLUDED]) {\n $section->markAsExcluded();\n }\n }" ]
[ "public function createService(ServiceLocatorInterface $serviceLocator)\n {\n /** @var $processingConfig ProcessingConfig */\n $processingConfig = $serviceLocator->get('processing_config');\n\n return ProcessingNode::initializeAs(NodeName::fromString($processingConfig->getNodeName()));\n ...
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software Development:" }
Loads the Anahita Framework
[ "public function loadFramework()\n {\n if (!defined('ANPATH_BASE')) {\n $_composerLoader = $GLOBALS['composerLoader'];\n define('ANPATH_BASE', WWW_ROOT);\n $_SERVER['HTTP_HOST'] = '';\n require_once ( ANPATH_BASE.'/includes/framework.php' );\n \\AnSer...
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
// SetUserId sets the UserId field's value.
[ "func (s *CreateUserInput) SetUserId(v string) *CreateUserInput {\n\ts.UserId = &v\n\treturn s\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 instruction about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about programming:" }
Adapted from: https://www.nczonline.net/blog/2013/01/15/fixing-skip-to-content-links/
[ "function setFocus (hash) {\n var element = document.getElementById(hash.substring(1))\n\n if (element) {\n if (!/^(?:a|select|input|button|textarea)$/i.test(element.tagName)) {\n element.tabIndex = -1\n }\n\n element.focus()\n }\n }" ]
[ "def cli(verbose):\n \n floyd.floyd_host = floyd.floyd_web_host = \"https://dev.floydhub.com\"\n floyd.tus_server_endpoint = \"https://upload-v2-dev.floydhub.com/api/v1/upload/\"\n configure_logger(verbose)\n check_cli_version()" ]
codesearchnet
{ "query": "Represent the post:", "pos": "Represent the code:", "neg": "Represent the code:" }
Allows to override population mode with a ``populate`` method.
[ "def create(self, **kwargs):\n \n with auto_populate(self._populate_mode):\n return super(MultilingualQuerySet, self).create(**kwargs)" ]
[ "def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)" ]
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code:" }
// See net.Conn for documentation
[ "func (c *managedConnImpl) RemoteAddr() net.Addr {\n\tconn, _ := c.rawConn()\n\treturn conn.RemoteAddr()\n}" ]
[ "@Override\n public void init(TCPWriteRequestContext x, H2MuxTCPWriteCallback c) {\n writeReqContext = x;\n muxCallback = c;\n\n // callback will need to know how to get back to this write queue.\n // This means one and only one H2WriteTree per H2InboundLink which has just one true TC...
codesearchnet
{ "query": "Represent the comment about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }
Checks the node's ancestors to find the highest ancestor with the same <code>headWordNode</code> as this node.
[ "public TreeGraphNode highestNodeWithSameHead() {\r\n TreeGraphNode node = this;\r\n while (true) {\r\n TreeGraphNode parent = safeCast(node.parent());\r\n if (parent == null || parent.headWordNode() != node.headWordNode()) {\r\n return node;\r\n }\r\n node = parent;\r\n }\r\n }...
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the Github text about Computer Science:", "pos": "Represent the Github code about Computer Science:", "neg": "Represent the Github code about programming:" }
Parses <DataWriter> @param node: Node containing the <DataWriter> element @type node: xml.etree.Element
[ "def parse_data_writer(self, node):\n \n\n if 'path' in node.lattrib:\n path = node.lattrib['path']\n else:\n self.raise_error('<DataWriter> must specify a path.')\n\n if 'filename' in node.lattrib:\n file_path = node.lattrib['filename']\n else:\n ...
[ "def DeserializeExclusiveData(self, reader):\n \n\n self.Type = TransactionType.IssueTransaction\n\n if self.Version > 1:\n raise Exception('Invalid TX Type')" ]
codesearchnet
{ "query": "Represent the Github comment about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
[ "func (in *RollingUpdateDeployment) DeepCopyInto(out *RollingUpdateDeployment) {\n\t*out = *in\n\tout.MaxUnavailable = in.MaxUnavailable\n\tout.MaxSurge = in.MaxSurge\n\treturn\n}" ]
[ "func ExternalCAsEqualStable(a, b []*api.ExternalCA) bool {\n\t// because DeepEqual will treat an empty list and a nil list differently, we want to manually check this first\n\tif len(a) == 0 && len(b) == 0 {\n\t\treturn true\n\t}\n\t// The assumption is that each individual api.ExternalCA within both lists are cre...
codesearchnet
{ "query": "Represent the sentence about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Sorts the current set of {@code Import}s by name and returns them as new instance of {@code Imports}. @return new instance of {@code Imports}
[ "@Nonnull\n\tpublic Imports sortByName() {\n\t\tfinal List<Import> imports = Lists.newArrayList(this.imports);\n\t\tCollections.sort(imports, ORDER.nullsLast());\n\t\treturn new Imports(imports);\n\t}" ]
[ "@SuppressWarnings(\"unchecked\")\n public <T> Param<T> get(int index) {\n // TODO: Provide a more type safe API. E.g. make index a pojo typed on T which is aligned with the Param<T>\n return (Param<T>) params[index];\n }" ]
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Render an individual tag by making the appropriate replacement within the current context (if any).
[ "def __render_tag(info, state):\n \n new_contexts, context_match = get_tag_context(info['tag_key'], state)\n replacement = ''\n\n if context_match or context_match == 0:\n replacement = context_match\n elif info['tag_key'] == '.':\n replacement = state.context()\n else:\n repl...
[ "function PbfSplicer(options) {\n // tag which will be auto-removed and auto-injected. Usually 'name'\n this.nameTag = options.nameTag;\n // tag that contains JSON initially, and which works as a prefix for multiple values\n this.multiTag = options.multiTag;\n\n // If options.namePicker is given, this class co...
codesearchnet
{ "query": "Represent the instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Retrieve a paginated result response. @param resource $result @paaram string $cookie @return bool @throws AdldapException
[ "public function controlPagedResultResponse($result, &$cookie)\n {\n if ($this->isPagingSupported()) {\n if ($this->suppressErrors) {\n return @ldap_control_paged_result_response($this->getConnection(), $result, $cookie);\n }\n\n return ldap_control_paged_re...
[ "private function processAuthenticate(Session $session, AuthenticateMessage $msg)\n {\n $session->abort(new \\stdClass(), 'thruway.error.internal');\n Logger::error($this, 'Authenticate sent to realm without auth manager.');\n }" ]
codesearchnet
{ "query": "Represent the Github comment about PHP:", "pos": "Represent the Github code about PHP:", "neg": "Represent the Github code about Programming:" }
convert status code in Responses from int to string
[ "def _op(self, _, obj, app):\n \n if obj.responses == None: return \n\n tmp = {}\n for k, v in six.iteritems(obj.responses):\n if isinstance(k, six.integer_types):\n tmp[str(k)] = v\n else:\n tmp[k] = v\n obj.update_field('respon...
[ "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:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Return the timers in the current lesson for the given user. @param int $lessonid lesson instance id @param int $userid only fetch timers of the given user @return array of warnings and timers @since Moodle 3.3 @throws moodle_exception
[ "public static function get_user_timers($lessonid, $userid = null) {\n global $USER;\n\n $params = array(\n 'lessonid' => $lessonid,\n 'userid' => $userid,\n );\n $params = self::validate_parameters(self::get_user_timers_parameters(), $params);\n $warnings = ...
[ "protected function validate_data() {\n parent::validate_data();\n // Make sure this class is never used without proper object details.\n if (empty($this->objectid) || empty($this->objecttable)) {\n throw new \\coding_exception('The course_module_viewed event must define objectid and...
codesearchnet
{ "query": "Represent the Github comment about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
// SetHierarchyPath sets the HierarchyPath field's value.
[ "func (s *HierarchyGroup) SetHierarchyPath(v *HierarchyPath) *HierarchyGroup {\n\ts.HierarchyPath = 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 summarization about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
// CloudBackupSchedCreate creates a schedule backup volume to cloud
[ "func (d *driver) CloudBackupSchedCreate(\n\tinput *api.CloudBackupSchedCreateRequest,\n) (*api.CloudBackupSchedCreateResponse, error) {\n\n\t// Confirm credential id\n\tif err := d.CredsValidate(input.CredentialUUID); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Check volume\n\tvols, err := d.Inspect([]string{in...
[ "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 Github post:", "pos": "Represent the Github code:", "neg": "Represent the Github code about Software development:" }
// reply message
[ "func (this *Weixinmp) replyMsg(rw http.ResponseWriter, msg interface{}) error {\n\tv := reflect.ValueOf(msg).Elem()\n\tv.FieldByName(\"ToUserName\").SetString(this.Request.FromUserName)\n\tv.FieldByName(\"FromUserName\").SetString(this.Request.ToUserName)\n\tv.FieldByName(\"CreateTime\").SetInt(time.Now().Unix())\...
[ "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 description:", "pos": "Represent the code:", "neg": "Represent the code about Software development:" }
Append noarchive attribute if it present. @param [Hash<String, String>] noindex noindex attributes. @return [Hash<String, String>] modified noindex attributes.
[ "def append_noarchive_attribute(noindex)\n noarchive_name, noarchive_value = extract_noindex_attribute :noarchive\n if noarchive_value\n if noindex[noarchive_name].blank?\n noindex[noarchive_name] = noarchive_value\n else\n noindex[noarchive_name] += \", #{noarchive_value}\...
[ "def uncomment(key, value, tree)\n # Try to find if it is commented out, so we can replace line\n matcher = Matcher.new(\n collection: \"#comment\",\n # FIXME: this assumes a specific \"=\" syntax, bypassing the lens\n # FIXME: this will match also \"# If you set FOO=bar then...\"\...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Computer Science:" }
Various informal tests of Redwood functionality @param args Unused
[ "public static void main(String[] args){\r\n\r\n // -- STRESS TEST THREADS --\r\n Runnable[] tasks = new Runnable[1000];\r\n for(int i=0; i<tasks.length; i++){\r\n final int fI = i;\r\n tasks[i] = new Runnable(){\r\n public void run(){\r\n startTrack(\"Runnable \" + fI);\r\n ...
[ "def setTargets(self, targets):\n \n if not self.verifyArguments(targets) and not self.patterned:\n raise NetworkError('setTargets() requires [[...],[...],...] or [{\"layerName\": [...]}, ...].', targets)\n self.targets = targets" ]
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
@param int $samplesCount @return array
[ "private function getBeyondMinimumIndexes(int $samplesCount)\n {\n $indexes = [];\n foreach ($this->frequencies as $token => $frequency) {\n if (($frequency / $samplesCount) < $this->minDF) {\n $indexes[] = $this->getTokenIndex($token);\n }\n }\n\n ...
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the description about Signal Processing:", "pos": "Represent the code about Signal Processing:", "neg": "Represent the code about programming:" }
Parses the leap seconds file. @throws Exception if an error occurs
[ "private void parseLeapSecondsFile() throws Exception {\n printVerbose(\"Parsing leap second file: \" + leapSecondsFile);\n int lineNumber = 1;\n String line = null;\n BufferedReader in = null;\n\n try {\n in = new BufferedReader(new FileReader(leapSecondsFile));\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 Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
this is pretty simple as we just have to deal with labels
[ "def _get_slice_axis(self, slice_obj, axis=None):\n \n if axis is None:\n axis = self.axis or 0\n\n obj = self.obj\n if not need_slice(slice_obj):\n return obj.copy(deep=False)\n\n labels = obj._get_axis(axis)\n indexer = labels.slice_indexer(slice_obj...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the description:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
// checkSecureAdminToken checks admin connection token which Centrifugo returns after admin login.
[ "func checkSecureAdminToken(secret string, token string) bool {\n\ts := securecookie.New([]byte(secret), nil)\n\tvar val string\n\terr := s.Decode(secureAdminTokenKey, token, &val)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif val != secureAdminTokenValue {\n\t\treturn false\n\t}\n\treturn true\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 instruction:", "pos": "Represent the code:", "neg": "Represent the code about programming:" }
Adds an assignment instruction. @param string $name Name of the value to assign @param string $value Value to assign @throws \InvalidArgumentException @return Graph Fluid-interface
[ "public function set($name, $value)\n {\n if (in_array($name, array('graph', 'node', 'edge'))) {\n throw new \\InvalidArgumentException(sprintf('Use method attr for setting %s', $name));\n }\n\n $this->instructions[] = new Assign($name, $value);\n\n return $this;\n }" ]
[ "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 sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about Software development:" }
Language Direction Support switches CSS positions based on the language direction <%= tml_style_attribute_tag('float', 'right') %> => "float: right" : "float: left" <%= tml_style_attribute_tag('align', 'right') %> => "align: right" : "align: left"
[ "def tml_style_attribute_tag(attr_name = 'float', default = 'right', lang = tml_current_language)\n return \"#{attr_name}:#{default}\".html_safe if Tml.config.disabled?\n \"#{attr_name}:#{lang.align(default)}\".html_safe\n end" ]
[ "def condense_multidimensional_zeros(css):\n \"\"\"\"\"\"\n\n css = css.replace(\":0 0 0 0;\", \":0;\")\n css = css.replace(\":0 0 0;\", \":0;\")\n css = css.replace(\":0 0;\", \":0;\")\n\n # Revert `background-position:0;` to the valid `background-position:0 0;`.\n css = css.replace(\"background-...
codesearchnet
{ "query": "Represent the Github comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
instance. @param array$config @return static
[ "public static function instance($config = [], BarManager $barManager = null, Bar $bar = null)\n {\n static $instance;\n\n if (is_null($instance) === false) {\n return $instance;\n }\n\n return $instance = new static($config, $barManager, $bar);\n }" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the Github sentence about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about programming:" }
Allow to select the text font.
[ "public void fontSelection() {\n \n FontChooserPanel panel = new FontChooserPanel(textFont);\n int result\n = JOptionPane.showConfirmDialog(\n this, panel, \"Font Selection\",\n JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE\...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github summarization:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Get the controller class suffix string. @param string $method @return string @since 2.0
[ "protected function fetchControllerSuffix($method = 'GET')\n {\n $method = strtoupper($method);\n\n // Validate that we have a map to handle the given HTTP method.\n if (!isset($this->suffixMap[$method])) {\n throw new \\RuntimeException(sprintf('Unable to support the HTTP method ...
[ "private function getApiOptionsDeclaration()\n {\n\n // we got a max instances allowed in normality tags\n $apiOptions = json_encode( $this->apiOptions );\n $apiOptions = Php::varExport( $apiOptions, true );\n\n $this->class->classComponents[] = new VariableDeclaration(\n '...
codesearchnet
{ "query": "Represent the Github text about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about programming:" }
Initializes the repository's prepared statements. @return void
[ "public function init()\n {\n\n // initialize the prepared statements\n $this->customerTextsStmt =\n $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::CUSTOMER_TEXTS));\n }" ]
[ "@Override\n\tpublic void validateSetup(Server server, Query query) throws ValidationException {\n\t\tlogger.info(\"Starting Stackdriver writer connected to '{}', proxy {} ...\", gatewayUrl, proxy);\n\t}" ]
codesearchnet
{ "query": "Represent the sentence about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Programming:" }
//PauseService provides a mock function with given fields: ctx, ScheduleServiceRequest
[ "func (_m *FacadeInterface) PauseService(ctx datastore.Context, request dao.ScheduleServiceRequest) (int, error) {\n\n\tret := _m.Called(ctx, request)\n\n\tvar r0 int\n\tif rf, ok := ret.Get(0).(func(datastore.Context, dao.ScheduleServiceRequest) int); ok {\n\t\tr0 = rf(ctx, request)\n\t} else {\n\t\tr0 = ret.Get(0...
[ "@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 Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Programming:" }
Get a list with all config keys
[ "def keys(cls, section=None):\n \"\"\"\"\"\"\n section = section or cls._default_sect\n if section not in cls._conf:\n cls._load(section=section)\n return cls._conf[section].keys()" ]
[ "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 sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
Create a queue. @param string $queueName
[ "public function createQueue($queueName)\n {\n $channel = $this->getChannel();\n $channel->exchange_declare($this->exchange, 'direct', false, true, false);\n $channel->queue_declare($queueName, false, true, false, false);\n $channel->queue_bind($queueName, $this->exchange, $queueName)...
[ "def getKeySequenceCounter(self):\n \"\"\"\"\"\"\n print '%s call getKeySequenceCounter' % self.port\n keySequence = ''\n keySequence = self.__sendCommand(WPANCTL_CMD + 'getprop -v Network:KeyIndex')[0]\n return keySequence" ]
codesearchnet
{ "query": "Represent the post about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code:" }
// GetPodVolumeStats returns the PodVolumeStats for a given pod. Results are looked up from a cache that // is eagerly populated in the background, and never calculated on the fly.
[ "func (s *fsResourceAnalyzer) GetPodVolumeStats(uid types.UID) (PodVolumeStats, bool) {\n\tcache := s.cachedVolumeStats.Load().(statCache)\n\tstatCalc, found := cache[uid]\n\tif !found {\n\t\t// TODO: Differentiate between stats being empty\n\t\t// See issue #20679\n\t\treturn PodVolumeStats{}, false\n\t}\n\treturn...
[ "func NewOnDemandStorer(s storage.Storer) (*OnDemandStorer, error) {\n\t// Track a small number of recent in-memory objects, to improve\n\t// performance without impacting memory too much.\n\t//\n\t// LRU is very helpful here because of the way delta compression\n\t// works. It first sorts the objects by type and d...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Technology:" }
Generates a default nullary public constructor for the given type on the {@link ClassVisitor}. <p>For java classes this is normally generated by the compiler and looks like: <pre>{@code public Foo() { super(); } }</pre>
[ "public static void defineDefaultConstructor(ClassVisitor cv, TypeInfo ownerType) {\n CodeBuilder mg = new CodeBuilder(Opcodes.ACC_PUBLIC, NULLARY_INIT, null, cv);\n mg.visitCode();\n Label start = mg.mark();\n Label end = mg.newLabel();\n LocalVariable thisVar = LocalVariable.createThisVar(ownerType...
[ "protected void createGenModelAnnotations()\n\t{\n\t\tString source = \"http://www.eclipse.org/emf/2002/GenModel\";\t\n\t\taddAnnotation\n\t\t (jvmIdentifiableElementEClass.getEOperations().get(0), \n\t\t source, \n\t\t new String[] \n\t\t {\n\t\t\t \"documentation\", \"<p>The identifier of a JvmIdentifiable...
codesearchnet
{ "query": "Represent the Github text about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Text generation:" }
leaderboardAction @return ViewModel $viewModel
[ "public function leaderboardAction()\n {\n $filter = $this->getEvent()->getRouteMatch()->getParam('filter');\n $p = $this->getEvent()->getRouteMatch()->getParam('p');\n\n $beforeLayout = $this->layout()->getTemplate();\n $subViewModel = $this->forward()->dispatch(\n 'p...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the Github text:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Returns the temperature in Celsius from the humidity sensor
[ "def get_temperature_from_humidity(self):\n \n\n self._init_humidity() # Ensure humidity sensor is initialised\n temp = 0\n data = self._humidity.humidityRead()\n if (data[2]): # Temp valid\n temp = data[3]\n return temp" ]
[ "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 instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
获得上传后的图片列表 @datetime 2017-11-01T14:56:22+0800 @author 韩文博 @return array
[ "public function getImages() : array\n\t{\n\t\t$list = array_merge( [\n\t\t\t'origin' => $this->getOriginImage(),\n\t\t], $this->getCropImages() );\n\t\tforeach( $list as $key => $image ){\n\t\t\t$image['path'] = str_replace( ROOT_PATH, '', $image['path'] );\n\t\t\t$list[$key] = $image;\n\t\t}\n\t\treturn $list;...
[ "def _build_msg_content(self, msgtype='text', **kwargs):\n \n data = {'msgtype': msgtype}\n if msgtype == 'text':\n data[msgtype] = {'content': kwargs.get('content')}\n elif msgtype == 'image' or msgtype == 'voice' or msgtype == 'file':\n data[msgtype] = {'media_id'...
codesearchnet
{ "query": "Represent the sentence about translation:", "pos": "Represent the code about translation:", "neg": "Represent the code about programming:" }
// class OyaVessel
[ "function updatePhase(self, value) {\n var cycle = self.cycles[self.cycle];\n self._state.countdown = 0;\n if (!cycle) {\n winston.info(`updatePhase no cycle`);\n return;\n }\n if (!self.isActive) {\n winston.info(`updatePhase inactive`);\n ...
[ "def :\n \"\"\"\"\"\"\n CheckParent(self)\n\n return _fitz.Annot_" ]
codesearchnet
{ "query": "Represent the sentence:", "pos": "Represent the code:", "neg": "Represent the code:" }
// MonthAbbreviated returns the locales abbreviated month given the 'month' provided
[ "func (chr *chr) MonthAbbreviated(month time.Month) string {\n\treturn chr.monthsAbbreviated[month]\n}" ]
[ "func parseDay(buff []byte, cursor *int, l int) (int, error) {\n\t// XXX : this is a relaxed constraint\n\t// XXX : we do not check if valid regarding February or leap years\n\t// XXX : we only checks that day is in range [01 -> 31]\n\t// XXX : in other words this function will not rant if you provide Feb 31th\n\tr...
codesearchnet
{ "query": "Represent the Github description about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about datetime:" }
Returns a given date object in the ISO 8601 format. @param date that should be converted. @return string that represents the given date in the ISO 8601 format.
[ "public static String getDateAsIso8601(long date) {\n\n // Check if date is set\n if ((date > Long.MIN_VALUE) && (date < Long.MAX_VALUE)) {\n final Date d_date = new Date(date);\n return getDateAsIso8601(d_date);\n }\n return null;\n }" ]
[ "private function to8601Utc(\\DateTimeInterface $dateTime): string\n {\n // Convert to UTC if we can\n if ($dateTime instanceof DateTime) {\n $dateTime->setTimezone(new \\DateTimeZone('UTC'));\n } elseif ($dateTime instanceof \\DateTimeImmutable && $dateTime->getOffset() > 0) {\n ...
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
从数据中获取到绘图相关的有用信息.
[ "def extract_data(self):\n \"\"\"\"\"\"\n self.time_axis = []\n self.cpu_axis = []\n self.mem_axis = []\n self.timestamp_list = []\n plot_data = self.data.get(\"plot_data\", [])\n # 按照时间分割线,划分成几段数据,取其中的最值\n for i in plot_data:\n timestamp = i[\"time...
[ "protected static void fixResultByRule(List<Vertex> linkedArray)\n {\n\n //--------------------------------------------------------------------\n //Merge all seperate continue num into one number\n mergeContinueNumIntoOne(linkedArray);\n\n //-------------------------------------------...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code about text processing:" }
Convert an Exception to RuntimeException @param e the Exception instance @return a RuntimeException instance
[ "public static RuntimeException asRuntimeException(Exception e) {\n if (e instanceof RuntimeException) {\n return (RuntimeException) e;\n }\n return UnexpectedMethodInvocationException.triage(e);\n }" ]
[ "public static void check(final Object result, final Class<?> targetType) {\n if (result != null && !targetType.isAssignableFrom(result.getClass())) {\n // note: conversion logic may go wrong (e.g. because converter expect collection input mostly and may\n // not work correctly for sing...
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
Add CORS support on your container REST: POST /cloud/project/{serviceName}/storage/{containerId}/cors @param containerId [required] Container id @param origin [required] Allow this origin @param serviceName [required] Service name
[ "public void project_serviceName_storage_containerId_cors_POST(String serviceName, String containerId, String origin) throws IOException {\n\t\tString qPath = \"/cloud/project/{serviceName}/storage/{containerId}/cors\";\n\t\tStringBuilder sb = path(qPath, serviceName, containerId);\n\t\tHashMap<String, Object>o = 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:", "pos": "Represent the code:", "neg": "Represent the code about Programming:" }
Make the first character upper case @param name Any String @return A String
[ "public static String toFirstUpper(String name) {\n if ( isEmpty( name )) {\n return name;\n }\n return \"\" + name.toUpperCase( Locale.ROOT ).charAt(0) + name.substring(1);\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:" }
Marshall the given parameter object.
[ "public void marshall(KeyValuePair keyValuePair, ProtocolMarshaller protocolMarshaller) {\n\n if (keyValuePair == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(keyValuePair.getName(), NAME_...
[ "def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p" ]
codesearchnet
{ "query": "Represent the Github text about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
Read configuration file options.
[ "def read_config(cls, configparser):\n \"\"\"\"\"\"\n config = dict()\n section = cls.__name__\n option = sslcertwarndays\n if configparser.has_option(section, option):\n num = configparser.getint(section, option)\n if num > 0:\n config[option]...
[ "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 comment:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
// Stop a container
[ "func (c *Container) Stop(ctx context.Context, timeout time.Duration) error {\n\tif c.Engine == nil {\n\t\treturn ErrNilEngine\n\t}\n\t// 这里 block 的问题很严重,按照目前的配置是 5 分钟一级的 block\n\t// 一个简单的处理方法是相信 ctx 不相信 engine 自身的处理\n\t// 另外我怀疑 engine 自己的 timeout 实现是完全的等 timeout 而非结束了就退出\n\tremoveCtx, cancel := context.WithTimeout...
[ "def start(self, timeout=None):\n \n\n started = super(Node, self).start(timeout=timeout)\n if started:\n # TODO : return something produced in the context manager passed\n return self._svc_address # returning the zmp url as a way to connect to the node\n # CAR...
codesearchnet
{ "query": "Represent the description about Container management:", "pos": "Represent the code about Container management:", "neg": "Represent the code about programming:" }
Returns an instance of the poll option formset to be used in the view.
[ "def get_poll_option_formset(self, formset_class):\n \n if self.request.forum_permission_handler.can_create_polls(\n self.get_forum(), self.request.user,\n ):\n return formset_class(**self.get_poll_option_formset_kwargs())" ]
[ "def bulk_related_objects(self, objs, using=DEFAULT_DB_ALIAS):\n \n if self.delete_related:\n return super(AuditlogHistoryField, self).bulk_related_objects(objs, using)\n\n # When deleting, Collector.collect() finds related objects using this\n # method. However, because we d...
codesearchnet
{ "query": "Represent the post about Software Development:", "pos": "Represent the code about Software Development:", "neg": "Represent the code about Software Development:" }
Dissassociates the given session from this managed connection. @param session the session to disassociate
[ "final void disassociateSession(final JmsJcaSessionImpl session) {\n\n if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {\n SibTr.entry(this, TRACE, \"disassociateSession\", session);\n }\n\n _sessions.remove(session);\n\n if (TraceComponent.isAnyTracingEnab...
[ "public void away (ClientObject caller, String message)\n {\n BodyObject body = _locator.forClient(caller);\n // we modify this field via an invocation service request because a body object is not\n // modifiable by the client\n body.setAwayMessage(message);\n }" ]
codesearchnet
{ "query": "Represent the post about Programming:", "pos": "Represent the code about Programming:", "neg": "Represent the code about Software development:" }
Returns requested URL @param bool $query @return string
[ "public function path($query = false)\n {\n return $this->path . ($query && $this->query->has() ? '?' . http_build_query($this->query->all(), null, '&') : null);\n }" ]
[ "final protected function c() {return dfc($this, function() {/** @var int|null $id $id */return\n\t\t!($id = $this->o()->getCustomerId()) ? null : df_customer($id)\n\t;});}" ]
codesearchnet
{ "query": "Represent the description about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
Returns: generator over all FARPs objects
[ "def farps(self) -> typing.Iterator['Static']:\n \n for coa in [self._blue_coa, self._red_coa]:\n if coa is not None:\n for farp in coa.farps:\n yield farp" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Fill a mutation with the lock column. This may be used when the mutation is executed externally but should be used with extreme caution to ensure the lock is properly released @param m @param time @param ttl
[ "public String fillLockMutation(MutationBatch m, Long time, Integer ttl) {\n if (lockColumn != null) {\n if (!lockColumn.equals(prefix+lockId))\n throw new IllegalStateException(\"Can't change prefix or lockId after acquiring the lock\");\n }\n else {\n lock...
[ "def getLockByID(self, lockid):\n \n assert isinstance(lockid, (locks.MasterLock, locks.WorkerLock))\n if lockid not in self.locks:\n self.locks[lockid] = lockid.lockClass(lockid)\n # if the master.cfg file has changed maxCount= on the lock, the next\n # time a build is...
codesearchnet
{ "query": "Represent the comment about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about programming:" }
/* Apply effects on an image Parameters resource $resource : image resource Return resource
[ "public function apply($resource){\n\t\t// Get resolution\n\t\t$width=imagesx($resource);\n\t\t$height=imagesy($resource);\n\t\tif($width===false || $height===false){\n\t\t\tthrow new Exception(\"An error was encountered while getting image resolution\");\n\t\t}\n\t\t// Image conversion\n\t\t$new=imagecreatetruecol...
[ "def changeTo(self, path):\n '''\n '''\n dictionary = DictSingle(Pair('PATH', StringSingle(path)))\n self.value = [dictionary]" ]
codesearchnet
{ "query": "Represent the Github instruction about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Loads an object instance from registry @param string $key @return mixed
[ "protected function loadFromRegistry(string $key)\n {\n return array_key_exists($key, $this->registry) ? $this->registry[$key] : null;\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 Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
// SetQuantity sets the Quantity field's value.
[ "func (s *Origins) SetQuantity(v int64) *Origins {\n\ts.Quantity = &v\n\treturn s\n}" ]
[ "function Rule(rules) {\n this.rules = rules;\n // Identifies individual rule\n this.name = \"\";\n // Identifies the grammar that this rule belongs to \n this.grammarName = \"\";\n // Identifies types of rules. Rules can have \"types\" that are diff...
codesearchnet
{ "query": "Represent the Github summarization about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
This function returns any UTF-8 encoded text as a list of Unicode values: @author Scott Michael Reynen <scott@randomchaos.com> @link http://www.randomchaos.com/document.php?source=php_and_unicode @see unicode_to_utf8()
[ "private static function utf8_to_unicode( &$str )\n {\n $unicode = array();\n $values = array();\n $looking_for = 1;\n\n for ($i = 0; $i < strlen( $str ); $i++ ) {\n $this_value = ord( $str[ $i ] );\n if ( $this_value < 128 ) $unicode[] = $this_value;\n ...
[ "def loadtitlefont(self):\n \"\"\"\"\"\"\n if self.titlefont == None:\n# print 'the bloody fonts dir is????', fontsdir\n# print 'pero esto que hace??', os.path.join(fontsdir, \"courR18.pil\")\n# /home/vital/Workspace/pyResources/Scientific_Lib/f2n_fonts/f2n_fonts/co...
codesearchnet
{ "query": "Represent the Github description about PHP programming:", "pos": "Represent the Github code about PHP programming:", "neg": "Represent the Github code:" }
Get the relative path between the given $parentPath and the given $subPath. Example with "/foo" and "/foo/bar/baz" will return "bar/baz". @param string $parentPath @param string $subPath @return string
[ "public static function getRelativePathBetween($parentPath, $subPath)\n {\n if (self::isSubPathOf($parentPath, $subPath) === false) {\n throw new \\InvalidArgumentException('Given path \"' . $parentPath . '\" is not the beginning of \"' . $subPath .'\", cannot get a relative path between them.'...
[ "function handleDataAndCallCallback(data) {\n\t\t\tconst j = file.lastIndexOf(\"/\");\n\n\t\t\t// Pass on an updated rootpath if path of imported file is relative and file\n\t\t\t// is in a (sub|sup) directory\n\t\t\t//\n\t\t\t// Examples:\n\t\t\t// - If path of imported file is 'module/nav/nav.less' and rootpath i...
codesearchnet
{ "query": "Represent the Github sentence about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code:" }
Extracts and decodes OAuth parameters from the passed string @param string $body the response body from an OAuth flow method @return array the response body safely decoded to an array of key => values
[ "function extract_params($body) {\n\t\t$kvs = explode ( '&', $body );\n\t\t$decoded = array ();\n\t\tforeach ( $kvs as $kv ) {\n\t\t\t$kv = explode ( '=', $kv, 2 );\n\t\t\t$kv [0] = $this->safe_decode ( $kv [0] );\n\t\t\t$kv [1] = $this->safe_decode ( $kv [1] );\n\t\t\t$decoded [$kv [0]] = $kv [1];\n\t\t}\n\t\tretu...
[ "def coerce_one(schema=str):\n \n def validate(val):\n \"\"\"Unpack a single item from the inputs sequence and run validation.\n\n NOTE(larsbutler): This code is highly opinionated for bottle, since\n bottle query params are wrapped in a list, even if there is just a\n single value...
codesearchnet
{ "query": "Represent the sentence about Software development:", "pos": "Represent the code about Software development:", "neg": "Represent the code about programming:" }
日本国内のみで流通しているRFC違反メールアドレスを許した上でemail addressとしての妥当性の検証を行います。 @param mixed $value 検証する値 @param array $options オプション @return bool 検証に合格した場合:true、検証に失敗した場合:false
[ "public static function EmailJpLimited ($value, $options) {\n\t\tif (filter_var($value, \\FILTER_SANITIZE_EMAIL) !== $value) {\n\t\t\treturn false;\n\t\t}\n\t\t$part = explode('@', $value, 2);\n\t\t$part[0] = preg_replace_callback(\"/(\\.{2,}|\\-{2,}|_{2,})/\", function ($mat) {return str_repeat('a', strlen($mat[1]...
[ "def special2csa(str)\n {\n \"中断\" => \"CHUDAN\",\n \"投了\" => \"TORYO\",\n \"持将棋\" => \"JISHOGI\",\n \"千日手\" => \"SENNICHITE\",\n \"詰み\" => \"TSUMI\",\n \"不詰\" => \"FUZUMI\",\n \"切れ負け\" => \"TIME_UP\",\n \"反則勝ち\" => \"ILLEGAL_ACTION\", # 直前の手が反則(先頭に+か-で反則...
codesearchnet
{ "query": "Represent the Github description about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Same as {#<<}, but also waits for a response from the actor and returns it. @param message [Message] the request to the actor @return [Message] the actor's response @raise [ArgumentError] if the message is "$TERM" (use {#terminate})
[ "def request(message)\n @mtx.synchronize do\n raise DeadActorError if not @running\n message = Message.coerce(message)\n raise ArgumentError, \"use #terminate\" if TERM == message[0]\n message.send_to(self)\n Message.receive_from(self)\n end\n rescue IO::EAGAINWaitWri...
[ "def linking_request(receiver, type)\n Celluloid.exclusive do\n receiver.mailbox << LinkingRequest.new(Actor.current, type)\n system_events = []\n\n Timers::Wait.for(LINKING_TIMEOUT) do |remaining|\n begin\n message = @mailbox.receive(remaining) do |msg|\n ...
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code:" }
Converts string to kebab case. @link https://en.wikipedia.org/wiki/Letter_case#Special_case_styles kebab case @usage __::kebabCase('Foo Bar'); >> 'foo-bar' @param string $input @return string
[ "public static function kebabCase(string $input): string\n {\n $words = __::words(preg_replace(\"/['\\x{2019}]/u\", '', $input));\n\n return array_reduce(\n $words,\n function ($result, $word) use ($words) {\n $isFirst = __::first($words) === $word;\n\n ...
[ "public static function normalizeClassname(string $name): string\n {\n $name = self::normalizeReservedKeywords($name, 'Type');\n\n return ucfirst(self::camelCase($name, '{[^a-z0-9]+}i'));\n }" ]
codesearchnet
{ "query": "Represent the Github instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
显示模板 @param string $tempFile 模板文件名称
[ "public function display($tempFile=null) {\n\n\t\t//如果没有传入模板文件,则访问默认模块下的默认模板\n if ( !$tempFile ) {\n $tempFile = $this->configs['action'].'_'.$this->configs['method'].EXT_TPL;\n } else {\n $tempFile .= EXT_TPL;\n }\n\n //判断是否是引用其他模块的模板, {module}:index.html\n ...
[ "private static function appRun(){\n // echo \"runing\";\n // 当有get参数传递时 获取get参数\n if(isset($_GET['s'])){\n // 更加\"/\"将get参数分割成数组\n $info = explode('/',$_GET['s']);\n\n // 获取模块名称 转换成小写\n $m = strtolower($info[0]);\n // 获取控制器名称 转换成小写\n ...
codesearchnet
{ "query": "Represent the Github post about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code:" }
// MatchPath matches the HTTP URL path of the given request.
[ "func MatchPath(req *http.Request, ereq *Request) (bool, error) {\n\tif req.URL.Path == ereq.URLStruct.Path {\n\t\treturn true, nil\n\t}\n\treturn regexp.MatchString(ereq.URLStruct.Path, req.URL.Path)\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 Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about Software development:" }
Initates a registry. @throws \netmigrosintranet\modules\Registry\Classes\RegistryException in case the initiation of an active registry was requested.
[ "public function init()\n {\n if (! empty($this->registry[$this->section])) {\n throw new RegistryException(\n RegistryException::DUPLICATE_INITIATION_ATTEMPT_TEXT . '(section: ' . $this->section . ')',\n RegistryException::DUPLICATE_INITIATION_ATTEMPT_CODE\n ...
[ "protected function isDatabaseReady()\n {\n // Such as during setup of testsession prior to DB connection.\n if (!DB::is_active()) {\n return false;\n }\n\n // If we have a DB of the wrong type then complain\n if (!(DB::get_conn() instanceof MySQLDatabase)) {\n ...
codesearchnet
{ "query": "Represent the text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code about Software Development:" }
Assert that the value matches a given regular expression. @param string $regex A regular expression to match against @throws AssertionFailureException @return self
[ "public function match($regex)\n {\n $matches = preg_match($regex, $this->value);\n $message = ['%s {{does not match|matches}} the regular expression %s', $this->value, $regex];\n $this->assert((!empty($matches)), $message);\n\n return $this;\n }" ]
[ "public static function ExpectRetrievedValueIsString(\n string $property,\n $value,\n string $class_name\n ) : string {\n /**\n * @psalm-var T\n */\n $value = static::MaybeThrowIfNotType($property, $value, $class_name, 'string');\n\n return $value;\n }" ...
codesearchnet
{ "query": "Represent the Github sentence about programming:", "pos": "Represent the Github code about programming:", "neg": "Represent the Github code about Software development:" }
// Width return the width of the terminal.
[ "func Width() (uint, error) {\n\toutput, err := size()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\t_, width, err := parse(output)\n\treturn width, err\n}" ]
[ "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 text about programming:", "pos": "Represent the code about programming:", "neg": "Represent the code:" }
Wraps send(), sending string ``s`` to child process, with os.linesep automatically appended. Returns number of bytes written.
[ "def sendline(self, s=''):\n ''' '''\n\n n = self.send(s)\n return n + self.send(self.linesep)" ]
[ "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 instruction:", "pos": "Represent the Github code:", "neg": "Represent the Github code about programming:" }
Assemble each statement into
[ "def assemble_english():\n \n if request.method == 'OPTIONS':\n return {}\n response = request.body.read().decode('utf-8')\n body = json.loads(response)\n stmts_json = body.get('statements')\n stmts = stmts_from_json(stmts_json)\n sentences = {}\n for st in stmts:\n enga = Engl...
[ "def read_description():\n \"\"\"\"\"\"\n try:\n with open(\"README.md\") as r:\n description = \"\\n\"\n description += r.read()\n with open(\"CHANGELOG.md\") as c:\n description += \"\\n\"\n description += c.read()\n return description\n ex...
codesearchnet
{ "query": "Represent the Github description:", "pos": "Represent the Github code:", "neg": "Represent the Github code:" }
Save the OpenAPI documentation to a file. @param string $filename @throws Exception
[ "public function saveAs($filename, $format = 'auto')\n {\n\n if ($format === 'auto') {\n $format = strtolower(substr($filename, -5)) === '.json' ? 'json' : 'yaml';\n }\n if (strtolower($format) === 'json') {\n $content = $this->toJson();\n } else {\n ...
[ "public File getExistingFile(final String param) {\n return get(param, getFileConverter(),\n new And<>(new FileExists(), new IsFile()),\n \"existing file\");\n }" ]
codesearchnet
{ "query": "Represent the Github post about Software development:", "pos": "Represent the Github code about Software development:", "neg": "Represent the Github code about File management:" }
Repairs a {@link ReplaceInList} in relation to an {@link AddToList} command. @param toRepair The command to repair. @param repairAgainst The command to repair against. @return The repaired command.
[ "public ReplaceInList repairCommand(final ReplaceInList toRepair, final AddToList repairAgainst) {\n if (repairAgainst.getPosition() > toRepair.getPosition()) {\n return toRepair;\n }\n return new ReplaceInList(toRepair.getListId(), toRepair.getListVersionChange(), toRepair.getValue(...
[ "public MultipleRuleContext<DPO, RI, RO> check(Collection<Rule<RI, RO>> rules) {\n if (rules != null) {\n addedRules.addAll(rules);\n }\n\n // Stay in the same context and re-use the same instance because no type has changed\n return this;\n }" ]
codesearchnet
{ "query": "Represent the description about Documentation:", "pos": "Represent the code about Documentation:", "neg": "Represent the code about Software development:" }
Process footer and return the processed string
[ "def get_ftr(self):\n \n if not self.ftr:\n return self.ftr\n\n width = self.size()[0]\n return re.sub(\n \"%time\", \"%s\\n\" % time.strftime(\"%H:%M:%S\"), self.ftr).rjust(width)" ]
[ "def _get_generic_schema(self):\n \n schema = Schema(\n vid=ID(stored=True, unique=True), # Object id\n title=NGRAMWORDS(),\n keywords=KEYWORD, # Lists of coverage identifiers, ISO time values and GVIDs, source names, source abbrev\n doc=TEXT) # Generated...
codesearchnet
{ "query": "Represent the comment:", "pos": "Represent the code:", "neg": "Represent the code:" }
Get list of all time zone offsets supported.
[ "private static List<String> getAllTimeZones() {\n final List<String> lst = ZoneId.getAvailableZoneIds().stream()\n .map(id -> ZonedDateTime.now(ZoneId.of(id)).getOffset().getId().replace(\"Z\", \"+00:00\")).distinct()\n .collect(Collectors.toList());\n lst.sort(null);\n ...
[ "public static PendingResult<TimeZone> getTimeZone(GeoApiContext context, LatLng location) {\n return context.get(\n API_CONFIG,\n Response.class,\n \"location\",\n location.toString(),\n // Java has its own lookup for time -> DST, so we really only need to fetch the TZ id.\n ...
codesearchnet
{ "query": "Represent the Github instruction about Programming:", "pos": "Represent the Github code about Programming:", "neg": "Represent the Github code about Software development:" }
Parse a superbox (box consisting of nothing but other boxes. Parameters ---------- fptr : file Open file object. Returns ------- list List of top-level boxes in the JPEG 2000 file.
[ "def parse_superbox(self, fptr):\n \n\n superbox = []\n\n start = fptr.tell()\n\n while True:\n\n # Are we at the end of the superbox?\n if start >= self.offset + self.length:\n break\n\n read_buffer = fptr.read(8)\n if len(read_...
[ "def _unpack_list(example):\n \n try:\n x = example[0]\n y = example[1]\n meta = None\n return x, y, meta\n except IndexError:\n raise IndicoError(\n \"Invalid input data. Please ensure input data is \"\n \"formatted as a list of `[data, target]` pa...
codesearchnet
{ "query": "Represent the comment about Computer Science:", "pos": "Represent the code about Computer Science:", "neg": "Represent the code:" }