Dataset Viewer
Auto-converted to Parquet Duplicate
Unnamed: 0.1
int64
0
499
Unnamed: 0
int64
48
24.3k
code
stringlengths
85
10.5k
docstring
stringlengths
11
15.5k
prompt
stringlengths
259
26.1k
0
1,677
def add_lexicographic_constraints(model, objectives, objective_direction=): if type(objective_direction) is not list: objective_direction = [objective_direction] * len(objectives) constraints = [] for rxn_id, obj_dir in zip(o...
Successively optimize separate targets in a specific order. For each objective, optimize the model and set the optimal value as a constraint. Proceed in the order of the objectives given. Due to the specific order this is called lexicographic FBA [1]_. This procedure is useful for returning unique solu...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Successively optimize separate targets in a specific order. For each objective, optimize the model and set the optimal value as a constraint. Proceed in the order of the objectives given...
1
16,592
def GetManagedObject(self, inMo=None, classId=None, params=None, inHierarchical=False, dumpXml=None): from Ucs import ClassFactory, Dn, DnSet, OrFilter, EqFilter, AndFilter, WcardFilter, FilterFilter from Mos import LsServer from UcsBase import WriteUcsWarning, WriteObject, UcsUtils, ManagedObject, AbstractFil...
Gets Managed Object from UCS. - inMo, if provided, it acts as a parent for the present operation. It should be None unless a user wants to define a parent scope. It can be a single MO or a list containing multiple managed objects. - classId of the managed object/s to get. - params contains semicolon (;) s...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Gets Managed Object from UCS. - inMo, if provided, it acts as a parent for the present operation. It should be None unless a user wants to define a parent scope. It can be a single MO o...
2
10,081
def _mom(self, k, dist, cache): return (-1)**numpy.sum(k)*evaluation.evaluate_moment( dist, k, cache=cache)
Statistical moments.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Statistical moments. ### Output: def _mom(self, k, dist, cache): return (-1)**numpy.sum(k)*evaluation.evaluate_moment( dist, k, cache=cache)
3
19,432
def save_binary(self, filename): _safe_call(_LIB.LGBM_DatasetSaveBinary( self.construct().handle, c_str(filename))) return self
Save Dataset to a binary file. Parameters ---------- filename : string Name of the output file. Returns ------- self : Dataset Returns self.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Save Dataset to a binary file. Parameters ---------- filename : string Name of the output file. Returns ------- self : Dataset ...
4
7,844
def copy_reference_group(resource, doc, env, *args, **kwargs): all_headers = [] for ref in doc.references(): if ref.get_value() == resource.get_value(): for row in ref.iterrowproxy(): all_headers.append(list(row.keys())) break heade...
A Row generating function that copies all of the references that have the same 'Group' argument as this reference The 'RefArgs' argument is a comma seperated list of arguments from the references that will be prepended to each row. :param resource: :param doc: :param env: :param args: :par...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: A Row generating function that copies all of the references that have the same 'Group' argument as this reference The 'RefArgs' argument is a comma seperated list of arguments from the refer...
5
16,803
def readlink(path): * if sys.getwindowsversion().major < 6: raise SaltInvocationError() try: return salt.utils.path.readlink(path) except OSError as exc: if exc.errno == errno.EINVAL: raise CommandExecutionError(.format(path)) raise CommandExecutionError(exc....
Return the path that a symlink points to This is only supported on Windows Vista or later. Inline with Unix behavior, this function will raise an error if the path is not a symlink, however, the error raised will be a SaltInvocationError, not an OSError. Args: path (str): The path to the ...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Return the path that a symlink points to This is only supported on Windows Vista or later. Inline with Unix behavior, this function will raise an error if the path is not a symlink,...
6
7,089
def dtw_distance(rep_one, rep_two, norm=True): if not isinstance(rep_one, np.ndarray): rep_one = rep_one.to_array() if not isinstance(rep_two, np.ndarray): rep_two = rep_two.to_array() assert (rep_one.shape[1] == rep_two.shape[1]) distMat = generate_distance_matrix(rep_one, rep_two)...
Computes the distance between two representations with the same number of filters using Dynamic Time Warping. Parameters ---------- rep_one : 2D array First representation to compare. First dimension is time in frames or samples and second dimension is the features. rep_two : 2D arr...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Computes the distance between two representations with the same number of filters using Dynamic Time Warping. Parameters ---------- rep_one : 2D array First representatio...
7
19,052
def start_tag(self, name, attrs=None): if not attrs: self._write( % name) else: self._write( + name) for (name, value) in sorted(attrs.items()): self._write( % (name, quoteattr(scientificformat(value)))) self._...
Open an XML tag
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Open an XML tag ### Output: def start_tag(self, name, attrs=None): if not attrs: self._write( % name) else: self._write( + name) for ...
8
14,336
def create(self, name): timer = metrics.Timer() timer.start() type = self.resolver.find(name) if type is None: raise TypeNotFound(name) if type.enum(): result = sudsobject.Factory.object(name) for e, a in type.children(): ...
Create a WSDL type by name. @param name: The name of a type defined in the WSDL. @type name: str @return: The requested object. @rtype: L{Object}
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Create a WSDL type by name. @param name: The name of a type defined in the WSDL. @type name: str @return: The requested object. @rtype: L{Object} ### Output: def...
9
15,658
async def destroy_async(self): try: await self.lock_async() _logger.debug("Unlocked connection %r to close.", self.container_id) await self._close_async() except asyncio.TimeoutError: _logger.debug( "Connection %r timed out while w...
Close the connection asynchronously, and close any associated CBS authentication session.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Close the connection asynchronously, and close any associated CBS authentication session. ### Output: async def destroy_async(self): try: await self.lock_asy...
10
8,860
def colorize(cls, color, string, auto=False): tag = .format( if auto else , color) return cls( % (tag, string, tag))
Color-code entire string using specified color. :param str color: Color of string. :param str string: String to colorize. :param bool auto: Enable auto-color (dark/light terminal). :return: Class instance for colorized string. :rtype: Color
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Color-code entire string using specified color. :param str color: Color of string. :param str string: String to colorize. :param bool auto: Enable auto-color (dark/light ...
11
858
def get_record_rdd_from_json_files(self, json_files: List[str], data_processor: DataProcessor = SimpleJsonDataProcessor(), spark_session: Optional[] = None) -> : spark_context = get_spar...
Reads the data from the given json_files path and converts them into the `Record`s format for processing. `data_processor` is used to process the per event data in those files to convert them into `Record`. :param json_files: List of json file paths. Regular Spark path wildcards are accepted. ...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Reads the data from the given json_files path and converts them into the `Record`s format for processing. `data_processor` is used to process the per event data in those files to convert ...
12
7,161
def datetime(self): if not self._datetime_calculated: self._datetime_calculated = True split_tokens = self.split_tokens[:10] for offs in range(len(split_tokens)): dt = self._match_datetime_pattern(split_tokens[offs:offs + 4...
Extract datetime if available (lazy).
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Extract datetime if available (lazy). ### Output: def datetime(self): if not self._datetime_calculated: self._datetime_calculated = True ...
13
8,368
def description(self): description = self.label if self.locator: description += " {}".format(desc(self.locator)) if self.options["text"] is not None: description += " with text {}".format(desc(self.options["text"])) description += self.selector.descrip...
str: A long description of this query.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: str: A long description of this query. ### Output: def description(self): description = self.label if self.locator: description += " {}".format(desc(self.l...
14
3,874
def burczynski06() -> AnnData: filename = settings.datasetdir / url = adata = sc.read(filename, backup_url=url) return adata
Bulk data with conditions ulcerative colitis (UC) and Crohn's disease (CD). The study assesses transcriptional profiles in peripheral blood mononuclear cells from 42 healthy individuals, 59 CD patients, and 26 UC patients by hybridization to microarrays interrogating more than 22,000 sequences. Refere...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Bulk data with conditions ulcerative colitis (UC) and Crohn's disease (CD). The study assesses transcriptional profiles in peripheral blood mononuclear cells from 42 healthy individuals,...
15
16,514
def folder_get_content(self, folder_key=None, content_type=None, filter_=None, device_id=None, order_by=None, order_direction=None, chunk=None, details=None, chunk_size=None): return self.request(, QueryParams({ ...
folder/get_content http://www.mediafire.com/developers/core_api/1.3/folder/#get_content
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: folder/get_content http://www.mediafire.com/developers/core_api/1.3/folder/#get_content ### Output: def folder_get_content(self, folder_key=None, content_type=None, ...
16
10,301
def wait_for_logs_matching(container, matcher, timeout=10, encoding=, **logs_kwargs): try: for line in stream_logs(container, timeout=timeout, **logs_kwargs): line = line.decode(encoding).rstrip() if matcher(line): return l...
Wait for matching log line(s) from the given container by streaming the container's stdout and/or stderr outputs. Each log line is decoded and any trailing whitespace is stripped before the line is matched. :param ~docker.models.containers.Container container: Container who's log lines to wait...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Wait for matching log line(s) from the given container by streaming the container's stdout and/or stderr outputs. Each log line is decoded and any trailing whitespace is stripped before ...
17
5,680
def integrate(ii, r0, c0, r1, c1): S = np.zeros(ii.shape[-1]) S += ii[r1, c1] if (r0 - 1 >= 0) and (c0 - 1 >= 0): S += ii[r0 - 1, c0 - 1] if (r0 - 1 >= 0): S -= ii[r0 - 1, c1] if (c0 - 1 >= 0): S -= ii[r1, c0 - 1] return S
Use an integral image to integrate over a given window. Parameters ---------- ii : ndarray Integral image. r0, c0 : int Top-left corner of block to be summed. r1, c1 : int Bottom-right corner of block to be summed. Returns ------- S : int Integral (sum) ...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Use an integral image to integrate over a given window. Parameters ---------- ii : ndarray Integral image. r0, c0 : int Top-left corner of block to be summed. ...
18
1,516
def sort_dataframe_cols(self): cols = self.df.columns groups = list(map(lambda x: self.data_model.get_group_for_col(self.dtype, x), cols)) sorted_cols = cols.groupby(groups) ordered_cols = [] try: names = sorted_cols.pop() except Key...
Sort self.df so that self.name is the first column, and the rest of the columns are sorted by group.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Sort self.df so that self.name is the first column, and the rest of the columns are sorted by group. ### Output: def sort_dataframe_cols(self): cols = self.df.c...
19
2,691
def from_rdmol(rdmol, assign_descriptor=True): mol = Compound() conf = rdmol.GetConformer() Chem.Kekulize(rdmol) for atom in rdmol.GetAtoms(): key = atom.GetIdx() a = Atom(atom.GetSymbol()) a.coords = conf.GetAtomPosition(key) mol.add_atom(key, a) for bond in rdm...
Convert RDMol to molecule
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Convert RDMol to molecule ### Output: def from_rdmol(rdmol, assign_descriptor=True): mol = Compound() conf = rdmol.GetConformer() Chem.Kekulize(rdmol) for atom in rdmol.GetA...
20
9,071
def fit_with_hmc(model, observed_time_series, num_results=100, num_warmup_steps=50, num_leapfrog_steps=15, initial_state=None, initial_step_size=None, chain_batch_shape=(), num_variati...
Draw posterior samples using Hamiltonian Monte Carlo (HMC). Markov chain Monte Carlo (MCMC) methods are considered the gold standard of Bayesian inference; under suitable conditions and in the limit of infinitely many draws they generate samples from the true posterior distribution. HMC [1] uses gradients of t...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Draw posterior samples using Hamiltonian Monte Carlo (HMC). Markov chain Monte Carlo (MCMC) methods are considered the gold standard of Bayesian inference; under suitable conditions and in t...
21
11,645
def from_triples(cls, triples, remap_nodeids=True): top_nid = str(LTOP_NODEID) top = lnk = surface = identifier = None nids, nd, edges = [], {}, [] for src, rel, tgt in triples: src, tgt = str(src), str(tgt) if src == top_nid and rel == : ...
Decode triples, as from :meth:`to_triples`, into a Dmrs object.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Decode triples, as from :meth:`to_triples`, into a Dmrs object. ### Output: def from_triples(cls, triples, remap_nodeids=True): top_nid = str(LTOP_NODEID) top = lnk = su...
22
14,381
def start(ctx, alias, description, f): today = datetime.date.today() try: timesheet_collection = get_timesheet_collection_for_context(ctx, f) except ParseError as e: ctx.obj[].err(e) return t = timesheet_collection.latest() duration = (new_entry_start_time, None)...
Use it when you start working on the given activity. This will add the activity and the current time to your entries file. When you're finished, use the stop command.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Use it when you start working on the given activity. This will add the activity and the current time to your entries file. When you're finished, use the stop command. ### Output: def sta...
23
23,558
def get_plugins_by_name(self, *names): self._import_plugins() plugin_instances = [] for name in names: if isinstance(name, six.string_types): try: plugin_instances.append(self.plugins[name.lower()]) except KeyError: ...
Return a list of plugins by plugin class, or name.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Return a list of plugins by plugin class, or name. ### Output: def get_plugins_by_name(self, *names): self._import_plugins() plugin_instances = [] for name in na...
24
2,528
def get_cert_file(): try: current_path = os.path.realpath(__file__) ca_cert_path = os.path.join(current_path, "..", "..", "..", "conf", "cacert.pem") return os.path.abspath(ca_cert_path) except Exception: return None
Get the certificates file for https
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Get the certificates file for https ### Output: def get_cert_file(): try: current_path = os.path.realpath(__file__) ca_cert_path = os.path.join(current_path, "..", "..",...
25
22,335
def arp_packet(opcode, src_mac, src_ip, dst_mac, dst_ip): pkt = packet.Packet() eth_pkt = ethernet.ethernet(dst_mac, src_mac, ETH_TYPE_ARP) pkt.add_protocol(eth_pkt) arp_pkt = arp.arp_ip(opcode, src_mac, src_ip, dst_mac, dst_ip) pkt.add_protocol(arp_pk...
Generate ARP packet with ethernet encapsulated.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Generate ARP packet with ethernet encapsulated. ### Output: def arp_packet(opcode, src_mac, src_ip, dst_mac, dst_ip): pkt = packet.Packet() eth_pkt = ethernet.e...
26
11,321
def get_split_datasets(self, X, y=None, **fit_params): dataset = self.get_dataset(X, y) if self.train_split: dataset_train, dataset_valid = self.train_split( dataset, y, **fit_params) else: dataset_train, dataset_valid = dataset, None retu...
Get internal train and validation datasets. The validation dataset can be None if ``self.train_split`` is set to None; then internal validation will be skipped. Override this if you want to change how the net splits incoming data into train and validation part. Parameters ...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Get internal train and validation datasets. The validation dataset can be None if ``self.train_split`` is set to None; then internal validation will be skipped. Override...
27
15,431
def getMultiSeriesRegistrations(self,q_filter=Q(),name_series=False,**kwargs): series_registered = self.getSeriesRegistered(q_filter,distinct=False,counter=False,**kwargs) counter_items = Counter(series_registered).items() multireg_list = [x for x in counter_items if x[1] > 1] ...
Use the getSeriesRegistered method above to get a list of each series the person has registered for. The return only indicates whether they are registered more than once for the same series (e.g. for keeping track of dance admissions for couples who register under one name).
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Use the getSeriesRegistered method above to get a list of each series the person has registered for. The return only indicates whether they are registered more than once for the ...
28
13,307
def cornerpoints(results, thin=1, span=None, cmap=, color=None, kde=True, nkde=1000, plot_kwargs=None, labels=None, label_kwargs=None, truths=None, truth_color=, truth_kwargs=None, max_n_ticks=5, use_math_text=False, fig=None): if truth_...
Generate a (sub-)corner plot of (weighted) samples. Parameters ---------- results : :class:`~dynesty.results.Results` instance A :class:`~dynesty.results.Results` instance from a nested sampling run. **Compatible with results derived from** `nestle <http://kylebarbary.com/nestle/>`_...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Generate a (sub-)corner plot of (weighted) samples. Parameters ---------- results : :class:`~dynesty.results.Results` instance A :class:`~dynesty.results.Results` instance fr...
29
23,076
def setup_privnet(self, host=None): self.setup(FILENAME_SETTINGS_PRIVNET) if isinstance(host, str): if ":" in host: raise Exception("No protocol prefix or port allowed in host, use just the IP or domain.") print("Using custom privatenet host:", host) ...
Load settings from the privnet JSON config file Args: host (string, optional): if supplied, uses this IP or domain as neo nodes. The host must use these standard ports: P2P 20333, RPC 30333.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Load settings from the privnet JSON config file Args: host (string, optional): if supplied, uses this IP or domain as neo nodes. The host must ...
30
2,547
async def submit_action(pool_handle: int, request_json: str, nodes: Optional[str], timeout: Optional[int]) -> str: logger = logging.getLogger(__name__) logger.debug("submit_action: >>> pool_handle: %r, request_json: %r, nodes: %r, tim...
Send action to particular nodes of validator pool. The list of requests can be send: POOL_RESTART GET_VALIDATOR_INFO The request is sent to the nodes as is. It's assumed that it's already prepared. :param pool_handle: pool handle (created by open_pool_ledger). :param request_js...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Send action to particular nodes of validator pool. The list of requests can be send: POOL_RESTART GET_VALIDATOR_INFO The request is sent to the nodes as is. It's ...
31
741
def isOnAxis(self): new = self.__class__() new.update(self) s = new.strip() dims = list(s.keys()) if len(dims)> 1: return False elif len(dims)==1: return dims[0] return None
Returns statements about this location: * False if the location is not on-axis * The name of the axis if it is on-axis * None if the Location is at the origin Note: this is only valid for an unbiased location. :: >>> l = Location(pop=1) ...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Returns statements about this location: * False if the location is not on-axis * The name of the axis if it is on-axis * None if the Location is...
32
10,609
def create_event(): event = windll.kernel32.CreateEventA( None, BOOL(True), BOOL(True), None ) if not event: raise Exception() return event
Create Win32 event.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Create Win32 event. ### Output: def create_event(): event = windll.kernel32.CreateEventA( None, BOOL(True), BOOL(True), None ) if not eve...
33
11,779
def outputs_of(self, idx, create=False): if create and not idx in self.edges: self.edges[idx] = set() return self.edges[idx]
Get a set of the outputs for a given node index.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Get a set of the outputs for a given node index. ### Output: def outputs_of(self, idx, create=False): if create and not idx in self.edges: self.edges[idx] = set() ...
34
17,913
def new_dataset(args): if not args.args: raise ParserError() outdir = Path(args.args.pop(0)) if not outdir.exists(): raise ParserError() id_pattern = re.compile() md = {} if args.args: md[] = args.args.pop(0) else: md[] = input() while not id_patter...
lexibank new-dataset OUTDIR [ID]
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: lexibank new-dataset OUTDIR [ID] ### Output: def new_dataset(args): if not args.args: raise ParserError() outdir = Path(args.args.pop(0)) if not outdir.exists(): ...
35
5,624
def get_db(self, db=): if db not in self._db: self._db[db] = self.client(db)[db] return self._db[db]
Get a db instance :param db: database name :return: the motor db instance
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Get a db instance :param db: database name :return: the motor db instance ### Output: def get_db(self, db=): if db not in self._db: self._db[db] = se...
36
19,068
def get_pubmed_citation_response(pubmed_identifiers: Iterable[str]): pubmed_identifiers = list(pubmed_identifiers) url = EUTILS_URL_FMT.format(.join( pubmed_identifier for pubmed_identifier in pubmed_identifiers if pubmed_identifier )) response = requests.get(url) return...
Get the response from PubMed E-Utils for a given list of PubMed identifiers. :param pubmed_identifiers: :rtype: dict
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Get the response from PubMed E-Utils for a given list of PubMed identifiers. :param pubmed_identifiers: :rtype: dict ### Output: def get_pubmed_citation_response(pubmed_identifiers: Ite...
37
24,137
def _resample_residual(self, star, epsf): x = epsf._oversampling[0] * star._xidx_centered y = epsf._oversampling[1] * star._yidx_centered epsf_xcenter, epsf_ycenter = epsf.origin xidx = _py2intround(x + epsf_xcenter) yidx = _py2intround(y + epsf_ycente...
Compute a normalized residual image in the oversampled ePSF grid. A normalized residual image is calculated by subtracting the normalized ePSF model from the normalized star at the location of the star in the undersampled grid. The normalized residual image is then resampled fr...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Compute a normalized residual image in the oversampled ePSF grid. A normalized residual image is calculated by subtracting the normalized ePSF model from the normalized s...
38
20,944
def humanize_size(size): for factor, format_string in ((1, ), (1024, ), (1024 * 1024, )): if size / factor < 1024: return format_string % (size / factor) return format_string % (size / factor)
Create a nice human readable representation of the given number (understood as bytes) using the "KiB" and "MiB" suffixes to indicate kibibytes and mebibytes. A kibibyte is defined as 1024 bytes (as opposed to a kilobyte which is 1000 bytes) and a mibibyte is 1024**2 bytes (as opposed to a megabyte which...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Create a nice human readable representation of the given number (understood as bytes) using the "KiB" and "MiB" suffixes to indicate kibibytes and mebibytes. A kibibyte is defined as 1024...
39
18,101
def _compute_layer_name(is_defined_within_template, arn): if is_defined_within_template: return arn try: _, layer_name, layer_version = arn.rsplit(, 2) except ValueError: raise InvalidLayerVersionArn(arn + " is an Invalid Layer Arn...
Computes a unique name based on the LayerVersion Arn Format: <Name of the LayerVersion>-<Version of the LayerVersion>-<sha256 of the arn> Parameters ---------- is_defined_within_template bool True if the resource is a Ref to a resource otherwise False arn st...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Computes a unique name based on the LayerVersion Arn Format: <Name of the LayerVersion>-<Version of the LayerVersion>-<sha256 of the arn> Parameters ---------- ...
40
13,359
def serialize_all(nodes, stream=None, Dumper=Dumper, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None): getvalue = None if stream is None: if encoding is None:...
Serialize a sequence of representation trees into a YAML stream. If stream is None, return the produced string instead.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Serialize a sequence of representation trees into a YAML stream. If stream is None, return the produced string instead. ### Output: def serialize_all(nodes, stream=None, Dumper=Dumper, ...
41
4,201
def use_bcbio_variation_recall(algs): for alg in algs: jointcaller = alg.get("jointcaller", []) if not isinstance(jointcaller, (tuple, list)): jointcaller = [jointcaller] for caller in jointcaller: if caller not in set(["gatk-haplotype-joint", None, False]): ...
Processing uses bcbio-variation-recall. Avoids core requirement if not used.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Processing uses bcbio-variation-recall. Avoids core requirement if not used. ### Output: def use_bcbio_variation_recall(algs): for alg in algs: jointcaller = alg.get("jointcalle...
42
7,084
def style_from_pygments(style_cls=pygments_DefaultStyle, style_dict=None, include_defaults=True): assert style_dict is None or isinstance(style_dict, dict) assert style_cls is None or issubclass(style_cls, pygments_Style) styles_dict = {} if style_c...
Shortcut to create a :class:`.Style` instance from a Pygments style class and a style dictionary. Example:: from prompt_toolkit.styles.from_pygments import style_from_pygments from pygments.styles import get_style_by_name style = style_from_pygments(get_style_by_name('monokai')) :...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Shortcut to create a :class:`.Style` instance from a Pygments style class and a style dictionary. Example:: from prompt_toolkit.styles.from_pygments import style_from_pygments ...
43
4,932
def rtt_control(self, command, config): config_byref = ctypes.byref(config) if config is not None else None res = self._dll.JLINK_RTTERMINAL_Control(command, config_byref) if res < 0: raise errors.JLinkRTTException(res) return res
Issues an RTT Control command. All RTT control is done through a single API call which expects specifically laid-out configuration structures. Args: self (JLink): the ``JLink`` instance command (int): the command to issue (see enums.JLinkRTTCommand) config (ctypes...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Issues an RTT Control command. All RTT control is done through a single API call which expects specifically laid-out configuration structures. Args: self (JLin...
44
20,093
def focus_next_unfolded(self): self.focus_property(lambda x: not x.is_collapsed(x.root), self._tree.next_position)
focus next unfolded message in depth first order
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: focus next unfolded message in depth first order ### Output: def focus_next_unfolded(self): self.focus_property(lambda x: not x.is_collapsed(x.root), ...
45
16,186
def _set_openflow_global(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=openflow_global.openflow_global, is_container=, presence=False, yang_name="openflow-global", rest_name="", parent=self, path_helper=self._path_helper, extmethods=self._extmethods...
Setter method for openflow_global, mapped from YANG variable /openflow_global (container) If this variable is read-only (config: false) in the source YANG file, then _set_openflow_global is considered as a private method. Backends looking to populate this variable should do so via calling thisObj._set_o...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Setter method for openflow_global, mapped from YANG variable /openflow_global (container) If this variable is read-only (config: false) in the source YANG file, then _set_openflow_global ...
46
20,208
def get_net_configuration(self, channel=None, gateway_macs=True): if channel is None: channel = self.get_network_channel() retdata = {} v4addr = self._fetch_lancfg_param(channel, 3) if v4addr is None: retdata[] = None else: v4masklen =...
Get network configuration data Retrieve network configuration from the target :param channel: Channel to configure, defaults to None for 'autodetect' :param gateway_macs: Whether to retrieve mac addresses for gateways :returns: A dictionary of network configuration data
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Get network configuration data Retrieve network configuration from the target :param channel: Channel to configure, defaults to None for 'autodetect' :param gateway_macs...
47
2,809
def pool(self): self._pool = self._pool or eventlet.GreenPool(size=self.pool_size) return self._pool
Get an eventlet pool used to dispatch requests.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Get an eventlet pool used to dispatch requests. ### Output: def pool(self): self._pool = self._pool or eventlet.GreenPool(size=self.pool_size) return self._pool
48
3,867
def number_of_items(pronac, dt): df = data.items_by_project project = df.loc[df[] == pronac] seg = project.iloc[0]["idSegmento"] info = data.items_by_project_agg.to_dict(orient="index")[seg] mean, std = info.values() threshold = mean + 1.5 * std project_items_count = project.shape[0] ...
This metric calculates the project number of declared number of items and compare it to projects in the same segment output: is_outlier: True if projects number of items is not compatible to others projects in the same segment valor: absolute number of items ...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: This metric calculates the project number of declared number of items and compare it to projects in the same segment output: is_outlier: True if projects number of items is no...
49
20,868
def get_plot(self, structure, two_theta_range=(0, 90), annotate_peaks=True, ax=None, with_labels=True, fontsize=16): if ax is None: from pymatgen.util.plotting import pretty_plot plt = pretty_plot(16, 10) ax = plt.gca() else:...
Returns the diffraction plot as a matplotlib.pyplot. Args: structure: Input structure two_theta_range ([float of length 2]): Tuple for range of two_thetas to calculate in degrees. Defaults to (0, 90). Set to None if you want all diffracted beams within th...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Returns the diffraction plot as a matplotlib.pyplot. Args: structure: Input structure two_theta_range ([float of length 2]): Tuple for range of tw...
50
11,515
def get_action_generator(self, action_name, policy, kwargs): action_generator_cls = self.generators[action_name][1] action_generator = action_generator_cls(policy, kwargs) return action_generator
Returns the action generator to be used for the given action. :param action_name: Action identifier name. :type action_name: unicode | str :param policy: An instance of the current policy class. :type policy: dockermap.map.policy.base.BasePolicy :param kwargs: Keyword arguments....
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Returns the action generator to be used for the given action. :param action_name: Action identifier name. :type action_name: unicode | str :param policy: An instance of t...
51
22,679
def OnSearchDirectionButton(self, event): if "DOWN" in self.search_options: flag_index = self.search_options.index("DOWN") self.search_options[flag_index] = "UP" elif "UP" in self.search_options: flag_index = self.search_options.index("UP") self....
Event handler for search direction toggle button
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Event handler for search direction toggle button ### Output: def OnSearchDirectionButton(self, event): if "DOWN" in self.search_options: flag_index = self.search_op...
52
24,052
def quantize(self, value): context = decimal.getcontext().copy() context.prec = self.max_digits return value.quantize( decimal.Decimal() ** self.decimal_places, context=context)
Quantize the decimal value to the configured precision.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Quantize the decimal value to the configured precision. ### Output: def quantize(self, value): context = decimal.getcontext().copy() context.prec = self.max_digits ...
53
17,778
def draw_plot(self): pylab.ion() fig = pylab.figure(1) reward_axis = fig.add_subplot(3, 1, 3) reward_lines = reward_axis.plot(self.reward_data[0, 0], [0], "mx-") self.reward_line = reward_lines[0] pylab.draw()
Initialises plots of the environment.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Initialises plots of the environment. ### Output: def draw_plot(self): pylab.ion() fig = pylab.figure(1) reward_axis...
54
3,643
def _fetch(self, entry_point, params): url = self.API_URL % {: self.base_url, : entry_point} logger.debug("Mattermost client requests: %s params: %s", entry_point, str(params)) r = self.fetch(url, payload=params) return r.text
Fetch a resource. :param entrypoint: entrypoint to access :param params: dict with the HTTP parameters needed to access the given entry point
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Fetch a resource. :param entrypoint: entrypoint to access :param params: dict with the HTTP parameters needed to access the given entry point ### Output: def _fetch(...
55
18,363
def mutate(dna, dna_size, tune_params): dna_out = [] mutation_chance = 10 for i in range(dna_size): if int(random.random()*mutation_chance) == 1: dna_out.append(random_val(i, tune_params)) else: dna_out.append(dna[i]) return dna_out
Mutate DNA with 1/mutation_chance chance
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Mutate DNA with 1/mutation_chance chance ### Output: def mutate(dna, dna_size, tune_params): dna_out = [] mutation_chance = 10 for i in range(dna_size): if int(random.ra...
56
6,197
def _lemmatise_suffixe(self, f, *args, **kwargs): for suffixe in self._suffixes: if f.endswith(suffixe) and suffixe != f: yield from self._lemmatise(f[:-len(suffixe)], *args, **kwargs)
Lemmatise un mot f si il finit par un suffixe :param f: Mot à lemmatiser :yield: Match formated like in _lemmatise()
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Lemmatise un mot f si il finit par un suffixe :param f: Mot à lemmatiser :yield: Match formated like in _lemmatise() ### Output: def _lemmatise_suffixe(self, f, *args, **kwargs)...
57
5,552
def generate_prov_doc(self): def host_provenance(document): document.add_namespace(CWLPROV) document.add_namespace(UUID) document.add_namespace(FOAF) hostname = getfqdn() self.document.add_namespace...
Add basic namespaces.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Add basic namespaces. ### Output: def generate_prov_doc(self): def host_provenance(document): document.add_namespace(CWLPROV) ...
58
347
def _stream_send_and_receive(self, _socket, message, *args, **kwargs): data = BytesIO() _socket_fd = _socket.makefile(mode=, encoding=) _socket_fd.write(message.encode()) _socket_fd.flush() for received in _socket_fd: data.write(received) data.seek(...
TCP/Stream sender and receiver
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: TCP/Stream sender and receiver ### Output: def _stream_send_and_receive(self, _socket, message, *args, **kwargs): data = BytesIO() _socket_fd = _socket.makefile(mode=, ...
59
15,328
def workers_status(self): return [self._workers_status[identifier] for identifier in sorted(self._workers_status.keys())]
The worker status objects sorted by identifier.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: The worker status objects sorted by identifier. ### Output: def workers_status(self): return [self._workers_status[identifier] for identifier in sorted(self._workers_status....
60
2,780
def set_value(self, key, value): file_cache = self.read_file() if file_cache: file_cache[key] = value else: file_cache = {} file_cache[key] = value self.update_file(file_cache)
Set key value to the file. The fuction will be make the key and value to dictinary formate. If its exist then it will update the current new key value to the file. Arg: key : cache key value : cache value
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Set key value to the file. The fuction will be make the key and value to dictinary formate. If its exist then it will update the current new key value to the file. ...
61
22,139
def total_edge_pixels_from_mask(mask): border_pixel_total = 0 for y in range(mask.shape[0]): for x in range(mask.shape[1]): if not mask[y, x]: if mask[y + 1, x] or mask[y - 1, x] or mask[y, x + 1] or mask[y, x - 1] or \ mask[y + 1, x + 1] or mas...
Compute the total number of borders-pixels in a masks.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Compute the total number of borders-pixels in a masks. ### Output: def total_edge_pixels_from_mask(mask): border_pixel_total = 0 for y in range(mask.shape[0]): for x in ra...
62
2,622
def render_error_page(code, exc, mimetype=, traceback=): from giotto.views import get_jinja_template if in mimetype: return json.dumps({ : code, : exc.__class__.__name__, : str(exc), }) et = get_config() if not et: return "%s %s\n%s" % ...
Render the error page
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Render the error page ### Output: def render_error_page(code, exc, mimetype=, traceback=): from giotto.views import get_jinja_template if in mimetype: return json.dumps({ ...
63
1,592
def add_scatter_option_group(parser): scatter_group = parser.add_argument_group("Options for configuring the " "scatter plot.") scatter_group.add_argument( , type=str, default=None, action=ParseParametersArg, help= ) scatter_gr...
Adds the options needed to configure scatter plots. Parameters ---------- parser : object ArgumentParser instance.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Adds the options needed to configure scatter plots. Parameters ---------- parser : object ArgumentParser instance. ### Output: def add_scatter_option_group(parser): ...
64
14,881
def createTable(self, tableName, strFields) : if not self.tableExits(tableName) : sql = % (tableName, strFields) self.execute(sql) self.tables.add(tableName) return True return False
creates a table and resturns the ursor, if the table already exists returns None
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: creates a table and resturns the ursor, if the table already exists returns None ### Output: def createTable(self, tableName, strFields) : if not self.tableExits(tableName) : sql = % (t...
65
11,100
def filter_by_hoys(self, hoys): existing_hoys = self.header.analysis_period.hoys hoys = [h for h in hoys if h in existing_hoys] _moys = tuple(int(hour * 60) for hour in hoys) return self.filter_by_moys(_moys)
Filter the Data Collection based onva list of hoys. Args: hoys: A List of hours of the year 0..8759 Return: A new Data Collection with filtered data
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Filter the Data Collection based onva list of hoys. Args: hoys: A List of hours of the year 0..8759 Return: A new Data Collection with filtered data ### O...
66
20,818
def _getArgSpec(func): spec = getArgsSpec(func) return ArgSpec( args=tuple(spec.args), varargs=spec.varargs, varkw=spec.varkw if six.PY3 else spec.keywords, defaults=spec.defaults if spec.defaults else (), kwonlyargs=tuple(spec.kwonlyargs) if six.PY3 else (), ...
Normalize inspect.ArgSpec across python versions and convert mutable attributes to immutable types. :param Callable func: A function. :return: The function's ArgSpec. :rtype: ArgSpec
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Normalize inspect.ArgSpec across python versions and convert mutable attributes to immutable types. :param Callable func: A function. :return: The function's ArgSpec. :rtype: Arg...
67
4,935
def set_target_temperature(self, ain, temperature): param = 16 + ((float(temperature) - 8) * 2) if param < min(range(16, 56)): param = 253 elif param > max(range(16, 56)): param = 254 self._aha_request(, ain=ain, param=int(param))
Set the thermostate target temperature.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Set the thermostate target temperature. ### Output: def set_target_temperature(self, ain, temperature): param = 16 + ((float(temperature) - 8) * 2) if param < min(range...
68
20,081
def widget(self, which_viz=): if hasattr(self, ) == True: self.widget_instance = self.widget_class(network = self.export_viz_to_widget(which_viz)) return self.widget_instance else: print() print()
Generate a widget visualization using the widget. The export_viz_to_widget method passes the visualization JSON to the instantiated widget, which is returned and visualized on the front-end.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Generate a widget visualization using the widget. The export_viz_to_widget method passes the visualization JSON to the instantiated widget, which is returned and visualized on the front-e...
69
6,587
def upload_news_picture(self, file): return self.post( url="https://api.weixin.qq.com/cgi-bin/media/uploadimg", params={"access_token": self.token}, files={"media": file} )
上传图文消息内的图片。 :param file: 要上传的文件,一个 File-object :return: 返回的 JSON 数据包
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: 上传图文消息内的图片。 :param file: 要上传的文件,一个 File-object :return: 返回的 JSON 数据包 ### Output: def upload_news_picture(self, file): return self.post( url="https:/...
70
14,724
def plotProgenitor(self,d1=,d2=,*args,**kwargs): tts= self._progenitor._orb.t[self._progenitor._orb.t \ < self._trackts[self._nTrackChunks-1]] obs= [self._R0,0.,self._Zsun] obs.extend(self._vsun) phys= kwargs.pop(,False) tx= self...
NAME: plotProgenitor PURPOSE: plot the progenitor orbit INPUT: d1= plot this on the X axis ('x','y','z','R','phi','vx','vy','vz','vR','vt','ll','bb','dist','pmll','pmbb','vlos') d2= plot this on the Y axis (same list as for d1) scaleToPhysica...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: NAME: plotProgenitor PURPOSE: plot the progenitor orbit INPUT: d1= plot this on the X axis ('x','y','z','R','phi','vx','vy','vz','vR','vt','l...
71
12,675
def process(event_name, data): deserialized = loads(data) event_cls = find_event(event_name) event = event_cls(event_name, deserialized) try: event.clean() except ValidationError as exc: if os.environ.get(): raise else: logger.warning( ...
Iterates over the event handler registry and execute each found handler. It takes the event name and its its `data`, passing the return of `ejson.loads(data)` to the found handlers.
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Iterates over the event handler registry and execute each found handler. It takes the event name and its its `data`, passing the return of `ejson.loads(data)` to the found handlers. ...
72
4,517
def add_word(self, customization_id, word, translation, part_of_speech=None, **kwargs): if customization_id is None: raise ValueError() if word is None: raise ValueError() if tr...
Add a custom word. Adds a single word and its translation to the specified custom voice model. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use crede...
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Add a custom word. Adds a single word and its translation to the specified custom voice model. Adding a new translation for a word that already exists in a custom model overwrite...
73
22,784
def get_property(self): prop = super(File, self).get_property() scope = self def fdel(self): if self._get(scope.name) is not None: self._get(scope.name).close() self._set(scope.name, undefined) new_prop = property...
Establishes access of Property values
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Establishes access of Property values ### Output: def get_property(self): prop = super(File, self).get_property() scope = self def fdel(self): ...
74
15,004
def maxdiff(self): POW = math.pow D = 0 for i in range(self.width): _min = 100 _max = -100 for L in ACGT: val = POW(2,self.logP[i][L]) if val > _max: _max = val _maxL = L ...
m.maxdiff() -- Compute maximum possible Euclidean distance to another motif. (For normalizing?)
Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: m.maxdiff() -- Compute maximum possible Euclidean distance to another motif. (For normalizing?) ### Output: def maxdiff(self): POW = math.pow D = 0 for i in ...
End of preview. Expand in Data Studio

Dataset Card for "code_searchnet_reduced_val"

More Information needed

Downloads last month
8