Unnamed: 0
int64
0
389k
code
stringlengths
26
79.6k
docstring
stringlengths
1
46.9k
371,600
def update_compaction(model): logger.debug("Checking %s for compaction differences", model) table = get_table_settings(model) existing_options = table.options.copy() existing_compaction_strategy = existing_options[] existing_options = json.loads(existing_options[]) desired_options = get...
Updates the compaction options for the given model if necessary. :param model: The model to update. :return: `True`, if the compaction options were modified in Cassandra, `False` otherwise. :rtype: bool
371,601
def load_history(self) -> List["IterationRecord"]: if path.isfile(self.history_filename): with open(self.history_filename, "r") as f: try: dicts = json.load(f) except json.decoder.JSONDecodeError as e: self.log.error(f...
Load messaging history from disk to self. :returns: List of iteration records comprising history.
371,602
def safe_unicode(e): try: return unicode(e) except UnicodeError: pass try: return py3compat.str_to_unicode(str(e)) except UnicodeError: pass try: return py3compat.str_to_unicode(repr(e)) except UnicodeError: pass return u
unicode(e) with various fallbacks. Used for exceptions, which may not be safe to call unicode() on.
371,603
def filter(self, **search_args): search_args = search_args or {} raw_resources = [] for url, paginator_params in self.paginator.get_urls(self.get_collection_endpoint()): search_args.update(paginator_params) response = self.paginator.process_response(self.send(ur...
Get a filtered list of resources :param search_args: To be translated into ?arg1=value1&arg2=value2... :return: A list of resources
371,604
def link_android(self, path, pkg): bundle_id = self.ctx[] pkg_root = join(path, pkg) f.write(main_application_java) raise
Link's the android project to this library. 1. Includes this project's directory in the app's android/settings.gradle It adds: include ':<project-name>' project(':<project-name>').projectDir = new File( rootProject.projectDir, '../package...
371,605
def clear_cache(self): errors = [] for rdir in (self.cache_root, self.file_list_cachedir): if os.path.exists(rdir): try: shutil.rmtree(rdir) except OSError as exc: errors.append( .format(...
Completely clear cache
371,606
def load_pdb(self, pdb_id, mapped_chains=None, pdb_file=None, file_type=None, is_experimental=True, set_as_representative=False, representative_chain=None, force_rerun=False): if self.structures.has_id(pdb_id): if force_rerun: existing = self.s...
Load a structure ID and optional structure file into the structures attribute. Args: pdb_id (str): PDB ID mapped_chains (str, list): Chain ID or list of IDs which you are interested in pdb_file (str): Path to PDB file file_type (str): Type of PDB file ...
371,607
def update_default_output_dir(self): if self.scenario_directory_radio.isChecked(): self.output_directory.setText(self.source_directory.text())
Update output dir if set to default.
371,608
def handle_events(self): for event in sys.stdin: if event.startswith(): continue name = json.loads(event.lstrip())[] for obj in self.loader.objects: if obj.output_options[] == name: obj.on_click(json.loads(event.lst...
An event handler that processes events from stdin and calls the on_click function of the respective object. This function is run in another thread, so as to not stall the main thread.
371,609
def _ParsePlistKeyValue(self, knowledge_base, name, value): if not knowledge_base.GetValue(): if name in self._PLIST_KEYS: if isinstance(value, (list, tuple)): value = value[0] _, _, keyboard_layout = value.rpartition() knowledge_base.SetValue(, keyboard_layout)
Parses a plist key value. Args: knowledge_base (KnowledgeBase): to fill with preprocessing information. name (str): name of the plist key. value (str): value of the plist key.
371,610
def make_middleware_stack(middleware, base): for ware in reversed(middleware): base = ware(base) return base
Given a list of in-order middleware callable objects `middleware` and a base function `base`, chains them together so each middleware is fed the function below, and returns the top level ready to call. :param middleware: The middleware stack :type middleware: iterable[callable] :param b...
371,611
def _log_players(self, players): self._logln(.format(len(players))) for p in self._players: self._logln(.format(p.name, p.color, p.seat))
:param players: list of catan.game.Player objects
371,612
def property_schema(self, key): schema = self.__class__.SCHEMA plain_schema = schema.get("properties", {}).get(key) if plain_schema is not None: return plain_schema pattern_properties = schema.get("patternProperties", {}) for pattern, patte...
Lookup the schema for a specific property.
371,613
def write_collection_from_tmpfile(self, collection_id, tmpfi, parent_sha, auth_info, commit_msg=): return self.write_doc_from_tmpfile(collection_id, tmpfi, parent_sha, auth_i...
Given a collection_id, temporary filename of content, branch and auth_info
371,614
def rfdist_task(newick_string_a, newick_string_b, normalise, min_overlap=4, overlap_fail_value=0): tree_a = Tree(newick_string_a) tree_b = Tree(newick_string_b) return treedist.rfdist(tree_a, tree_b, normalise, min_overlap, overlap_fail_value)
Distributed version of tree_distance.rfdist Parameters: two valid newick strings and a boolean
371,615
def is_stopword(self, text): found_content_word = False for record in self.analyze(text): if not self.is_stopword_record(record): found_content_word = True break return not found_content_word
Determine whether a single word is a stopword, or whether a short phrase is made entirely of stopwords, disregarding context. Use of this function should be avoided; it's better to give the text in context and let the process determine which words are the stopwords.
371,616
def get_license_manager(service_instance): log.debug() try: lic_manager = service_instance.content.licenseManager except vim.fault.NoPermission as exc: log.exception(exc) raise salt.exceptions.VMwareApiError( .format(exc.privilegeId)) except vim.fau...
Returns the license manager. service_instance The Service Instance Object from which to obrain the license manager.
371,617
def page(self, number): number = self.validate_number(number) bottom = (number - 1) * self.per_page top = bottom + self.per_page if top + self.orphans >= self.count: top = self.count return self._get_page(self.object_list[bottom:top], number, self)
Returns a Page object for the given 1-based page number.
371,618
def cli_wrapper(generator): first = True response = None while True: if not first: print() first = False try: message = generator.send(response) if isinstance(message, MultipleChoice): print(message.question) ...
Given a wizard, implements an interactive command-line human-friendly interface for it. Parameters ---------- generator A generator such as one created by calling :py:func:`rig.wizard.wizard_generator`. Returns ------- dict or None Returns a dictionary containing th...
371,619
def _get_files(self, attrs=None): try: f_multicall = self._engine._rpc.f.multicall f_params = [self._fields["hash"], 0, "f.path=", "f.size_bytes=", "f.last_touched=", "f.priority=", "f.is_created=", "f.is_open=", ] ...
Get a list of all files in this download; each entry has the attributes C{path} (relative to root), C{size} (in bytes), C{mtime}, C{prio} (0=off, 1=normal, 2=high), C{created}, and C{opened}. This is UNCACHED, use C{fetch("files")} instead. @param attrs: Opt...
371,620
async def sendto(self, data, component): active_pair = self._nominated.get(component) if active_pair: await active_pair.protocol.send_data(data, active_pair.remote_addr) else: raise ConnectionError()
Send a datagram on the specified component. If the connection is not established, a `ConnectionError` is raised.
371,621
def query_alternative_short_name(): args = get_args( request_args=request.args, allowed_str_args=[, ], allowed_int_args=[] ) return jsonify(query.alternative_short_name(**args))
Returns list of alternative short name by query query parameters --- tags: - Query functions parameters: - name: name in: query type: string required: false description: Alternative short name default: CVAP - name: entry_name in: query ...
371,622
def _addDatasetAction(self, dataset): action = QAction(dataset.name(), self) action.setIcon(XColorIcon(dataset.color())) action.setCheckable(True) action.setChecked(True) action.setData(wrapVariant(dataset)) action.toggled.connect(self.toggleDatas...
Adds an action for the inputed dataset to the toolbar :param dataset | <XChartDataset>
371,623
def add_hits_to_proteins(self, hmm_hit_list): for org in self.organisms: print "adding SearchIO hit objects for", org.accession for hit in hmm_hit_list: hit_org_id = hit.id.split()[0] hit_prot_id = hit.id.split()[1] if org.acce...
Add HMMER results to Protein objects
371,624
def myRank(grade, badFormat, year, length): return int(sorted(everyonesAverage(year, badFormat, length), reverse=True).index(grade) + 1)
rank of candidateNumber in year Arguments: grade {int} -- a weighted average for a specific candidate number and year badFormat {dict} -- candNumber : [results for candidate] year {int} -- year you are in length {int} -- length of each row in badFormat divided by 2 Returns: ...
371,625
def factory(cls, endpoint, timeout, *args, **kwargs): start = time.time() kwargs[] = timeout conn = cls(endpoint, *args, **kwargs) elapsed = time.time() - start conn.connected_event.wait(timeout - elapsed) if conn.last_error: if conn.is_unsupported_pr...
A factory function which returns connections which have succeeded in connecting and are ready for service (or raises an exception otherwise).
371,626
def _matrix_adjust(self, X): data_matrix = X.data if sparse.issparse(X) else X data_matrix += len(SPARSE_ENCODINGS) + 1 data_matrix[~np.isfinite(data_matrix)] = SPARSE_ENCODINGS[] return ...
Adjust all values in X to encode for NaNs and infinities in the data. Parameters ---------- X : array-like, shape=(n_samples, n_feature) Input array of type int. Returns ------- X : array-like, shape=(n_samples, n_feature) Input array without any...
371,627
def diff(self, test_id_1, test_id_2, config=None, **kwargs): output_directory = os.path.join(self._output_directory, + str(test_id_1) + + str(test_id_2)) if kwargs: if in kwargs.keys(): output_directory = kwargs[] diff_report = Diff([NaaradReport(self._analyses[test_id_1].output_direct...
Create a diff report using test_id_1 as a baseline :param: test_id_1: test id to be used as baseline :param: test_id_2: test id to compare against baseline :param: config file for diff (optional) :param: **kwargs: keyword arguments
371,628
def register_signals(self): from .models import Collection from .receivers import CollectionUpdater if self.app.config[]: from .percolator import collection_inserted_percolator, \ collection_removed_percolator, \ collection_updated_percolator...
Register signals.
371,629
def get_engine_from_session(dbsession: Session) -> Engine: engine = dbsession.bind assert isinstance(engine, Engine) return engine
Gets the SQLAlchemy :class:`Engine` from a SQLAlchemy :class:`Session`.
371,630
def computePerturbedExpectation(self, u_n, A_n, compute_uncertainty=True, uncertainty_method=None, warning_cutoff=1.0e-10, return_theta=False): if len(np.shape(u_n)) == 2: u_n = kn_to_n(u_n, N_k=self.N_k) if len(np.shape(A_n)) == 2: A_n = kn_to_n(A_n, N_k=self.N_k) ...
Compute the expectation of an observable of phase space function A(x) for a single new state. Parameters ---------- u_n : np.ndarray, float, shape=(K, N_max) u_n[n] = u(x_n) - the energy of the new state at all N samples previously sampled. A_n : np.ndarray, float, shape=(K,...
371,631
def logMsg(self, msg, printMsg=True): time = datetime.datetime.now().strftime() self.log = .format(self.log, time, msg) if printMsg: print msg if self.addLogsToArcpyMessages: from arcpy import AddMessage AddMessage(msg)
logs a message and prints it to the screen
371,632
def __get_all_child_accounts_as_array(self, account: Account) -> List[Account]: result = [] result.append(account) for child in account.children: sub_accounts = self.__get_all_child_accounts_as_array(child) result += sub_accounts ...
Returns the whole tree of child accounts in a list
371,633
def syncScrollbars(self): chart_hbar = self.uiChartVIEW.horizontalScrollBar() chart_vbar = self.uiChartVIEW.verticalScrollBar() x_hbar = self.uiXAxisVIEW.horizontalScrollBar() x_vbar = self.uiXAxisVIEW.verticalScrollBar() y_hbar = self.uiYAxisVI...
Synchronizes the various scrollbars within this chart.
371,634
def call_requests( requests: Union[Request, Iterable[Request]], methods: Methods, debug: bool ) -> Response: if isinstance(requests, collections.Iterable): return BatchResponse(safe_call(r, methods, debug=debug) for r in requests) return safe_call(requests, methods, debug=debug)
Takes a request or list of Requests and calls them. Args: requests: Request object, or a collection of them. methods: The list of methods that can be called. debug: Include more information in error responses.
371,635
def deprecated(operation=None): def inner(o): o.deprecated = True return o return inner(operation) if operation else inner
Mark an operation deprecated.
371,636
def start_msstitch(exec_drivers, sysargs): parser = populate_parser(exec_drivers) args = parser.parse_args(sysargs[1:]) args.func(**vars(args))
Passed all drivers of executable, checks which command is passed to the executable and then gets the options for a driver, parses them from command line and runs the driver
371,637
def export_dist(self, args): ctx = self.ctx dist = dist_from_args(ctx, args) if dist.needs_build: raise BuildInterruptingException( ) if args.symlink: shprint(sh.ln, , dist.dist_dir, args.output_dir) ...
Copies a created dist to an output dir. This makes it easy to navigate to the dist to investigate it or call build.py, though you do not in general need to do this and can use the apk command instead.
371,638
def register_blueprint(self, blueprint: Blueprint, url_prefix: Optional[str]=None) -> None: first_registration = False if blueprint.name in self.blueprints and self.blueprints[blueprint.name] is not blueprint: raise RuntimeError( f"Blueprint name " f...
Register a blueprint on the app. This results in the blueprint's routes, error handlers etc... being added to the app. Arguments: blueprint: The blueprint to register. url_prefix: Optional prefix to apply to all paths.
371,639
def version_cli(ctx, porcelain): if ctx.invoked_subcommand: return from peltak.core import log from peltak.core import versioning current = versioning.current() if porcelain: print(current) else: log.info("Version: <35>{}".format(current))
Show project version. Has sub commands. For this command to work you must specify where the project version is stored. You can do that with version_file conf variable. peltak supports multiple ways to store the project version. Right now you can store it in a python file using built-in __version__ vari...
371,640
def bigquery_schema(table): fields = OrderedDict((el.name, dt.dtype(el)) for el in table.schema) partition_info = table._properties.get(, None) if partition_info is not None: partition_field = partition_info.get(, NATIVE_PARTITION_COL) fields.setdefault(partition_field, ...
Infer the schema of a BigQuery `table` object.
371,641
def read_roi(fileobj): s ROI format. Points are returned in a nx2 array. Each row is in [row, column] -- that is, (y,x) -- order. readroi: Unexpected EOFIoutMagic number not foundroireader: ROI type %s not supportedroireader: ROI subtype %s not supported (!= 0)' % subtype) if roi_type == RoiType.RE...
points = read_roi(fileobj) Read ImageJ's ROI format. Points are returned in a nx2 array. Each row is in [row, column] -- that is, (y,x) -- order.
371,642
def _RemoveAuthorizedKeys(self, user): pw_entry = self._GetUser(user) if not pw_entry: return home_dir = pw_entry.pw_dir authorized_keys_file = os.path.join(home_dir, , ) if os.path.exists(authorized_keys_file): try: os.remove(authorized_keys_file) except OSError as e...
Remove a Linux user account's authorized keys file to prevent login. Args: user: string, the Linux user account to remove access.
371,643
def get_session_token(self): try: response = requests.post(self.__session_url__ + , cert=(self.__crt__, self.__key__), verify=True) except requests.exceptions.RequestException as err: self.logger.error(err) raise ...
get session token
371,644
def close_monomers(self, group, cutoff=4.0): nearby_residues = [] for self_atom in self.atoms.values(): nearby_atoms = group.is_within(cutoff, self_atom) for res_atom in nearby_atoms: if res_atom.parent not in nearby_residues: nearby_r...
Returns a list of Monomers from within a cut off distance of the Monomer Parameters ---------- group: BaseAmpal or Subclass Group to be search for Monomers that are close to this Monomer. cutoff: float Distance cut off. Returns ------- ne...
371,645
def convert(area_um, deform, emodulus, channel_width_in, channel_width_out, flow_rate_in, flow_rate_out, viscosity_in, viscosity_out, inplace=False): copy = not inplace area_um_corr = np.array(area_um, dtype=float, copy=copy) deform_corr = np.array(d...
convert area-deformation-emodulus triplet The conversion formula is described in :cite:`Mietke2015`. Parameters ---------- area_um: ndarray Convex cell area [µm²] deform: ndarray Deformation emodulus: ndarray Young's Modulus [kPa] channel_width_in: float Ori...
371,646
def create_roles(apps, schema_editor): SystemWideEnterpriseRole = apps.get_model(, ) SystemWideEnterpriseRole.objects.update_or_create(name=ENTERPRISE_ADMIN_ROLE) SystemWideEnterpriseRole.objects.update_or_create(name=ENTERPRISE_LEARNER_ROLE)
Create the enterprise roles if they do not already exist.
371,647
def gettrace(self, burn=0, thin=1, chain=-1, slicing=None): if chain is not None: tables = [self.db._gettables()[chain], ] else: tables = self.db._gettables() for i, table in enumerate(tables): if slicing is not None: burn, stop, thi...
Return the trace (last by default). :Parameters: burn : integer The number of transient steps to skip. thin : integer Keep one in thin. chain : integer The index of the chain to fetch. If None, return all chains. The default is to return the last ...
371,648
def tocimxmlstr(value, indent=None): if isinstance(value, Element): xml_elem = value else: xml_elem = tocimxml(value) if indent is None: xml_str = xml_elem.toxml() else: if isinstance(indent, six.string_types): pass elif isinstance(indent, six...
Return the CIM-XML representation of the CIM object or CIM data type, as a :term:`unicode string`. *New in pywbem 0.9.* The returned CIM-XML representation is consistent with :term:`DSP0201`. Parameters: value (:term:`CIM object` or :term:`CIM data type` or :term:`Element`): The CIM ob...
371,649
def is_entailed_by(self, other): other = BoolCell.coerce(other) if self.value == U or other.value == self.value: return True return False
If the other is as or more specific than self
371,650
def dial(self, number, timeout=5, callStatusUpdateCallbackFunc=None): if self._waitForCallInitUpdate: self._dialEvent = threading.Event() try: self.write(.format(number), timeout=timeout, waitForResponse=self._waitForAtdResponse) except E...
Calls the specified phone number using a voice phone call :param number: The phone number to dial :param timeout: Maximum time to wait for the call to be established :param callStatusUpdateCallbackFunc: Callback function that is executed if the call's status changes due to remote...
371,651
def get(self, key): value = self._results.get(key) if value is not None: return value option = list(filter(lambda o: o.key == key, self._option_list)) if not option: raise ValueError( % key) option = option[0] return option.def...
Get parsed result. After :func:`parse` the argv, we can get the parsed results:: # command.option('-f', 'description of -f') command.get('-f') command.get('verbose') # we can also get ``verbose``: command.verbose
371,652
def ProgramScanner(**kw): kw[] = SCons.Scanner.FindPathDirs() ps = SCons.Scanner.Base(scan, "ProgramScanner", **kw) return ps
Return a prototype Scanner instance for scanning executable files for static-lib dependencies
371,653
def inverse_transform(self, y, lengths=None): y = np.argmax(y, -1) inverse_y = [self._label_vocab.id2doc(ids) for ids in y] if lengths is not None: inverse_y = [iy[:l] for iy, l in zip(inverse_y, lengths)] return inverse_y
Return label strings. Args: y: label id matrix. lengths: sentences length. Returns: list: list of list of strings.
371,654
def patchproperty(*cls, **kwargs): def _patch(fun): m = kwargs.pop(, None) or fun.__name__ p = property(fun) for c in cls: setattr(c, m, p) def wrap(fun): _patch(fun) return fun return wrap
class getter 함수 패치 decorator EX) class B(A): pass @patchproperty(B) def prop(self): return 'hello' :param cls: :param kwargs:
371,655
def text(self, selector): result = self.__bs4.select(selector) return [r.get_text() for r in result] \ if result.__len__() > 1 else \ result[0].get_text() if result.__len__() > 0 else None
Return text result that executed by given css selector :param selector: `str` css selector :return: `list` or `None`
371,656
def num_samples(self): with self.container.open_if_needed(mode=) as cnt: return cnt.get(self.key)[0].shape[0]
Return the total number of samples.
371,657
def element_exists(self, element): if not self.__elements: return False for item in foundations.walkers.dictionaries_walker(self.__elements): path, key, value = item if key == element: LOGGER.debug("> attribute exists.".format(element)) ...
Checks if given element exists. Usage:: >>> plist_file_parser = PlistFileParser("standard.plist") >>> plist_file_parser.parse() True >>> plist_file_parser.element_exists("String A") True >>> plist_file_parser.element_exists("String Nemo")...
371,658
def _run__http(self, action, replace): query = action[] url = .format(path=query[], **action) content = None method = query.get(, "get").lower() self.debug("{} {} url={}\n", action[], method, url) if method == "post": content = query[] heade...
More complex HTTP query.
371,659
def hmmalign_sequences(self, hmm, sequences, output_file): cmd = % (hmm, sequences) output = extern.run(cmd) with open(output_file, ) as f: SeqIO.write(SeqIO.parse(StringIO(output), ), f, )
Run hmmalign and convert output to aligned fasta format Parameters ---------- hmm: str path to hmm file sequences: str path to file of sequences to be aligned output_file: str write sequences to this file Returns ------- ...
371,660
def get_write_fields(self): rec_write_fields = self.get_write_subset() if self.comments != None: rec_write_fields.append() self.check_field() if self.n_sig > 0: sig_write_fields = self.get_write_subset() else: ...
Get the list of fields used to write the header, separating record and signal specification fields. Returns the default required fields, the user defined fields, and their dependencies. Does NOT include `d_signal` or `e_d_signal`. Returns ------- rec_write_field...
371,661
def _group(self, group_data): if isinstance(group_data, dict): xid = group_data.get() else: xid = group_data.xid if self.groups.get(xid) is not None: group_data = self.groups.get(xid) elif self.groups_sh...
Return previously stored group or new group. Args: group_data (dict|obj): An Group dict or instance of Group object. Returns: dict|obj: The new Group dict/object or the previously stored dict/object.
371,662
def args(self, *args, **kwargs): self._any_args = False self._arguments_rule.set_args(*args, **kwargs) return self
Creates a ArgumentsExpectationRule and adds it to the expectation
371,663
def watch(models, criterion=None, log="gradients", log_freq=100): global watch_called if run is None: raise ValueError( "You must call `wandb.init` before calling watch") if watch_called: raise ValueError( "You can only call `wandb.watch` once per process. If you...
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...
371,664
async def handle_action(self, action_type, payload, **kwds): if hasattr(self, ): await roll_call_handler(self.service, action_type, payload, **kwds)
The default action Handler has no action.
371,665
def get_cluster( self, project_id, region, cluster_name, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): if "get_cluster" not in self._inner_api_calls: self...
Gets the resource representation for a cluster in a project. Example: >>> from google.cloud import dataproc_v1beta2 >>> >>> client = dataproc_v1beta2.ClusterControllerClient() >>> >>> # TODO: Initialize `project_id`: >>> project_id = '' ...
371,666
def read(self, output_tile): if self.config.mode not in ["readonly", "continue", "overwrite"]: raise ValueError("process mode must be readonly, continue or overwrite") if isinstance(output_tile, tuple): output_tile = self.config.output_pyramid.tile(*output_tile) ...
Read from written process output. Parameters ---------- output_tile : BufferedTile or tile index tuple Member of the output tile pyramid (not necessarily the process pyramid, if output has a different metatiling setting) Returns ------- data : Nu...
371,667
def download(self, content, filename=None, media_type=None, charset=): if isinstance(content, int) and content != 200: return content if filename is not None: filename = os.path.basename(filename) elif in self.response.state: filenam...
Send content as attachment (downloadable file). The *content* is sent after setting Content-Disposition header such that the client prompts the user to save the content locally as a file. An HTTP response status code may be specified as *content*. If the status code is not ``200``, then...
371,668
def sendEmail(sender, recipients, subject, body, attachments=None, cc=None, bcc=None, contentType=, server=None, useMSExchange=None, encoding=, raiseErrors=False): ...
Sends an email from the inputted email address to the list of given recipients with the inputted subject and body. This will also attach the inputted list of attachments to the email. The server value will default to mail.<sender_domain> and you can use a ':' to specify a port for the server. ...
371,669
def stopall(self, sudo=False, quiet=True): t make sense to call from a single instance Parameters ========== sudo: if the command should be done with sudo (exposes different set of instances) instance.stopversion 3--allreturn_code%s : return code %smessagereturn_codereturn_co...
stop ALL instances. This command is only added to the command group as it doesn't make sense to call from a single instance Parameters ========== sudo: if the command should be done with sudo (exposes different set of instances)
371,670
def mstmap(args): from jcvi.assembly.geneticmap import MSTMatrix p = OptionParser(mstmap.__doc__) p.add_option("--dh", default=False, action="store_true", help="Double haploid population, no het [default: %default]") p.add_option("--freq", default=.2, type="float", ...
%prog mstmap bcffile/vcffile > matrixfile Convert bcf/vcf format to mstmap input.
371,671
def nearest_neighbor(x, tSet): assert isinstance(x, tuple) and isinstance(tSet, dict) current_key = () min_d = float() for key in tSet: d = distance(x, key) if d < min_d: min_d = d current_key = key return tSet[current_key]
[summary] Implements the nearest neighbor algorithm Arguments: x {[tupel]} -- [vector] tSet {[dict]} -- [training set] Returns: [type] -- [result of the AND-function]
371,672
def loadFromTemplate(template, stim=None): stim = StimulusModel.loadFromTemplate(template, stim=stim) qstim = QStimulusModel(stim) qstim.setEditor(template[]) return qstim
Initialized this stimulus from a saved *template* :param template: doc from a previously stored stimulus via :class:`templateDoc` :type template: dict
371,673
def acceptedUser(self, logType): from urllib2 import urlopen, URLError, HTTPError import json isApproved = False userName = str(self.logui.userName.text()) if userName == "": return False if logType == "MCC": n...
Verify enetered user name is on accepted MCC logbook list.
371,674
def allocate_ids(self, partial_keys): conn = self.get_conn() resp = (conn .projects() .allocateIds(projectId=self.project_id, body={: partial_keys}) .execute(num_retries=self.num_retries)) return resp[]
Allocate IDs for incomplete keys. .. seealso:: https://cloud.google.com/datastore/docs/reference/rest/v1/projects/allocateIds :param partial_keys: a list of partial keys. :type partial_keys: list :return: a list of full keys. :rtype: list
371,675
def _prm_write_shared_table(self, key, hdf5_group, fullname, **kwargs): first_row = None description = None if in kwargs: first_row = kwargs.pop() if not in kwargs: description = {} for colname in first_row: d...
Creates a new empty table
371,676
def text_(s, encoding=, errors=): return s.decode(encoding, errors) if isinstance(s, binary_type) else s
If ``s`` is an instance of ``binary_type``, return ``s.decode(encoding, errors)``, otherwise return ``s``
371,677
def input_value(self, locator, text): self._info("Setting text into text field " % (text, locator)) self._element_input_value_by_locator(locator, text)
Sets the given value into text field identified by `locator`. This is an IOS only keyword, input value makes use of set_value See `introduction` for details about locating elements.
371,678
def download(sess_id_or_alias, files, dest): if len(files) < 1: return with Session() as session: try: print_wait( .format(sess_id_or_alias)) kernel = session.Kernel(sess_id_or_alias) kernel.download(files, dest, show_progress=True)...
Download files from a running container. \b SESSID: Session ID or its alias given when creating the session. FILES: Paths inside container.
371,679
def format_block(block, nlspaces=0): lines = smart_text(block).split() while lines and not lines[0]: del lines[0] while lines and not lines[-1]: del lines[-1] ws = re.match(r, lines[0]).group(0) if ws: lines = map(lambda x: x.replace(ws, , 1), lines) ...
Format the given block of text, trimming leading/trailing empty lines and any leading whitespace that is common to all lines. The purpose is to let us list a code block as a multiline, triple-quoted Python string, taking care of indentation concerns. http://code.activestate.com/recipes/145672/
371,680
def _walk_through(job_dir, display_progress=False): serial = salt.payload.Serial(__opts__) for top in os.listdir(job_dir): t_path = os.path.join(job_dir, top) for final in os.listdir(t_path): load_path = os.path.join(t_path, final, ) with salt.utils.files.fopen(loa...
Walk through the job dir and return jobs
371,681
def dump_data_peek(data, base = 0, separator = , width = 16, bits = None): ...
Dump data from pointers guessed within the given binary data. @type data: str @param data: Dictionary mapping offsets to the data they point to. @type base: int @param base: Base offset. @type bits: int @param bits: (Optional) Number of bits of the targe...
371,682
def as_list(self, key): result = self[key] if isinstance(result, (tuple, list)): return list(result) return [result]
A convenience method which fetches the specified value, guaranteeing that it is a list. >>> a = ConfigObj() >>> a['a'] = 1 >>> a.as_list('a') [1] >>> a['a'] = (1,) >>> a.as_list('a') [1] >>> a['a'] = [1] >>> a.as_list('a') [1]
371,683
def cli(env, account_id, content_url, type, cname): manager = SoftLayer.CDNManager(env.client) manager.add_origin(account_id, type, content_url, cname)
Create an origin pull mapping.
371,684
def split(self): assert(self.status == SolverStatus.exhausted) scopes = [] next_scopes = [] split_i = None for i, scope in enumerate(self.scopes): if split_i is None: r = scope.split() if r is not None: sc...
Split the phase. When a phase is exhausted, it gets split into a pair of phases to be further solved. The split happens like so: 1) Select the first unsolved package scope. 2) Find some common dependency in the first N variants of the scope. 3) Split the scope into two: [:N] and...
371,685
def remove_pane(self, pane): assert isinstance(pane, Pane) for w in self.windows: w.remove_pane(pane) if not w.has_panes: for app, active_w in self._active_window_for_cli.items(): if w == active_w: ...
Remove a :class:`.Pane`. (Look in all windows.)
371,686
def step(self, path=None, peer_table=None): if path is None: path = self.atlasdb_path num_fetched = 0 missing_zinfo = None peer_hostports = None with AtlasPeerTableLocked(peer_table) as ptbl: missing_zfinfo = atlas_find_miss...
Run one step of this algorithm: * find the set of missing zonefiles * try to fetch each of them * store them * update our zonefile database Fetch rarest zonefiles first, but batch whenever possible. Return the number of zonefiles fetched
371,687
def namedb_get_all_revealed_namespace_ids( self, current_block ): query = "SELECT namespace_id FROM namespaces WHERE op = ? AND reveal_block < ?;" args = (NAMESPACE_REVEAL, current_block + NAMESPACE_REVEAL_EXPIRE ) namespace_rows = namedb_query_execute( cur, query, args ) ret = [] for nam...
Get all non-expired revealed namespaces.
371,688
def epilogue(app_name): app_name = clr.stringc(app_name, "bright blue") command = clr.stringc("command", "cyan") help = clr.stringc("--help", "green") return "\n%s %s %s for more info on a command\n" % (app_name, command, help)
Return the epilogue for the help command.
371,689
def fqscreen_plot (self): categories = list() getCats = True data = list() p_types = OrderedDict() p_types[] = {: , : } p_types[] = {: , : } p_types[] = {: , : } p_types[] = {: , : } for k, t in p_types.items(): first = Tr...
Makes a fancy custom plot which replicates the plot seen in the main FastQ Screen program. Not useful if lots of samples as gets too wide.
371,690
def compile_and_process(self, in_path): out_path = self.path_mapping[in_path] if not self.embed: pdebug("[%s::%s] %s -> %s" % ( self.compiler_name, self.name, os.path.relpath(in_path), os.path.relpath(out_path)), ...
compile a file, save it to the ouput file if the inline flag true
371,691
def h2o_explained_variance_score(y_actual, y_predicted, weights=None): ModelBase._check_targets(y_actual, y_predicted) _, numerator = _mean_var(y_actual - y_predicted, weights) _, denominator = _mean_var(y_actual, weights) if denominator == 0.0: return 1. if numerator == 0 else 0. re...
Explained variance regression score function. :param y_actual: H2OFrame of actual response. :param y_predicted: H2OFrame of predicted response. :param weights: (Optional) sample weights :returns: the explained variance score.
371,692
def _get_and_count_containers(self, custom_cgroups=False, healthchecks=False): if custom_cgroups or healthchecks: try: inspect_dict = self.docker_util.client.inspect_container(container_name) container[] = inspect_dict[]...
List all the containers from the API, filter and count them.
371,693
def _create_chrome_options(self): options = webdriver.ChromeOptions() if self.config.getboolean_optional(, ): self.logger.debug("Running Chrome in headless mode") options.add_argument() if os.name == : options.add_argument() ...
Create and configure a chrome options object :returns: chrome options object
371,694
def _cldf2wld(dataset): header = [f for f in dataset.dataset.lexeme_class.fieldnames() if f != ] D = {0: [] + [h.lower() for h in header]} for idx, row in enumerate(dataset.objects[]): row = deepcopy(row) row[] = .join(row[]) D[idx + 1] = [row[]] + [row[h] for h in header] r...
Make lingpy-compatible dictinary out of cldf main data.
371,695
def build_mine_matrix(self, w, h, minenum): self.minecount = 0 matrix = [[Cell(30, 30, x, y, self) for x in range(w)] for y in range(h)] for i in range(0, minenum): x = random.randint(0, w - 1) y = random.randint(0, h - 1) if matrix[y][x].has_mine: ...
random fill cells with mines and increments nearest mines num in adiacent cells
371,696
def _l_cv_weight(self, donor_catchment): try: dist = donor_catchment.similarity_dist except AttributeError: dist = self._similarity_distance(self.catchment, donor_catchment) b = 0.0047 * sqrt(dist) + 0.0023 / 2 c = 0.02609 / (donor_catchment.record_length...
Return L-CV weighting for a donor catchment. Methodology source: Science Report SC050050, eqn. 6.18 and 6.22a
371,697
def bait(self, maskmiddle=, k=): logging.info(.format(at=self.analysistype)) if self.kmer_size is None: kmer = k else: kmer = self.kmer_size with progressbar(self.runmetadata) as bar: for sample in bar: if sam...
Use bbduk to perform baiting :param maskmiddle: boolean argument treat the middle base of a kmer as a wildcard; increases sensitivity in the presence of errors. :param k: keyword argument for length of kmers to use in the analyses
371,698
def split_param_vec(param_vec, rows_to_alts, design, return_all_types=False): num_index_coefs = design.shape[1] betas = param_vec[-1 * num_index_coefs:] remaining_idx = param_vec.shape[0] - num_index_coefs if remaining_idx > 0: intercepts = param_vec[:remaining_idx] els...
Parameters ---------- param_vec : 1D ndarray. Elements should all be ints, floats, or longs. Should have as many elements as there are parameters being estimated. rows_to_alts : 2D scipy sparse matrix. There should be one row per observation per available alternative and one ...
371,699
def seq_site_length(self): relative_positions_set = set() for peak_descr in self: relative_positions_set.update(peak_descr.relative_positions) return len(relative_positions_set)
Calculate length of a single sequence site based upon relative positions specified in peak descriptions. :return: Length of sequence site. :rtype: :py:class:`int`