Dataset Viewer
query
stringlengths 16
255
| pos
sequence | neg
sequence | task
stringclasses 1
value | instruction
dict |
---|---|---|---|---|
Computes the new parent id for the node being moved.
@return int | [
"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}"
] | [
"final void initDocument(int documentNumber)\n {\n // save masked DTM document handle\n m_docHandle = documentNumber<<DOCHANDLE_SHIFT;\n\n // Initialize the doc -- no parent, no next-sib\n nodes.writeSlot(0,DOCUMENT_NODE,-1,-1,0);\n // wait for the first startElement to create the doc root node\n done = false;\n }"
] | codesearchnet | {
"query": "Represent the instruction about Computer Science:",
"pos": "Represent the code about Computer Science:",
"neg": "Represent the code:"
} |
// SetWinSize overwrites the playlist's window size. | [
"func (p *MediaPlaylist) SetWinSize(winsize uint) error {\n\tif winsize > p.capacity {\n\t\treturn errors.New(\"capacity must be greater than winsize or equal\")\n\t}\n\tp.winsize = winsize\n\treturn nil\n}"
] | [
"def transform_cb(self, setting, value):\n \"\"\"\"\"\"\n self.make_callback('transform')\n\n # whence=0 because need to calculate new extents for proper\n # cutout for rotation (TODO: always make extents consider\n # room for rotation)\n whence = 0\n self.redraw(whence=whence)"
] | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Show the sidebar and squish the container to make room for the sidebar.
If hideOthers is true, hide other open sidebars. | [
"function() {\n var options = this.options;\n\n if (options.hideOthers) {\n this.secondary.each(function() {\n var sidebar = $(this);\n\n if (sidebar.hasClass('is-expanded')) {\n sidebar.toolkit('offCanvas', 'hide');\n }\n });\n }\n\n this.fireEvent('showing');\n\n this.container.addClass('move-' + this.opposite);\n\n this.element\n .reveal()\n .addClass('is-expanded')\n .aria('expanded', true);\n\n if (options.stopScroll) {\n $('body').addClass('no-scroll');\n }\n\n this.fireEvent('shown');\n }"
] | [
"function showDropdown(position) {\n // If the dropdown is already visible, just return (so the root click handler on html\n // will close it).\n if ($dropdown) {\n return;\n }\n\n Menus.closeAll();\n\n $dropdown = $(renderList())\n .css({\n left: position.pageX,\n top: position.pageY\n })\n .appendTo($(\"body\"));\n\n PopUpManager.addPopUp($dropdown, cleanupDropdown, true);\n\n // TODO: should use capture, otherwise clicking on the menus doesn't close it. More fallout\n // from the fact that we can't use the Boostrap (1.4) dropdowns.\n $(\"html\").on(\"click\", closeDropdown);\n\n // Hide the menu if the user scrolls in the project tree. Otherwise the Lion scrollbar\n // overlaps it.\n // TODO: This duplicates logic that's already in ProjectManager (which calls Menus.close()).\n // We should fix this when the popup handling is centralized in PopupManager, as well\n // as making Esc close the dropdown. See issue #1381.\n $(\"#project-files-container\").on(\"scroll\", closeDropdown);\n\n // Note: PopUpManager will automatically hide the sidebar in other cases, such as when a\n // command is run, Esc is pressed, or the menu is focused.\n\n // Hacky: if we detect a click in the menubar, close ourselves.\n // TODO: again, we should have centralized popup management.\n $(\"#titlebar .nav\").on(\"click\", closeDropdown);\n\n _handleListEvents();\n $(window).on(\"keydown\", keydownHook);\n }"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Decide the fate of the cells | [
"def nextGen(self):\n \n self.current_gen += 1\n self.change_gen[self.current_gen % 3] = copy.copy(self.grid)\n grid_cp = copy.copy(self.grid)\n\n for cell in self.grid:\n y, x = cell\n y1 = (y - 1) % self.y_grid\n y2 = (y + 1) % self.y_grid\n x1 = (x - 1) % self.x_grid\n x2 = (x + 1) % self.x_grid\n n = self.countNeighbours(cell)\n\n if n < 2 or n > 3:\n del grid_cp[cell]\n self.addchar(y + self.y_pad, x + self.x_pad, ' ')\n else:\n grid_cp[cell] = min(self.grid[cell] + 1, self.color_max)\n\n for neighbour in product([y1, y, y2], [x1, x, x2]):\n if not self.grid.get(neighbour):\n if self.countNeighbours(neighbour) == 3:\n y, x = neighbour\n y = y % self.y_grid\n x = x % self.x_grid\n neighbour = y, x\n grid_cp[neighbour] = 1\n\n self.grid = grid_cp"
] | [
"function showIntro() {\n write(\"Welcome to the Recognizer's Sample console application!\");\n write(\"To try the recognizers enter a phrase and let us show you the different outputs for each recognizer or just type 'exit' to leave the application.\");\n write();\n write(\"Here are some examples you could try:\");\n write();\n write(\"\\\" I want twenty meters of cable for tomorrow\\\"\");\n write(\"\\\" I'll be available tomorrow from 11am to 2pm to receive up to 5kg of sugar\\\"\");\n write(\"\\\" I'll be out between 4 and 22 this month\\\"\");\n write(\"\\\" I was the fifth person to finish the 10 km race\\\"\");\n write(\"\\\" The temperature this night will be of 40 deg celsius\\\"\");\n write(\"\\\" The american stock exchange said a seat was sold for down $ 5,000 from the previous sale last friday\\\"\");\n write(\"\\\" It happened when the baby was only ten months old\\\"\");\n write(\"\\\" No, I don't think that we can make 100k USD today\\\"\");\n write();\n}"
] | codesearchnet | {
"query": "Represent the Github text:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
Return the kind specified by a given __property__ key.
Args:
key: key whose kind name is requested.
Returns:
The kind specified by key. | [
"def key_to_kind(cls, key):\n \n if key.kind() == Kind.KIND_NAME:\n return key.id()\n else:\n return key.parent().id()"
] | [
"def persistent_id(self, obj):\n \"\"\"\"\"\"\n if isinstance(obj, Element):\n # Here, our persistent ID is simply a tuple, containing a tag and\n # a key\n return obj.__class__.__name__, obj.symbol\n else:\n # If obj does not have a persistent ID, return None. This means obj\n # needs to be pickled as usual.\n return None"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Gets a recursive list of traits used by a class
@param string $class Full class name
@return array | [
"private function getRecursiveTraits($class = null)\n {\n if (null == $class) {\n $class = get_class($this);\n }\n\n $reflection = new \\ReflectionClass($class);\n $traits = array_keys($reflection->getTraits());\n\n foreach ($traits as $trait) {\n $traits = array_merge($traits, $this->getRecursiveTraits($trait));\n }\n\n if ($parent = $reflection->getParentClass()) {\n $traits = array_merge($traits, $this->getRecursiveTraits($parent->getName()));\n }\n\n return $traits;\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 instruction about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code:"
} |
// SetMaxRecords sets the MaxRecords field's value. | [
"func (s *DescribeSnapshotCopyGrantsInput) SetMaxRecords(v int64) *DescribeSnapshotCopyGrantsInput {\n\ts.MaxRecords = &v\n\treturn s\n}"
] | [
"def from_bucket(cls, connection, bucket):\n \"\"\"\"\"\"\n if bucket is None:\n raise errors.NoContainerException\n\n # It appears that Amazon does not have a single-shot REST query to\n # determine the number of keys / overall byte size of a bucket.\n return cls(connection, bucket.name)"
] | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about AWS S3:"
} |
Check if the current position of the pointer is valid
@return bool True if the pointer position is valid | [
"public function valid() : bool\n {\n if ($this->pointer >= 0 && $this->pointer < count($this->members)) {\n return true;\n }\n return false;\n }"
] | [
"private void init() {\n // defaults for internal bookkeeping\n index = 0; // internal index always starts at 0\n count = 1; // internal count always starts at 1\n status = null; // we clear status on release()\n item = null; // item will be retrieved for each round\n last = false; // last must be set explicitly\n beginSpecified = false; // not specified until it's specified :-)\n endSpecified = false; // (as above)\n stepSpecified = false; // (as above)\n deferredExpression = null;\n\n // defaults for interface with page author\n begin = 0; // when not specified, 'begin' is 0 by spec.\n end = -1; // when not specified, 'end' is not used\n step = 1; // when not specified, 'step' is 1\n itemId = null; // when not specified, no variable exported\n statusId = null; // when not specified, no variable exported\n }"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Computer Science:"
} |
Creates a new {@link TopicProducer}. The producer accepts arbitrary objects and uses the Jackson object mapper to convert them into
JSON and sends them as a text message. | [
"public TopicProducer<Object> createTopicJsonProducer(final String topic)\n {\n Preconditions.checkState(connectionFactory != null, \"connection factory was never injected!\");\n return new TopicProducer<Object>(connectionFactory, jmsConfig, topic, producerCallback);\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 doesn't match the actual resuts (e.g. xml with CONSTRUCT).\n // TODO: We could include multiple media types in the Accept: field, but that assumes that the\n // server has proper support for content negotiation. Many servers only look at the first value.\n return (format != null) ? format.mimeText : null;\n }"
] | codesearchnet | {
"query": "Represent the description about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about programming:"
} |
Dynamically add an array of setting items
@param string $owner
@param array $definitions | [
"public function addSettingItems($owner, array $definitions)\n {\n foreach ($definitions as $code => $definition) {\n $this->addSettingItem($owner, $code, $definition);\n }\n }"
] | [
"public function updateConfigOptions()\n {\n //search the config menu for our item\n $options = $this->searchMenu($this->name);\n\n //override the config's options\n $this->getConfig()->setOptions($options);\n }"
] | codesearchnet | {
"query": "Represent the comment about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Update brand group of parameters. | [
"def update_brand(self) -> None:\n \"\"\"\"\"\"\n self.update(path=URL_GET + GROUP.format(group=BRAND))"
] | [
"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:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
construct a string of space-delimited control keys based on properties of this class.
@param bool $disconnect
@return string | [
"protected function getControlKey($disconnect = false)\n {\n $key = '';\n\n if ($disconnect) {\n return \"*immed\";\n }\n\n /*\n if(?) *justproc\n if(?) *debug\n if(?) *debugproc\n if(?) *nostart\n if(?) *rpt*/\n\n // Idle timeout supported by XMLSERVICE 1.62\n // setting idle for *sbmjob protects the time taken by program calls\n // Do that with *idle(30/kill) or whatever the time in seconds.\n if (trim($this->getOption('idleTimeout')) != '') {\n $idleTimeout = $this->getOption('idleTimeout');\n $key .= \" *idle($idleTimeout/kill)\"; // ends idle only, but could end MSGW with *call(30/kill)\n }\n\n // if cdata requested, request it. XMLSERVICE will then wrap all output in CDATA tags.\n if ($this->getOption('cdata')) {\n $key .= \" *cdata\";\n }\n\n /* stateless calls in stored procedure job\n *\n * Add *here, which will run everything inside the current PHP/transport job\n * without spawning or submitting a separate XTOOLKIT job.\n */\n if ($this->isStateless()) {\n $key .= \" *here\";\n } else {\n // not stateless, so could make sense to supply *sbmjob parameters for spawning a separate job.\n if (trim($this->getOption('sbmjobParams')) != '') {\n $sbmjobParams = $this->getOption('sbmjobParams');\n $key .= \" *sbmjob($sbmjobParams)\";\n }\n }\n\n // if internal XMLSERVICE tracing, into database table XMLSERVLOG/LOG, is desired\n if ($this->getOption('trace')) {\n $key .= \" *log\";\n }\n\n // directive not to run any program, but to parse XML and return parsed output, including dim/dou.\n if ($this->getOption('parseOnly')) {\n $key .= \" *test\";\n\n // add a debugging level (1-9) to the parse, to make *test(n) where n is the debugging level\n if ($parseDebugLevel = $this->getOption('parseDebugLevel')) {\n $key .= \"($parseDebugLevel)\";\n }\n }\n\n // return XMLSERVICE version/license information (no XML calls)\n if ($this->getOption('license')) {\n $key .= \" *license\";\n }\n\n // check proc call speed (no XML calls)\n if ($this->getOption('transport')) {\n $key .= \" *justproc\";\n }\n\n // get performance of last call data (no XML calls)\n if ($this->getOption('performance')) {\n $key .= \" *rpt\";\n }\n\n // *fly is number of ticks of each operation. *nofly is the default\n if ($this->getOption('timeReport')) {\n $key .= \" *fly\";\n }\n\n // PASE CCSID for <sh> type of functions such as WRKACTJOB ('system' command in PASE)\n if ($paseCcsid = $this->getOption('paseCcsid')) {\n $key .= \" *pase($paseCcsid)\";\n }\n\n // allow custom control keys\n if ($this->getOption('customControl')) {\n $key .= \" {$this->getOption('customControl')}\";\n }\n\n return trim($key); // trim off any extra blanks on beginning or end\n }"
] | [
"def _enter(self):\n \"\"\"\"\"\"\n command = self.command\n logger.log(5, \"Snippet keystroke `Enter`.\")\n # NOTE: we need to set back the actions (mode_off) before running\n # the command.\n self.mode_off()\n self.run(command)"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
Need to refactor, fukken complicated conditions. | [
"def check_symbol_to_proc\n return unless method_call.block_argument_names.count == 1\n return if method_call.block_body.nil?\n return unless method_call.block_body.sexp_type == :call\n return if method_call.arguments.count > 0\n\n body_method_call = MethodCall.new(method_call.block_body)\n\n return unless body_method_call.arguments.count.zero?\n return if body_method_call.has_block?\n return unless body_method_call.receiver.name == method_call.block_argument_names.first\n\n add_offense(:block_vs_symbol_to_proc)\n end"
] | [
"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 # CAREFUL : doesnt make sense if this node only run a one-time task...\n # TODO: futures and ThreadPoolExecutor (so we dont need to manage the pool ourselves)\n else:\n return False"
] | codesearchnet | {
"query": "Represent the description:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
Helper method to lookup a DAO if it has already been associated with the table-config. Otherwise this returns
null. | [
"public synchronized static <D extends Dao<T, ?>, T> D lookupDao(ConnectionSource connectionSource,\n\t\t\tDatabaseTableConfig<T> tableConfig) {\n\t\tif (connectionSource == null) {\n\t\t\tthrow new IllegalArgumentException(\"connectionSource argument cannot be null\");\n\t\t}\n\t\tTableConfigConnectionSource key = new TableConfigConnectionSource(connectionSource, tableConfig);\n\t\tDao<?, ?> dao = lookupDao(key);\n\t\tif (dao == null) {\n\t\t\treturn null;\n\t\t} else {\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tD castDao = (D) dao;\n\t\t\treturn castDao;\n\t\t}\n\t}"
] | [
"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 likely to be in terms of SQL path. Currently we still don't have support multiple function namespaces, nor\n // SQL path. As a result, session is not used here. We still add this to distinguish the two versions of resolveFunction\n // while the refactoring is on-going.\n return staticFunctionNamespace.resolveFunction(name, parameterTypes);\n }"
] | codesearchnet | {
"query": "Represent the Github instruction about Software Development:",
"pos": "Represent the Github code about Software Development:",
"neg": "Represent the Github code about Software development:"
} |
// Provided for compatibility with the Transformer interface. Since Caser has no
// special treatment of bytes, the bytes are converted to and from strings.
// Will treat the entirety of src as ONE variable name. | [
"func (c Caser) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) {\n\tnSrc = len(src) // Always read all the bytes of src\n\tresult := c.Bytes(src)\n\tif len(result) > len(dst) {\n\t\terr = transform.ErrShortDst\n\t}\n\tnDst = copy(dst, result)\n\treturn\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 likely to be in terms of SQL path. Currently we still don't have support multiple function namespaces, nor\n // SQL path. As a result, session is not used here. We still add this to distinguish the two versions of resolveFunction\n // while the refactoring is on-going.\n return staticFunctionNamespace.resolveFunction(name, parameterTypes);\n }"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Software development:"
} |
Creates (or updates) a new ProjectStatus for the given build and
returns it. | [
"def create_or_update(cls, build):\n \n\n test_summary = build.test_summary\n metrics_summary = MetricsSummary(build)\n now = timezone.now()\n test_runs_total = build.test_runs.count()\n test_runs_completed = build.test_runs.filter(completed=True).count()\n test_runs_incomplete = build.test_runs.filter(completed=False).count()\n regressions = None\n fixes = None\n\n previous_build = Build.objects.filter(\n status__finished=True,\n datetime__lt=build.datetime,\n project=build.project,\n ).order_by('datetime').last()\n if previous_build is not None:\n comparison = TestComparison(previous_build, build)\n if comparison.regressions:\n regressions = yaml.dump(comparison.regressions)\n if comparison.fixes:\n fixes = yaml.dump(comparison.fixes)\n\n finished, _ = build.finished\n data = {\n 'tests_pass': test_summary.tests_pass,\n 'tests_fail': test_summary.tests_fail,\n 'tests_xfail': test_summary.tests_xfail,\n 'tests_skip': test_summary.tests_skip,\n 'metrics_summary': metrics_summary.value,\n 'has_metrics': metrics_summary.has_metrics,\n 'last_updated': now,\n 'finished': finished,\n 'test_runs_total': test_runs_total,\n 'test_runs_completed': test_runs_completed,\n 'test_runs_incomplete': test_runs_incomplete,\n 'regressions': regressions,\n 'fixes': fixes\n }\n\n status, created = cls.objects.get_or_create(build=build, defaults=data)\n if not created and test_summary.tests_total >= status.tests_total:\n # XXX the test above for the new total number of tests prevents\n # results that arrived earlier, but are only being processed now,\n # from overwriting a ProjectStatus created by results that arrived\n # later but were already processed.\n status.tests_pass = test_summary.tests_pass\n status.tests_fail = test_summary.tests_fail\n status.tests_xfail = test_summary.tests_xfail\n status.tests_skip = test_summary.tests_skip\n status.metrics_summary = metrics_summary.value\n status.has_metrics = metrics_summary.has_metrics\n status.last_updated = now\n finished, _ = build.finished\n status.finished = finished\n status.build = build\n status.test_runs_total = test_runs_total\n status.test_runs_completed = test_runs_completed\n status.test_runs_incomplete = test_runs_incomplete\n status.regressions = regressions\n status.fixes = fixes\n status.save()\n return status"
] | [
"@Override\n public void addElement(Map<String, Object> e, Map<String, AggregatorFactory> a)\n {\n // since we return a constant, no need to read from the event\n }"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Static pressure.
Args:
msg (String): 28 bytes hexadecimal message string
Returns:
int: static pressure in hPa | [
"def p44(msg):\n \n d = hex2bin(data(msg))\n\n if d[34] == '0':\n return None\n\n p = bin2int(d[35:46]) # hPa\n\n return p"
] | [
"def create_response_pdu(self, data):\n \n log.debug('Create single bit response pdu {0}.'.format(data))\n bytes_ = [data[i:i + 8] for i in range(0, len(data), 8)]\n\n # Reduce each all bits per byte to a number. Byte\n # [0, 0, 0, 0, 0, 1, 1, 1] is intepreted as binary en is decimal 3.\n for index, byte in enumerate(bytes_):\n bytes_[index] = \\\n reduce(lambda a, b: (a << 1) + b, list(reversed(byte)))\n\n log.debug('Reduced single bit data to {0}.'.format(bytes_))\n # The first 2 B's of the format encode the function code (1 byte) and\n # the length (1 byte) of the following byte series. Followed by # a B\n # for every byte in the series of bytes. 3 lead to the format '>BBB'\n # and 257 lead to the format '>BBBB'.\n fmt = '>BB' + self.format_character * len(bytes_)\n return struct.pack(fmt, self.function_code, len(bytes_), *bytes_)"
] | codesearchnet | {
"query": "Represent the summarization about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about Software development:"
} |
Trace TCP flows.
Keyword arguments:
* fout -- str, output path
* format -- str, output format
* byteorder -- str, output file byte order
* nanosecond -- bool, output nanosecond-resolution file flag | [
"def trace(fout=None, format=None, byteorder=sys.byteorder, nanosecond=False):\n \n str_check(fout or '', format or '')\n return TraceFlow(fout=fout, format=format, byteorder=byteorder, nanosecond=nanosecond)"
] | [
"def _writer_factory(name, format, def_fs, descr):\n \n def basic_writer(data, filename, fs = def_fs, enc = format.encoding):\n \"\"\"Common \"template\" to all write functions.\"\"\"\n if np.ndim(data) <= 1:\n nc = 1\n elif np.ndim(data) == 2:\n nc = data.shape[1]\n else:\n RuntimeError(\"Only rank 0, 1, and 2 arrays supported as audio data\")\n\n uformat = Format(format.file_format, encoding=enc,\n endianness=format.endianness)\n hdl = Sndfile(filename, 'w', uformat, nc, fs)\n try:\n hdl.write_frames(data)\n finally:\n hdl.close()\n doc = \\\n \"\"\"Simple writer for %(format)s audio files.\n\n Parameters\n ----------\n data : array\n a rank 1 (mono) or 2 (one channel per col) numpy array\n filename : str\n audio file name\n fs : scalar\n sampling rate in Hz (%(def_fs)s by default)\n enc : str\n The encoding such as 'pcm16', etc...(%(def_enc)s by default). A\n list of supported encodings can be queried through the function\n available_encodings.\n\n Notes\n -----\n OVERWRITES EXISTING FILE !\n\n These functions are similar to matlab's wavwrite/auwrite and the\n like. For total control over options, such as endianness, appending data\n to an existing file, etc... you should use Sndfile class instances\n instead\n\n See also\n --------\n available_encodings, Sndfile, Format\"\"\" \\\n % {'format' : str(descr), 'def_fs': def_fs,\n 'def_enc': format.encoding}\n basic_writer.__doc__ = doc\n basic_writer.__name__ = name\n return basic_writer"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about File management:"
} |
Sets the URL to navigate to when the menu item is invoked.
@param url the url to set. | [
"public void setUrl(final String url) {\n\t\tMenuItemModel model = getOrCreateComponentModel();\n\t\tmodel.url = url;\n\t\tmodel.action = null;\n\t}"
] | [
"public void discardHeaderClick(ClickEvent event) {\n if (event == null) return;\n\n // Example: we use radioset on collapsible header, so stopPropagation() is needed\n // to suppress collapsible open/close behavior.\n // But preventDefault() is not needed, otherwise radios won't switch.\n // event.preventDefault(); // For example, clicked anchors will not take the browser to a new URL\n\n event.stopPropagation();\n makeHeaderInactive(header.getElement());\n }"
] | codesearchnet | {
"query": "Represent the Github sentence:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetSecurityGroupArns sets the SecurityGroupArns field's value. | [
"func (s *Ec2Config) SetSecurityGroupArns(v []*string) *Ec2Config {\n\ts.SecurityGroupArns = v\n\treturn s\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 * (Optional)Callback function to receive the result of the _delete operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~_deleteCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UsersResponse} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Removes users account privileges.\n * This closes one or more user records in the account. Users are never deleted from an account, but closing a user prevents them from using account functions.\n\nThe response returns whether the API execution was successful (200 - OK) or if it failed. The response contains a user structure similar to the request and includes the user changes. If an error occurred during the DELETE operation for any of the users, the response for that user contains an `errorDetails` node with `errorCode` and `message` properties.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback._delete \n * @param {module:model/UserInfoList} optsOrCallback.userInfoList \n * @param {module:api/UsersApi~_deleteCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UsersResponse}\n */\n this._delete = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userInfoList'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling _delete\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n 'delete': optsOrCallback['_delete']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UsersResponse;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the create operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~createCallback\n * @param {String} error Error message, if any.\n * @param {module:model/NewUsersSummary} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Adds news user to the specified account.\n * Adds new users to your account. Set the `userSettings` property in the request to specify the actions the users can perform on the account.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/NewUsersDefinition} optsOrCallback.newUsersDefinition \n * @param {module:api/UsersApi~createCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/NewUsersSummary}\n */\n this.create = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['newUsersDefinition'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling create\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = NewUsersSummary;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users', 'POST',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the createSignatures operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~createSignaturesCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignaturesInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Adds user Signature and initials images to a Signature.\n * Adds a user signature image and/or user initials image to the specified user. \n\nThe userId property specified in the endpoint must match the authenticated user's userId and the user must be a member of the account.\n\nThe rules and processes associated with this are:\n\n* If Content-Type is set to application/json, then the default behavior for creating a default signature image, based on the name and a DocuSign font, is used.\n* If Content-Type is set to multipart/form-data, then the request must contain a first part with the user signature information, followed by parts that contain the images.\n\nFor each Image part, the Content-Disposition header has a \"filename\" value that is used to map to the `signatureName` and/or `signatureInitials` properties in the JSON to the image. \n\nFor example: \n`Content-Disposition: file; filename=\"Ron Test20121127083900\"`\n\nIf no matching image (by filename value) is found, then the image is not set. One, both, or neither of the signature and initials images can be set with this call.\n\nThe Content-Transfer-Encoding: base64 header, set in the header for the part containing the image, can be set to indicate that the images are formatted as base64 instead of as binary.\n\nIf successful, 200-OK is returned, and a JSON structure containing the signature information is provided, note that the signatureId can change with each API POST, PUT, or DELETE since the changes to the signature structure cause the current signature to be closed, and a new signature record to be created.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/UserSignaturesInformation} optsOrCallback.userSignaturesInformation \n * @param {module:api/UsersApi~createSignaturesCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignaturesInformation}\n */\n this.createSignatures = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userSignaturesInformation'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling createSignatures\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling createSignatures\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSignaturesInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures', 'POST',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the deleteContactWithId operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~deleteContactWithIdCallback\n * @param {String} error Error message, if any.\n * @param {module:model/ContactUpdateResponse} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Replaces a particular contact associated with an account for the DocuSign service.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} contactId The unique identifier of a person in the contacts address book.\n * @param {module:api/UsersApi~deleteContactWithIdCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/ContactUpdateResponse}\n */\n this.deleteContactWithId = function(accountId, contactId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling deleteContactWithId\");\n }\n\n // verify the required parameter 'contactId' is set\n if (contactId == undefined || contactId == null) {\n throw new Error(\"Missing the required parameter 'contactId' when calling deleteContactWithId\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'contactId': contactId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = ContactUpdateResponse;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/contacts/{contactId}', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the deleteContacts operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~deleteContactsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/ContactUpdateResponse} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Delete contacts associated with an account for the DocuSign service.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/ContactModRequest} optsOrCallback.contactModRequest \n * @param {module:api/UsersApi~deleteContactsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/ContactUpdateResponse}\n */\n this.deleteContacts = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['contactModRequest'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling deleteContacts\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = ContactUpdateResponse;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/contacts', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the deleteCustomSettings operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~deleteCustomSettingsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/CustomSettingsInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Deletes custom user settings for a specified user.\n * Deletes the specified custom user settings for a single user.\n\n###Deleting Grouped Custom User Settings###\n\nIf the custom user settings you want to delete are grouped, you must include the following information in the header, after Content-Type, in the request:\n\n`X-DocuSign-User-Settings-Key:group_name`\n\nWhere the `group_name` is your designated name for the group of customer user settings.\n\nIf the extra header information is not included, only the custom user settings that were added without a group are deleted.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/CustomSettingsInformation} optsOrCallback.customSettingsInformation \n * @param {module:api/UsersApi~deleteCustomSettingsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/CustomSettingsInformation}\n */\n this.deleteCustomSettings = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['customSettingsInformation'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling deleteCustomSettings\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling deleteCustomSettings\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = CustomSettingsInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/custom_settings', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the deleteProfileImage operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~deleteProfileImageCallback\n * @param {String} error Error message, if any.\n * @param data This operation does not return a value.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Deletes the user profile image for the specified user.\n * Deletes the user profile image from the specified user's profile.\n\nThe userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the specified account.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {module:api/UsersApi~deleteProfileImageCallback} callback The callback function, accepting three arguments: error, data, response\n */\n this.deleteProfileImage = function(accountId, userId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling deleteProfileImage\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling deleteProfileImage\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = null;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/profile/image', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the deleteSignature operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~deleteSignatureCallback\n * @param {String} error Error message, if any.\n * @param data This operation does not return a value.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Removes removes signature information for the specified user.\n * Removes the signature information for the user.\n\nThe userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {String} signatureId The ID of the signature being accessed.\n * @param {module:api/UsersApi~deleteSignatureCallback} callback The callback function, accepting three arguments: error, data, response\n */\n this.deleteSignature = function(accountId, userId, signatureId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling deleteSignature\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling deleteSignature\");\n }\n\n // verify the required parameter 'signatureId' is set\n if (signatureId == undefined || signatureId == null) {\n throw new Error(\"Missing the required parameter 'signatureId' when calling deleteSignature\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId,\n 'signatureId': signatureId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = null;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures/{signatureId}', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the deleteSignatureImage operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~deleteSignatureImageCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignature} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Deletes the user initials image or the user signature image for the specified user.\n * Deletes the specified initials image or signature image for the specified user.\n\nThe function deletes one or the other of the image types, to delete both the initials image and signature image you must call the endpoint twice.\n\nThe userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {String} signatureId The ID of the signature being accessed.\n * @param {String} imageType One of **signature_image** or **initials_image**.\n * @param {module:api/UsersApi~deleteSignatureImageCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignature}\n */\n this.deleteSignatureImage = function(accountId, userId, signatureId, imageType, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling deleteSignatureImage\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling deleteSignatureImage\");\n }\n\n // verify the required parameter 'signatureId' is set\n if (signatureId == undefined || signatureId == null) {\n throw new Error(\"Missing the required parameter 'signatureId' when calling deleteSignatureImage\");\n }\n\n // verify the required parameter 'imageType' is set\n if (imageType == undefined || imageType == null) {\n throw new Error(\"Missing the required parameter 'imageType' when calling deleteSignatureImage\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId,\n 'signatureId': signatureId,\n 'imageType': imageType\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSignature;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures/{signatureId}/{imageType}', 'DELETE',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getContactById operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getContactByIdCallback\n * @param {String} error Error message, if any.\n * @param {module:model/ContactGetResponse} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Gets a particular contact associated with the user's account.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} contactId The unique identifier of a person in the contacts address book.\n * @param {module:api/UsersApi~getContactByIdCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/ContactGetResponse}\n */\n this.getContactById = function(accountId, contactId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getContactById\");\n }\n\n // verify the required parameter 'contactId' is set\n if (contactId == undefined || contactId == null) {\n throw new Error(\"Missing the required parameter 'contactId' when calling getContactById\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'contactId': contactId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = ContactGetResponse;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/contacts/{contactId}', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getInformation operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getInformationCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Gets the user information for a specified user.\n * Retrieves the user information for the specified user. \n\nTo return additional user information that details the last login date, login status, and the user's password expiration date, set the optional `additional_info` query string parameter to **true**.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback.additionalInfo When set to **true**, the full list of user information is returned for each user in the account.\n * @param {String} optsOrCallback.email \n * @param {module:api/UsersApi~getInformationCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserInformation}\n */\n this.getInformation = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getInformation\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling getInformation\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n 'additional_info': optsOrCallback['additionalInfo'],\n 'email': optsOrCallback['email']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getProfile operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getProfileCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserProfile} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Retrieves the user profile for a specified user.\n * Retrieves the user profile information, the privacy settings and personal information (address, phone number, etc.) for the specified user.\n\nThe userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the specified account.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {module:api/UsersApi~getProfileCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserProfile}\n */\n this.getProfile = function(accountId, userId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getProfile\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling getProfile\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserProfile;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/profile', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getProfileImage operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getProfileImageCallback\n * @param {String} error Error message, if any.\n * @param {Object} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Retrieves the user profile image for the specified user.\n * Retrieves the user profile picture for the specified user. The image is returned in the same format as uploaded.\n\nThe userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the specified account.\n\nIf successful, the response returns a 200 - OK and the user profile image.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback.encoding \n * @param {module:api/UsersApi~getProfileImageCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link Object}\n */\n this.getProfileImage = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getProfileImage\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling getProfileImage\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n 'encoding': optsOrCallback['encoding']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['image/gif'];\n var returnType = Object;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/profile/image', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getSettings operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getSettingsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSettingsInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Gets the user account settings for a specified user.\n * Retrieves a list of the account settings and email notification information for the specified user.\n\nThe response returns the account setting name/value information and the email notification settings for the specified user. For more information about the different user settings, see the [ML:userSettings list].\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {module:api/UsersApi~getSettingsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSettingsInformation}\n */\n this.getSettings = function(accountId, userId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getSettings\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling getSettings\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSettingsInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/settings', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getSignature operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getSignatureCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignature} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Gets the user signature information for the specified user.\n * Retrieves the structure of a single signature with a known signature name.\n\nThe userId specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {String} signatureId The ID of the signature being accessed.\n * @param {module:api/UsersApi~getSignatureCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignature}\n */\n this.getSignature = function(accountId, userId, signatureId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getSignature\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling getSignature\");\n }\n\n // verify the required parameter 'signatureId' is set\n if (signatureId == undefined || signatureId == null) {\n throw new Error(\"Missing the required parameter 'signatureId' when calling getSignature\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId,\n 'signatureId': signatureId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSignature;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures/{signatureId}', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the getSignatureImage operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~getSignatureImageCallback\n * @param {String} error Error message, if any.\n * @param {Object} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Retrieves the user initials image or the user signature image for the specified user.\n * Retrieves the specified initials image or signature image for the specified user. The image is returned in the same format as uploaded. In the request you can specify if the chrome (the added line and identifier around the initial image) is returned with the image.\n\nThe userId property specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n\n###### Note: Older envelopes might only have chromed images. If getting the non-chromed image fails, try getting the chromed image.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {String} signatureId The ID of the signature being accessed.\n * @param {String} imageType One of **signature_image** or **initials_image**.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback.includeChrome \n * @param {module:api/UsersApi~getSignatureImageCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link Object}\n */\n this.getSignatureImage = function(accountId, userId, signatureId, imageType, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling getSignatureImage\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling getSignatureImage\");\n }\n\n // verify the required parameter 'signatureId' is set\n if (signatureId == undefined || signatureId == null) {\n throw new Error(\"Missing the required parameter 'signatureId' when calling getSignatureImage\");\n }\n\n // verify the required parameter 'imageType' is set\n if (imageType == undefined || imageType == null) {\n throw new Error(\"Missing the required parameter 'imageType' when calling getSignatureImage\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId,\n 'signatureId': signatureId,\n 'imageType': imageType\n };\n var queryParams = {\n 'include_chrome': optsOrCallback['includeChrome']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['image/gif'];\n var returnType = Object;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures/{signatureId}/{imageType}', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the list operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~listCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserInformationList} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Retrieves the list of users for the specified account.\n * Retrieves the list of users for the specified account.\n\nThe response returns the list of users for the account along with the information about the result set. If the `additional_info` query was added to the endpoint and set to **true**, the full user information is returned for each user\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback.additionalInfo When set to **true**, the full list of user information is returned for each user in the account.\n * @param {String} optsOrCallback.count Number of records to return. The number must be greater than 0 and less than or equal to 100. \n * @param {String} optsOrCallback.email \n * @param {String} optsOrCallback.emailSubstring Filters the returned user records by the email address or a sub-string of email address.\n * @param {String} optsOrCallback.groupId Filters user records returned by one or more group Id's.\n * @param {String} optsOrCallback.loginStatus \n * @param {String} optsOrCallback.notGroupId \n * @param {String} optsOrCallback.startPosition Starting value for the list. \n * @param {String} optsOrCallback.status \n * @param {String} optsOrCallback.userNameSubstring Filters the user records returned by the user name or a sub-string of user name.\n * @param {module:api/UsersApi~listCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserInformationList}\n */\n this.list = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling list\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n 'additional_info': optsOrCallback['additionalInfo'],\n 'count': optsOrCallback['count'],\n 'email': optsOrCallback['email'],\n 'email_substring': optsOrCallback['emailSubstring'],\n 'group_id': optsOrCallback['groupId'],\n 'login_status': optsOrCallback['loginStatus'],\n 'not_group_id': optsOrCallback['notGroupId'],\n 'start_position': optsOrCallback['startPosition'],\n 'status': optsOrCallback['status'],\n 'user_name_substring': optsOrCallback['userNameSubstring']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserInformationList;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the listCustomSettings operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~listCustomSettingsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/CustomSettingsInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Retrieves the custom user settings for a specified user.\n * Retrieves a list of custom user settings for a single user.\n\nCustom settings provide a flexible way to store and retrieve custom user information that can be used in your own system.\n\n###### Note: Custom user settings are not the same as user account settings.\n\n###Getting Grouped Custom User Settings###\n\nIf the custom user settings you want to retrieve are grouped, you must include the following information in the header, after Content-Type, in the request:\n\n`X-DocuSign-User-Settings-Key:group_name`\n\nWhere the `group_name` is your designated name for the group of customer user settings.\n\nIf the extra header information is not included, only the custom user settings that were added without a group are retrieved.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {module:api/UsersApi~listCustomSettingsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/CustomSettingsInformation}\n */\n this.listCustomSettings = function(accountId, userId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling listCustomSettings\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling listCustomSettings\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = CustomSettingsInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/custom_settings', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the listSignatures operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~listSignaturesCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignaturesInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Retrieves a list of user signature definitions for a specified user.\n * Retrieves the signature definitions for the specified user.\n\nThe userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback.stampType \n * @param {module:api/UsersApi~listSignaturesCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignaturesInformation}\n */\n this.listSignatures = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling listSignatures\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling listSignatures\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n 'stamp_type': optsOrCallback['stampType']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSignaturesInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures', 'GET',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the postContacts operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~postContactsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/ContactUpdateResponse} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Imports multiple new contacts into the contacts collection from CSV, JSON, or XML (based on content type).\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/ContactModRequest} optsOrCallback.contactModRequest \n * @param {module:api/UsersApi~postContactsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/ContactUpdateResponse}\n */\n this.postContacts = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['contactModRequest'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling postContacts\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = ContactUpdateResponse;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/contacts', 'POST',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the putContacts operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~putContactsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/ContactUpdateResponse} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Replaces contacts associated with an account for the DocuSign service.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/ContactModRequest} optsOrCallback.contactModRequest \n * @param {module:api/UsersApi~putContactsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/ContactUpdateResponse}\n */\n this.putContacts = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['contactModRequest'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling putContacts\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = ContactUpdateResponse;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/contacts', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateCustomSettings operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateCustomSettingsCallback\n * @param {String} error Error message, if any.\n * @param {module:model/CustomSettingsInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Adds or updates custom user settings for the specified user.\n * Adds or updates custom user settings for the specified user.\n\n###### Note: Custom user settings are not the same as user account settings.\n\nCustom settings provide a flexible way to store and retrieve custom user information that you can use in your own system.\n\n**Important**: There is a limit on the size for all the custom user settings for a single user. The limit is 4,000 characters, which includes the XML and JSON structure for the settings.\n\n### Grouping Custom User Settings ###\n\nYou can group custom user settings when adding them. Grouping allows you to retrieve settings that are in a specific group, instead of retrieving all the user custom settings.\n\nTo group custom user settings, add the following information in the header, after Content-Type:\n\n`X-DocuSign-User-Settings-Key:group_name`\n\nWhere the `group_name` is your designated name for the group of customer user settings. Grouping is shown in the Example Request Body below.\n\nWhen getting or deleting grouped custom user settings, you must include the extra header information.\n\nGrouping custom user settings is not required and if the extra header information is not included, the custom user settings are added normally and can be retrieved or deleted without including the additional header.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/CustomSettingsInformation} optsOrCallback.customSettingsInformation \n * @param {module:api/UsersApi~updateCustomSettingsCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/CustomSettingsInformation}\n */\n this.updateCustomSettings = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['customSettingsInformation'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateCustomSettings\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateCustomSettings\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = CustomSettingsInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/custom_settings', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateProfile operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateProfileCallback\n * @param {String} error Error message, if any.\n * @param data This operation does not return a value.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Updates the user profile information for the specified user.\n * Updates the user's detail information, profile information, privacy settings, and personal information in the user ID card.\n\nYou can also change a user's name by changing the information in the `userDetails` property. When changing a user's name, you can either change the information in the `userName` property OR change the information in `firstName`, `middleName`, `lastName, suffixName`, and `title` properties. Changes to `firstName`, `middleName`, `lastName`, `suffixName`, and `title` properties take precedence over changes to the `userName` property.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/UserProfile} optsOrCallback.userProfile \n * @param {module:api/UsersApi~updateProfileCallback} callback The callback function, accepting three arguments: error, data, response\n */\n this.updateProfile = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userProfile'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateProfile\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateProfile\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = null;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/profile', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateProfileImage operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateProfileImageCallback\n * @param {String} error Error message, if any.\n * @param data This operation does not return a value.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Updates the user profile image for a specified user.\n * Updates the user profile image by uploading an image to the user profile.\n\nThe supported image formats are: gif, png, jpeg, and bmp. The file must be less than 200K. For best viewing results, DocuSign recommends that the image is no more than 79 pixels wide and high.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {module:api/UsersApi~updateProfileImageCallback} callback The callback function, accepting three arguments: error, data, response\n */\n this.updateProfileImage = function(accountId, userId, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateProfileImage\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateProfileImage\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = ['image/gif'];\n var accepts = ['application/json'];\n var returnType = null;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/profile/image', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateSettings operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateSettingsCallback\n * @param {String} error Error message, if any.\n * @param data This operation does not return a value.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Updates the user account settings for a specified user.\n * Updates the account settings list and email notification types for the specified user.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/UserSettingsInformation} optsOrCallback.userSettingsInformation \n * @param {module:api/UsersApi~updateSettingsCallback} callback The callback function, accepting three arguments: error, data, response\n */\n this.updateSettings = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userSettingsInformation'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateSettings\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateSettings\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = null;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/settings', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateSignature operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateSignatureCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignature} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Updates the user signature for a specified user.\n * Creates, or updates, the signature font and initials for the specified user. When creating a signature, you use this resource to create the signature name and then add the signature and initials images into the signature.\n\n###### Note: This will also create a default signature for the user when one does not exist.\n\nThe userId property specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {String} signatureId The ID of the signature being accessed.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {String} optsOrCallback.closeExistingSignature When set to **true**, closes the current signature.\n * @param {module:model/UserSignatureDefinition} optsOrCallback.userSignatureDefinition \n * @param {module:api/UsersApi~updateSignatureCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignature}\n */\n this.updateSignature = function(accountId, userId, signatureId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userSignatureDefinition'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateSignature\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateSignature\");\n }\n\n // verify the required parameter 'signatureId' is set\n if (signatureId == undefined || signatureId == null) {\n throw new Error(\"Missing the required parameter 'signatureId' when calling updateSignature\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId,\n 'signatureId': signatureId\n };\n var queryParams = {\n 'close_existing_signature': optsOrCallback['closeExistingSignature']\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSignature;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures/{signatureId}', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateSignatureImage operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateSignatureImageCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignature} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Updates the user signature image or user initials image for the specified user.\n * Updates the user signature image or user initials image for the specified user. The supported image formats for this file are: gif, png, jpeg, and bmp. The file must be less than 200K.\n\nThe userId property specified in the endpoint must match the authenticated user's user ID and the user must be a member of the account.\n\nThe `signatureId` parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (`signatureId`), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. \n\nFor example encode \"Bob Smith\" as \"Bob%20Smith\".\n\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {String} signatureId The ID of the signature being accessed.\n * @param {String} imageType One of **signature_image** or **initials_image**.\n * @param {module:api/UsersApi~updateSignatureImageCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignature}\n */\n this.updateSignatureImage = function(accountId, userId, signatureId, imageType, callback) {\n var postBody = null;\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateSignatureImage\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateSignatureImage\");\n }\n\n // verify the required parameter 'signatureId' is set\n if (signatureId == undefined || signatureId == null) {\n throw new Error(\"Missing the required parameter 'signatureId' when calling updateSignatureImage\");\n }\n\n // verify the required parameter 'imageType' is set\n if (imageType == undefined || imageType == null) {\n throw new Error(\"Missing the required parameter 'imageType' when calling updateSignatureImage\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId,\n 'signatureId': signatureId,\n 'imageType': imageType\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = ['image/gif'];\n var accepts = ['application/json'];\n var returnType = UserSignature;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures/{signatureId}/{imageType}', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateSignatures operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateSignaturesCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserSignaturesInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Adds/updates a user signature.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/UserSignaturesInformation} optsOrCallback.userSignaturesInformation \n * @param {module:api/UsersApi~updateSignaturesCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserSignaturesInformation}\n */\n this.updateSignatures = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userSignaturesInformation'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateSignatures\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateSignatures\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserSignaturesInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}/signatures', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateUser operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateUserCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserInformation} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Updates the specified user information.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {String} userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/UserInformation} optsOrCallback.userInformation \n * @param {module:api/UsersApi~updateUserCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserInformation}\n */\n this.updateUser = function(accountId, userId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userInformation'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateUser\");\n }\n\n // verify the required parameter 'userId' is set\n if (userId == undefined || userId == null) {\n throw new Error(\"Missing the required parameter 'userId' when calling updateUser\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId,\n 'userId': userId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserInformation;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users/{userId}', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n\n /**\n * (Optional)Callback function to receive the result of the updateUsers operation. If none specified a Promise will be returned.\n * @callback module:api/UsersApi~updateUsersCallback\n * @param {String} error Error message, if any.\n * @param {module:model/UserInformationList} data The data returned by the service call.\n * @param {String} If a callback was specified, the response The complete HTTP response, else a Promise resolving the response Data.\n */\n\n /**\n * Change one or more user in the specified account.\n * @param {String} accountId The external account number (int) or account ID Guid.\n * @param {Object} optsOrCallback Optional parameters, if you are passing no optional parameters, you can either pass a null or omit this parameter entirely.\n * @param {module:model/UserInformationList} optsOrCallback.userInformationList \n * @param {module:api/UsersApi~updateUsersCallback} callback The callback function, accepting three arguments: error, data, response\n * data is of type: {@link module:model/UserInformationList}\n */\n this.updateUsers = function(accountId, optsOrCallback, callback) {\n optsOrCallback = optsOrCallback || {};\n\n if (typeof optsOrCallback === 'function') {\n callback = optsOrCallback;\n optsOrCallback = {};\n }\n\n var postBody = optsOrCallback['userInformationList'];\n\n // verify the required parameter 'accountId' is set\n if (accountId == undefined || accountId == null) {\n throw new Error(\"Missing the required parameter 'accountId' when calling updateUsers\");\n }\n\n if (typeof callback !== 'function' && arguments.length && typeof arguments[arguments.length-1] === 'function'){\n if (typeof optsOrCallback !== 'undefined') {\n optsOrCallback = callback;\n }\n callback = arguments[arguments.length-1];\n }\n\n var pathParams = {\n 'accountId': accountId\n };\n var queryParams = {\n };\n var headerParams = {\n };\n var formParams = {\n };\n\n var authNames = [];\n var contentTypes = [];\n var accepts = ['application/json'];\n var returnType = UserInformationList;\n\n return this.apiClient.callApi(\n '/v2/accounts/{accountId}/users', 'PUT',\n pathParams, queryParams, headerParams, formParams, postBody,\n authNames, contentTypes, accepts, returnType, callback\n );\n };\n }"
] | codesearchnet | {
"query": "Represent the Github text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about Software development:"
} |
Does not perform {@link PrivilegedAction} unless necessary.
@param javaClass
@param fieldName
@return a field from the class
@throws NoSuchMethodException | [
"static Field lookupField(Class<?> javaClass, String fieldName) throws NoSuchFieldException {\n if (System.getSecurityManager() != null) {\n try {\n return AccessController.doPrivileged(new FieldLookupAction(javaClass, fieldName));\n } catch (PrivilegedActionException e) {\n if (e.getCause() instanceof NoSuchFieldException) {\n throw (NoSuchFieldException) e.getCause();\n }\n throw new WeldException(e.getCause());\n }\n } else {\n return FieldLookupAction.lookupField(javaClass, fieldName);\n }\n }"
] | [
"public @CheckForNull PropertyType getPropertyType(@Nonnull Object instance, @Nonnull String field) {\n // in global.jelly, instance==descriptor\n return instance==this ? getGlobalPropertyType(field) : getPropertyType(field);\n }"
] | codesearchnet | {
"query": "Represent the Github comment about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
migrate the retry jobs of a queue
@param string $queue
@return array | [
"protected function migrateRetryJobs($queue)\n {\n $luaScript = <<<LUA\n-- Get all of the jobs with an expired \"score\"...\nlocal val = redis.call('zrangebyscore', KEYS[1], '-inf', ARGV[1])\n\n-- If we have values in the array, we will remove them from the first queue\n-- and add them onto the destination queue in chunks of 100, which moves\n-- all of the appropriate jobs onto the destination queue very safely.\nif(next(val) ~= nil) then\n redis.call('zremrangebyrank', KEYS[1], 0, #val - 1)\n\n for i = 1, #val, 100 do\n redis.call('rpush', KEYS[2], unpack(val, i, math.min(i+99, #val)))\n end\nend\n\nreturn val\nLUA;\n\n return $this->client->eval(\n $luaScript,\n 2,\n $this->getRetryZsetNameWithPrefix($queue),\n $this->getQueueNameWithPrefix($queue),\n time()\n );\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 summarization about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Dump the payload to JSON | [
"def jsonify_payload(self):\n \n # Assume already json serialized\n if isinstance(self.payload, string_types):\n return self.payload\n return json.dumps(self.payload, cls=StandardJSONEncoder)"
] | [
"def post_build(self, p, pay):\n \n p += pay\n if self.auxdlen != 0:\n print(\"NOTICE: A properly formatted and complaint V3 Group Record should have an Auxiliary Data length of zero (0).\")\n print(\" Subsequent Group Records are lost!\")\n return p"
] | codesearchnet | {
"query": "Represent the instruction about Technology:",
"pos": "Represent the code about Technology:",
"neg": "Represent the code:"
} |
Get system backtrace in formated view
@param bool $trace Custom php backtrace
@param bool $addObject Show objects in result
@return JBDump | [
"public static function trace($trace = null, $addObject = false)\r\n {\r\n if (!self::isDebug()) {\r\n return false;\r\n }\r\n\r\n $_this = self::i();\r\n\r\n $trace = $trace ? $trace : debug_backtrace($addObject);\r\n unset($trace[0]);\r\n\r\n $result = $_this->convertTrace($trace, $addObject);\r\n\r\n return $_this->dump($result, '! backtrace !');\r\n }"
] | [
"function make_event(event, target) {\n return string_p(event)? Event.make(event, target)\n : /* otherwise */ event }"
] | codesearchnet | {
"query": "Represent the Github instruction about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Get a short value from the form, and place it in <code>attribute</code>.
@param name attribute name
@param attribute attribute to put value
@since 1.11.1 | [
"@Api\n\tpublic void getValue(String name, ShortAttribute attribute) {\n\t\tattribute.setValue(toShort(formWidget.getValue(name)));\n\t}"
] | [
"protected function setupObject()\n {\n $this->name = $this->getAttribute(\"name\");\n $this->value = $this->getAttribute(\"value\");\n $this->classname = $this->getAttribute(\"class\");\n\n /*\n * Set some default values if they are not specified.\n * This is especially useful for maxLength; the size\n * is already known by the column and this way it is\n * not necessary to manage the same size two times.\n *\n * Currently there is only one such supported default:\n * - maxLength value = column max length\n * (this default cannot be easily set at runtime w/o changing\n * design of class system in undesired ways)\n */\n if ($this->value === null) {\n switch ($this->name) {\n case 'maxLength':\n $this->value = $this->validator->getColumn()->getSize();\n break;\n }\n }\n\n $this->message = $this->getAttribute(\"message\");\n }"
] | codesearchnet | {
"query": "Represent the sentence about Programming:",
"pos": "Represent the code about Programming:",
"neg": "Represent the code about Software development:"
} |
Submits the {@link org.apache.gobblin.metrics.GobblinTrackingEvent} to the {@link org.apache.gobblin.metrics.MetricContext}.
@param name Name of the event.
@param additionalMetadata Additional metadata to be added to the event. | [
"public void submit(String name, Map<String, String> additionalMetadata) {\n if(this.metricContext.isPresent()) {\n Map<String, String> finalMetadata = Maps.newHashMap(this.metadata);\n if(!additionalMetadata.isEmpty()) {\n finalMetadata.putAll(additionalMetadata);\n }\n\n // Timestamp is set by metric context.\n this.metricContext.get().submitEvent(new GobblinTrackingEvent(0l, this.namespace, name, finalMetadata));\n }\n }"
] | [
"@Override\n public <T extends Metric> T register(String name, T metric) throws IllegalArgumentException {\n // For MP Metrics 1.0, MetricType.from(Class in) does not support lambdas or proxy classes\n return register(name, metric, new Metadata(name, from(metric)));\n }"
] | codesearchnet | {
"query": "Represent the Github instruction about Data management:",
"pos": "Represent the Github code about Data management:",
"neg": "Represent the Github code about programming:"
} |
// FallbackAddr is a functional option that allows callers of NewInvoice to set
// the Invoice's fallback on-chain address that can be used for payment in case
// the Lightning payment fails | [
"func FallbackAddr(fallbackAddr btcutil.Address) func(*Invoice) {\n\treturn func(i *Invoice) {\n\t\ti.FallbackAddr = fallbackAddr\n\t}\n}"
] | [
"func (h Handler) GetE(cmd common.GetRequest) (<-chan common.GetEResponse, <-chan error) {\n\t// Being minimalist, not lazy. The chunked handler is not meant to be used with a\n\t// backing store that supports the GetE protocol extension. It would be a waste of\n\t// time and effort to support it here if it would \"never\" be used. It will be added\n\t// as soon as a case for it exists.\n\t//\n\t// The GetE extension is an addition that only rend supports. This chunked handler\n\t// is pretty explicitly for talking to memcached since it is a complex workaround\n\t// for pathological behavior when data size rapidly changes that only happens in\n\t// memcached. The chunked handler will not work well with the L2 the EVCache team\n\t// uses.\n\tpanic(\"GetE not supported in Rend chunked mode\")\n}"
] | codesearchnet | {
"query": "Represent the Github comment:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about Software development:"
} |
Get our daemon script path. | [
"def get_manager_cmd(self):\n \"\"\"\"\"\"\n cmd = os.path.abspath(os.path.join(os.path.dirname(__file__), \"server\", \"notebook_daemon.py\"))\n assert os.path.exists(cmd)\n return cmd"
] | [
"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 post:",
"pos": "Represent the code:",
"neg": "Represent the code about Software development:"
} |
// SetMaxHumanLabeledObjectCount sets the MaxHumanLabeledObjectCount field's value. | [
"func (s *LabelingJobStoppingConditions) SetMaxHumanLabeledObjectCount(v int64) *LabelingJobStoppingConditions {\n\ts.MaxHumanLabeledObjectCount = &v\n\treturn s\n}"
] | [
"private Counter<L> logProbabilityOfRVFDatum(RVFDatum<L, F> example) {\r\n // NB: this duplicate method is needed so it calls the scoresOf method\r\n // with an RVFDatum signature!! Don't remove it!\r\n // JLS: type resolution of method parameters is static\r\n Counter<L> scores = scoresOfRVFDatum(example);\r\n Counters.logNormalizeInPlace(scores);\r\n return scores;\r\n }"
] | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Create a default {@link FeatureInfoWidget} with a {@link ZoomToObjectAction}
to allow zooming to selected features.
@param mapPresenter The map presenter used by the action(s).
@return A feature info widget with actions. | [
"public FeatureInfoWithActions getFeatureInfoWidgetWithActions(MapPresenter mapPresenter) {\n\t\tFeatureInfoWithActions widgetWithActions = new FeatureInfoWithActions();\n\t\twidgetWithActions.addHasFeature(new ZoomToObjectAction(mapPresenter));\n\n\t\treturn widgetWithActions;\n\t}"
] | [
"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 object (may be null)\n this.scope = config.scope; // The ID of the widget that this widget is scoped within\n this.domEvents = null; // An array of DOM events that need to be added (in sets of three)\n this.customEvents = config.customEvents; // An array containing information about custom events\n this.bodyElId = config.bodyElId; // The ID for the default body element (if any any)\n this.children = []; // An array of nested WidgetDef instances\n this.end = endFunc; // A function that when called will pop this widget def off the stack\n this.extend = config.extend; // Information about other widgets that extend this widget.\n this.out = out; // The AsyncWriter that this widget is associated with\n this.hasDomEvents = config.hasDomEvents; // A flag to indicate if this widget has any\n // listeners for non-bubbling DOM events\n this._nextId = 0; // The unique integer to use for the next scoped ID\n}"
] | codesearchnet | {
"query": "Represent the text about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
// SetError sets the Error field's value. | [
"func (s *TaskFailedEventDetails) SetError(v string) *TaskFailedEventDetails {\n\ts.Error = &v\n\treturn s\n}"
] | [
"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 text about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code about programming:"
} |
Access the Monitor Twilio Domain
:returns: Monitor Twilio Domain
:rtype: twilio.rest.monitor.Monitor | [
"def monitor(self):\n \n if self._monitor is None:\n from twilio.rest.monitor import Monitor\n self._monitor = Monitor(self)\n return self._monitor"
] | [
"def plan(self):\n \n import ns1.rest.account\n return ns1.rest.account.Plan(self.config)"
] | codesearchnet | {
"query": "Represent the Github comment about Twilio:",
"pos": "Represent the Github code about Twilio:",
"neg": "Represent the Github code:"
} |
// ExecuteRaw receives, parse and executes raw source template contents
// it's super-simple function without options and funcs, it's not used widely
// implements the EngineRawExecutor interface | [
"func (p *Engine) ExecuteRaw(src string, wr io.Writer, binding interface{}) (err error) {\n\tset := pongo2.NewSet(\"\", pongo2.DefaultLoader)\n\tset.Globals = getPongoContext(p.Config.Globals)\n\ttmpl, err := set.FromString(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn tmpl.ExecuteWriter(getPongoContext(binding), wr)\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 likely to be in terms of SQL path. Currently we still don't have support multiple function namespaces, nor\n // SQL path. As a result, session is not used here. We still add this to distinguish the two versions of resolveFunction\n // while the refactoring is on-going.\n return staticFunctionNamespace.resolveFunction(name, parameterTypes);\n }"
] | codesearchnet | {
"query": "Represent the Github sentence about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about Software development:"
} |
Returns a parameter value in the specified array, if not in, returns the
first element instead
@param string $name The parameter name
@param array $array The array to be search
@return mixed The parameter value | [
"public function getInArray($name, array $array)\n {\n $value = $this->get($name);\n return in_array($value, $array) ? $value : $array[key($array)];\n }"
] | [
"public function singlePcmlToParam(\\SimpleXmlElement $dataElement)\n {\n $tagName = $dataElement->getName();\n \n // get attributes of this element.\n $attrs = $dataElement->attributes();\n \n // both struct and data have name, count (optional), usage\n $name = (isset($attrs['name'])) ? (string) $attrs['name'] : '';\n $count = (isset($attrs['count'])) ? (string) $attrs['count'] : '';\n $usage = (isset($attrs['usage'])) ? (string) $attrs['usage'] : '';\n $structName = (isset($attrs['struct'])) ? (string) $attrs['struct'] : '';\n \n // fill this if we have a struct\n $subElements = array();\n \n // each item should have tag name <data>\n if ($tagName != 'data') {\n return false;\n }\n \n $type = (isset($attrs['type'])) ? (string) $attrs['type'] : '';\n\n // Get initial value, if specified by PCML.\n $dataValue = (isset($attrs['init'])) ? (string) $attrs['init'] : '';\n \n // if a struct then we need to recurse.\n if ($type == 'struct') {\n $theStruct = null; // init\n\n // look for matching struct definition encountered earlier.\n if ($this->_pcmlStructs) {\n\n // @todo verify type with is_array and count\n foreach ($this->_pcmlStructs as $possibleStruct) {\n $possStructAttrs = $possibleStruct->attributes();\n \n if ($possStructAttrs['name'] == $structName) {\n $theStruct = $possibleStruct;\n $structAttrs = $possStructAttrs;\n break;\n }\n }\n }\n\n // if struct was not found, generate error for log\n if (!$theStruct) {\n // $this->getConnection->logThis(\"PCML structure '$structName' not found.\");\n return null;\n }\n\n // count can also be defined at the structure level. If so, it will override count from data level)\n if (isset($structAttrs['count'])) {\n $count = (string) $structAttrs['count'];\n }\n\n // \"usage\" (in/out/inherit) can be defined here, at the structure level.\n $structUsage = (isset($structAttrs['usage'])) ? (string) $structAttrs['usage'] : '';\n\n // if we're not inheriting from our parent data element, but there is a struct usage, use the struct's usage (input, output, or inputoutput).\n if (!empty($structUsage) && ($structUsage != 'inherit')) {\n $usage = $structUsage;\n }\n\n $structSubDataElementsXmlObj = $theStruct->xpath('data');\n if ($structSubDataElementsXmlObj) {\n foreach ($structSubDataElementsXmlObj as $subDataElementXmlObj) {\n\n if ($subDataElementXmlObj->attributes()->usage == 'inherit') {\n // subdata is inheriting type from us. Give it to them.\n $subDataElementXmlObj->attributes()->usage = $usage;\n }\n\n // here's where the recursion comes in. Convert data and add to array for our struct.\n $subElements[] = $this->singlePcmlToParam($subDataElementXmlObj);\n }\n }\n }\n\n /* explanation of the terms \"length\" and \"precision\" in PCML:\n * http://publib.boulder.ibm.com/infocenter/iadthelp/v6r0/index.jsp?topic=/com.ibm.etools.iseries.webtools.doc/ref/rdtcattr.htm\n * \n * For \"int\" values, length is the number of bytes; precision represents the number of bits. (Can be ignored here)\n * For zoned and packed values, length is the maximum number of digits; precision represents the maximum decimal places.\n * \n */\n $length = (isset($attrs['length'])) ? (string) $attrs['length'] : '';\n $precision = (isset($attrs['precision'])) ? (string) $attrs['precision'] : '';\n\n $passBy = ''; // default of blank will become 'ref'/Reference in XMLSERVICE. Blank is fine here.\n if (isset($attrs['passby']) && ($attrs['passby'] == 'value')) {\n $passBy = 'val'; // rare. PCML calls it 'value'. XMLSERVICE calls it 'val'.\n }\n \n // find new toolkit equivalent of PCML data type\n if (isset($this->_pcmlTypeMap[$type])) {\n // a simple type mapping\n $newType = (string) $this->_pcmlTypeMap[$type];\n } elseif ($type == 'int') {\n // one of the integer types. Need to use length to determine which one.\n if ($length == '2') {\n $newType = '5i0'; // short ints have two bytes\n } elseif ($length == '4') {\n $newType = '10i0'; // normal ints have four bytes\n } else {\n $newType = ''; // no match\n } //(length == 2, et al.)\n } else {\n $newType = '';\n }\n \n $newInout = (isset($this->_pcmlInoutMap[$usage])) ? (string) $this->_pcmlInoutMap[$usage] : '';\n\n // @todo correct all this isArray business. \n // Can we manage without isArray? \n // well, it's already handled by toolkit....try and see, though.\n // poss. eliminate extra object levels, at least?\n \n if ($count > 1) {\n $isArray = true;\n } else {\n // no need for any dummy value.Could be 'init' from above, or leave the default.\n $isArray = false;\n }\n\n // @todo I think simply add 'counterLabel' and 'countedLabel'. \n // count\n $newCount = 0; // initialize\n // @todo deal with this. Really need a better way to find the counter data elements.\n // Allow a countref, too, in PCML??? Maybe! Count will be the dim (max) and countref is the actual name.\n // Some customers have done it wrong. Instead of specifying a field as count, gave max count.\n // \"count can be a number where number defines a fixed, never-changing number of elements in a sized array.\n // OR a data-name where data-name defines the name of a <data> element within the PCML document that will contain, at runtime, the number of elements in the array. The data-name specified can be a fully qualified name or a name that is relative to the current element. In either case, the name must reference a <data> element that is defined with type=\"int\". See Resolving Relative Names for more information about how relative names are resolved.\n // about finding the element: http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/index.jsp?topic=%2Frzahh%2Flengthprecisionrelative.htm\n // Names are resolved by seeing if the name can be resolved as a child or descendent of the tag containing the current tag. If the name cannot be resolved at this level, the search continues with the next highest containing tag. This resolution must eventually result in a match of a tag that is contained by either the <pcml> tag or the <rfml> tag, in which case the name is considered to be an absolute name, not a relative name.\"\"\n // Let's simply use $countersAndCounted. If necessary, pre-process PCML to create $countersAndCounted.\n if (is_numeric($count) && ($count > 0)) {\n $newCount = $count;\n }\n \n // $subElements are if this is a struct.\n if (count($subElements)) {\n $dataValue = $subElements;\n }\n\n $param = new ProgramParameter(sprintf($newType, $length, $precision), $newInout, '', $name, $dataValue, 'off', $newCount, $passBy, $isArray);\n\n if ($this->_countersAndCounted) {\n // some counters were configured\n // counter item reference was specified.\n if (isset($this->_countersAndCounted[$name])) {\n $param->setParamLabelCounter($name);\n }\n \n // counted item reference was specified as value in array.\n // look for value ($name). if found, counter is key.\n if ($counter = array_search($name, $this->_countersAndCounted)) {\n $param->setParamLabelCounted($counter);\n }\n }\n \n return $param;\n }"
] | codesearchnet | {
"query": "Represent the Github text about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Sets metainfo properties as JCR properties to node. | [
"private void setJCRProperties(NodeImpl parent, Properties props) throws Exception\n {\n if (!parent.isNodeType(\"dc:elementSet\"))\n {\n parent.addMixin(\"dc:elementSet\");\n }\n\n ValueFactory vFactory = parent.getSession().getValueFactory();\n LocationFactory lFactory = parent.getSession().getLocationFactory();\n\n for (Entry entry : props.entrySet())\n {\n QName qname = (QName)entry.getKey();\n JCRName jcrName = lFactory.createJCRName(new InternalQName(qname.getNamespace(), qname.getName()));\n\n PropertyDefinitionData definition =\n parent\n .getSession()\n .getWorkspace()\n .getNodeTypesHolder()\n .getPropertyDefinitions(jcrName.getInternalName(), ((NodeData)parent.getData()).getPrimaryTypeName(),\n ((NodeData)parent.getData()).getMixinTypeNames()).getAnyDefinition();\n\n if (definition != null)\n {\n if (definition.isMultiple())\n {\n Value[] values = {createValue(entry.getValue(), vFactory)};\n parent.setProperty(jcrName.getAsString(), values);\n }\n else\n {\n Value value = createValue(entry.getValue(), vFactory);\n parent.setProperty(jcrName.getAsString(), value);\n }\n }\n }\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.deserializeThreadContext\n // in order to re-establish the thread context based on the metadata identity if not defaulted.\n }"
] | codesearchnet | {
"query": "Represent the comment about Software Development:",
"pos": "Represent the code about Software Development:",
"neg": "Represent the code about programming:"
} |
Get profiles grouped by account and webproperty
TODO Handle "(403) User does not have any Google Analytics account."
@return array | [
"protected function getGroupedProfiles()\n {\n $this->analytics->requireAuthentication();\n\n $groupedProfiles = [];\n $accounts = $this->analytics->management_accounts->listManagementAccounts();\n foreach ($accounts as $account) {\n $groupedProfiles[$account->getId()]['label'] = $account->getName();\n $groupedProfiles[$account->getId()]['items'] = [];\n }\n $webproperties = $this->analytics->management_webproperties->listManagementWebproperties('~all');\n $webpropertiesById = [];\n foreach ($webproperties as $webproperty) {\n $webpropertiesById[$webproperty->getId()] = $webproperty;\n }\n $profiles = $this->analytics->management_profiles->listManagementProfiles('~all', '~all');\n foreach ($profiles as $profile) {\n if (isset($webpropertiesById[$profile->getWebpropertyId()])) {\n $webproperty = $webpropertiesById[$profile->getWebpropertyId()];\n $groupedProfiles[$profile->getAccountId()]['items'][$profile->getId()] = ['label' => $webproperty->getName() . ' > ' . $profile->getName(), 'value' => $profile->getId()];\n }\n }\n\n return $groupedProfiles;\n }"
] | [
"def create(self, **kwargs):\n \n raise exceptions.MethodNotImplemented(method=self.create, url=self.url, details='GUID cannot be duplicated, to create a new GUID use the relationship resource')"
] | codesearchnet | {
"query": "Represent the Github summarization about accounts.authinfo:",
"pos": "Represent the Github code about accounts.authinfo:",
"neg": "Represent the Github code about Natural Language Processing:"
} |
// addValueToMap adds the given value to the map on which the method is run.
// This allows us to merge maps such as {foo: {bar: baz}} and {foo: {baz: faz}}
// into {foo: {bar: baz, baz: faz}}. | [
"func addValueToMap(keys []string, value interface{}, target map[string]interface{}) {\n\tnext := target\n\n\tfor i := range keys {\n\t\t// If we are on last key set or overwrite the val.\n\t\tif i == len(keys)-1 {\n\t\t\tnext[keys[i]] = value\n\t\t\tbreak\n\t\t}\n\n\t\tif iface, ok := next[keys[i]]; ok {\n\t\t\tswitch typed := iface.(type) {\n\t\t\tcase map[string]interface{}:\n\t\t\t\t// If we already had a map inside, keep\n\t\t\t\t// stepping through.\n\t\t\t\tnext = typed\n\t\t\tdefault:\n\t\t\t\t// If we didn't, then overwrite value\n\t\t\t\t// with a map and iterate with that.\n\t\t\t\tm := map[string]interface{}{}\n\t\t\t\tnext[keys[i]] = m\n\t\t\t\tnext = m\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// Otherwise, it wasn't present, so make it and step\n\t\t// into.\n\t\tm := map[string]interface{}{}\n\t\tnext[keys[i]] = m\n\t\tnext = m\n\t}\n}"
] | [
"function(newValues, oldValues, paths) {\n var name, method, called = {};\n for (var i in oldValues) {\n // note: paths is of form [object, path, object, path]\n name = paths[2 * i + 1];\n method = this.observe[name];\n if (method) {\n var ov = oldValues[i], nv = newValues[i];\n // observes the value if it is an array\n this.observeArrayValue(name, nv, ov);\n if (!called[method]) {\n // only invoke change method if one of ov or nv is not (undefined | null)\n if ((ov !== undefined && ov !== null) || (nv !== undefined && nv !== null)) {\n called[method] = true;\n // TODO(sorvell): call method with the set of values it's expecting;\n // e.g. 'foo bar': 'invalidate' expects the new and old values for\n // foo and bar. Currently we give only one of these and then\n // deliver all the arguments.\n this.invokeMethod(method, [ov, nv, arguments]);\n }\n }\n }\n }\n }"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about programming:"
} |
// Run parses arguments from the command line and passes them to RunCommand. | [
"func (s *Service) Run() {\n\tflag.Usage = s.Usage\n\tflag.Parse()\n\targs := flag.Args()\n\tif len(args) == 0 && s.defaultCommand != \"\" {\n\t\targs = append([]string{s.defaultCommand}, args...)\n\t}\n\tif len(args) == 0 {\n\t\ts.Usage()\n\t\tBootPrintln()\n\t\treturn\n\t}\n\terr := s.RunCommand(args[0], args[1:]...)\n\tif err != nil {\n\t\tpanic(err)\n\t}\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 # CAREFUL : doesnt make sense if this node only run a one-time task...\n # TODO: futures and ThreadPoolExecutor (so we dont need to manage the pool ourselves)\n else:\n return False"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
store one item in database | [
"def _put_one(self, item):\n ''' \n '''\n # prepare values\n values = []\n for k, v in item.items():\n if k == '_id':\n continue\n if 'dblite_serializer' in item.fields[k]:\n serializer = item.fields[k]['dblite_serializer']\n v = serializer.dumps(v)\n if v is not None:\n v = sqlite3.Binary(buffer(v))\n values.append(v)\n\n # check if Item is new => update it\n if '_id' in item:\n fieldnames = ','.join(['%s=?' % f for f in item if f != '_id'])\n values.append(item['_id'])\n SQL = 'UPDATE %s SET %s WHERE rowid=?;' % (self._table, fieldnames)\n # new Item\n else:\n fieldnames = ','.join([f for f in item if f != '_id'])\n fieldnames_template = ','.join(['?' for f in item if f != '_id'])\n SQL = 'INSERT INTO %s (%s) VALUES (%s);' % (self._table, fieldnames, fieldnames_template)\n\n try:\n self._cursor.execute(SQL, values)\n except sqlite3.OperationalError, err:\n raise RuntimeError('Item put() error, %s, SQL: %s, values: %s' % (err, SQL, values) )\n except sqlite3.IntegrityError:\n raise DuplicateItem('Duplicate item, %s' % item)\n self._do_autocommit()"
] | [
"public String filePath(int index, String savePath) {\n // not calling the corresponding swig function because internally,\n // the use of the function GetStringUTFChars does not consider the case of\n // a copy not made\n return savePath + File.separator + fs.file_path(index);\n }"
] | codesearchnet | {
"query": "Represent the Github instruction:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Computes the theta & phi angles of the vector.
@memberof Vec3#
@returns {object} ret
@returns {Number} ret.theta - angle from the xz plane
@returns {Number} ret.phi - angle from the y axis | [
"function() {\n return {\n theta: Math.atan2(this.z, this.x),\n phi: Math.asin(this.y / this.length())\n };\n }"
] | [
"def alignment_matrix_3D(u, v):\n '''\n \n '''\n # normalize both vectors:\n u = normalize(u)\n v = normalize(v)\n # get the cross product of u cross v\n w = np.cross(u, v)\n # the angle we need to rotate\n th = vector_angle(u, v)\n # we rotate around this vector by the angle between them\n return rotation_matrix_3D(w, th)"
] | codesearchnet | {
"query": "Represent the Github description about mathematics:",
"pos": "Represent the Github code about mathematics:",
"neg": "Represent the Github code:"
} |
CArray with evenly spaced numbers over a specified interval.
@param $start The starting value of the sequence.
@param $stop The end value of the sequence
@param int $num Number of samples to generate. Default is 50.
@return \CArray | [
"public static function linspace($start, $stop, int $num): \\CArray\n {\n return parent::linspace($start, $stop, $num);\n }"
] | [
"static int getRandomValueFromInterval(\n double randomizationFactor, double random, int currentIntervalMillis) {\n double delta = randomizationFactor * currentIntervalMillis;\n double minInterval = currentIntervalMillis - delta;\n double maxInterval = currentIntervalMillis + delta;\n // Get a random value from the range [minInterval, maxInterval].\n // The formula used below has a +1 because if the minInterval is 1 and the maxInterval is 3 then\n // we want a 33% chance for selecting either 1, 2 or 3.\n int randomValue = (int) (minInterval + (random * (maxInterval - minInterval + 1)));\n return randomValue;\n }"
] | codesearchnet | {
"query": "Represent the instruction:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
// Digests hashes each segment of each key fragment 26 times and returns them.
// Optionally takes the SpongeFunction to use. Default is Kerl. | [
"func Digests(key Trits, spongeFunc ...SpongeFunction) (Trits, error) {\n\tvar err error\n\tfragments := int(math.Floor(float64(len(key)) / KeyFragmentLength))\n\tdigests := make(Trits, fragments*HashTrinarySize)\n\tbuf := make(Trits, HashTrinarySize)\n\n\th := GetSpongeFunc(spongeFunc, kerl.NewKerl)\n\tdefer h.Reset()\n\n\t// iterate through each key fragment\n\tfor i := 0; i < fragments; i++ {\n\t\tkeyFragment := key[i*KeyFragmentLength : (i+1)*KeyFragmentLength]\n\n\t\t// each fragment consists of 27 segments\n\t\tfor j := 0; j < KeySegmentsPerFragment; j++ {\n\t\t\tcopy(buf, keyFragment[j*HashTrinarySize:(j+1)*HashTrinarySize])\n\n\t\t\t// hash each segment 26 times\n\t\t\tfor k := 0; k < KeySegmentHashRounds; k++ {\n\t\t\t\th.Absorb(buf)\n\t\t\t\tbuf, err = h.Squeeze(HashTrinarySize)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\th.Reset()\n\t\t\t}\n\n\t\t\tcopy(keyFragment[j*HashTrinarySize:], buf)\n\t\t}\n\n\t\t// hash the key fragment (which now consists of hashed segments)\n\t\tif err := h.Absorb(keyFragment); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tbuf, err := h.Squeeze(HashTrinarySize)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tcopy(digests[i*HashTrinarySize:], buf)\n\n\t\th.Reset()\n\t}\n\n\treturn digests, nil\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 about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code:"
} |
Loading hparams from json; can also start from hparams if specified. | [
"def create_hparams_from_json(json_path, hparams=None):\n \"\"\"\"\"\"\n tf.logging.info(\"Loading hparams from existing json %s\" % json_path)\n with tf.gfile.Open(json_path, \"r\") as f:\n hparams_values = json.load(f)\n # Prevent certain keys from overwriting the passed-in hparams.\n # TODO(trandustin): Remove this hack after registries are available to avoid\n # saving them as functions.\n hparams_values.pop(\"bottom\", None)\n hparams_values.pop(\"loss\", None)\n hparams_values.pop(\"name\", None)\n hparams_values.pop(\"top\", None)\n hparams_values.pop(\"weights_fn\", None)\n new_hparams = hparam.HParams(**hparams_values)\n # Some keys are in new_hparams but not hparams, so we need to be more\n # careful than simply using parse_json() from HParams\n if hparams: # hparams specified, so update values from json\n for key in sorted(new_hparams.values().keys()):\n if hasattr(hparams, key): # Overlapped keys\n value = getattr(hparams, key)\n new_value = getattr(new_hparams, key)\n if value != new_value: # Different values\n tf.logging.info(\"Overwrite key %s: %s -> %s\" % (\n key, value, new_value))\n setattr(hparams, key, new_value)\n else:\n hparams = new_hparams\n\n return hparams"
] | [
"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\n # the instackenv.json, BUT it may be interesting to add a check.\n return ret.split()"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Technology:"
} |
Sort an collection by values using a user-defined comparison function
@param \Closure $callback
@param bool $save_keys maintain index association
@return static | [
"public function sortBy( \\Closure $callback, bool $save_keys = true )\n\t{\n\t\t$items = $this->items;\n\t\t$save_keys ? uasort($items, $callback) : usort($items, $callback);\n\t\treturn new static($items);\n\t}"
] | [
"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 Github post about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
Attempts to upload the Docker image for a given tool to
`DockerHub <https://hub.docker.com>`_. | [
"def upload(self, tool: Tool) -> bool:\n \n return self.__installation.build.upload(tool.image)"
] | [
"def create_logstash(self, **kwargs):\n \n logstash = predix.admin.logstash.Logging(**kwargs)\n logstash.create()\n logstash.add_to_manifest(self)\n\n logging.info('Install Kibana-Me-Logs application by following GitHub instructions')\n logging.info('git clone https://github.com/cloudfoundry-community/kibana-me-logs.git')\n\n return logstash"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
SET CHECK
@param string $name
@param string $arg
@return $this | [
"public function checks($name, $arg = null) {\n if (empty($arg)) {\n $this->checks[] = $name;\n } else {\n $this->checks[$name] = $arg;\n }\n return $this;\n }"
] | [
"final static function f($op) {return dfcf(function(OP $op) {\n\t\t$c = df_con_hier($m = df_ar(dfpm($op), M::class), __CLASS__); /** @var string $c */ /** @var M $m */\n\t\treturn new $c($m);\n\t}, [dfp($op)]);}"
] | codesearchnet | {
"query": "Represent the sentence about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
From a list of top level trees, return the list of contained class definitions | [
"List<JCClassDecl> listClasses(List<JCCompilationUnit> trees) {\n List<JCClassDecl> result = new ArrayList<>();\n for (JCCompilationUnit t : trees) {\n for (JCTree def : t.defs) {\n if (def.hasTag(JCTree.Tag.CLASSDEF))\n result.add((JCClassDecl)def);\n }\n }\n return result;\n }"
] | [
"def register (g):\n \n assert isinstance(g, Generator)\n id = g.id()\n\n __generators [id] = g\n\n # A generator can produce several targets of the\n # same type. We want unique occurence of that generator\n # in .generators.$(t) in that case, otherwise, it will\n # be tried twice and we'll get false ambiguity.\n for t in sequence.unique(g.target_types()):\n __type_to_generators.setdefault(t, []).append(g)\n\n # Update the set of generators for toolset\n\n # TODO: should we check that generator with this id\n # is not already registered. For example, the fop.jam\n # module intentionally declared two generators with the\n # same id, so such check will break it.\n\n # Some generators have multiple periods in their name, so the\n # normal $(id:S=) won't generate the right toolset name.\n # e.g. if id = gcc.compile.c++, then\n # .generators-for-toolset.$(id:S=) will append to\n # .generators-for-toolset.gcc.compile, which is a separate\n # value from .generators-for-toolset.gcc. Correcting this\n # makes generator inheritance work properly.\n # See also inherit-generators in module toolset\n base = id.split ('.', 100) [0]\n\n __generators_for_toolset.setdefault(base, []).append(g)\n\n # After adding a new generator that can construct new target types, we need\n # to clear the related cached viable source target type information for\n # constructing a specific target type or using a specific generator. Cached\n # viable source target type lists affected by this are those containing any\n # of the target types constructed by the new generator or any of their base\n # target types.\n #\n # A more advanced alternative to clearing that cached viable source target\n # type information would be to expand it with additional source types or\n # even better - mark it as needing to be expanded on next use.\n #\n # For now we just clear all the cached viable source target type information\n # that does not simply state 'all types' and may implement a more detailed\n # algorithm later on if it becomes needed.\n\n invalidate_extendable_viable_source_target_type_cache()"
] | codesearchnet | {
"query": "Represent the post about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code:"
} |
-------------------------------------------------------------------------------------------- | [
"@Override\n\tpublic void configure(Configuration parameters) {\n\n\t\t// enforce sequential configuration() calls\n\t\tsynchronized (CONFIGURE_MUTEX) {\n\t\t\tif (mapreduceInputFormat instanceof Configurable) {\n\t\t\t\t((Configurable) mapreduceInputFormat).setConf(configuration);\n\t\t\t}\n\t\t}\n\t}"
] | [
"public static function run($speech = null)\n\t{\n\t\tif ( ! isset($speech))\n\t\t{\n\t\t\t$speech = 'KILL ALL HUMANS!';\n\t\t}\n\n\t\t$eye = \\Cli::color(\"*\", 'red');\n\n\t\treturn \\Cli::color(\"\n\t\t\t\t\t\\\"{$speech}\\\"\n\t\t\t _____ /\n\t\t\t /_____\\\\\", 'blue').\"\\n\"\n.\\Cli::color(\"\t\t\t ____[\\\\\", 'blue').$eye.\\Cli::color('---', 'blue').$eye.\\Cli::color('/]____', 'blue').\"\\n\"\n.\\Cli::color(\"\t\t\t /\\\\ #\\\\ \\\\_____/ /# /\\\\\n\t\t\t / \\\\# \\\\_.---._/ #/ \\\\\n\t\t\t / /|\\\\ | | /|\\\\ \\\\\n\t\t\t/___/ | | | | | | \\\\___\\\\\n\t\t\t| | | | |---| | | | |\n\t\t\t|__| \\\\_| |_#_| |_/ |__|\n\t\t\t//\\\\\\\\ <\\\\ _//^\\\\\\\\_ /> //\\\\\\\\\n\t\t\t\\\\||/ |\\\\//// \\\\\\\\\\\\\\\\/| \\\\||/\n\t\t\t | | | |\n\t\t\t |---| |---|\n\t\t\t |---| |---|\n\t\t\t | | | |\n\t\t\t |___| |___|\n\t\t\t / \\\\ / \\\\\n\t\t\t |_____| |_____|\n\t\t\t |HHHHH| |HHHHH|\", 'blue');\n\t}"
] | codesearchnet | {
"query": "Represent the instruction about language and writing:",
"pos": "Represent the code about language and writing:",
"neg": "Represent the code about programming:"
} |
Parses the requested parameter from the given state.<p>
@param state the state
@param paramName the parameter name
@return the parameter value | [
"public static String getParamFromState(String state, String paramName) {\n\n String prefix = PARAM_SEPARATOR + paramName + PARAM_ASSIGN;\n if (state.contains(prefix)) {\n String result = state.substring(state.indexOf(prefix) + prefix.length());\n if (result.contains(PARAM_SEPARATOR)) {\n result = result.substring(0, result.indexOf(PARAM_SEPARATOR));\n }\n return CmsEncoder.decode(result, CmsEncoder.ENCODING_UTF_8);\n }\n return null;\n }"
] | [
"@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 text about text processing:",
"pos": "Represent the code about text processing:",
"neg": "Represent the code about Software development:"
} |
// intIf returns a if cnd is true, otherwise b | [
"func intIf(cnd bool, a, b int) int {\n\tif cnd {\n\t\treturn a\n\t}\n\treturn b\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 evaluator polynomial, etc. but not the errors positions).\n # This is not necessary as anyway syndromes are defined such as there are only non-zero coefficients (the only 0 is the shift of the constant here) and subsequent computations will/must account for the shift by skipping the first iteration (eg, the often seen range(1, n-k+1)), but you can also avoid prepending the 0 coeff and adapt every subsequent computations to start from 0 instead of 1.\n return [0] + [gf_poly_eval(msg, gf_pow(generator, i+fcr)) for i in xrange(nsym)]"
] | codesearchnet | {
"query": "Represent the comment about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about Natural Language Processing:"
} |
Create a writer builder for Ebi41InvoiceType.
@return The builder and never <code>null</code> | [
"@Nonnull\n public static EbInterfaceWriter <Ebi41InvoiceType> ebInterface41 ()\n {\n final EbInterfaceWriter <Ebi41InvoiceType> ret = EbInterfaceWriter.create (Ebi41InvoiceType.class);\n ret.setNamespaceContext (EbInterface41NamespaceContext.getInstance ());\n return ret;\n }"
] | [
"def build(self):\n \"\"\"\"\"\"\n from ambry.orm.config import BuildConfigGroupAccessor\n\n # It is a lightweight object, so no need to cache\n return BuildConfigGroupAccessor(self.dataset, 'buildstate', self._session)"
] | codesearchnet | {
"query": "Represent the Github summarization:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code:"
} |
// SetKey sets the Key field's value. | [
"func (s *GetObjectLegalHoldInput) SetKey(v string) *GetObjectLegalHoldInput {\n\ts.Key = &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 different than the class name\n this.type = \"\";\n // Used to provide access to the name of the class \n this.className = \"Rule\";\n // Indicates whether generated nodes should be added to the abstract syntax tree\n this._createAstNode = false;\n // A parser function, computed in a rule's constructor. If successful returns either the original or a new \n // ParseState object. If it fails it returns null.\n this.parser = null;\n // A lexer function, computed in a rule's constructor. The lexer may update the ParseState if successful.\n // If it fails it is required that the lexer restore the ParseState index to the previous state. \n // Lexers should only update the index. \n this.lexer = null;\n }"
] | codesearchnet | {
"query": "Represent the Github instruction about Programming:",
"pos": "Represent the Github code about Programming:",
"neg": "Represent the Github code:"
} |
// Range check string's length | [
"func Range(str string, params ...string) bool {\n\tif len(params) == 2 {\n\t\tvalue, _ := ToFloat(str)\n\t\tmin, _ := ToFloat(params[0])\n\t\tmax, _ := ToFloat(params[1])\n\t\treturn InRange(value, min, max)\n\t}\n\n\treturn false\n}"
] | [
"private static String keyToGoWithElementsString(String label, DuplicateGroupedAndTyped elements) {\n /*\n * elements.toString(), which the caller is going to use, includes the homogeneous type (if\n * any), so we don't want to include it here. (And it's better to have it in the value, rather\n * than in the key, so that it doesn't push the horizontally aligned values over too far.)\n */\n return lenientFormat(\"%s (%s)\", label, elements.totalCopies());\n }"
] | codesearchnet | {
"query": "Represent the description about 32-bit integers:",
"pos": "Represent the code about 32-bit integers:",
"neg": "Represent the code about programming:"
} |
Add command arguments | [
"def add_arguments(self, parser):\n \"\"\"\"\"\"\n parser.add_argument(self._source_param, **self._source_kwargs)\n parser.add_argument('--base', '-b', action='store',\n help= 'Supply the base currency as code or a settings variable name. '\n 'The default is taken from settings CURRENCIES_BASE or SHOP_DEFAULT_CURRENCY, '\n 'or the db, otherwise USD')"
] | [
"def star_sep_check(self, original, loc, tokens):\n \"\"\"\"\"\"\n return self.check_py(\"3\", \"keyword-only argument separator (add 'match' to front to produce universal code)\", original, loc, tokens)"
] | codesearchnet | {
"query": "Represent the text:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Grab values from the $_SERVER global.
@param mixed $index The index that we will be searching for.
@param boolean $xss_clean Whether we want to clean it or not.
@since 1.0.0
@return mixed | [
"public function server(string $index = '', $xss_clean = false)\n {\n return $this->fetchFromArray($_SERVER, $index, $xss_clean);\n }"
] | [
"private function filter($variable, $filter, $options = null)\n {\n\n //gets a specific external variable and filter it\n //determine what variable name is being used here;\n $this->sanitized = true;\n\n //@TODO To trust or not to trust?\n return filter_var($variable, $filter, $options);\n }"
] | codesearchnet | {
"query": "Represent the Github post about programming:",
"pos": "Represent the Github code about programming:",
"neg": "Represent the Github code about programming:"
} |
Get a server by calling {@link AbstractServerPredicate#chooseRandomlyAfterFiltering(java.util.List, Object)}.
The performance for this method is O(n) where n is number of servers to be filtered. | [
"@Override\n public Server choose(Object key) {\n ILoadBalancer lb = getLoadBalancer();\n Optional<Server> server = getPredicate().chooseRoundRobinAfterFiltering(lb.getAllServers(), key);\n if (server.isPresent()) {\n return server.get();\n } else {\n return null;\n } \n }"
] | [
"@Override\n public <T> Streamlet<T> applyOperator(IStreamletOperator<R, T> operator) {\n checkNotNull(operator, \"operator cannot be null\");\n\n // By default, NoneStreamGrouping stategy is used. In this stategy, tuples are forwarded\n // from parent component to a ramdon one of all the instances of the child component,\n // which is the same logic as shuffle grouping.\n return applyOperator(operator, new NoneStreamGrouping());\n }"
] | codesearchnet | {
"query": "Represent the Github text about Computer Science:",
"pos": "Represent the Github code about Computer Science:",
"neg": "Represent the Github code about Programming:"
} |
Validate that an attribute is greater than another attribute.
@param string $attribute
@param mixed $value
@param array $parameters
@return bool | [
"public function validateGt($attribute, $value, $parameters)\n {\n $this->requireParameterCount(1, $parameters, 'gt');\n\n $comparedToValue = $this->getValue($parameters[0]);\n\n $this->shouldBeNumeric($attribute, 'Gt');\n\n if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) {\n return $this->getSize($attribute, $value) > $parameters[0];\n }\n\n if (! $this->isSameType($value, $comparedToValue)) {\n return false;\n }\n\n return $this->getSize($attribute, $value) > $this->getSize($attribute, $comparedToValue);\n }"
] | [
"protected function setupObject()\n {\n $this->name = $this->getAttribute(\"name\");\n $this->value = $this->getAttribute(\"value\");\n $this->classname = $this->getAttribute(\"class\");\n\n /*\n * Set some default values if they are not specified.\n * This is especially useful for maxLength; the size\n * is already known by the column and this way it is\n * not necessary to manage the same size two times.\n *\n * Currently there is only one such supported default:\n * - maxLength value = column max length\n * (this default cannot be easily set at runtime w/o changing\n * design of class system in undesired ways)\n */\n if ($this->value === null) {\n switch ($this->name) {\n case 'maxLength':\n $this->value = $this->validator->getColumn()->getSize();\n break;\n }\n }\n\n $this->message = $this->getAttribute(\"message\");\n }"
] | codesearchnet | {
"query": "Represent the instruction about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code about Software development:"
} |
// SetErrorCode returns source code that sets return parameters. | [
"func (r *Rets) SetErrorCode() string {\n\tconst code = `if r0 != 0 {\n\t\t%s = %sErrno(r0)\n\t}`\n\tif r.Name == \"\" && !r.ReturnsError {\n\t\treturn \"\"\n\t}\n\tif r.Name == \"\" {\n\t\treturn r.useLongHandleErrorCode(\"r1\")\n\t}\n\tif r.Type == \"error\" {\n\t\treturn fmt.Sprintf(code, r.Name, syscalldot())\n\t}\n\ts := \"\"\n\tswitch {\n\tcase r.Type[0] == '*':\n\t\ts = fmt.Sprintf(\"%s = (%s)(unsafe.Pointer(r0))\", r.Name, r.Type)\n\tcase r.Type == \"bool\":\n\t\ts = fmt.Sprintf(\"%s = r0 != 0\", r.Name)\n\tdefault:\n\t\ts = fmt.Sprintf(\"%s = %s(r0)\", r.Name, r.Type)\n\t}\n\tif !r.ReturnsError {\n\t\treturn s\n\t}\n\treturn s + \"\\n\\t\" + r.useLongHandleErrorCode(r.Name)\n}"
] | [
"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 instruction about Natural Language Processing:",
"pos": "Represent the code about Natural Language Processing:",
"neg": "Represent the code about programming:"
} |
// StartPlugins starts all plugins in the correct order. | [
"func (co *Coordinator) StartPlugins() {\n\t// Launch routers\n\tfor _, router := range co.routers {\n\t\tlogrus.Debug(\"Starting \", reflect.TypeOf(router))\n\t\tif err := router.Start(); err != nil {\n\t\t\tlogrus.WithError(err).Errorf(\"Failed to start router of type '%s'\", reflect.TypeOf(router))\n\t\t}\n\t}\n\n\t// Launch producers\n\tco.state = coordinatorStateStartProducers\n\tfor _, producer := range co.producers {\n\t\tproducer := producer\n\t\tgo tgo.WithRecoverShutdown(func() {\n\t\t\tlogrus.Debug(\"Starting \", reflect.TypeOf(producer))\n\t\t\tproducer.Produce(co.producerWorker)\n\t\t})\n\t}\n\n\t// Set final log target and purge the intermediate buffer\n\tif core.StreamRegistry.IsStreamRegistered(core.LogInternalStreamID) {\n\t\t// The _GOLLUM_ stream has listeners, so use LogConsumer to write to it\n\t\tif *flagLogColors == \"always\" {\n\t\t\tlogrus.SetFormatter(logger.NewConsoleFormatter())\n\t\t}\n\t\tlogrusHookBuffer.SetTargetHook(co.logConsumer)\n\t\tlogrusHookBuffer.Purge()\n\n\t} else {\n\t\tlogrusHookBuffer.SetTargetWriter(logger.FallbackLogDevice)\n\t\tlogrusHookBuffer.Purge()\n\t}\n\n\t// Launch consumers\n\tco.state = coordinatorStateStartConsumers\n\tfor _, consumer := range co.consumers {\n\t\tconsumer := consumer\n\t\tgo tgo.WithRecoverShutdown(func() {\n\t\t\tlogrus.Debug(\"Starting \", reflect.TypeOf(consumer))\n\t\t\tconsumer.Consume(co.consumerWorker)\n\t\t})\n\t}\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 # CAREFUL : doesnt make sense if this node only run a one-time task...\n # TODO: futures and ThreadPoolExecutor (so we dont need to manage the pool ourselves)\n else:\n return False"
] | codesearchnet | {
"query": "Represent the Github post:",
"pos": "Represent the Github code:",
"neg": "Represent the Github code about programming:"
} |
Get a consumer for a connection. | [
"def consumer(self, conn):\n \"\"\"\"\"\"\n return Consumer(\n connection=conn,\n queue=self.queue.name,\n exchange=self.exchange.name,\n exchange_type=self.exchange.type,\n durable=self.exchange.durable,\n auto_delete=self.exchange.auto_delete,\n routing_key=self.routing_key,\n no_ack=self.no_ack,\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 instruction:",
"pos": "Represent the code:",
"neg": "Represent the code about Programming:"
} |
Returns the generator reactive power variable set. | [
"def _get_qgen_var(self, generators, base_mva):\n \n Qg = array([g.q / base_mva for g in generators])\n\n Qmin = array([g.q_min / base_mva for g in generators])\n Qmax = array([g.q_max / base_mva for g in generators])\n\n return Variable(\"Qg\", len(generators), Qg, Qmin, Qmax)"
] | [
"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:",
"pos": "Represent the code:",
"neg": "Represent the code:"
} |
Associations labels getter.
@param \Cake\Datasource\RepositoryInterface $table Table instance
@return mixed[] | [
"public function getAssociationLabels(RepositoryInterface $table) : array\n {\n /** @var \\Cake\\ORM\\Table */\n $table = $table;\n\n $result = [];\n foreach ($table->associations() as $association) {\n if (!in_array($association->type(), $this->searchableAssociations)) {\n continue;\n }\n\n $result[$association->getName()] = Inflector::humanize(current((array)$association->getForeignKey()));\n }\n\n return $result;\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 text about Software development:",
"pos": "Represent the code about Software development:",
"neg": "Represent the code:"
} |
Return matched comments
@param int $page
@return array | [
"public function get_comments($page = '') {\n global $DB, $CFG, $USER, $OUTPUT;\n if (!$this->can_view()) {\n return false;\n }\n if (!is_numeric($page)) {\n $page = 0;\n }\n $params = array();\n $perpage = (!empty($CFG->commentsperpage))?$CFG->commentsperpage:15;\n $start = $page * $perpage;\n $ufields = user_picture::fields('u');\n\n list($componentwhere, $component) = $this->get_component_select_sql('c');\n if ($component) {\n $params['component'] = $component;\n }\n\n $sql = \"SELECT $ufields, c.id AS cid, c.content AS ccontent, c.format AS cformat, c.timecreated AS ctimecreated\n FROM {comments} c\n JOIN {user} u ON u.id = c.userid\n WHERE c.contextid = :contextid AND\n c.commentarea = :commentarea AND\n c.itemid = :itemid AND\n $componentwhere\n ORDER BY c.timecreated DESC\";\n $params['contextid'] = $this->contextid;\n $params['commentarea'] = $this->commentarea;\n $params['itemid'] = $this->itemid;\n\n $comments = array();\n $formatoptions = array('overflowdiv' => true, 'blanktarget' => true);\n $rs = $DB->get_recordset_sql($sql, $params, $start, $perpage);\n foreach ($rs as $u) {\n $c = new stdClass();\n $c->id = $u->cid;\n $c->content = $u->ccontent;\n $c->format = $u->cformat;\n $c->timecreated = $u->ctimecreated;\n $c->strftimeformat = get_string('strftimerecentfull', 'langconfig');\n $url = new moodle_url('/user/view.php', array('id'=>$u->id, 'course'=>$this->courseid));\n $c->profileurl = $url->out(false); // URL should not be escaped just yet.\n $c->fullname = fullname($u);\n $c->time = userdate($c->timecreated, $c->strftimeformat);\n $c->content = format_text($c->content, $c->format, $formatoptions);\n $c->avatar = $OUTPUT->user_picture($u, array('size'=>18));\n $c->userid = $u->id;\n\n $candelete = $this->can_delete($c->id);\n if (($USER->id == $u->id) || !empty($candelete)) {\n $c->delete = true;\n }\n $comments[] = $c;\n }\n $rs->close();\n\n if (!empty($this->plugintype)) {\n // moodle module will filter comments\n $comments = plugin_callback($this->plugintype, $this->pluginname, 'comment', 'display', array($comments, $this->comment_param), $comments);\n }\n\n return $comments;\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 summarization about programming:",
"pos": "Represent the code about programming:",
"neg": "Represent the code about programming:"
} |
End of preview. Expand
in Data Studio
- Downloads last month
- 28