code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def image(self,path_img): """ Open image file """ im_open = Image.open(path_img) im = im_open.convert("RGB") # Convert the RGB image in printable image pix_line, img_size = self._convert_image(im) self._print_image(pix_line, img_size)
Open image file
Below is the the instruction that describes the task: ### Input: Open image file ### Response: def image(self,path_img): """ Open image file """ im_open = Image.open(path_img) im = im_open.convert("RGB") # Convert the RGB image in printable image pix_line, img_size = self._c...
def result(retn): ''' Return a value or raise an exception from a retn tuple. ''' ok, valu = retn if ok: return valu name, info = valu ctor = getattr(s_exc, name, None) if ctor is not None: raise ctor(**info) info['errx'] = name raise s_exc.SynErr(**info)
Return a value or raise an exception from a retn tuple.
Below is the the instruction that describes the task: ### Input: Return a value or raise an exception from a retn tuple. ### Response: def result(retn): ''' Return a value or raise an exception from a retn tuple. ''' ok, valu = retn if ok: return valu name, info = valu ctor =...
def getRowByIndex(self, index): """ Get row by numeric index. Args: index: Zero-based index of the row to get. Returns: The corresponding row. """ assert isinstance(index, int) return Row(self._impl.getRowByIndex(index))
Get row by numeric index. Args: index: Zero-based index of the row to get. Returns: The corresponding row.
Below is the the instruction that describes the task: ### Input: Get row by numeric index. Args: index: Zero-based index of the row to get. Returns: The corresponding row. ### Response: def getRowByIndex(self, index): """ Get row by numeric index. ...
def main(argString=None): """The main function of the module. :param argString: the options. :type argString: list These are the steps: 1. Prints the options. 2. Reads the ``tfam`` and ``tped`` files and find all heterozygous and all failed markers (:py:func:`processTPEDandTFAM`). ...
The main function of the module. :param argString: the options. :type argString: list These are the steps: 1. Prints the options. 2. Reads the ``tfam`` and ``tped`` files and find all heterozygous and all failed markers (:py:func:`processTPEDandTFAM`).
Below is the the instruction that describes the task: ### Input: The main function of the module. :param argString: the options. :type argString: list These are the steps: 1. Prints the options. 2. Reads the ``tfam`` and ``tped`` files and find all heterozygous and all failed markers ...
def workspace_create(ctx, clobber_mets, directory): """ Create a workspace with an empty METS file in DIRECTORY. Use '.' for $PWD" """ workspace = ctx.resolver.workspace_from_nothing( directory=os.path.abspath(directory), mets_basename=ctx.mets_basename, clobber_mets=clobber...
Create a workspace with an empty METS file in DIRECTORY. Use '.' for $PWD"
Below is the the instruction that describes the task: ### Input: Create a workspace with an empty METS file in DIRECTORY. Use '.' for $PWD" ### Response: def workspace_create(ctx, clobber_mets, directory): """ Create a workspace with an empty METS file in DIRECTORY. Use '.' for $PWD" """ ...
def ctc_beam_search_decoder(probs_seq, alphabet, beam_size, cutoff_prob=1.0, cutoff_top_n=40, scorer=None): """Wrapper for the CTC Beam Search Decoder. :param probs_seq: 2...
Wrapper for the CTC Beam Search Decoder. :param probs_seq: 2-D list of probability distributions over each time step, with each element being a list of normalized probabilities over alphabet and blank. :type probs_seq: 2-D list :param alphabet: alphabet list. ...
Below is the the instruction that describes the task: ### Input: Wrapper for the CTC Beam Search Decoder. :param probs_seq: 2-D list of probability distributions over each time step, with each element being a list of normalized probabilities over alphabet and blank. ...
def shuffle(self, times=1): """ Shuffles the Stack. .. note:: Shuffling large numbers of cards (100,000+) may take a while. :arg int times: The number of times to shuffle. """ for _ in xrange(times): random.shuffle(self.cards)
Shuffles the Stack. .. note:: Shuffling large numbers of cards (100,000+) may take a while. :arg int times: The number of times to shuffle.
Below is the the instruction that describes the task: ### Input: Shuffles the Stack. .. note:: Shuffling large numbers of cards (100,000+) may take a while. :arg int times: The number of times to shuffle. ### Response: def shuffle(self, times=1): """ Shuffl...
def get_service_policy(host, username, password, service_name, protocol=None, port=None, host_names=None): ''' Get the service name's policy for a given host or list of hosts. host The location of the host. username The username used to login to the host, such as ``root``. passwor...
Get the service name's policy for a given host or list of hosts. host The location of the host. username The username used to login to the host, such as ``root``. password The password used to login to the host. service_name The name of the service for which to retrie...
Below is the the instruction that describes the task: ### Input: Get the service name's policy for a given host or list of hosts. host The location of the host. username The username used to login to the host, such as ``root``. password The password used to login to the host. ...
def _collapse_variants_by_function(graph: BELGraph, func: str) -> None: """Collapse all of the given functions' variants' edges to their parents, in-place.""" for parent_node, variant_node, data in graph.edges(data=True): if data[RELATION] == HAS_VARIANT and parent_node.function == func: col...
Collapse all of the given functions' variants' edges to their parents, in-place.
Below is the the instruction that describes the task: ### Input: Collapse all of the given functions' variants' edges to their parents, in-place. ### Response: def _collapse_variants_by_function(graph: BELGraph, func: str) -> None: """Collapse all of the given functions' variants' edges to their parents, in-pl...
def associate(self, id_option_vip, id_environment_vip): """Create a relationship of OptionVip with EnvironmentVip. :param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero. :param id_environment_vip: Identifier of the Environment VIP. Integer value and greater tha...
Create a relationship of OptionVip with EnvironmentVip. :param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero. :param id_environment_vip: Identifier of the Environment VIP. Integer value and greater than zero. :return: Following dictionary :: ...
Below is the the instruction that describes the task: ### Input: Create a relationship of OptionVip with EnvironmentVip. :param id_option_vip: Identifier of the Option VIP. Integer value and greater than zero. :param id_environment_vip: Identifier of the Environment VIP. Integer value and greater t...
def keyPressEvent(self, event): """ Listens for the escape key to cancel out from this snapshot. :param event | <QKeyPressEvent> """ # reject on a cancel if event.key() == Qt.Key_Escape: self.reject() super(XSnapshotWid...
Listens for the escape key to cancel out from this snapshot. :param event | <QKeyPressEvent>
Below is the the instruction that describes the task: ### Input: Listens for the escape key to cancel out from this snapshot. :param event | <QKeyPressEvent> ### Response: def keyPressEvent(self, event): """ Listens for the escape key to cancel out from this snapshot. ...
def add_triple( self, subj: Union[URIRef, str], pred: Union[URIRef, str], obj: Union[URIRef, Literal, str] ) -> None: """ Adds triple to rdflib Graph Triple can be of any subject, predicate, and object of the entity without a need for order. ...
Adds triple to rdflib Graph Triple can be of any subject, predicate, and object of the entity without a need for order. Args: subj: Entity subject pred: Entity predicate obj: Entity object Example: In [1]: add_triple( ...: 'h...
Below is the the instruction that describes the task: ### Input: Adds triple to rdflib Graph Triple can be of any subject, predicate, and object of the entity without a need for order. Args: subj: Entity subject pred: Entity predicate obj: Entity object ...
def send_immediately(self, message, fail_silently=False): """Send a message immediately, outside the transaction manager. If there is a connection error to the mail server this will have to be handled manually. However if you pass ``fail_silently`` the error will be swallowed. ...
Send a message immediately, outside the transaction manager. If there is a connection error to the mail server this will have to be handled manually. However if you pass ``fail_silently`` the error will be swallowed. :versionadded: 0.3 :param message: a 'Message' instance. ...
Below is the the instruction that describes the task: ### Input: Send a message immediately, outside the transaction manager. If there is a connection error to the mail server this will have to be handled manually. However if you pass ``fail_silently`` the error will be swallowed. ...
def adjust_for_registry_api_versions(self): """ Enable/disable plugins depending on supported registry API versions """ versions = self.spec.registry_api_versions.value if 'v2' not in versions: raise OsbsValidationException('v1-only docker registry API is not support...
Enable/disable plugins depending on supported registry API versions
Below is the the instruction that describes the task: ### Input: Enable/disable plugins depending on supported registry API versions ### Response: def adjust_for_registry_api_versions(self): """ Enable/disable plugins depending on supported registry API versions """ versions = self....
def load(self, **kwargs): """Method to list the UCS on the system Since this is only fixed in 12.1.0 and up we implemented version check here """ # Check if we are using 12.1.0 version or above when using this method self._is_version_supported_method('12.1.0') n...
Method to list the UCS on the system Since this is only fixed in 12.1.0 and up we implemented version check here
Below is the the instruction that describes the task: ### Input: Method to list the UCS on the system Since this is only fixed in 12.1.0 and up we implemented version check here ### Response: def load(self, **kwargs): """Method to list the UCS on the system Since this is only fixe...
def setHorCrossPlotAutoRangeOn(self, axisNumber): """ Sets the horizontal cross-hair plot's auto-range on for the axis with number axisNumber. :param axisNumber: 0 (X-axis), 1 (Y-axis), 2, (Both X and Y axes). """ setXYAxesAutoRangeOn(self, self.xAxisRangeCti, self.horCrossPlotRange...
Sets the horizontal cross-hair plot's auto-range on for the axis with number axisNumber. :param axisNumber: 0 (X-axis), 1 (Y-axis), 2, (Both X and Y axes).
Below is the the instruction that describes the task: ### Input: Sets the horizontal cross-hair plot's auto-range on for the axis with number axisNumber. :param axisNumber: 0 (X-axis), 1 (Y-axis), 2, (Both X and Y axes). ### Response: def setHorCrossPlotAutoRangeOn(self, axisNumber): """ Sets ...
def percentile(data, n): """Return the n-th percentile of the given data Assume that the data are already sorted """ size = len(data) idx = (n / 100.0) * size - 0.5 if idx < 0 or idx > size: raise StatisticsError("Too few data points ({}) for {}th percentile".format(size, n)) re...
Return the n-th percentile of the given data Assume that the data are already sorted
Below is the the instruction that describes the task: ### Input: Return the n-th percentile of the given data Assume that the data are already sorted ### Response: def percentile(data, n): """Return the n-th percentile of the given data Assume that the data are already sorted """ size = len...
def files(self): """files that will be add to tar file later should be tuple, list or generator that returns strings """ ios_names = [info.name for info in self._ios_to_add.keys()] return set(self.files_to_add + ios_names)
files that will be add to tar file later should be tuple, list or generator that returns strings
Below is the the instruction that describes the task: ### Input: files that will be add to tar file later should be tuple, list or generator that returns strings ### Response: def files(self): """files that will be add to tar file later should be tuple, list or generator that returns string...
def propose(self): """ Proposals for positive definite matrix using random walk deviations on the Cholesky factor of the current value. """ # Locally store size of matrix dims = self.stochastic.value.shape # Add normal deviate to value and symmetrize dev...
Proposals for positive definite matrix using random walk deviations on the Cholesky factor of the current value.
Below is the the instruction that describes the task: ### Input: Proposals for positive definite matrix using random walk deviations on the Cholesky factor of the current value. ### Response: def propose(self): """ Proposals for positive definite matrix using random walk deviations on the C...
def safe_extract_proto_from_ipfs(ipfs_client, ipfs_hash, protodir): """ Tar files might be dangerous (see https://bugs.python.org/issue21109, and https://docs.python.org/3/library/tarfile.html, TarFile.extractall warning) we extract only simple files """ spec_tar = get_from_ipfs_and_checkhash(ip...
Tar files might be dangerous (see https://bugs.python.org/issue21109, and https://docs.python.org/3/library/tarfile.html, TarFile.extractall warning) we extract only simple files
Below is the the instruction that describes the task: ### Input: Tar files might be dangerous (see https://bugs.python.org/issue21109, and https://docs.python.org/3/library/tarfile.html, TarFile.extractall warning) we extract only simple files ### Response: def safe_extract_proto_from_ipfs(ipfs_client, ipf...
def get_input_kwargs(self, key=None, default=None): """ Deprecated. Use `get_catalog_info` instead. Get information from the catalog config file. If *key* is `None`, return the full dict. """ warnings.warn("`get_input_kwargs` is deprecated; use `get_catalog_info` instead...
Deprecated. Use `get_catalog_info` instead. Get information from the catalog config file. If *key* is `None`, return the full dict.
Below is the the instruction that describes the task: ### Input: Deprecated. Use `get_catalog_info` instead. Get information from the catalog config file. If *key* is `None`, return the full dict. ### Response: def get_input_kwargs(self, key=None, default=None): """ Deprecated. Use...
def get_tweet(self, id): """ Get an existing tweet. :param id: ID of the tweet in question :return: Tweet object. None if not found """ try: return Tweet(self._client.get_status(id=id)._json) except TweepError as e: if e.api_code == TWITTE...
Get an existing tweet. :param id: ID of the tweet in question :return: Tweet object. None if not found
Below is the the instruction that describes the task: ### Input: Get an existing tweet. :param id: ID of the tweet in question :return: Tweet object. None if not found ### Response: def get_tweet(self, id): """ Get an existing tweet. :param id: ID of the tweet in question ...
def read_config(config_path_or_dict=None): """ Read config from given path string or dict object. :param config_path_or_dict: :type config_path_or_dict: str or dict :return: Returns config object or None if not found. :rtype: :class:`revision.config.Config` """ config = None if isi...
Read config from given path string or dict object. :param config_path_or_dict: :type config_path_or_dict: str or dict :return: Returns config object or None if not found. :rtype: :class:`revision.config.Config`
Below is the the instruction that describes the task: ### Input: Read config from given path string or dict object. :param config_path_or_dict: :type config_path_or_dict: str or dict :return: Returns config object or None if not found. :rtype: :class:`revision.config.Config` ### Response: def read...
def delay(self, wait, *args): """ Delays a function for the given number of milliseconds, and then calls it with the arguments supplied. """ def call_it(): self.obj(*args) t = Timer((float(wait) / float(1000)), call_it) t.start() return self....
Delays a function for the given number of milliseconds, and then calls it with the arguments supplied.
Below is the the instruction that describes the task: ### Input: Delays a function for the given number of milliseconds, and then calls it with the arguments supplied. ### Response: def delay(self, wait, *args): """ Delays a function for the given number of milliseconds, and then calls ...
def update(self, td): """Update state of ball""" self.sprite.last_position = self.sprite.position self.sprite.last_velocity = self.sprite.velocity if self.particle_group != None: self.update_particle_group(td)
Update state of ball
Below is the the instruction that describes the task: ### Input: Update state of ball ### Response: def update(self, td): """Update state of ball""" self.sprite.last_position = self.sprite.position self.sprite.last_velocity = self.sprite.velocity if self.particle_group != None: ...
async def DestroyMachines(self, force, machine_names): ''' force : bool machine_names : typing.Sequence[str] Returns -> None ''' # map input types to rpc msg _params = dict() msg = dict(type='Client', request='DestroyMachines', ...
force : bool machine_names : typing.Sequence[str] Returns -> None
Below is the the instruction that describes the task: ### Input: force : bool machine_names : typing.Sequence[str] Returns -> None ### Response: async def DestroyMachines(self, force, machine_names): ''' force : bool machine_names : typing.Sequence[str] Returns -> No...
def where_entry_date(query, datespec): """ Where clause for entries which match a textual date spec datespec -- The date spec to check for, in YYYY[[-]MM[[-]DD]] format """ date, interval, _ = utils.parse_date(datespec) start_date, end_date = date.span(interval) return orm.select( e fo...
Where clause for entries which match a textual date spec datespec -- The date spec to check for, in YYYY[[-]MM[[-]DD]] format
Below is the the instruction that describes the task: ### Input: Where clause for entries which match a textual date spec datespec -- The date spec to check for, in YYYY[[-]MM[[-]DD]] format ### Response: def where_entry_date(query, datespec): """ Where clause for entries which match a textual date spec ...
def run(self, data, rewrap=False, prefetch=0): """ Wires the pipeline and returns a lazy object of the transformed data. :param data: must be an iterable, where a full document must be returned for each loop :param rewrap: (optional) is a bool that indicates the need to...
Wires the pipeline and returns a lazy object of the transformed data. :param data: must be an iterable, where a full document must be returned for each loop :param rewrap: (optional) is a bool that indicates the need to rewrap data in cases where iterating over it produces unde...
Below is the the instruction that describes the task: ### Input: Wires the pipeline and returns a lazy object of the transformed data. :param data: must be an iterable, where a full document must be returned for each loop :param rewrap: (optional) is a bool that indicates the need ...
def _get_answer(self, part): """ Note: Answers are only revealed after a correct submission. If you've have not already solved the puzzle, AocdError will be raised. """ answer_fname = getattr(self, "answer_{}_fname".format(part)) if os.path.isfile(answer_fname): ...
Note: Answers are only revealed after a correct submission. If you've have not already solved the puzzle, AocdError will be raised.
Below is the the instruction that describes the task: ### Input: Note: Answers are only revealed after a correct submission. If you've have not already solved the puzzle, AocdError will be raised. ### Response: def _get_answer(self, part): """ Note: Answers are only revealed after a correct...
def find(self, *strings, **kwargs): """ Search the entire editor for lines that match the string. .. code-block:: Python string = '''word one word two three''' ed = Editor(string) ed.find('word') # [(0, "word one"), (1, "word...
Search the entire editor for lines that match the string. .. code-block:: Python string = '''word one word two three''' ed = Editor(string) ed.find('word') # [(0, "word one"), (1, "word two")] ed.find('word', 'three') # {'word': ...
Below is the the instruction that describes the task: ### Input: Search the entire editor for lines that match the string. .. code-block:: Python string = '''word one word two three''' ed = Editor(string) ed.find('word') # [(0, "word one...
def download_from_url(source, destination, progress=False, uncompress=False): """Download a file from an URL and place it somewhere. Like wget. Uses requests and tqdm to display progress if you want. By default it will uncompress files. #TODO: handle case where destination is a directory""" # Module...
Download a file from an URL and place it somewhere. Like wget. Uses requests and tqdm to display progress if you want. By default it will uncompress files. #TODO: handle case where destination is a directory
Below is the the instruction that describes the task: ### Input: Download a file from an URL and place it somewhere. Like wget. Uses requests and tqdm to display progress if you want. By default it will uncompress files. #TODO: handle case where destination is a directory ### Response: def download_fro...
def fill(self, passage=None, xpath=None): """ Fill the xpath with given informations :param passage: CapitainsCtsPassage reference :type passage: CtsReference or list or None. Can be list of None and not None :param xpath: If set to True, will return the replaced self.xpath value and no...
Fill the xpath with given informations :param passage: CapitainsCtsPassage reference :type passage: CtsReference or list or None. Can be list of None and not None :param xpath: If set to True, will return the replaced self.xpath value and not the whole self.refsDecl :type xpath: Boolean...
Below is the the instruction that describes the task: ### Input: Fill the xpath with given informations :param passage: CapitainsCtsPassage reference :type passage: CtsReference or list or None. Can be list of None and not None :param xpath: If set to True, will return the replaced self.xpa...
def find_idx_by_threshold(self, threshold, train=False, valid=False, xval=False): """ Retrieve the index in this metric's threshold list at which the given threshold is located. If all are False (default), then return the training metric value. If more than one options is set to True, t...
Retrieve the index in this metric's threshold list at which the given threshold is located. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metrics where the keys are "train", "valid", and "xval". :...
Below is the the instruction that describes the task: ### Input: Retrieve the index in this metric's threshold list at which the given threshold is located. If all are False (default), then return the training metric value. If more than one options is set to True, then return a dictionary of metric...
def cost_min2(self, alpha): """Residual formulation, Hessian is a low-rank update of the identity. """ n = self.V.dim() ax = alpha[:n] ay = alpha[n:] # ml = pyamg.ruge_stuben_solver(self.L) # # ml = pyamg.smoothed_aggregation_solver(self.L) # print(ml) ...
Residual formulation, Hessian is a low-rank update of the identity.
Below is the the instruction that describes the task: ### Input: Residual formulation, Hessian is a low-rank update of the identity. ### Response: def cost_min2(self, alpha): """Residual formulation, Hessian is a low-rank update of the identity. """ n = self.V.dim() ax = alpha[:n] ...
def set_embeddings(self, embeddings): ''' Specifies fixed set of embeddings :param embeddings: array-like, sparse or dense, shape should be (embedding size, # terms) :return: EmbeddingsResolver ''' if self.embeddings_ is not None: raise Exception("You have alr...
Specifies fixed set of embeddings :param embeddings: array-like, sparse or dense, shape should be (embedding size, # terms) :return: EmbeddingsResolver
Below is the the instruction that describes the task: ### Input: Specifies fixed set of embeddings :param embeddings: array-like, sparse or dense, shape should be (embedding size, # terms) :return: EmbeddingsResolver ### Response: def set_embeddings(self, embeddings): ''' Specifies ...
def on_quit(self, connection, event): """ Someone left the channel - send the nicknames list to the WebSocket. """ nickname = self.get_nickname(event) nickname_color = self.nicknames[nickname] del self.nicknames[nickname] self.namespace.emit("message", nic...
Someone left the channel - send the nicknames list to the WebSocket.
Below is the the instruction that describes the task: ### Input: Someone left the channel - send the nicknames list to the WebSocket. ### Response: def on_quit(self, connection, event): """ Someone left the channel - send the nicknames list to the WebSocket. """ nick...
def _open_ok(self, args): """ signal that the connection is ready This method signals to the client that the connection is ready for use. PARAMETERS: known_hosts: shortstr """ self.known_hosts = args.read_shortstr() AMQP_LOGGER.debug('Open O...
signal that the connection is ready This method signals to the client that the connection is ready for use. PARAMETERS: known_hosts: shortstr
Below is the the instruction that describes the task: ### Input: signal that the connection is ready This method signals to the client that the connection is ready for use. PARAMETERS: known_hosts: shortstr ### Response: def _open_ok(self, args): """ signal tha...
def on_configparser_dumps(self, configparser, config, dictionary, **kwargs): """ The :mod:`configparser` dumps method. :param module configparser: The ``configparser`` module :param class config: The instance's config class :param dict dictionary: The dictionary instance to serialize ...
The :mod:`configparser` dumps method. :param module configparser: The ``configparser`` module :param class config: The instance's config class :param dict dictionary: The dictionary instance to serialize :param str root: The top-level section of the ini file, defaults to ``c...
Below is the the instruction that describes the task: ### Input: The :mod:`configparser` dumps method. :param module configparser: The ``configparser`` module :param class config: The instance's config class :param dict dictionary: The dictionary instance to serialize :param str roo...
def get_author_and_version(package): """ Return package author and version as listed in `init.py`. """ init_py = open(os.path.join(package, '__init__.py')).read() author = re.search("__author__ = ['\"]([^'\"]+)['\"]", init_py).group(1) version = re.search("__version__ = ['\"]([^'\"]+)['\"]", ini...
Return package author and version as listed in `init.py`.
Below is the the instruction that describes the task: ### Input: Return package author and version as listed in `init.py`. ### Response: def get_author_and_version(package): """ Return package author and version as listed in `init.py`. """ init_py = open(os.path.join(package, '__init__.py')).read()...
def run_instance_jmap(cluster, environ, topology, instance, role=None): ''' :param cluster: :param environ: :param topology: :param instance: :param role: :return: ''' params = dict( cluster=cluster, environ=environ, topology=topology, instance=instance) if role is not None:...
:param cluster: :param environ: :param topology: :param instance: :param role: :return:
Below is the the instruction that describes the task: ### Input: :param cluster: :param environ: :param topology: :param instance: :param role: :return: ### Response: def run_instance_jmap(cluster, environ, topology, instance, role=None): ''' :param cluster: :param environ: :param topology: :pa...
def pgettext(self, context, string, domain=None, **variables): """Like :meth:`gettext` but with a context.""" t = self.get_translations(domain) return t.upgettext(context, string) % variables
Like :meth:`gettext` but with a context.
Below is the the instruction that describes the task: ### Input: Like :meth:`gettext` but with a context. ### Response: def pgettext(self, context, string, domain=None, **variables): """Like :meth:`gettext` but with a context.""" t = self.get_translations(domain) return t.upgettext(context,...
def cd(cls, directory): """Change directory. It behaves like "cd directory".""" Log.debug('CMD: cd {0}'.format(directory)) os.chdir(directory)
Change directory. It behaves like "cd directory".
Below is the the instruction that describes the task: ### Input: Change directory. It behaves like "cd directory". ### Response: def cd(cls, directory): """Change directory. It behaves like "cd directory".""" Log.debug('CMD: cd {0}'.format(directory)) os.chdir(directory)
def write(self, obj, **kwargs): """ write it as a collection of individual sparse series """ super().write(obj, **kwargs) for name, ss in obj.items(): key = 'sparse_series_{name}'.format(name=name) if key not in self.group._v_children: node = self._handle....
write it as a collection of individual sparse series
Below is the the instruction that describes the task: ### Input: write it as a collection of individual sparse series ### Response: def write(self, obj, **kwargs): """ write it as a collection of individual sparse series """ super().write(obj, **kwargs) for name, ss in obj.items(): ...
def _ggplot(df, out_file): """Plot faceted items with ggplot wrapper on top of matplotlib. XXX Not yet functional """ import ggplot as gg df["variant.type"] = [vtype_labels[x] for x in df["variant.type"]] df["category"] = [cat_labels[x] for x in df["category"]] df["caller"] = [caller_labels....
Plot faceted items with ggplot wrapper on top of matplotlib. XXX Not yet functional
Below is the the instruction that describes the task: ### Input: Plot faceted items with ggplot wrapper on top of matplotlib. XXX Not yet functional ### Response: def _ggplot(df, out_file): """Plot faceted items with ggplot wrapper on top of matplotlib. XXX Not yet functional """ import ggplot ...
def init_class(self, class_, step_func=None): """ This method simulates the loading of a class by the JVM, during which parts of the class (e.g. static fields) are initialized. For this, we run the class initializer method <clinit> (if available) and update the state accordingly....
This method simulates the loading of a class by the JVM, during which parts of the class (e.g. static fields) are initialized. For this, we run the class initializer method <clinit> (if available) and update the state accordingly. Note: Initialization is skipped, if the class has alread...
Below is the the instruction that describes the task: ### Input: This method simulates the loading of a class by the JVM, during which parts of the class (e.g. static fields) are initialized. For this, we run the class initializer method <clinit> (if available) and update the state according...
def seed_zoom(seeds, zoom): """ Smart zoom for sparse matrix. If there is resize to bigger resolution thin line of label could be lost. This function prefers labels larger then zero. If there is only one small voxel in larger volume with zeros it is selected. """ # import scipy # loseeds...
Smart zoom for sparse matrix. If there is resize to bigger resolution thin line of label could be lost. This function prefers labels larger then zero. If there is only one small voxel in larger volume with zeros it is selected.
Below is the the instruction that describes the task: ### Input: Smart zoom for sparse matrix. If there is resize to bigger resolution thin line of label could be lost. This function prefers labels larger then zero. If there is only one small voxel in larger volume with zeros it is selected. ### Respons...
def _match_nodes(self, validators, obj): """Apply each validator in validators to each node in obj. Return each node in obj which matches all validators. """ results = [] for node in object_iter(obj): if all([validate(node) for validate in validators]): ...
Apply each validator in validators to each node in obj. Return each node in obj which matches all validators.
Below is the the instruction that describes the task: ### Input: Apply each validator in validators to each node in obj. Return each node in obj which matches all validators. ### Response: def _match_nodes(self, validators, obj): """Apply each validator in validators to each node in obj. ...
def match_string(self, stype): """Match string type.""" return not (stype - self.string_types) or bool(stype & self.wild_string_types)
Match string type.
Below is the the instruction that describes the task: ### Input: Match string type. ### Response: def match_string(self, stype): """Match string type.""" return not (stype - self.string_types) or bool(stype & self.wild_string_types)
def page(self, enabled=values.unset, date_created_after=values.unset, date_created_before=values.unset, friendly_name=values.unset, page_token=values.unset, page_number=values.unset, page_size=values.unset): """ Retrieve a single page of CompositionHookInstance rec...
Retrieve a single page of CompositionHookInstance records from the API. Request is executed immediately :param bool enabled: Only show Composition Hooks enabled or disabled. :param datetime date_created_after: Only show Composition Hooks created on or after this ISO8601 date-time with timezone....
Below is the the instruction that describes the task: ### Input: Retrieve a single page of CompositionHookInstance records from the API. Request is executed immediately :param bool enabled: Only show Composition Hooks enabled or disabled. :param datetime date_created_after: Only show Compos...
def publish(self, user=None, when=None): """ Publishes a item and any sub items. A new transaction will be started if we aren't already in a transaction. Should only be run on draft items """ assert self.state == self.DRAFT user_published = 'code' ...
Publishes a item and any sub items. A new transaction will be started if we aren't already in a transaction. Should only be run on draft items
Below is the the instruction that describes the task: ### Input: Publishes a item and any sub items. A new transaction will be started if we aren't already in a transaction. Should only be run on draft items ### Response: def publish(self, user=None, when=None): """ Publish...
def eintr_retry_zmq(f, *args, **kwargs): """The specialization of :func:`eintr_retry` by :exc:`zmq.ZMQError`.""" return eintr_retry(zmq.ZMQError, f, *args, **kwargs)
The specialization of :func:`eintr_retry` by :exc:`zmq.ZMQError`.
Below is the the instruction that describes the task: ### Input: The specialization of :func:`eintr_retry` by :exc:`zmq.ZMQError`. ### Response: def eintr_retry_zmq(f, *args, **kwargs): """The specialization of :func:`eintr_retry` by :exc:`zmq.ZMQError`.""" return eintr_retry(zmq.ZMQError, f, *args, **kwar...
def _resolve_dotted_name(dotted_name): """Returns objects from strings Deals e.g. with 'torch.nn.Softmax(dim=-1)'. Modified from palladium: https://github.com/ottogroup/palladium/blob/8a066a9a7690557d9b1b6ed54b7d1a1502ba59e3/palladium/util.py with added support for instantiated objects. """...
Returns objects from strings Deals e.g. with 'torch.nn.Softmax(dim=-1)'. Modified from palladium: https://github.com/ottogroup/palladium/blob/8a066a9a7690557d9b1b6ed54b7d1a1502ba59e3/palladium/util.py with added support for instantiated objects.
Below is the the instruction that describes the task: ### Input: Returns objects from strings Deals e.g. with 'torch.nn.Softmax(dim=-1)'. Modified from palladium: https://github.com/ottogroup/palladium/blob/8a066a9a7690557d9b1b6ed54b7d1a1502ba59e3/palladium/util.py with added support for instant...
def display_message(pymux, variables): " Display a message. " message = variables['<message>'] client_state = pymux.get_client_state() client_state.message = message
Display a message.
Below is the the instruction that describes the task: ### Input: Display a message. ### Response: def display_message(pymux, variables): " Display a message. " message = variables['<message>'] client_state = pymux.get_client_state() client_state.message = message
def clear_tc(self, owner, data, clear_type): """Delete threat intel from ThreatConnect platform. Args: owner (str): The ThreatConnect owner. data (dict): The data for the threat intel to clear. clear_type (str): The type of clear action. """ batch = s...
Delete threat intel from ThreatConnect platform. Args: owner (str): The ThreatConnect owner. data (dict): The data for the threat intel to clear. clear_type (str): The type of clear action.
Below is the the instruction that describes the task: ### Input: Delete threat intel from ThreatConnect platform. Args: owner (str): The ThreatConnect owner. data (dict): The data for the threat intel to clear. clear_type (str): The type of clear action. ### Response: d...
def sample_stats_to_xarray(self): """Extract sample_stats from tfp trace.""" if self.model_fn is None or self.observed is None: return None log_likelihood = [] sample_size = self.posterior[0].shape[0] for i in range(sample_size): variables = {} ...
Extract sample_stats from tfp trace.
Below is the the instruction that describes the task: ### Input: Extract sample_stats from tfp trace. ### Response: def sample_stats_to_xarray(self): """Extract sample_stats from tfp trace.""" if self.model_fn is None or self.observed is None: return None log_likelihood = ...
def available_modes(self): """Return list of available mode names.""" if not self._available_modes: modes = self.available_modes_with_ids if not modes: return None self._available_modes = list(modes.keys()) return self._available_modes
Return list of available mode names.
Below is the the instruction that describes the task: ### Input: Return list of available mode names. ### Response: def available_modes(self): """Return list of available mode names.""" if not self._available_modes: modes = self.available_modes_with_ids if not modes: ...
def get_byte_array(integer): """Return the variable length bytes corresponding to the given int""" # Operate in big endian (unlike most of Telegram API) since: # > "...pq is a representation of a natural number # (in binary *big endian* format)..." # > "...current value of dh_prime equals # ...
Return the variable length bytes corresponding to the given int
Below is the the instruction that describes the task: ### Input: Return the variable length bytes corresponding to the given int ### Response: def get_byte_array(integer): """Return the variable length bytes corresponding to the given int""" # Operate in big endian (unlike most of Telegram API) since: ...
def write_var(self, var_spec, var_attrs=None, var_data=None): ''' Writes a variable, along with variable attributes and data. Parameters ---------- var_spec : dict The specifications of the variable. The required/optional keys for creating a variable: ...
Writes a variable, along with variable attributes and data. Parameters ---------- var_spec : dict The specifications of the variable. The required/optional keys for creating a variable: Required keys: - ['Variable']: The name of the variable ...
Below is the the instruction that describes the task: ### Input: Writes a variable, along with variable attributes and data. Parameters ---------- var_spec : dict The specifications of the variable. The required/optional keys for creating a variable: Req...
def DiamAns(cmd, **fields): """Craft Diameter answer commands""" upfields, name = getCmdParams(cmd, False, **fields) p = DiamG(**upfields) p.name = name return p
Craft Diameter answer commands
Below is the the instruction that describes the task: ### Input: Craft Diameter answer commands ### Response: def DiamAns(cmd, **fields): """Craft Diameter answer commands""" upfields, name = getCmdParams(cmd, False, **fields) p = DiamG(**upfields) p.name = name return p
def attr_delete(args): ''' Delete key=value attributes: if entity name & type are specified then attributes will be deleted from that entity, otherwise the attribute will be removed from the workspace''' if args.entity_type and args.entities: # Since there is no attribute deletion endpoint, we ...
Delete key=value attributes: if entity name & type are specified then attributes will be deleted from that entity, otherwise the attribute will be removed from the workspace
Below is the the instruction that describes the task: ### Input: Delete key=value attributes: if entity name & type are specified then attributes will be deleted from that entity, otherwise the attribute will be removed from the workspace ### Response: def attr_delete(args): ''' Delete key=value attrib...
def open_files(self, path): """Load file(s) -- image*.fits, image*.fits[ext]. Returns success code (True or False). """ paths = [] input_list = _patt.findall(path) if not input_list: input_list = [path] for path in input_list: # Strips tra...
Load file(s) -- image*.fits, image*.fits[ext]. Returns success code (True or False).
Below is the the instruction that describes the task: ### Input: Load file(s) -- image*.fits, image*.fits[ext]. Returns success code (True or False). ### Response: def open_files(self, path): """Load file(s) -- image*.fits, image*.fits[ext]. Returns success code (True or False). """...
def create_graph_html(js_template, css_template, html_template=None): """ Create HTML code block given the graph Javascript and CSS. """ if html_template is None: html_template = read_lib('html', 'graph') # Create div ID for the graph and give it to the JS and CSS templates so # they can refere...
Create HTML code block given the graph Javascript and CSS.
Below is the the instruction that describes the task: ### Input: Create HTML code block given the graph Javascript and CSS. ### Response: def create_graph_html(js_template, css_template, html_template=None): """ Create HTML code block given the graph Javascript and CSS. """ if html_template is None: ...
def configuration_check(config): """Perform a sanity check on configuration. First it performs a sanity check against settings for daemon and then against settings for each service check. Arguments: config (obj): A configparser object which holds our configuration. Returns: None i...
Perform a sanity check on configuration. First it performs a sanity check against settings for daemon and then against settings for each service check. Arguments: config (obj): A configparser object which holds our configuration. Returns: None if all checks are successfully passed oth...
Below is the the instruction that describes the task: ### Input: Perform a sanity check on configuration. First it performs a sanity check against settings for daemon and then against settings for each service check. Arguments: config (obj): A configparser object which holds our configuration....
def load(self, filename, format_file='cloudupdrs'): """ This is a general load data method where the format of data to load can be passed as a parameter, :param str filename: The path to load data from :param str format_file: format of the file. Default is CloudUPDRS. Set to...
This is a general load data method where the format of data to load can be passed as a parameter, :param str filename: The path to load data from :param str format_file: format of the file. Default is CloudUPDRS. Set to mpower for mpower data. :return dataframe: data_frame.x, data_f...
Below is the the instruction that describes the task: ### Input: This is a general load data method where the format of data to load can be passed as a parameter, :param str filename: The path to load data from :param str format_file: format of the file. Default is CloudUPDRS. Set to mpower...
def visitPrefixDecl(self, ctx: ShExDocParser.PrefixDeclContext): """ prefixDecl: KW_PREFIX PNAME_NS IRIREF """ iri = self.context.iriref_to_shexj_iriref(ctx.IRIREF()) prefix = ctx.PNAME_NS().getText() if iri not in self.context.ld_prefixes: self.context.prefixes.setdefault(pr...
prefixDecl: KW_PREFIX PNAME_NS IRIREF
Below is the the instruction that describes the task: ### Input: prefixDecl: KW_PREFIX PNAME_NS IRIREF ### Response: def visitPrefixDecl(self, ctx: ShExDocParser.PrefixDeclContext): """ prefixDecl: KW_PREFIX PNAME_NS IRIREF """ iri = self.context.iriref_to_shexj_iriref(ctx.IRIREF()) prefix ...
def add(self, num): """ Adds num to the current value """ self.index = max(0, min(len(self.allowed)-1, self.index+num)) self.set(self.allowed[self.index])
Adds num to the current value
Below is the the instruction that describes the task: ### Input: Adds num to the current value ### Response: def add(self, num): """ Adds num to the current value """ self.index = max(0, min(len(self.allowed)-1, self.index+num)) self.set(self.allowed[self.index])
def _query(function, consul_url, token=None, method='GET', api_version='v1', data=None, query_params=None): ''' Consul object method function to construct and execute on the API URL. :param api_url: The Consul api url. :param api_ver...
Consul object method function to construct and execute on the API URL. :param api_url: The Consul api url. :param api_version The Consul api version :param function: The Consul api function to perform. :param method: The HTTP method, e.g. GET or POST. :param data: The data to be...
Below is the the instruction that describes the task: ### Input: Consul object method function to construct and execute on the API URL. :param api_url: The Consul api url. :param api_version The Consul api version :param function: The Consul api function to perform. :param method: The ...
def plot_hpd( x, y, credible_interval=0.94, color="C1", circular=False, smooth=True, smooth_kwargs=None, fill_kwargs=None, plot_kwargs=None, ax=None, ): """ Plot hpd intervals for regression data. Parameters ---------- x : array-like Values to plot ...
Plot hpd intervals for regression data. Parameters ---------- x : array-like Values to plot y : array-like values ​​from which to compute the hpd credible_interval : float, optional Credible interval to plot. Defaults to 0.94. color : str Color used for the limit...
Below is the the instruction that describes the task: ### Input: Plot hpd intervals for regression data. Parameters ---------- x : array-like Values to plot y : array-like values ​​from which to compute the hpd credible_interval : float, optional Credible interval to plo...
def add_interrupt_callback(gpio_id, callback, edge='both', \ pull_up_down=PUD_OFF, threaded_callback=False, \ debounce_timeout_ms=None): """ Add a callback to be executed when the value on 'gpio_id' changes to the edge specified via the 'edge' parameter (default='both'). `pull_up_down` ...
Add a callback to be executed when the value on 'gpio_id' changes to the edge specified via the 'edge' parameter (default='both'). `pull_up_down` can be set to `RPIO.PUD_UP`, `RPIO.PUD_DOWN`, and `RPIO.PUD_OFF`. If `threaded_callback` is True, the callback will be started inside a Thread. If ...
Below is the the instruction that describes the task: ### Input: Add a callback to be executed when the value on 'gpio_id' changes to the edge specified via the 'edge' parameter (default='both'). `pull_up_down` can be set to `RPIO.PUD_UP`, `RPIO.PUD_DOWN`, and `RPIO.PUD_OFF`. If `threaded_callback...
def p_created_1(self, p): """created : CREATED DATE""" try: if six.PY2: value = p[2].decode(encoding='utf-8') else: value = p[2] self.builder.set_created_date(self.document, value) except CardinalityError: self.more_...
created : CREATED DATE
Below is the the instruction that describes the task: ### Input: created : CREATED DATE ### Response: def p_created_1(self, p): """created : CREATED DATE""" try: if six.PY2: value = p[2].decode(encoding='utf-8') else: value = p[2] ...
def string_value(node): """Compute the string-value of a node.""" if (node.nodeType == node.DOCUMENT_NODE or node.nodeType == node.ELEMENT_NODE): s = u'' for n in axes['descendant'](node): if n.nodeType == n.TEXT_NODE: s += n.data return s elif no...
Compute the string-value of a node.
Below is the the instruction that describes the task: ### Input: Compute the string-value of a node. ### Response: def string_value(node): """Compute the string-value of a node.""" if (node.nodeType == node.DOCUMENT_NODE or node.nodeType == node.ELEMENT_NODE): s = u'' for n in axes[...
def list_replica_set_for_all_namespaces(self, **kwargs): # noqa: E501 """list_replica_set_for_all_namespaces # noqa: E501 list or watch objects of kind ReplicaSet # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass a...
list_replica_set_for_all_namespaces # noqa: E501 list or watch objects of kind ReplicaSet # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_replica_set_for_all_namespaces(async_r...
Below is the the instruction that describes the task: ### Input: list_replica_set_for_all_namespaces # noqa: E501 list or watch objects of kind ReplicaSet # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True...
def _merge_bee(self, bee): '''Shifts a random value for a supplied bee with in accordance with another random bee's value Args: bee (EmployerBee): supplied bee to merge Returns: tuple: (score of new position, values of new position, fitness funct...
Shifts a random value for a supplied bee with in accordance with another random bee's value Args: bee (EmployerBee): supplied bee to merge Returns: tuple: (score of new position, values of new position, fitness function return value of new position)
Below is the the instruction that describes the task: ### Input: Shifts a random value for a supplied bee with in accordance with another random bee's value Args: bee (EmployerBee): supplied bee to merge Returns: tuple: (score of new position, values of new position...
def map_sid2sub(self, sid, sub): """ Store the connection between a Session ID and a subject ID. :param sid: Session ID :param sub: subject ID """ self.set('sid2sub', sid, sub) self.set('sub2sid', sub, sid)
Store the connection between a Session ID and a subject ID. :param sid: Session ID :param sub: subject ID
Below is the the instruction that describes the task: ### Input: Store the connection between a Session ID and a subject ID. :param sid: Session ID :param sub: subject ID ### Response: def map_sid2sub(self, sid, sub): """ Store the connection between a Session ID and a subject ID. ...
def draw(self): """Draws cell content to context""" # Content is only rendered within rect self.context.save() self.context.rectangle(*self.rect) self.context.clip() content = self.get_cell_content() pos_x, pos_y = self.rect[:2] self.context.translate(p...
Draws cell content to context
Below is the the instruction that describes the task: ### Input: Draws cell content to context ### Response: def draw(self): """Draws cell content to context""" # Content is only rendered within rect self.context.save() self.context.rectangle(*self.rect) self.context.clip()...
def write(self): '''write status to status.txt''' f = open('status.txt', mode='w') self.show(f) f.close()
write status to status.txt
Below is the the instruction that describes the task: ### Input: write status to status.txt ### Response: def write(self): '''write status to status.txt''' f = open('status.txt', mode='w') self.show(f) f.close()
def _format_templates(name, command, templates): ''' Creates a list-table directive for a set of defined environment variables Parameters: name (str): The name of the config section command (object): The sdss_access path instance templates (dict): ...
Creates a list-table directive for a set of defined environment variables Parameters: name (str): The name of the config section command (object): The sdss_access path instance templates (dict): A dictionary of the path templates Yields: ...
Below is the the instruction that describes the task: ### Input: Creates a list-table directive for a set of defined environment variables Parameters: name (str): The name of the config section command (object): The sdss_access path instance templates (dict)...
def get_exchange_rate(self, base, target, raise_errors=True): """Return the ::base:: to ::target:: exchange rate.""" assert base and target base, target = base.lower(), target.lower() r = self.session.get(API_SIMPLE_TICKER.format(base, target)) if r.status_code != requests.code...
Return the ::base:: to ::target:: exchange rate.
Below is the the instruction that describes the task: ### Input: Return the ::base:: to ::target:: exchange rate. ### Response: def get_exchange_rate(self, base, target, raise_errors=True): """Return the ::base:: to ::target:: exchange rate.""" assert base and target base, target = base.lo...
def killJobs(self, jobsToKill): """ Kills the given set of jobs and then sends them for processing """ if len(jobsToKill) > 0: self.batchSystem.killBatchJobs(jobsToKill) for jobBatchSystemID in jobsToKill: self.processFinishedJob(jobBatchSystemID, ...
Kills the given set of jobs and then sends them for processing
Below is the the instruction that describes the task: ### Input: Kills the given set of jobs and then sends them for processing ### Response: def killJobs(self, jobsToKill): """ Kills the given set of jobs and then sends them for processing """ if len(jobsToKill) > 0: se...
def _iter_text_wave( self, text, numbers, step=1, fore=None, back=None, style=None, rgb_mode=False): """ Yield colorized characters from `text`, using a wave of `numbers`. Arguments: text : String to be colorized. numbers : A list/tuple ...
Yield colorized characters from `text`, using a wave of `numbers`. Arguments: text : String to be colorized. numbers : A list/tuple of numbers (256 colors). step : Number of characters to colorize per color. fore : Fore color t...
Below is the the instruction that describes the task: ### Input: Yield colorized characters from `text`, using a wave of `numbers`. Arguments: text : String to be colorized. numbers : A list/tuple of numbers (256 colors). step : Number of chara...
def page(self, end_date=values.unset, event_type=values.unset, minutes=values.unset, reservation_sid=values.unset, start_date=values.unset, task_queue_sid=values.unset, task_sid=values.unset, worker_sid=values.unset, workflow_sid=values.unset, task_channel=values.unse...
Retrieve a single page of EventInstance records from the API. Request is executed immediately :param datetime end_date: Filter events by an end date. :param unicode event_type: Filter events by those of a certain event type :param unicode minutes: Filter events by up to 'x' minutes in t...
Below is the the instruction that describes the task: ### Input: Retrieve a single page of EventInstance records from the API. Request is executed immediately :param datetime end_date: Filter events by an end date. :param unicode event_type: Filter events by those of a certain event type ...
def parse_reference_line(ref_line, kbs, bad_titles_count={}, linker_callback=None): """Parse one reference line @input a string representing a single reference bullet @output parsed references (a list of elements objects) """ # Strip the 'marker' (e.g. [1]) from this reference line: line_marker...
Parse one reference line @input a string representing a single reference bullet @output parsed references (a list of elements objects)
Below is the the instruction that describes the task: ### Input: Parse one reference line @input a string representing a single reference bullet @output parsed references (a list of elements objects) ### Response: def parse_reference_line(ref_line, kbs, bad_titles_count={}, linker_callback=None): """P...
def security_rule_get(security_rule, security_group, resource_group, **kwargs): ''' .. versionadded:: 2019.2.0 Get a security rule within a specified network security group. :param name: The name of the security rule to query. :param security_group: The network security group containing the ...
.. versionadded:: 2019.2.0 Get a security rule within a specified network security group. :param name: The name of the security rule to query. :param security_group: The network security group containing the security rule. :param resource_group: The resource group name assigned to the ...
Below is the the instruction that describes the task: ### Input: .. versionadded:: 2019.2.0 Get a security rule within a specified network security group. :param name: The name of the security rule to query. :param security_group: The network security group containing the security rule. ...
def katex_rendering_delimiters(app): """Delimiters for rendering KaTeX math. If no delimiters are specified in katex_options, add the katex_inline and katex_display delimiters. See also https://khan.github.io/KaTeX/docs/autorender.html """ # Return if we have user defined rendering delimiters ...
Delimiters for rendering KaTeX math. If no delimiters are specified in katex_options, add the katex_inline and katex_display delimiters. See also https://khan.github.io/KaTeX/docs/autorender.html
Below is the the instruction that describes the task: ### Input: Delimiters for rendering KaTeX math. If no delimiters are specified in katex_options, add the katex_inline and katex_display delimiters. See also https://khan.github.io/KaTeX/docs/autorender.html ### Response: def katex_rendering_delimit...
def ReadPreprocessingInformation(self, knowledge_base): """Reads preprocessing information. The preprocessing information contains the system configuration which contains information about various system specific configuration data, for example the user accounts. Args: knowledge_base (Knowle...
Reads preprocessing information. The preprocessing information contains the system configuration which contains information about various system specific configuration data, for example the user accounts. Args: knowledge_base (KnowledgeBase): is used to store the preprocessing informat...
Below is the the instruction that describes the task: ### Input: Reads preprocessing information. The preprocessing information contains the system configuration which contains information about various system specific configuration data, for example the user accounts. Args: knowledge_base (...
def sample(self, rstate=None, return_q=False): """ Sample a point uniformly distributed within the *union* of ellipsoids. Returns ------- x : `~numpy.ndarray` with shape (ndim,) A coordinate within the set of ellipsoids. idx : int The index of th...
Sample a point uniformly distributed within the *union* of ellipsoids. Returns ------- x : `~numpy.ndarray` with shape (ndim,) A coordinate within the set of ellipsoids. idx : int The index of the ellipsoid `x` was sampled from. q : int, optional ...
Below is the the instruction that describes the task: ### Input: Sample a point uniformly distributed within the *union* of ellipsoids. Returns ------- x : `~numpy.ndarray` with shape (ndim,) A coordinate within the set of ellipsoids. idx : int The index of ...
def mount(self, app=None): """Mounts all registered routes to a bottle.py application instance. Args: app (instance): A `bottle.Bottle()` application instance. Returns: The Router instance (for chaining purposes). """ for endpoint in self._routes: ...
Mounts all registered routes to a bottle.py application instance. Args: app (instance): A `bottle.Bottle()` application instance. Returns: The Router instance (for chaining purposes).
Below is the the instruction that describes the task: ### Input: Mounts all registered routes to a bottle.py application instance. Args: app (instance): A `bottle.Bottle()` application instance. Returns: The Router instance (for chaining purposes). ### Response: def mount(...
def save(self): """ Save the current instance to the DB """ with rconnect() as conn: try: self.validate() except ValidationError as e: log.warn(e.messages) raise except ModelValidationError as e: ...
Save the current instance to the DB
Below is the the instruction that describes the task: ### Input: Save the current instance to the DB ### Response: def save(self): """ Save the current instance to the DB """ with rconnect() as conn: try: self.validate() except ValidationE...
def get_arrive_stop(self, **kwargs): """Obtain bus arrival info in target stop. Args: stop_number (int): Stop number to query. lang (str): Language code (*es* or *en*). Returns: Status boolean and parsed response (list[Arrival]), or message string ...
Obtain bus arrival info in target stop. Args: stop_number (int): Stop number to query. lang (str): Language code (*es* or *en*). Returns: Status boolean and parsed response (list[Arrival]), or message string in case of error.
Below is the the instruction that describes the task: ### Input: Obtain bus arrival info in target stop. Args: stop_number (int): Stop number to query. lang (str): Language code (*es* or *en*). Returns: Status boolean and parsed response (list[Arrival]), or mess...
def _at_for(self, calculator, rule, scope, block): """ Implements @for """ var, _, name = block.argument.partition(' from ') frm, _, through = name.partition(' through ') if through: inclusive = True else: inclusive = False frm,...
Implements @for
Below is the the instruction that describes the task: ### Input: Implements @for ### Response: def _at_for(self, calculator, rule, scope, block): """ Implements @for """ var, _, name = block.argument.partition(' from ') frm, _, through = name.partition(' through ') i...
def glover_time_derivative(tr, oversampling=50, time_length=32., onset=0.): """Implementation of the Glover time derivative hrf (dhrf) model Parameters ---------- tr: float scan repeat time, in seconds oversampling: int, temporal oversampling factor, optional time_length: float,...
Implementation of the Glover time derivative hrf (dhrf) model Parameters ---------- tr: float scan repeat time, in seconds oversampling: int, temporal oversampling factor, optional time_length: float, hrf kernel length, in seconds onset: float, onset of the respo...
Below is the the instruction that describes the task: ### Input: Implementation of the Glover time derivative hrf (dhrf) model Parameters ---------- tr: float scan repeat time, in seconds oversampling: int, temporal oversampling factor, optional time_length: float, hrf k...
def space(self, newlines=1): """Creates a vertical space of newlines Args: newlines (int): number of empty lines Returns: self for chaining """ space = Space() for line in range(newlines): space.add_line('\n') self._container....
Creates a vertical space of newlines Args: newlines (int): number of empty lines Returns: self for chaining
Below is the the instruction that describes the task: ### Input: Creates a vertical space of newlines Args: newlines (int): number of empty lines Returns: self for chaining ### Response: def space(self, newlines=1): """Creates a vertical space of newlines ...
def get_instances(self, object_specs, version=None): """Get the cached native representation for one or more objects. Keyword arguments: object_specs - A sequence of triples (model name, pk, obj): - model name - the name of the model - pk - the primary key of the instance ...
Get the cached native representation for one or more objects. Keyword arguments: object_specs - A sequence of triples (model name, pk, obj): - model name - the name of the model - pk - the primary key of the instance - obj - the instance, or None to load it version - The...
Below is the the instruction that describes the task: ### Input: Get the cached native representation for one or more objects. Keyword arguments: object_specs - A sequence of triples (model name, pk, obj): - model name - the name of the model - pk - the primary key of the instance ...
def make_functions(self): """ Revisit the entire control flow graph, create Function instances accordingly, and correctly put blocks into each function. Although Function objects are crated during the CFG recovery, they are neither sound nor accurate. With a pre-constructed CFG,...
Revisit the entire control flow graph, create Function instances accordingly, and correctly put blocks into each function. Although Function objects are crated during the CFG recovery, they are neither sound nor accurate. With a pre-constructed CFG, this method rebuilds all functions bearing th...
Below is the the instruction that describes the task: ### Input: Revisit the entire control flow graph, create Function instances accordingly, and correctly put blocks into each function. Although Function objects are crated during the CFG recovery, they are neither sound nor accurate. With a ...
def load_and_migrate() -> Dict[str, Path]: """ Ensure the settings directory tree is properly configured. This function does most of its work on the actual robot. It will move all settings files from wherever they happen to be to the proper place. On non-robots, this mostly just loads. In addition, it ...
Ensure the settings directory tree is properly configured. This function does most of its work on the actual robot. It will move all settings files from wherever they happen to be to the proper place. On non-robots, this mostly just loads. In addition, it writes a default config and makes sure all dire...
Below is the the instruction that describes the task: ### Input: Ensure the settings directory tree is properly configured. This function does most of its work on the actual robot. It will move all settings files from wherever they happen to be to the proper place. On non-robots, this mostly just loads...
def ra(self,*args,**kwargs): """ NAME: ra PURPOSE: return the right ascension INPUT: t - (optional) time at which to get ra (can be Quantity) obs=[X,Y,Z] - (optional) position of observer (in kpc; entries can be Quantity) (def...
NAME: ra PURPOSE: return the right ascension INPUT: t - (optional) time at which to get ra (can be Quantity) obs=[X,Y,Z] - (optional) position of observer (in kpc; entries can be Quantity) (default=[8.0,0.,0.]) OR Orbit object that correspond...
Below is the the instruction that describes the task: ### Input: NAME: ra PURPOSE: return the right ascension INPUT: t - (optional) time at which to get ra (can be Quantity) obs=[X,Y,Z] - (optional) position of observer (in kpc; entries can be Quanti...
def update_function(self, param_vals): """Updates the opt_obj, returns new error.""" self.opt_obj.update_function(param_vals) return self.opt_obj.get_error()
Updates the opt_obj, returns new error.
Below is the the instruction that describes the task: ### Input: Updates the opt_obj, returns new error. ### Response: def update_function(self, param_vals): """Updates the opt_obj, returns new error.""" self.opt_obj.update_function(param_vals) return self.opt_obj.get_error()
def _get_one_pending_job(self): """ Retrieve a pending job. :return: A CFGJob instance or None """ pending_job_key, pending_job = self._pending_jobs.popitem() pending_job_state = pending_job.state pending_job_call_stack = pending_job.call_stack pending_j...
Retrieve a pending job. :return: A CFGJob instance or None
Below is the the instruction that describes the task: ### Input: Retrieve a pending job. :return: A CFGJob instance or None ### Response: def _get_one_pending_job(self): """ Retrieve a pending job. :return: A CFGJob instance or None """ pending_job_key, pending_jo...
def _increment_recursion_level(self): """Increment current_depth based on either defaults or the enclosing Async. """ # Update the recursion info. This is done so that if an async created # outside an executing context, or one previously created is later # loaded from st...
Increment current_depth based on either defaults or the enclosing Async.
Below is the the instruction that describes the task: ### Input: Increment current_depth based on either defaults or the enclosing Async. ### Response: def _increment_recursion_level(self): """Increment current_depth based on either defaults or the enclosing Async. """ # Upd...
def raise_204(instance): """Abort the current request with a 204 (No Content) response code. Clears out the body of the response. :param instance: Resource instance (used to access the response) :type instance: :class:`webob.resource.Resource` :raises: :class:`webob.exceptions.ResponseException` of...
Abort the current request with a 204 (No Content) response code. Clears out the body of the response. :param instance: Resource instance (used to access the response) :type instance: :class:`webob.resource.Resource` :raises: :class:`webob.exceptions.ResponseException` of status 204
Below is the the instruction that describes the task: ### Input: Abort the current request with a 204 (No Content) response code. Clears out the body of the response. :param instance: Resource instance (used to access the response) :type instance: :class:`webob.resource.Resource` :raises: :class:`w...