code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def cyntenator(args): """ %prog cyntenator athaliana.athaliana.last athaliana.bed Prepare input for Cyntenator. """ p = OptionParser(cyntenator.__doc__) opts, args = p.parse_args(args) if len(args) < 2: sys.exit(not p.print_help()) lastfile = args[0] fp = open(lastfile) ...
%prog cyntenator athaliana.athaliana.last athaliana.bed Prepare input for Cyntenator.
Below is the the instruction that describes the task: ### Input: %prog cyntenator athaliana.athaliana.last athaliana.bed Prepare input for Cyntenator. ### Response: def cyntenator(args): """ %prog cyntenator athaliana.athaliana.last athaliana.bed Prepare input for Cyntenator. """ p = Opti...
def namedb_get_all_preordered_namespace_hashes( cur, current_block ): """ Get a list of all preordered namespace hashes that haven't expired yet. Used for testing """ query = "SELECT preorder_hash FROM preorders WHERE op = ? AND block_number >= ? AND block_number < ?;" args = (NAMESPACE_PREORDER...
Get a list of all preordered namespace hashes that haven't expired yet. Used for testing
Below is the the instruction that describes the task: ### Input: Get a list of all preordered namespace hashes that haven't expired yet. Used for testing ### Response: def namedb_get_all_preordered_namespace_hashes( cur, current_block ): """ Get a list of all preordered namespace hashes that haven't ex...
def simplefenestration(idf, fsd, deletebsd=True, setto000=False): """convert a bsd (fenestrationsurface:detailed) into a simple fenestrations""" funcs = (window, door, glazeddoor,) for func in funcs: fenestration = func(idf, fsd, deletebsd=deletebsd, setto000=setto000) i...
convert a bsd (fenestrationsurface:detailed) into a simple fenestrations
Below is the the instruction that describes the task: ### Input: convert a bsd (fenestrationsurface:detailed) into a simple fenestrations ### Response: def simplefenestration(idf, fsd, deletebsd=True, setto000=False): """convert a bsd (fenestrationsurface:detailed) into a simple fenestrations""" ...
def _create_state_graph(self, name): """Creates the graph nodes that hold the state of the Module. Args: name: name scope to create the state graph in. Returns: A tuple consisting of: variables_tensor_map: a map from tensor names in the original graph def to the created Varia...
Creates the graph nodes that hold the state of the Module. Args: name: name scope to create the state graph in. Returns: A tuple consisting of: variables_tensor_map: a map from tensor names in the original graph def to the created Variables objects. state_map: a map from ...
Below is the the instruction that describes the task: ### Input: Creates the graph nodes that hold the state of the Module. Args: name: name scope to create the state graph in. Returns: A tuple consisting of: variables_tensor_map: a map from tensor names in the original graph def ...
def string_result(result, func, arguments): """Errcheck function. Returns a string and frees the original pointer. It assumes the result is a char *. """ if result: # make a python string copy s = bytes_to_str(ctypes.string_at(result)) # free original string ptr libvlc_f...
Errcheck function. Returns a string and frees the original pointer. It assumes the result is a char *.
Below is the the instruction that describes the task: ### Input: Errcheck function. Returns a string and frees the original pointer. It assumes the result is a char *. ### Response: def string_result(result, func, arguments): """Errcheck function. Returns a string and frees the original pointer. It a...
def predict_noiseless(self, Xnew, full_cov=False, kern=None): """ Predict the underlying function f at the new point(s) Xnew. :param Xnew: The points at which to make a prediction :type Xnew: np.ndarray (Nnew x self.input_dim) :param full_cov: whether to return the full covaria...
Predict the underlying function f at the new point(s) Xnew. :param Xnew: The points at which to make a prediction :type Xnew: np.ndarray (Nnew x self.input_dim) :param full_cov: whether to return the full covariance matrix, or just the diagonal :type full_cov: bool :param kern:...
Below is the the instruction that describes the task: ### Input: Predict the underlying function f at the new point(s) Xnew. :param Xnew: The points at which to make a prediction :type Xnew: np.ndarray (Nnew x self.input_dim) :param full_cov: whether to return the full covariance matrix, o...
def function_call_prepare_action(self, text, loc, fun): """Code executed after recognising a function call (type and function name)""" exshared.setpos(loc, text) if DEBUG > 0: print("FUN_PREP:",fun) if DEBUG == 2: self.symtab.display() if DEBUG > 2: retu...
Code executed after recognising a function call (type and function name)
Below is the the instruction that describes the task: ### Input: Code executed after recognising a function call (type and function name) ### Response: def function_call_prepare_action(self, text, loc, fun): """Code executed after recognising a function call (type and function name)""" exshared.s...
def _new_session(retry_timeout_config): """ Return a new `requests.Session` object. """ retry = requests.packages.urllib3.Retry( total=None, connect=retry_timeout_config.connect_retries, read=retry_timeout_config.read_retries, method_whitel...
Return a new `requests.Session` object.
Below is the the instruction that describes the task: ### Input: Return a new `requests.Session` object. ### Response: def _new_session(retry_timeout_config): """ Return a new `requests.Session` object. """ retry = requests.packages.urllib3.Retry( total=None, ...
def thread_stopped(self): """ If original task is :class:`.WStoppableTask` object, then stop it :return: None """ task = self.task() if isinstance(task, WStoppableTask) is True: task.stop()
If original task is :class:`.WStoppableTask` object, then stop it :return: None
Below is the the instruction that describes the task: ### Input: If original task is :class:`.WStoppableTask` object, then stop it :return: None ### Response: def thread_stopped(self): """ If original task is :class:`.WStoppableTask` object, then stop it :return: None """ task = self.task() if isinst...
def deploy( config, name, bucket, timeout, memory, description, subnet_ids, security_group_ids ): """ Deploy/Update a function from a project directory """ # options should override config if it is there myname = name or config.name mybucket = bucket or config.bucket ...
Deploy/Update a function from a project directory
Below is the the instruction that describes the task: ### Input: Deploy/Update a function from a project directory ### Response: def deploy( config, name, bucket, timeout, memory, description, subnet_ids, security_group_ids ): """ Deploy/Update a function from a project director...
def copy(self): """Creates a copy of this :class:`Group`.""" ret = super().copy() for cmd in self.commands: ret.add_command(cmd.copy()) return ret
Creates a copy of this :class:`Group`.
Below is the the instruction that describes the task: ### Input: Creates a copy of this :class:`Group`. ### Response: def copy(self): """Creates a copy of this :class:`Group`.""" ret = super().copy() for cmd in self.commands: ret.add_command(cmd.copy()) return ret
def list_spiders(self, project): """ Lists all known spiders for a specific project. First class, maps to Scrapyd's list spiders endpoint. """ url = self._build_url(constants.LIST_SPIDERS_ENDPOINT) params = {'project': project} json = self.client.get(url, params=p...
Lists all known spiders for a specific project. First class, maps to Scrapyd's list spiders endpoint.
Below is the the instruction that describes the task: ### Input: Lists all known spiders for a specific project. First class, maps to Scrapyd's list spiders endpoint. ### Response: def list_spiders(self, project): """ Lists all known spiders for a specific project. First class, maps ...
def save(self, force_insert=False): """ Save the model and any related many-to-many fields. :param force_insert: Should the save force an insert? :return: Number of rows impacted, or False. """ delayed = {} for field, value in self.data.items(): model...
Save the model and any related many-to-many fields. :param force_insert: Should the save force an insert? :return: Number of rows impacted, or False.
Below is the the instruction that describes the task: ### Input: Save the model and any related many-to-many fields. :param force_insert: Should the save force an insert? :return: Number of rows impacted, or False. ### Response: def save(self, force_insert=False): """ Save the mode...
def animate_phase_matrix(sync_output_dynamic, grid_width = None, grid_height = None, animation_velocity = 75, colormap = 'jet', save_movie = None): """! @brief Shows animation of phase matrix between oscillators during simulation on 2D stage. @details If grid_width or grid_height are not spec...
! @brief Shows animation of phase matrix between oscillators during simulation on 2D stage. @details If grid_width or grid_height are not specified than phase matrix size will by calculated automatically by square root. @param[in] sync_output_dynamic (sync_dynamic): Output dynamic o...
Below is the the instruction that describes the task: ### Input: ! @brief Shows animation of phase matrix between oscillators during simulation on 2D stage. @details If grid_width or grid_height are not specified than phase matrix size will by calculated automatically by square root. ...
def compose_elemental_basis(file_relpath, data_dir): """ Creates an 'elemental' basis from an elemental json file This function reads the info from the given file, and reads all the component basis set information from the files listed therein. It then composes all the information together into one...
Creates an 'elemental' basis from an elemental json file This function reads the info from the given file, and reads all the component basis set information from the files listed therein. It then composes all the information together into one 'elemental' basis dictionary
Below is the the instruction that describes the task: ### Input: Creates an 'elemental' basis from an elemental json file This function reads the info from the given file, and reads all the component basis set information from the files listed therein. It then composes all the information together into...
def loader(filepath, logger=None, **kwargs): """ Load an object from an ASDF file. See :func:`ginga.util.loader` for more info. TODO: kwargs may contain info about what part of the file to load """ # see ginga.util.loader module # TODO: return an AstroTable if loading a table, etc. # ...
Load an object from an ASDF file. See :func:`ginga.util.loader` for more info. TODO: kwargs may contain info about what part of the file to load
Below is the the instruction that describes the task: ### Input: Load an object from an ASDF file. See :func:`ginga.util.loader` for more info. TODO: kwargs may contain info about what part of the file to load ### Response: def loader(filepath, logger=None, **kwargs): """ Load an object from an AS...
def append_update_buffer(self, agent_id, key_list=None, batch_size=None, training_length=None): """ Appends the buffer of an agent to the update buffer. :param agent_id: The id of the agent which data will be appended :param key_list: The fields that must be added. If None: all fields wi...
Appends the buffer of an agent to the update buffer. :param agent_id: The id of the agent which data will be appended :param key_list: The fields that must be added. If None: all fields will be appended. :param batch_size: The number of elements that must be appended. If None: All of them will b...
Below is the the instruction that describes the task: ### Input: Appends the buffer of an agent to the update buffer. :param agent_id: The id of the agent which data will be appended :param key_list: The fields that must be added. If None: all fields will be appended. :param batch_size: The ...
def readline(prev, filename=None, mode='r', trim=str.rstrip, start=1, end=sys.maxsize): """This pipe get filenames or file object from previous pipe and read the content of file. Then, send the content of file line by line to next pipe. The start and end parameters are used to limit the range of reading fr...
This pipe get filenames or file object from previous pipe and read the content of file. Then, send the content of file line by line to next pipe. The start and end parameters are used to limit the range of reading from file. :param prev: The previous iterator of pipe. :type prev: Pipe :param filen...
Below is the the instruction that describes the task: ### Input: This pipe get filenames or file object from previous pipe and read the content of file. Then, send the content of file line by line to next pipe. The start and end parameters are used to limit the range of reading from file. :param prev:...
def rcompose(*fs: Any) -> Callable: """ Compose functions from right to left. e.g. rcompose(f, g)(x) = g(f(x)) """ return foldl1(lambda f, g: lambda *x: g(f(*x)), fs)
Compose functions from right to left. e.g. rcompose(f, g)(x) = g(f(x))
Below is the the instruction that describes the task: ### Input: Compose functions from right to left. e.g. rcompose(f, g)(x) = g(f(x)) ### Response: def rcompose(*fs: Any) -> Callable: """ Compose functions from right to left. e.g. rcompose(f, g)(x) = g(f(x)) """ return foldl1(lambda f, g: l...
def AdaptiveOpticsCorrect(pupils,diameter,maxRadial,numRemove=None): """ Correct a wavefront using Zernike rejection up to some maximal order. Can operate on multiple telescopes in parallel. Note that this version removes the piston mode as well """ gridSize=pupils.shape[-1] pupilsVector=np...
Correct a wavefront using Zernike rejection up to some maximal order. Can operate on multiple telescopes in parallel. Note that this version removes the piston mode as well
Below is the the instruction that describes the task: ### Input: Correct a wavefront using Zernike rejection up to some maximal order. Can operate on multiple telescopes in parallel. Note that this version removes the piston mode as well ### Response: def AdaptiveOpticsCorrect(pupils,diameter,maxRadial,nu...
def numberMapForBits(self, bits): """ Return a map from number to matching on bits, for all numbers that match a set of bits. @param bits (set) Indices of bits @return (dict) Mapping from number => on bits. """ numberMap = dict() for bit in bits: numbers = self.numbersForBit(bit...
Return a map from number to matching on bits, for all numbers that match a set of bits. @param bits (set) Indices of bits @return (dict) Mapping from number => on bits.
Below is the the instruction that describes the task: ### Input: Return a map from number to matching on bits, for all numbers that match a set of bits. @param bits (set) Indices of bits @return (dict) Mapping from number => on bits. ### Response: def numberMapForBits(self, bits): """ Return ...
def update_grammar_to_be_variable_free(grammar_dictionary: Dict[str, List[str]]): """ SQL is a predominately variable free language in terms of simple usage, in the sense that most queries do not create references to variables which are not already static tables in a dataset. However, it is possible to ...
SQL is a predominately variable free language in terms of simple usage, in the sense that most queries do not create references to variables which are not already static tables in a dataset. However, it is possible to do this via derived tables. If we don't require this functionality, we can tighten the ...
Below is the the instruction that describes the task: ### Input: SQL is a predominately variable free language in terms of simple usage, in the sense that most queries do not create references to variables which are not already static tables in a dataset. However, it is possible to do this via derived t...
def reactants(self): """ List of reactants """ return [self._all_comp[i] for i in range(len(self._all_comp)) if self._coeffs[i] < 0]
List of reactants
Below is the the instruction that describes the task: ### Input: List of reactants ### Response: def reactants(self): """ List of reactants """ return [self._all_comp[i] for i in range(len(self._all_comp)) if self._coeffs[i] < 0]
def postgres_migration_prep(apps, schema_editor): """ Set null text fields to empty string to workaround incompatibility with migration 0003 on postgres See https://github.com/dj-stripe/dj-stripe/issues/850 """ Account = apps.get_model("djstripe", "Account") BankAccount = apps.get_model("djstripe", "BankAccount"...
Set null text fields to empty string to workaround incompatibility with migration 0003 on postgres See https://github.com/dj-stripe/dj-stripe/issues/850
Below is the the instruction that describes the task: ### Input: Set null text fields to empty string to workaround incompatibility with migration 0003 on postgres See https://github.com/dj-stripe/dj-stripe/issues/850 ### Response: def postgres_migration_prep(apps, schema_editor): """ Set null text fields to em...
def as_samples(samples_like, dtype=None, copy=False, order='C'): """Convert a samples_like object to a NumPy array and list of labels. Args: samples_like (samples_like): A collection of raw samples. `samples_like` is an extension of NumPy's array_like_ structure. See examples be...
Convert a samples_like object to a NumPy array and list of labels. Args: samples_like (samples_like): A collection of raw samples. `samples_like` is an extension of NumPy's array_like_ structure. See examples below. dtype (data-type, optional): dtype for the ret...
Below is the the instruction that describes the task: ### Input: Convert a samples_like object to a NumPy array and list of labels. Args: samples_like (samples_like): A collection of raw samples. `samples_like` is an extension of NumPy's array_like_ structure. See examples below...
def add_argument(self, parser, path, name=None, schema=None, **kwargs): """ Add an argument to the `parser` based on a schema definition. Parameters ---------- parser : argparse.ArgumentParser parser to add an argument to path : str path in the co...
Add an argument to the `parser` based on a schema definition. Parameters ---------- parser : argparse.ArgumentParser parser to add an argument to path : str path in the configuration document to add an argument for name : str or None name of t...
Below is the the instruction that describes the task: ### Input: Add an argument to the `parser` based on a schema definition. Parameters ---------- parser : argparse.ArgumentParser parser to add an argument to path : str path in the configuration document to...
def do_req(self, method, url, body=None, headers=None, status=None): """Used internally to send a request to the API, left public so it can be used to talk to the API more directly. """ if body is None: body = '' else: body = json.dumps(body) res =...
Used internally to send a request to the API, left public so it can be used to talk to the API more directly.
Below is the the instruction that describes the task: ### Input: Used internally to send a request to the API, left public so it can be used to talk to the API more directly. ### Response: def do_req(self, method, url, body=None, headers=None, status=None): """Used internally to send a request to t...
def watch(models, criterion=None, log="gradients", log_freq=100): """ Hooks into the torch model to collect gradients and the topology. Should be extended to accept arbitrary ML models. :param (torch.Module) models: The model to hook, can be a tuple :param (torch.F) criterion: An optional loss val...
Hooks into the torch model to collect gradients and the topology. Should be extended to accept arbitrary ML models. :param (torch.Module) models: The model to hook, can be a tuple :param (torch.F) criterion: An optional loss value being optimized :param (str) log: One of "gradients", "parameters", "al...
Below is the the instruction that describes the task: ### Input: Hooks into the torch model to collect gradients and the topology. Should be extended to accept arbitrary ML models. :param (torch.Module) models: The model to hook, can be a tuple :param (torch.F) criterion: An optional loss value being ...
def prompt_user(prompt): """Ask user for agreeing to data set licenses.""" # raw_input returns the empty string for "enter" yes = set(['yes', 'y']) no = set(['no','n']) try: print(prompt) choice = input().lower() # would like to test for exception here, but not sure if we ca...
Ask user for agreeing to data set licenses.
Below is the the instruction that describes the task: ### Input: Ask user for agreeing to data set licenses. ### Response: def prompt_user(prompt): """Ask user for agreeing to data set licenses.""" # raw_input returns the empty string for "enter" yes = set(['yes', 'y']) no = set(['no','n']) tr...
def getExtensionArgs(self): """Get a dictionary of unqualified simple registration arguments representing this request. This method is essentially the inverse of C{L{parseExtensionArgs}}. This method serializes the simple registration request fields. @rtype: {str:str} ...
Get a dictionary of unqualified simple registration arguments representing this request. This method is essentially the inverse of C{L{parseExtensionArgs}}. This method serializes the simple registration request fields. @rtype: {str:str}
Below is the the instruction that describes the task: ### Input: Get a dictionary of unqualified simple registration arguments representing this request. This method is essentially the inverse of C{L{parseExtensionArgs}}. This method serializes the simple registration request fields...
def containsPoint(self, point, Zorder=False): ''' :param: point - Point subclass :param: Zorder - optional Boolean Is true if the point is contain in the rectangle or along the rectangle's edges. If Zorder is True, the method will check point.z for equality wit...
:param: point - Point subclass :param: Zorder - optional Boolean Is true if the point is contain in the rectangle or along the rectangle's edges. If Zorder is True, the method will check point.z for equality with the rectangle origin's Z coordinate.
Below is the the instruction that describes the task: ### Input: :param: point - Point subclass :param: Zorder - optional Boolean Is true if the point is contain in the rectangle or along the rectangle's edges. If Zorder is True, the method will check point.z for equality ...
def stop(self): """ Stops the current task and cleans up, including removing active task config file. * Raises ``NoActiveTask`` exception if no active task found. """ self._clean_prior() if not self._loaded: raise errors.NoActiveTask se...
Stops the current task and cleans up, including removing active task config file. * Raises ``NoActiveTask`` exception if no active task found.
Below is the the instruction that describes the task: ### Input: Stops the current task and cleans up, including removing active task config file. * Raises ``NoActiveTask`` exception if no active task found. ### Response: def stop(self): """ Stops the current task and cleans up, in...
def adjoint(self): """Return the adjoint operator.""" if not self.is_linear: raise ValueError('operator with nonzero pad_const ({}) is not' ' linear and has no adjoint' ''.format(self.pad_const)) return -PartialDerivative(sel...
Return the adjoint operator.
Below is the the instruction that describes the task: ### Input: Return the adjoint operator. ### Response: def adjoint(self): """Return the adjoint operator.""" if not self.is_linear: raise ValueError('operator with nonzero pad_const ({}) is not' ' linear a...
def add_layer(self, obj=None): """This function adds another empty layer (Layer) to the layers list and optionally merges a given object into this layer :param obj: An object to be merged with this layer :type obj: object """ new_layer = Layer() if obj: ...
This function adds another empty layer (Layer) to the layers list and optionally merges a given object into this layer :param obj: An object to be merged with this layer :type obj: object
Below is the the instruction that describes the task: ### Input: This function adds another empty layer (Layer) to the layers list and optionally merges a given object into this layer :param obj: An object to be merged with this layer :type obj: object ### Response: def add_layer(self, obj...
def getDownloadUrls(self): """Return a list of the urls to download from""" data = self.searchIndex(False) fileUrls = [] for datum in data: fileUrl = self.formatDownloadUrl(datum[0]) fileUrls.append(fileUrl) return fileUrls
Return a list of the urls to download from
Below is the the instruction that describes the task: ### Input: Return a list of the urls to download from ### Response: def getDownloadUrls(self): """Return a list of the urls to download from""" data = self.searchIndex(False) fileUrls = [] for datum in data: fileUrl = self.formatDownloadUrl(datum[0])...
def remove_callback(self, callback): """Remove callback from the list of callbacks if it exists""" if callback in self.callbacks: self.callbacks.remove(callback)
Remove callback from the list of callbacks if it exists
Below is the the instruction that describes the task: ### Input: Remove callback from the list of callbacks if it exists ### Response: def remove_callback(self, callback): """Remove callback from the list of callbacks if it exists""" if callback in self.callbacks: self.callbacks.remove(...
def update(self): """Sync up changes to reminders. """ params = {} return self.send( url=self._base_url + 'update', method='POST', json=params )
Sync up changes to reminders.
Below is the the instruction that describes the task: ### Input: Sync up changes to reminders. ### Response: def update(self): """Sync up changes to reminders. """ params = {} return self.send( url=self._base_url + 'update', method='POST', json=pa...
def write_text(filename, data, add=False): """ Write image data to text file :param filename: name of text file to write data to :type filename: str :param data: image data to write to text file :type data: numpy array :param add: whether to append to existing file or not. Default is ``False`` ...
Write image data to text file :param filename: name of text file to write data to :type filename: str :param data: image data to write to text file :type data: numpy array :param add: whether to append to existing file or not. Default is ``False`` :type add: bool
Below is the the instruction that describes the task: ### Input: Write image data to text file :param filename: name of text file to write data to :type filename: str :param data: image data to write to text file :type data: numpy array :param add: whether to append to existing file or not. Def...
def liked(parser, token): """ {% liked objects by user as varname %} """ tag, objects, _, user, _, varname = token.split_contents() return LikedObjectsNode(objects, user, varname)
{% liked objects by user as varname %}
Below is the the instruction that describes the task: ### Input: {% liked objects by user as varname %} ### Response: def liked(parser, token): """ {% liked objects by user as varname %} """ tag, objects, _, user, _, varname = token.split_contents() return LikedObjectsNode(objects, user, varnam...
def weighted_variance(image, mask, binary_image): """Compute the log-transformed variance of foreground and background image - intensity image used for thresholding mask - mask of ignored pixels binary_image - binary image marking foreground and background """ if not np.any(mask):...
Compute the log-transformed variance of foreground and background image - intensity image used for thresholding mask - mask of ignored pixels binary_image - binary image marking foreground and background
Below is the the instruction that describes the task: ### Input: Compute the log-transformed variance of foreground and background image - intensity image used for thresholding mask - mask of ignored pixels binary_image - binary image marking foreground and background ### Response: def w...
def get_aggregation_propensity(self, email, password, cutoff_v=5, cutoff_n=5, run_amylmuts=False, outdir=None): """Run the AMYLPRED2 web server to calculate the aggregation propensity of this protein sequence, which is the number of aggregation-prone segments on the unfolded protein sequence. S...
Run the AMYLPRED2 web server to calculate the aggregation propensity of this protein sequence, which is the number of aggregation-prone segments on the unfolded protein sequence. Stores statistics in the ``annotations`` attribute, under the key `aggprop-amylpred`. See :mod:`ssbio.protein.seque...
Below is the the instruction that describes the task: ### Input: Run the AMYLPRED2 web server to calculate the aggregation propensity of this protein sequence, which is the number of aggregation-prone segments on the unfolded protein sequence. Stores statistics in the ``annotations`` attribute, und...
def exchange_code(self, code): """Exchange one-use code for an access_token and request_token.""" params = {'client_id': self.client_id, 'client_secret': self.client_secret, 'grant_type': 'authorization_code', 'code': code} result = self._sen...
Exchange one-use code for an access_token and request_token.
Below is the the instruction that describes the task: ### Input: Exchange one-use code for an access_token and request_token. ### Response: def exchange_code(self, code): """Exchange one-use code for an access_token and request_token.""" params = {'client_id': self.client_id, 'cli...
def namedObject(name): """Get a fully named module-global object. """ classSplit = name.split('.') module = namedModule('.'.join(classSplit[:-1])) return getattr(module, classSplit[-1])
Get a fully named module-global object.
Below is the the instruction that describes the task: ### Input: Get a fully named module-global object. ### Response: def namedObject(name): """Get a fully named module-global object. """ classSplit = name.split('.') module = namedModule('.'.join(classSplit[:-1])) return getattr(module, classS...
def serialize_example(transformed_json_data, info_dict): """Makes a serialized tf.example. Args: transformed_json_data: dict of transformed data. info_dict: output of feature_transforms.get_transfrormed_feature_info() Returns: The serialized tf.example version of transformed_json_data. """ impor...
Makes a serialized tf.example. Args: transformed_json_data: dict of transformed data. info_dict: output of feature_transforms.get_transfrormed_feature_info() Returns: The serialized tf.example version of transformed_json_data.
Below is the the instruction that describes the task: ### Input: Makes a serialized tf.example. Args: transformed_json_data: dict of transformed data. info_dict: output of feature_transforms.get_transfrormed_feature_info() Returns: The serialized tf.example version of transformed_json_data. ### Re...
def argsort(data, out=None, chunksize=None, baseargsort=None, argmerge=None, np=None): """ parallel argsort, like numpy.argsort use sizeof(intp) * len(data) as scratch space use baseargsort for serial sort ind = baseargsort(data) use argmerge to merge def ...
parallel argsort, like numpy.argsort use sizeof(intp) * len(data) as scratch space use baseargsort for serial sort ind = baseargsort(data) use argmerge to merge def argmerge(data, A, B, out): ensure data[out] is sorted and out[:] = A join B TODO: shal...
Below is the the instruction that describes the task: ### Input: parallel argsort, like numpy.argsort use sizeof(intp) * len(data) as scratch space use baseargsort for serial sort ind = baseargsort(data) use argmerge to merge def argmerge(data, A, B, out): ensure da...
def parse_python_paths(self, args): """ optparse doesn't manage stuff like this: --pythonpath /my/modules/* but it can manages --pythonpath=/my/modules/*/ (but without handling globing) This method handles correctly the one without "=" and manages globing ...
optparse doesn't manage stuff like this: --pythonpath /my/modules/* but it can manages --pythonpath=/my/modules/*/ (but without handling globing) This method handles correctly the one without "=" and manages globing
Below is the the instruction that describes the task: ### Input: optparse doesn't manage stuff like this: --pythonpath /my/modules/* but it can manages --pythonpath=/my/modules/*/ (but without handling globing) This method handles correctly the one without "=" and man...
def check_garner(text): """Suggest the preferred forms. source: Garner's Modern American Usage source_url: http://bit.ly/1T4alrY """ err = "redundancy.garner" msg = "Redundancy. Use '{}' instead of '{}'." redundancies = [ ["adequate", ["adequate enough"]], ["ad...
Suggest the preferred forms. source: Garner's Modern American Usage source_url: http://bit.ly/1T4alrY
Below is the the instruction that describes the task: ### Input: Suggest the preferred forms. source: Garner's Modern American Usage source_url: http://bit.ly/1T4alrY ### Response: def check_garner(text): """Suggest the preferred forms. source: Garner's Modern American Usage source_ur...
def _get_seal_key_ntlm1(negotiate_flags, exported_session_key): """ 3.4.5.3 SEALKEY Calculates the seal_key used to seal (encrypt) messages. This for authentication where NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY has not been negotiated. Will weaken the keys if NTLMSSP_NEGOTIATE_56 is not negotiate...
3.4.5.3 SEALKEY Calculates the seal_key used to seal (encrypt) messages. This for authentication where NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY has not been negotiated. Will weaken the keys if NTLMSSP_NEGOTIATE_56 is not negotiated it will default to the 40-bit key @param negotiate_flags: The negotia...
Below is the the instruction that describes the task: ### Input: 3.4.5.3 SEALKEY Calculates the seal_key used to seal (encrypt) messages. This for authentication where NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY has not been negotiated. Will weaken the keys if NTLMSSP_NEGOTIATE_56 is not negotiated it wi...
def get_process_log(self, pid=None, start=0, limit=1000): ''' get_process_log(self, pid=None, start=0, limit=1000 Get process logs :Parameters: * *pid* (`string`) -- Identifier of an existing process * *pid* (`string`) -- start index to retrieve logs from * *pid...
get_process_log(self, pid=None, start=0, limit=1000 Get process logs :Parameters: * *pid* (`string`) -- Identifier of an existing process * *pid* (`string`) -- start index to retrieve logs from * *pid* (`string`) -- maximum number of entities to retrieve :return: Proce...
Below is the the instruction that describes the task: ### Input: get_process_log(self, pid=None, start=0, limit=1000 Get process logs :Parameters: * *pid* (`string`) -- Identifier of an existing process * *pid* (`string`) -- start index to retrieve logs from * *pid* (`strin...
def deploy_file(source, dest): """Deploy a file""" date = datetime.utcnow().strftime('%Y-%m-%d') shandle = open(source) with open(dest, 'w') as handle: for line in shandle: if line == '# Updated: %date%\n': newline = '# Updated: %s\n' % date else: ...
Deploy a file
Below is the the instruction that describes the task: ### Input: Deploy a file ### Response: def deploy_file(source, dest): """Deploy a file""" date = datetime.utcnow().strftime('%Y-%m-%d') shandle = open(source) with open(dest, 'w') as handle: for line in shandle: if line == '#...
def linspace_pix(self, start=None, stop=None, pixel_step=1, y_vs_x=True): """Return x,y values evaluated with a given pixel step.""" return CCDLine.linspace_pix(self, start=start, stop=stop, pixel_step=pixel_step, y_vs_x=y_vs_x)
Return x,y values evaluated with a given pixel step.
Below is the the instruction that describes the task: ### Input: Return x,y values evaluated with a given pixel step. ### Response: def linspace_pix(self, start=None, stop=None, pixel_step=1, y_vs_x=True): """Return x,y values evaluated with a given pixel step.""" return CCDLine.linspace_pix(self, ...
def ca_bundle(self, ca_bundle): """Sets the ca_bundle of this AdmissionregistrationV1beta1WebhookClientConfig. `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used. # noqa: E501 :par...
Sets the ca_bundle of this AdmissionregistrationV1beta1WebhookClientConfig. `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used. # noqa: E501 :param ca_bundle: The ca_bundle of this Admissi...
Below is the the instruction that describes the task: ### Input: Sets the ca_bundle of this AdmissionregistrationV1beta1WebhookClientConfig. `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used. ...
def validate_items(all_items): """Find errors in the schedule. Check for: - pending / rejected talks in the schedule - items with both talks and pages assigned - items with neither talks nor pages assigned """ validation = [] for item in all_items: if item.talk is...
Find errors in the schedule. Check for: - pending / rejected talks in the schedule - items with both talks and pages assigned - items with neither talks nor pages assigned
Below is the the instruction that describes the task: ### Input: Find errors in the schedule. Check for: - pending / rejected talks in the schedule - items with both talks and pages assigned - items with neither talks nor pages assigned ### Response: def validate_items(all_items): ""...
def run_filter_query(self, resource_name, filter_clause): """run a query (get) against the CLUE api, using the API and user key fields of self and the fitler_clause provided Args: resource_name: str - name of the resource / collection to query - e.g. genes, perts, cells etc. fil...
run a query (get) against the CLUE api, using the API and user key fields of self and the fitler_clause provided Args: resource_name: str - name of the resource / collection to query - e.g. genes, perts, cells etc. filter_clause: dictionary - contains filter to pass to API to; uses loop...
Below is the the instruction that describes the task: ### Input: run a query (get) against the CLUE api, using the API and user key fields of self and the fitler_clause provided Args: resource_name: str - name of the resource / collection to query - e.g. genes, perts, cells etc. fil...
def feed_line(self, line): """Feeds one line of input into the reader machine. This method is a generator that yields all top-level S-expressions that have been recognized on this line (including multi-line expressions whose last character is on this line). """ self.line...
Feeds one line of input into the reader machine. This method is a generator that yields all top-level S-expressions that have been recognized on this line (including multi-line expressions whose last character is on this line).
Below is the the instruction that describes the task: ### Input: Feeds one line of input into the reader machine. This method is a generator that yields all top-level S-expressions that have been recognized on this line (including multi-line expressions whose last character is on this line)...
def getfacl(*args, **kwargs): ''' Return (extremely verbose) map of FACLs on specified file(s) CLI Examples: .. code-block:: bash salt '*' acl.getfacl /tmp/house/kitchen salt '*' acl.getfacl /tmp/house/kitchen /tmp/house/livingroom salt '*' acl.getfacl /tmp/house/kitchen /tmp/...
Return (extremely verbose) map of FACLs on specified file(s) CLI Examples: .. code-block:: bash salt '*' acl.getfacl /tmp/house/kitchen salt '*' acl.getfacl /tmp/house/kitchen /tmp/house/livingroom salt '*' acl.getfacl /tmp/house/kitchen /tmp/house/livingroom recursive=True
Below is the the instruction that describes the task: ### Input: Return (extremely verbose) map of FACLs on specified file(s) CLI Examples: .. code-block:: bash salt '*' acl.getfacl /tmp/house/kitchen salt '*' acl.getfacl /tmp/house/kitchen /tmp/house/livingroom salt '*' acl.getfa...
def read_config(): """ Read a config file from ``$HOME/.profrc`` We expect a file of the following form [DEFAULT] Baseurl = https://your-prof-instance Login = username """ filename = path.join(path.expanduser('~'), '.profrc') config = configparser.ConfigParser() config.read(file...
Read a config file from ``$HOME/.profrc`` We expect a file of the following form [DEFAULT] Baseurl = https://your-prof-instance Login = username
Below is the the instruction that describes the task: ### Input: Read a config file from ``$HOME/.profrc`` We expect a file of the following form [DEFAULT] Baseurl = https://your-prof-instance Login = username ### Response: def read_config(): """ Read a config file from ``$HOME/.profrc`` ...
def closing(image, radius=None, mask=None, footprint = None): '''Do a morphological closing image - pixel image to operate on radius - use a structuring element with the given radius. If no structuring element, use an 8-connected structuring element. mask - if present, only use unmaske...
Do a morphological closing image - pixel image to operate on radius - use a structuring element with the given radius. If no structuring element, use an 8-connected structuring element. mask - if present, only use unmasked pixels for operations
Below is the the instruction that describes the task: ### Input: Do a morphological closing image - pixel image to operate on radius - use a structuring element with the given radius. If no structuring element, use an 8-connected structuring element. mask - if present, only use unmaske...
def times(A, b, offset=0): """ Times the view of A with b in place (!). Returns modified A Broadcasting is allowed, thus b can be scalar. if offset is not zero, make sure b is of right shape! :param ndarray A: 2 dimensional array :param ndarray-like b: either one dimensional or scalar ...
Times the view of A with b in place (!). Returns modified A Broadcasting is allowed, thus b can be scalar. if offset is not zero, make sure b is of right shape! :param ndarray A: 2 dimensional array :param ndarray-like b: either one dimensional or scalar :param int offset: same as in view. ...
Below is the the instruction that describes the task: ### Input: Times the view of A with b in place (!). Returns modified A Broadcasting is allowed, thus b can be scalar. if offset is not zero, make sure b is of right shape! :param ndarray A: 2 dimensional array :param ndarray-like b: either ...
def ocsp_responder_certificate_path(): """Get ocsp responder certificate path Test: TEST_of_SK_OCSP_RESPONDER_2011.pem Live: sk-ocsp-responder-certificates.pem Note: These files are distributed under esteid/certs :return: """ certificate_path = getattr(settings, 'ESTEID_OCSP_RESPONDER_CER...
Get ocsp responder certificate path Test: TEST_of_SK_OCSP_RESPONDER_2011.pem Live: sk-ocsp-responder-certificates.pem Note: These files are distributed under esteid/certs :return:
Below is the the instruction that describes the task: ### Input: Get ocsp responder certificate path Test: TEST_of_SK_OCSP_RESPONDER_2011.pem Live: sk-ocsp-responder-certificates.pem Note: These files are distributed under esteid/certs :return: ### Response: def ocsp_responder_certificate_path()...
def variantAnnotationSetsGenerator(self, request): """ Returns a generator over the (variantAnnotationSet, nextPageToken) pairs defined by the specified request. """ compoundId = datamodel.VariantSetCompoundId.parse( request.variant_set_id) dataset = self.getD...
Returns a generator over the (variantAnnotationSet, nextPageToken) pairs defined by the specified request.
Below is the the instruction that describes the task: ### Input: Returns a generator over the (variantAnnotationSet, nextPageToken) pairs defined by the specified request. ### Response: def variantAnnotationSetsGenerator(self, request): """ Returns a generator over the (variantAnnotationSet...
def delete_raid(self): """Clears the RAID configuration from the system. """ if not self.logical_drives: msg = ('No logical drives found on the controller ' '%(controller)s' % {'controller': str(self.controller_id)}) LOG.debug(msg) raise ex...
Clears the RAID configuration from the system.
Below is the the instruction that describes the task: ### Input: Clears the RAID configuration from the system. ### Response: def delete_raid(self): """Clears the RAID configuration from the system. """ if not self.logical_drives: msg = ('No logical drives found on the controll...
def credential_delete(self, *ids): """Delete one or more credentials. :param ids: one or more credential ids """ return self.raw_query("credential", "delete", data={ "credentials": [{"id": str(id)} for id in ids] })
Delete one or more credentials. :param ids: one or more credential ids
Below is the the instruction that describes the task: ### Input: Delete one or more credentials. :param ids: one or more credential ids ### Response: def credential_delete(self, *ids): """Delete one or more credentials. :param ids: one or more credential ids """ return sel...
def _convert_definition(self, definition, ref=None, cls=None): """ Converts any object to its troposphere equivalent, if applicable. This function will recurse into lists and mappings to create additional objects as necessary. :param {*} definition: Object to convert :pa...
Converts any object to its troposphere equivalent, if applicable. This function will recurse into lists and mappings to create additional objects as necessary. :param {*} definition: Object to convert :param str ref: Name of key in parent dict that the provided definition ...
Below is the the instruction that describes the task: ### Input: Converts any object to its troposphere equivalent, if applicable. This function will recurse into lists and mappings to create additional objects as necessary. :param {*} definition: Object to convert :param str ref: N...
def _call(self, stream, func): """ Call `func(self)`, catching any exception that might occur, logging it, and force-disconnecting the related `stream`. """ try: func(self) except Exception: LOG.exception('%r crashed', stream) stream.on...
Call `func(self)`, catching any exception that might occur, logging it, and force-disconnecting the related `stream`.
Below is the the instruction that describes the task: ### Input: Call `func(self)`, catching any exception that might occur, logging it, and force-disconnecting the related `stream`. ### Response: def _call(self, stream, func): """ Call `func(self)`, catching any exception that might occur,...
def encodeSentence(self, *words): """ Encode given sentence in API format. :param words: Words to endoce. :returns: Encoded sentence. """ encoded = map(self.encodeWord, words) encoded = b''.join(encoded) # append EOS (end of sentence) byte encoded...
Encode given sentence in API format. :param words: Words to endoce. :returns: Encoded sentence.
Below is the the instruction that describes the task: ### Input: Encode given sentence in API format. :param words: Words to endoce. :returns: Encoded sentence. ### Response: def encodeSentence(self, *words): """ Encode given sentence in API format. :param words: Words to ...
def supports_suggested_actions(channel_id: str, button_cnt: int = 100) -> bool: """Determine if a number of Suggested Actions are supported by a Channel. Args: channel_id (str): The Channel to check the if Suggested Actions are supported in. button_cnt (int, optional): Defaults ...
Determine if a number of Suggested Actions are supported by a Channel. Args: channel_id (str): The Channel to check the if Suggested Actions are supported in. button_cnt (int, optional): Defaults to 100. The number of Suggested Actions to check for the Channel. Returns: ...
Below is the the instruction that describes the task: ### Input: Determine if a number of Suggested Actions are supported by a Channel. Args: channel_id (str): The Channel to check the if Suggested Actions are supported in. button_cnt (int, optional): Defaults to 100. The number of ...
def cache_path(runas=None, env=None): ''' List path of the NPM cache directory. runas The user to run NPM with env Environment variables to set when invoking npm. Uses the same ``env`` format as the :py:func:`cmd.run <salt.modules.cmdmod.run>` execution function. C...
List path of the NPM cache directory. runas The user to run NPM with env Environment variables to set when invoking npm. Uses the same ``env`` format as the :py:func:`cmd.run <salt.modules.cmdmod.run>` execution function. CLI Example: .. code-block:: bash sal...
Below is the the instruction that describes the task: ### Input: List path of the NPM cache directory. runas The user to run NPM with env Environment variables to set when invoking npm. Uses the same ``env`` format as the :py:func:`cmd.run <salt.modules.cmdmod.run>` execution ...
def _load_and_verify_metadata(self, submission_type): """Loads and verifies metadata. Args: submission_type: type of the submission Returns: dictionaty with metadata or None if metadata not found or invalid """ metadata_filename = os.path.join(self._extracted_submission_dir, ...
Loads and verifies metadata. Args: submission_type: type of the submission Returns: dictionaty with metadata or None if metadata not found or invalid
Below is the the instruction that describes the task: ### Input: Loads and verifies metadata. Args: submission_type: type of the submission Returns: dictionaty with metadata or None if metadata not found or invalid ### Response: def _load_and_verify_metadata(self, submission_type): """Loa...
def use_master_key(flag=True): """是否使用 master key 发送请求。 如果不调用此函数,会根据 leancloud.init 的参数来决定是否使用 master key。 :type flag: bool """ global USE_MASTER_KEY if not flag: USE_MASTER_KEY = False return if not MASTER_KEY: raise RuntimeError('LeanCloud SDK master key not specif...
是否使用 master key 发送请求。 如果不调用此函数,会根据 leancloud.init 的参数来决定是否使用 master key。 :type flag: bool
Below is the the instruction that describes the task: ### Input: 是否使用 master key 发送请求。 如果不调用此函数,会根据 leancloud.init 的参数来决定是否使用 master key。 :type flag: bool ### Response: def use_master_key(flag=True): """是否使用 master key 发送请求。 如果不调用此函数,会根据 leancloud.init 的参数来决定是否使用 master key。 :type flag: bool ...
def reload(self): """ Reloads the limits configuration from the database. If an error occurs loading the configuration, an error-level log message will be emitted. Additionally, the error message will be added to the set specified by the 'redis.errors_key' configuration...
Reloads the limits configuration from the database. If an error occurs loading the configuration, an error-level log message will be emitted. Additionally, the error message will be added to the set specified by the 'redis.errors_key' configuration ('errors' by default) and sent to the...
Below is the the instruction that describes the task: ### Input: Reloads the limits configuration from the database. If an error occurs loading the configuration, an error-level log message will be emitted. Additionally, the error message will be added to the set specified by the 'redis.er...
def set_parameter(self, name, par, value, true_value=True, scale=None, bounds=None, error=None, update_source=True): """ Update the value of a parameter. Parameter bounds will automatically be adjusted to encompass the new parameter value. Parameters ...
Update the value of a parameter. Parameter bounds will automatically be adjusted to encompass the new parameter value. Parameters ---------- name : str Source name. par : str Parameter name. value : float Parameter value. ...
Below is the the instruction that describes the task: ### Input: Update the value of a parameter. Parameter bounds will automatically be adjusted to encompass the new parameter value. Parameters ---------- name : str Source name. par : str ...
def set(self, data_type, values): """Set the attribute value. Args:: data_type : attribute data type (see constants HC.xxx) values : attribute value(s); specify a list to create a multi-valued attribute; a string valued att...
Set the attribute value. Args:: data_type : attribute data type (see constants HC.xxx) values : attribute value(s); specify a list to create a multi-valued attribute; a string valued attribute can be created by setting 'data_type' ...
Below is the the instruction that describes the task: ### Input: Set the attribute value. Args:: data_type : attribute data type (see constants HC.xxx) values : attribute value(s); specify a list to create a multi-valued attribute; a string valued ...
def parse(self, data=None, table_name=None): """Parse the lines from index i :param data: optional, store the parsed result to it when specified :param table_name: when inside a table array, it is the table name """ temp = self.dict_() sub_table = None is_array =...
Parse the lines from index i :param data: optional, store the parsed result to it when specified :param table_name: when inside a table array, it is the table name
Below is the the instruction that describes the task: ### Input: Parse the lines from index i :param data: optional, store the parsed result to it when specified :param table_name: when inside a table array, it is the table name ### Response: def parse(self, data=None, table_name=None): ""...
def require_meta_and_content(self, content_handler, params, **kwargs): """Require 'meta' and 'content' dictionaries using proper hander. Args: content_handler (callable): function that accepts ``params, meta, **kwargs`` argument and returns dictionary for ``c...
Require 'meta' and 'content' dictionaries using proper hander. Args: content_handler (callable): function that accepts ``params, meta, **kwargs`` argument and returns dictionary for ``content`` response section params (dict): dictionary of parsed resource...
Below is the the instruction that describes the task: ### Input: Require 'meta' and 'content' dictionaries using proper hander. Args: content_handler (callable): function that accepts ``params, meta, **kwargs`` argument and returns dictionary for ``content`` resp...
def _make_matchers(self, crontab): ''' This constructs the full matcher struct. ''' crontab = _aliases.get(crontab, crontab) ct = crontab.split() if len(ct) == 5: ct.insert(0, '0') ct.append('*') elif len(ct) == 6: ct.insert(0, ...
This constructs the full matcher struct.
Below is the the instruction that describes the task: ### Input: This constructs the full matcher struct. ### Response: def _make_matchers(self, crontab): ''' This constructs the full matcher struct. ''' crontab = _aliases.get(crontab, crontab) ct = crontab.split() i...
def nucleotidesToStr(nucleotides, prefix=''): """ Convert offsets and base counts to a string. @param nucleotides: A C{defaultdict(Counter)} instance, keyed by C{int} offset, with nucleotides keying the Counters. @param prefix: A C{str} to put at the start of each line. @return: A C{str} re...
Convert offsets and base counts to a string. @param nucleotides: A C{defaultdict(Counter)} instance, keyed by C{int} offset, with nucleotides keying the Counters. @param prefix: A C{str} to put at the start of each line. @return: A C{str} representation of the offsets and nucleotide counts ...
Below is the the instruction that describes the task: ### Input: Convert offsets and base counts to a string. @param nucleotides: A C{defaultdict(Counter)} instance, keyed by C{int} offset, with nucleotides keying the Counters. @param prefix: A C{str} to put at the start of each line. @return: ...
def Add(self, service, method, request, global_params=None): """Add a request to the batch. Args: service: A class inheriting base_api.BaseApiService. method: A string indicated desired method from the service. See the example in the class docstring. request:...
Add a request to the batch. Args: service: A class inheriting base_api.BaseApiService. method: A string indicated desired method from the service. See the example in the class docstring. request: An input message appropriate for the specified service.me...
Below is the the instruction that describes the task: ### Input: Add a request to the batch. Args: service: A class inheriting base_api.BaseApiService. method: A string indicated desired method from the service. See the example in the class docstring. request: An...
def _get_build_path(app_spec): """ Given a spec for an app, returns the value of the `build` field for docker-compose. If the path is relative, it is expanded and added to the path of the app's repo. """ if os.path.isabs(app_spec['build']): return app_spec['build'] return os.path.join(Repo(app_s...
Given a spec for an app, returns the value of the `build` field for docker-compose. If the path is relative, it is expanded and added to the path of the app's repo.
Below is the the instruction that describes the task: ### Input: Given a spec for an app, returns the value of the `build` field for docker-compose. If the path is relative, it is expanded and added to the path of the app's repo. ### Response: def _get_build_path(app_spec): """ Given a spec for an app, ret...
def multi_move(self, path_list, **kwargs): """批量移动文件或目录. :param path_list: 源文件地址和目标文件地址对列表: >>> path_list = [ ... ('/apps/test_sdk/test.txt', # 源文件 ... '/apps/test_sdk/testmkdir/b.txt' # 目标文件 ...
批量移动文件或目录. :param path_list: 源文件地址和目标文件地址对列表: >>> path_list = [ ... ('/apps/test_sdk/test.txt', # 源文件 ... '/apps/test_sdk/testmkdir/b.txt' # 目标文件 ... ), ... ('/apps/test...
Below is the the instruction that describes the task: ### Input: 批量移动文件或目录. :param path_list: 源文件地址和目标文件地址对列表: >>> path_list = [ ... ('/apps/test_sdk/test.txt', # 源文件 ... '/apps/test_sdk/testmkdir/b.txt' # 目标文件 ...
def registerMUX(self, stm: Union[HdlStatement, Operator], sig: RtlSignal, inputs_cnt: int): """ mux record is in format (self.MUX, n, m) where n is number of bits of this mux and m is number of possible inputs """ assert inputs_cnt > 1 res = se...
mux record is in format (self.MUX, n, m) where n is number of bits of this mux and m is number of possible inputs
Below is the the instruction that describes the task: ### Input: mux record is in format (self.MUX, n, m) where n is number of bits of this mux and m is number of possible inputs ### Response: def registerMUX(self, stm: Union[HdlStatement, Operator], sig: RtlSignal, inputs_cnt: ...
def _calcOrbits(self): """Prepares data structure for breaking data into orbits. Not intended for end user.""" # if the breaks between orbit have not been defined, define them # also, store the data so that grabbing different orbits does not # require reloads of whole dataset ...
Prepares data structure for breaking data into orbits. Not intended for end user.
Below is the the instruction that describes the task: ### Input: Prepares data structure for breaking data into orbits. Not intended for end user. ### Response: def _calcOrbits(self): """Prepares data structure for breaking data into orbits. Not intended for end user.""" # if the br...
def get_node(self,obj,cls=type(None),hist={}): """ Returns the node corresponding to obj. If does not already exist then it will create it. """ #~ ident = getattr(obj,'ident',obj) if obj in self.modules and is_module(obj,cls): return self.modules[obj] ...
Returns the node corresponding to obj. If does not already exist then it will create it.
Below is the the instruction that describes the task: ### Input: Returns the node corresponding to obj. If does not already exist then it will create it. ### Response: def get_node(self,obj,cls=type(None),hist={}): """ Returns the node corresponding to obj. If does not already exist ...
def remove_entry(self, pathname_name, recursive=True): """Removes the specified child file or directory. Args: pathname_name: Basename of the child object to remove. recursive: If True (default), the entries in contained directories are deleted first. Used to pro...
Removes the specified child file or directory. Args: pathname_name: Basename of the child object to remove. recursive: If True (default), the entries in contained directories are deleted first. Used to propagate removal errors (e.g. permission problems) f...
Below is the the instruction that describes the task: ### Input: Removes the specified child file or directory. Args: pathname_name: Basename of the child object to remove. recursive: If True (default), the entries in contained directories are deleted first. Used to ...
def format_cmd(args): """ Format the arg list appropriate for display as a command line with individual arguments quoted appropriately. This is intended for logging or display and not as input to a command interpreter (shell). """ if args is None: return '' out = '' if not isinstanc...
Format the arg list appropriate for display as a command line with individual arguments quoted appropriately. This is intended for logging or display and not as input to a command interpreter (shell).
Below is the the instruction that describes the task: ### Input: Format the arg list appropriate for display as a command line with individual arguments quoted appropriately. This is intended for logging or display and not as input to a command interpreter (shell). ### Response: def format_cmd(args): ...
def set_osc_code(self, params): """ Set attributes based on OSC (Operating System Command) parameters. Parameters ---------- params : sequence of str The parameters for the command. """ try: command = int(params.pop(0)) except (IndexError,...
Set attributes based on OSC (Operating System Command) parameters. Parameters ---------- params : sequence of str The parameters for the command.
Below is the the instruction that describes the task: ### Input: Set attributes based on OSC (Operating System Command) parameters. Parameters ---------- params : sequence of str The parameters for the command. ### Response: def set_osc_code(self, params): """ Set attri...
def _findFiles(self,pushdir,files=None): """Find all files, return dict, where key is filename files[filename]=dictionary where dictionary has keys: ['mtime'] = modification time """ #If no file list given, go through all if not files: fil...
Find all files, return dict, where key is filename files[filename]=dictionary where dictionary has keys: ['mtime'] = modification time
Below is the the instruction that describes the task: ### Input: Find all files, return dict, where key is filename files[filename]=dictionary where dictionary has keys: ['mtime'] = modification time ### Response: def _findFiles(self,pushdir,files=None): """Find all files, retur...
def make_call_types(f, globals_d): # type: (Callable, Dict) -> Tuple[Dict[str, Anno], Anno] """Make a call_types dictionary that describes what arguments to pass to f Args: f: The function to inspect for argument names (without self) globals_d: A dictionary of globals to lookup annotation d...
Make a call_types dictionary that describes what arguments to pass to f Args: f: The function to inspect for argument names (without self) globals_d: A dictionary of globals to lookup annotation definitions in
Below is the the instruction that describes the task: ### Input: Make a call_types dictionary that describes what arguments to pass to f Args: f: The function to inspect for argument names (without self) globals_d: A dictionary of globals to lookup annotation definitions in ### Response: def m...
def apply(self, q, bindings, cuts): """ Apply a set of filters, which can be given as a set of tuples in the form (ref, operator, value), or as a string in query form. If it is ``None``, no filter will be applied. """ info = [] for (ref, operator, value) in self.parse(cuts): ...
Apply a set of filters, which can be given as a set of tuples in the form (ref, operator, value), or as a string in query form. If it is ``None``, no filter will be applied.
Below is the the instruction that describes the task: ### Input: Apply a set of filters, which can be given as a set of tuples in the form (ref, operator, value), or as a string in query form. If it is ``None``, no filter will be applied. ### Response: def apply(self, q, bindings, cuts): ""...
def xrmerge(das, accept_new=True): """ Merges xarrays with different dimension sets Parameters ---------- das : list of data_arrays accept_new Returns ------- da : an xarray that is the merge of das References ---------- Thanks to @jcmgray https://github.com/pydata/xar...
Merges xarrays with different dimension sets Parameters ---------- das : list of data_arrays accept_new Returns ------- da : an xarray that is the merge of das References ---------- Thanks to @jcmgray https://github.com/pydata/xarray/issues/742#issue-130753818 In the futu...
Below is the the instruction that describes the task: ### Input: Merges xarrays with different dimension sets Parameters ---------- das : list of data_arrays accept_new Returns ------- da : an xarray that is the merge of das References ---------- Thanks to @jcmgray https:/...
def isin(self, values): """ Compute boolean array of whether each index value is found in the passed set of values. Parameters ---------- values : set or sequence of values Returns ------- is_contained : ndarray (boolean dtype) """ ...
Compute boolean array of whether each index value is found in the passed set of values. Parameters ---------- values : set or sequence of values Returns ------- is_contained : ndarray (boolean dtype)
Below is the the instruction that describes the task: ### Input: Compute boolean array of whether each index value is found in the passed set of values. Parameters ---------- values : set or sequence of values Returns ------- is_contained : ndarray (boolean ...
def posterior_samples_f(self,X, size=10, **predict_kwargs): """ Samples the posterior GP at the points X. :param X: The points at which to take the samples. :type X: np.ndarray (Nnew x self.input_dim) :param size: the number of a posteriori samples. :type size: int. ...
Samples the posterior GP at the points X. :param X: The points at which to take the samples. :type X: np.ndarray (Nnew x self.input_dim) :param size: the number of a posteriori samples. :type size: int. :returns: set of simulations :rtype: np.ndarray (Nnew x D x samples)
Below is the the instruction that describes the task: ### Input: Samples the posterior GP at the points X. :param X: The points at which to take the samples. :type X: np.ndarray (Nnew x self.input_dim) :param size: the number of a posteriori samples. :type size: int. :return...
def _authenticate_user_dn(self, password): """ Binds to the LDAP server with the user's DN and password. Raises AuthenticationFailed on failure. """ if self.dn is None: raise self.AuthenticationFailed("failed to map the username to a DN.") try: st...
Binds to the LDAP server with the user's DN and password. Raises AuthenticationFailed on failure.
Below is the the instruction that describes the task: ### Input: Binds to the LDAP server with the user's DN and password. Raises AuthenticationFailed on failure. ### Response: def _authenticate_user_dn(self, password): """ Binds to the LDAP server with the user's DN and password. Raises ...
def get_all_eip_addresses(addresses=None, allocation_ids=None, region=None, key=None, keyid=None, profile=None): ''' Get public addresses of some, or all EIPs associated with the current account. addresses (list) - Optional list of addresses. If provided, only the addres...
Get public addresses of some, or all EIPs associated with the current account. addresses (list) - Optional list of addresses. If provided, only the addresses associated with those in the list will be returned. allocation_ids (list) - Optional list of allocation IDs. If provided, only ...
Below is the the instruction that describes the task: ### Input: Get public addresses of some, or all EIPs associated with the current account. addresses (list) - Optional list of addresses. If provided, only the addresses associated with those in the list will be returned. allocation_ids ...
def _check_deprecated(self, dest, kwargs): """Checks option for deprecation and issues a warning/error if necessary.""" removal_version = kwargs.get('removal_version', None) if removal_version is not None: warn_or_error( removal_version=removal_version, deprecated_entity_description="o...
Checks option for deprecation and issues a warning/error if necessary.
Below is the the instruction that describes the task: ### Input: Checks option for deprecation and issues a warning/error if necessary. ### Response: def _check_deprecated(self, dest, kwargs): """Checks option for deprecation and issues a warning/error if necessary.""" removal_version = kwargs.get('removal...
def flattened_nested_key_indices(nested_dict): """ Combine the outer and inner keys of nested dictionaries into a single ordering. """ outer_keys, inner_keys = collect_nested_keys(nested_dict) combined_keys = list(sorted(set(outer_keys + inner_keys))) return {k: i for (i, k) in enumerate(com...
Combine the outer and inner keys of nested dictionaries into a single ordering.
Below is the the instruction that describes the task: ### Input: Combine the outer and inner keys of nested dictionaries into a single ordering. ### Response: def flattened_nested_key_indices(nested_dict): """ Combine the outer and inner keys of nested dictionaries into a single ordering. """ ...
def download(self): """Download an image file if it exists :raise GyazoError: """ if self.url: try: return requests.get(self.url).content except requests.RequestException as e: raise GyazoError(str(e)) return None
Download an image file if it exists :raise GyazoError:
Below is the the instruction that describes the task: ### Input: Download an image file if it exists :raise GyazoError: ### Response: def download(self): """Download an image file if it exists :raise GyazoError: """ if self.url: try: return requ...
def flip_strand(self): """Flips the strand of the alleles.""" self.reference = complement_alleles(self.reference) self.coded = complement_alleles(self.coded) self.variant.complement_alleles()
Flips the strand of the alleles.
Below is the the instruction that describes the task: ### Input: Flips the strand of the alleles. ### Response: def flip_strand(self): """Flips the strand of the alleles.""" self.reference = complement_alleles(self.reference) self.coded = complement_alleles(self.coded) self.variant....
def getElementsByName(self, name, root='root', useIndex=True): ''' getElementsByName - Searches and returns all elements with a specific name. @param name <str> - A string of the name attribute @param root <AdvancedTag/'root'> - Search starting at a sp...
getElementsByName - Searches and returns all elements with a specific name. @param name <str> - A string of the name attribute @param root <AdvancedTag/'root'> - Search starting at a specific node, if provided. if string 'root', the root of the parsed tree will be used. ...
Below is the the instruction that describes the task: ### Input: getElementsByName - Searches and returns all elements with a specific name. @param name <str> - A string of the name attribute @param root <AdvancedTag/'root'> - Search starting at a specific node, if pr...
def contract(self, x): """Contract each of the `active` `Segments` by ``x`` seconds. This method adds ``x`` to each segment's lower bound, and subtracts ``x`` from the upper bound. The :attr:`~DataQualityFlag.active` `SegmentList` is modified in place. Parameters ...
Contract each of the `active` `Segments` by ``x`` seconds. This method adds ``x`` to each segment's lower bound, and subtracts ``x`` from the upper bound. The :attr:`~DataQualityFlag.active` `SegmentList` is modified in place. Parameters ---------- x : `float` ...
Below is the the instruction that describes the task: ### Input: Contract each of the `active` `Segments` by ``x`` seconds. This method adds ``x`` to each segment's lower bound, and subtracts ``x`` from the upper bound. The :attr:`~DataQualityFlag.active` `SegmentList` is modified ...