Unnamed: 0
int64
0
389k
code
stringlengths
26
79.6k
docstring
stringlengths
1
46.9k
366,800
def find_overlaps(self, index=False): return self.__find_incongruities(op=operator.gt, index=index)
Find overlaps in a striplog. Args: index (bool): If True, returns indices of intervals with gaps after them. Returns: Striplog: A striplog of all the overlaps as intervals.
366,801
def rgb_color(self): self.update() return [self._red, self._green, self._blue]
Return the color property as list of [R, G, B], each 0-255.
366,802
def _append_count_to_matrix(qtl_matrixfile, lod_threshold): if not os.path.exists(qtl_matrixfile): raise MQ2Exception( % qtl_matrixfile) matrix = read_input_file(qtl_matrixfile, sep=) tmp = list(matrix[0]) tmp.append() matrix[0] = tmp cnt = 1 while cnt < len(matrix): r...
Append an extra column at the end of the matrix file containing for each row (marker) the number of QTL found if the marker is known ie: Locus != '' :arg qtl_matrix, the matrix in which to save the output. :arg threshold, threshold used to determine if a given LOD value is reflective the presen...
366,803
def get_hours_description(self): expression = self._expression_parts[2] return self.get_segment_description( expression, _("every hour"), lambda s: self.format_time(s, "0"), lambda s: _("every {0} hours").format(s), lambda s: _("betwee...
Generates a description for only the HOUR portion of the expression Returns: The HOUR description
366,804
def compute_layer(cls, data, params, layout): def fn(pdata): if len(pdata) == 0: return pdata scales = layout.get_scales(pdata[].iat[0]) return cls.compute_panel(pdata, scales, params) retur...
Compute position for the layer in all panels Positions can override this function instead of `compute_panel` if the position computations are independent of the panel. i.e when not colliding
366,805
def fast_hamiltonian_terms(Ep, epsilonp, detuning_knob, omega_level, rm, xi, theta, unfolding, matrix_form=False, file_name=None, return_code=False): r if not unfolding.lower_triangular: mes = "It is very inefficient to sol...
r"""Return a fast function that returns the Hamiltonian terms. We test a basic two-level system. >>> import numpy as np >>> from scipy.constants import physical_constants >>> from sympy import Matrix, symbols >>> from fast.electric_field import electric_field_amplitude_top >>> from fast.symbol...
366,806
def _fast_write(self, outfile, value): outfile.truncate(0) outfile.write(str(int(value))) outfile.flush()
Function for fast writing to motor files.
366,807
def pfm_to_pwm(self, pfm, pseudo=0.001): return [[(x + pseudo)/(float(np.sum(row)) + pseudo * 4) for x in row] for row in pfm]
Convert PFM with counts to a PFM with fractions. Parameters ---------- pfm : list 2-dimensional list with counts. pseudo : float Pseudocount used in conversion. Returns ------- pwm : list 2-dimensional list with fracti...
366,808
def enumerate_builtins(tokens): out = [] for index, tok in enumerate(tokens): token_type = tok[0] token_string = tok[1] if token_string in builtins: special_special = [] if py3: special_special = [] if token_string no...
Returns a list of all the builtins being used in *tokens*.
366,809
def zendesk_ticket(self): if self.api and self.zendesk_ticket_id: return self.api._get_zendesk_ticket(self.zendesk_ticket_id)
| Description: The ID of the Zendesk Support ticket created from this chat. Available only if using version 2 of the Zendesk Chat-Support integration
366,810
def setup_request_sessions(self): self.req_session = requests.Session() self.req_session.headers.update(self.headers)
Sets up a requests.Session object for sharing headers across API requests.
366,811
def create_process_work_item_type(self, work_item_type, process_id): route_values = {} if process_id is not None: route_values[] = self._serialize.url(, process_id, ) content = self._serialize.body(work_item_type, ) response = self._send(http_method=, ...
CreateProcessWorkItemType. [Preview API] Creates a work item type in the process. :param :class:`<CreateProcessWorkItemTypeRequest> <azure.devops.v5_0.work_item_tracking_process.models.CreateProcessWorkItemTypeRequest>` work_item_type: :param str process_id: The ID of the process on which to cre...
366,812
def RemoveClientLabels(self, client_id, owner, labels, cursor=None): query = ("DELETE FROM client_labels " "WHERE client_id = %s AND owner_username_hash = %s " "AND label IN ({})").format(", ".join(["%s"] * len(labels))) args = [db_utils.ClientIDToInt(client_id), mysql_utils.Hash...
Removes a list of user labels from a given client.
366,813
def raw_chroma_accuracy(ref_voicing, ref_cent, est_voicing, est_cent, cent_tolerance=50): validate_voicing(ref_voicing, est_voicing) validate(ref_voicing, ref_cent, est_voicing, est_cent) ref_voicing = ref_voicing.astype(bool) est_voicing = est_voicing.astype(bool) ...
Compute the raw chroma accuracy given two pitch (frequency) sequences in cents and matching voicing indicator sequences. The first pitch and voicing arrays are treated as the reference (truth), and the second two as the estimate (prediction). All 4 sequences must be of the same length. Examples -...
366,814
def loop(self): self.count += 1 self.tf = time.time() self.elapsed = self.tf - self.ti if self.verbose: displayAll(self.elapsed, self.display_amt, self.est_end, self.nLoops, self.count, self.numPrints)
Tracks the time in a loop. The estimated time to completion can be calculated and if verbose is set to *True*, the object will print estimated time to completion, and percent complete. Actived in every loop to keep track
366,815
def init_config(self, **kw): return YubiKeyConfigUSBHID(ykver=self.version_num(), \ capabilities = self.capabilities, \ **kw)
Get a configuration object for this type of YubiKey.
366,816
def write_if_allowed(filename: str, content: str, overwrite: bool = False, mock: bool = False) -> None: if not overwrite and exists(filename): fail("File exists, not overwriting: {!r}".format(filename)) directory = dirname(fi...
Writes the contents to a file, if permitted. Args: filename: filename to write content: contents to write overwrite: permit overwrites? mock: pretend to write, but don't Raises: RuntimeError: if file exists but overwriting not permitted
366,817
def local_moe_tpu(inputs, hidden_size, output_size, num_experts, loss_coef=1e-3, overhead=1.0): batch, length, input_size = common_layers.shape_list(inputs)[:] if isinstance(length, int): expert_capacity = min( ...
Local mixture of experts that works well on TPU. See https://arxiv.org/abs/1701.06538 There are num_experts expert networks, each containing a relu-activated hidden layer of size hidden_size, followed by an output projection. The number of parameters is thus: num_experts * (input_size * hidden_size + hid...
366,818
def calculate(self, T, P, zs, ws, method): r if method == SIMPLE: Cplms = [i(T) for i in self.HeatCapacityLiquids] return mixing_simple(zs, Cplms) elif method == LALIBERTE: ws = list(ws) ; ws.pop(self.index_w) Cpl = Laliberte_heat_capacity(T, ws, s...
r'''Method to calculate heat capacity of a liquid mixture at temperature `T`, pressure `P`, mole fractions `zs` and weight fractions `ws` with a given method. This method has no exception handling; see `mixture_property` for that. Parameters ---------- T : floa...
366,819
def wc(filename, contents, parsed=None, is_jekyll=False): if is_jekyll: fmt = else: fmt = body = parsed.strip() if parsed else contents.strip() words = re.sub(r, , body, re.MULTILINE) for punctuation in INTERSTITIAL_PUNCTUATION: words = re.sub(punctuation, , word...
Count the words, characters, and paragraphs in a string. Args: contents: the original string to count filename (optional): the filename as provided to the CLI parsed (optional): a parsed string, expected to be plaintext only is_jekyll: whether the original contents were from a Jekyl...
366,820
def remove_output_data_port(self, data_port_id, force=False, destroy=True): if data_port_id in self._output_data_ports: if destroy: self.remove_data_flows_with_data_port_id(data_port_id) self._output_data_ports[data_port_id].parent = None return self....
Remove an output data port from the state :param int data_port_id: the id of the output data port to remove :raises exceptions.AttributeError: if the specified input data port does not exist
366,821
def do_json_set(self, params): try: Keys.validate(params.keys) except Keys.Bad as ex: self.show_output(str(ex)) return try: jstr, stat = self._zk.get(params.path) obj_src = json_deserialize(jstr) obj_dst = copy.dee...
\x1b[1mNAME\x1b[0m json_set - Sets the value for the given (possibly nested) key on a JSON object serialized in the given path \x1b[1mSYNOPSIS\x1b[0m json_set <path> <keys> <value> <value_type> [confirm] \x1b[1mDESCRIPTION\x1b[0m If the key exists and the value is different, the znode will be ...
366,822
def get(location, **kwargs): provider = kwargs.get(, ).lower().strip() method = kwargs.get(, ).lower().strip() if isinstance(location, (list, dict)) and method == : raise ValueError("Location should be a string") if provider not in options: raise ValueError("Invalid provider") ...
Get Geocode :param ``location``: Your search location you want geocoded. :param ``provider``: The geocoding engine you want to use. :param ``method``: Define the method (geocode, method).
366,823
def control_loop(): set_service_status(Service.SCHEDULE, ServiceStatus.BUSY) notify.notify() while not terminate(): notify.notify() get_schedule() session = get_session() next_event = session.query(UpcomingEvent)\ .filter(UpcomingEven...
Main loop, retrieving the schedule.
366,824
def _whitespace_tokenize(self, text): text = text.strip() tokens = text.split() return tokens
Runs basic whitespace cleaning and splitting on a piece of text.
366,825
def PopEvents(self): event = self.PopEvent() while event: yield event event = self.PopEvent()
Pops events from the heap. Yields: EventObject: event.
366,826
def describe_load_balancers(names=None, load_balancer_arns=None, region=None, key=None, keyid=None, profile=None): if names and load_balancer_arns: raise SaltInvoc...
Describes the specified load balancer or all of your load balancers. Returns: list CLI example: .. code-block:: bash salt myminion boto_elbv2.describe_load_balancers salt myminion boto_elbv2.describe_load_balancers alb_name salt myminion boto_elbv2.describe_load_balancers "[alb_n...
366,827
def set_scrollbars_cb(self, w, tf): scrollbars = if tf else self.t_.set(scrollbars=scrollbars)
This callback is invoked when the user checks the 'Use Scrollbars' box in the preferences pane.
366,828
def shell(self, *args, **kwargs): args = [] + list(args) return self.run_cmd(*args, **kwargs)
Run command `adb shell`
366,829
def build_self_reference(filename, clean_wcs=False): if in filename: sciname = else: sciname = wcslin = build_reference_wcs([filename], sciname=sciname) if clean_wcs: wcsbase = wcslin.wcs customwcs = build_hstwcs(wcsbase.crval[0], wcsbase.crval[1], wcsbase.crpix...
This function creates a reference, undistorted WCS that can be used to apply a correction to the WCS of the input file. Parameters ---------- filename : str Filename of image which will be corrected, and which will form the basis of the undistorted WCS. clean_wcs : bool Spe...
366,830
def fft(fEM, time, freq, ftarg): r dfreq, nfreq, ntot, pts_per_dec = ftarg if pts_per_dec: sfEMr = iuSpline(np.log(freq), fEM.real) sfEMi = iuSpline(np.log(freq), fEM.imag) freq = np.arange(1, nfreq+1)*dfreq fEM = sfEMr(np.log(freq)) + 1j*sfEMi(np.log(freq)) ...
r"""Fourier Transform using the Fast Fourier Transform. The function is called from one of the modelling routines in :mod:`model`. Consult these modelling routines for a description of the input and output parameters. Returns ------- tEM : array Returns time-domain EM response of ``fEM...
366,831
def system(self): if self._resources is None: self.__init() if "system" in self._resources: url = self._url + "/system" return _system.System(url=url, securityHandler=self._securityHandler, p...
returns an object to work with the site system
366,832
def getParent(self, returned_properties=None): parent_tag = ("rtc_cm:com.ibm.team.workitem.linktype." "parentworkitem.parent") rp = returned_properties parent = (self.rtc_obj ._get_paged_resources("Parent", ...
Get the parent workitem of this workitem If no parent, None will be returned. :param returned_properties: the returned properties that you want. Refer to :class:`rtcclient.client.RTCClient` for more explanations :return: a :class:`rtcclient.workitem.Workitem` object :rtype:...
366,833
def get_objects(self): for modname, info in self.data[].items(): yield (modname, modname, , info[0], + modname, 0) for refname, (docname, type_name) in self.data[].items(): if type_name != : yield (refname, refname, type_name, docname, refname, 1)
Return iterable of "object descriptions", which are tuple with these items: * `name` * `dispname` * `type` * `docname` * `anchor` * `priority` For details on each item, see :py:meth:`~sphinx.domains.Domain.get_objects`.
366,834
def ext_pillar(minion_id, pillar, conf, nesting_key=None): comps = conf.split() paths = [comp for comp in comps if comp.startswith()] if not paths: log.error(, conf) return {} vault_pillar = {} try: path = paths[0].repl...
Get pillar data from Vault for the configuration ``conf``.
366,835
def accessible(self,fromstate, tostate): if (not (fromstate in self.nodes)) or (not (tostate in self.nodes)) or not (fromstate in self.edges_out): return 0 if tostate in self.edges_out[fromstate]: return self.edges_out[fromstate][tostate] else: return...
Is state tonode directly accessible (in one step) from state fromnode? (i.e. is there an edge between the nodes). If so, return the probability, else zero
366,836
def revoke_access_token(self): if not self._access_token: return self.execute_post(, json=dict( token_type_hint=, token=self._access_token )) self._access_token = None
Revoke the access token currently in use.
366,837
def set_layer(self, layer=None): if layer: self.layer = layer else: self.layer = self.input_layer_combo_box.currentLayer() if not self.layer: return try: keywords = self.keyword_io.read_keywords(layer) self.show_curren...
Set layer and update UI accordingly. :param layer: A QgsVectorLayer. :type layer: QgsVectorLayer
366,838
def _varLib_finder(source, directory="", ext="ttf"): fname = os.path.splitext(os.path.basename(source))[0] + "." + ext return os.path.join(directory, fname)
Finder function to be used with varLib.build to find master TTFs given the filename of the source UFO master as specified in the designspace. It replaces the UFO directory with the one specified in 'directory' argument, and replaces the file extension with 'ext'.
366,839
def Stat(self, urns): if isinstance(urns, string_types): raise ValueError("Expected an iterable, not string.") for subject, values in data_store.DB.MultiResolvePrefix( urns, ["aff4:type", "metadata:last"]): res = dict(urn=rdfvalue.RDFURN(subject)) for v in values: if v[0] ...
Returns metadata about all urns. Currently the metadata include type, and last update time. Args: urns: The urns of the objects to open. Yields: A dict of metadata. Raises: ValueError: A string was passed instead of an iterable.
366,840
def _get_team_stats_table(self, selector): doc = self.get_main_doc() table = doc(selector) df = sportsref.utils.parse_table(table) df.set_index(, inplace=True) return df
Helper function for stats tables on season pages. Returns a DataFrame.
366,841
def write(self, data, assert_ss=True, deassert_ss=True): if self._mosi is None: raise RuntimeError() if assert_ss and self._ss is not None: self._gpio.set_low(self._ss) for byte in data: for i in range(8): if ...
Half-duplex SPI write. If assert_ss is True, the SS line will be asserted low, the specified bytes will be clocked out the MOSI line, and if deassert_ss is True the SS line be put back high.
366,842
def authentication_url(self): params = { : self.client_id, : self.type, : self.callback_url } return AUTHENTICATION_URL + "?" + urlencode(params)
Redirect your users to here to authenticate them.
366,843
def get_text_rule_groups(declarations): property_map = {: , : , : , : , : , : , : , : , : , : , : , ...
Given a list of declarations, return a list of output.Rule objects.
366,844
def rotate_z(self, angle): axis_rotation(self.points, angle, inplace=True, axis=)
Rotates mesh about the z-axis. Parameters ---------- angle : float Angle in degrees to rotate about the z-axis.
366,845
def _get_organisations(self): organisations = [] for child in self.vcard.getChildren(): if child.name == "ORG": organisations.append(child.value) return sorted(organisations)
:returns: list of organisations, sorted alphabetically :rtype: list(list(str))
366,846
def getPlainText(self, identify=None): frags = getattr(self, , None) if frags: plains = [] for frag in frags: if hasattr(frag, ): plains.append(frag.text) return .join(plains) elif identify: text = geta...
Convenience function for templates which want access to the raw text, without XML tags.
366,847
def add_common_files_to_file_list(self): common-disease-mondo repo_dir = .join((self.rawdir, )) common_disease_dir = .join(( repo_dir, , )) filelist = glob.glob(common_disease_dir) fcount = 0 for small_file in filelist: if sma...
The (several thousands) common-disease files from the repo tarball are added to the files object. try adding the 'common-disease-mondo' files as well?
366,848
def import_locations(self, data, index=): self._data = data data = utils.prepare_read(data) for line in data: line = line.strip() chunk = line.split() if not len(chunk) == 14: if index == : ...
Parse NOAA weather station data files. ``import_locations()`` returns a dictionary with keys containing either the WMO or ICAO identifier, and values that are ``Station`` objects that describes the large variety of data exported by NOAA_. It expects data files in one of the following f...
366,849
def BLX(self, params): Rj = self.get_one_parameter(self.ONE_PARAMETER, params) self.check_arguments(LR_or_general_purpose_registers=(Rj,)) def BLX_func(): self.register[] = self.register[] self.register[] = self.register[Rj] return BLX_func
BLX Rj Branch to the address in Rj, storing the next instruction in the Link Register
366,850
def cleanup(self, sched, coro): try: sched.sigwait[self.name].remove((self, coro)) except ValueError: pass return True
Remove this coro from the waiting for signal queue.
366,851
def init(cls, repo_dir=None, temp=False, initial_commit=False): if temp: suffix = repo_dir = create_tempdir(suffix=suffix, delete=True) else: repo_dir = repo_dir or os.getcwd() git_init(repo_dir) instance = cls(repo_dir) ...
Run `git init` in the repo_dir. Defaults to current working directory if repo_dir is not supplied. If 'temp' is True, a temporary directory will be created for you and the repository will be initialized. The tempdir is scheduled for deletion (when the process exits) through an exit fun...
366,852
def parse(self, fd): def resolve_args(args): current_section.add_line(keyword, parts)
very simple parser - but why would we want it to be complex?
366,853
def untag(self): new_obj = self.__class__() new_obj._copy(self, copy.deepcopy) return new_obj
Copies the object, removing any special tagging from it :return: An Asn1Value object
366,854
def main(arguments): formatter_class = argparse.ArgumentDefaultsHelpFormatter parser = argparse.ArgumentParser(description=__doc__, formatter_class=formatter_class) parser.add_argument(, help="Input file", type=argparse.FileType()) parser...
Parse arguments, request the urls, notify if different.
366,855
def local_manager_is_default(self, adm_gid, gid): config = self.root[][].attrs rule = config[adm_gid] if gid not in rule[]: raise Exception(u"group not managed by " % (gid, adm_gid)) return gid in rule[]
Check whether gid is default group for local manager group.
366,856
def _InstallInstallers(self): installer_amd64 = glob.glob( os.path.join(args.output_dir, "dbg_*_amd64.exe")).pop() self._CleanupInstall() subprocess.check_call([installer_amd64]) self._CheckInstallSuccess()
Install the installer built by RepackTemplates.
366,857
def deserialize_date(string): try: from dateutil.parser import parse return parse(string).date() except ImportError: return string
Deserializes string to date. :param string: str. :type string: str :return: date. :rtype: date
366,858
def clean_report(self, options, sosreport): if options.report_dir: if os.path.isdir(options.report_dir): self.report_dir = options.report_dir self.origin_path, self.dir_path, self.session, self.logfile, self.uuid = self._prep_environment() self._start_logg...
this is the primary function, to put everything together and analyze an sosreport
366,859
def ucas_download_single(url, output_dir = , merge = False, info_only = False, **kwargs): html = get_content(url) resourceID = re.findall( r, html)[0] assert resourceID != , title = match1(html, r) url_lists = _ucas_get_url_lists_by_resourceID(resourceID) assert url_lists, ...
video page
366,860
def add_url_rule(self, rule, endpoint=None, view_func=None, **options): if self.url_prefix: rule = self.url_prefix + rule options.setdefault(, self.subdomain) if endpoint is None: endpoint = _endpoint_from_view_func(view_func) defaults = self.url_defaults...
A helper method to register a rule (and optionally a view function) to the application. The endpoint is automatically prefixed with the blueprint's name.
366,861
def bounds(filename, start_re, end_re, encoding=): start_re, end_re = re.compile(start_re), re.compile(end_re) mo, line_start, line_end, byte_start, byte_end = [None]*5 offset = 0 with open(filename, ) as f: for index, line in enumerate(f): line_text = line.decode(encoding) ...
Compute chunk bounds from text file according to start_re and end_re: yields (start_match, Bounds) tuples.
366,862
def _interpret_oserror(exc, cwd, cmd): if len(cmd) == 0: raise dbt.exceptions.CommandError(cwd, cmd) if os.name == : _handle_windows_error(exc, cwd, cmd) else: _handle_posix_error(exc, cwd, cmd) raise dbt.exceptions.InternalException( .format(exc) )
Interpret an OSError exc and raise the appropriate dbt exception.
366,863
def get(quantity, min_type=EventType.firstevent, max_type=EventType.lastevent): return _peep(quantity, lib.SDL_GETEVENT, min_type, max_type)
Return events at the front of the event queue, within the specified minimum and maximum type, and remove them from the queue. Args: quantity (int): The maximum number of events to return. min_type (int): The minimum value for the event type of the returned events. max_type (int): The ma...
366,864
def _delete(self, **kwargs): requests_params = self._handle_requests_params(kwargs) delete_uri = self._meta_data[] session = self._meta_data[]._meta_data[] force = self._check_force_arg(kwargs.pop(, True)) if not force: self._check_generation() ...
wrapped with delete, override that in a subclass to customize
366,865
def get_role_secret_id_accessor(self, role_name, secret_id_accessor, mount_point=): url = .format(mount_point, role_name) params = {: secret_id_accessor} return self._adapter.post(url, json=params).json()
POST /auth/<mount_point>/role/<role name>/secret-id-accessor/lookup :param role_name: :type role_name: :param secret_id_accessor: :type secret_id_accessor: :param mount_point: :type mount_point: :return: :rtype:
366,866
def Md5Hex(filename=None, contents=None): import io import hashlib md5 = hashlib.md5() if filename: stream = io.open(filename, ) try: while True: data = stream.read(md5.block_size * 128) if not data: break ...
:param unicode filename: The file from which the md5 should be calculated. If the filename is given, the contents should NOT be given. :param unicode contents: The contents for which the md5 should be calculated. If the contents are given, the filename should NOT be given. :rty...
366,867
def query_folder(self, dir_name): if dir_name[0] == : dir_name = dir_name[1:len(dir_name)] self.url = + self.config.region + + + str(self.config.app_id) + + self.config.bucket + + dir_name + self.headers[] = CosAuth(self.config).sign_more(self.config.bucket, , 30) ...
查询目录属性(https://www.qcloud.com/document/product/436/6063) :param dir_name:查询的目录的名称 :return:查询出来的结果,为json格式
366,868
def repair(self, volume_id_or_uri, timeout=-1): data = { "type": "ExtraManagedStorageVolumePaths", "resourceUri": self._client.build_uri(volume_id_or_uri) } custom_headers = {: } uri = self.URI + return self._client.create(data, uri=uri, timeout=...
Removes extra presentations from a specified volume on the storage system. Args: volume_id_or_uri: Can be either the volume id or the volume uri. timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in...
366,869
def get_fields_dict(self, row): return {k: getattr(self, .format(k), lambda x: x)(v.strip() if isinstance(v, str) else None) for k, v in zip_longest(self.get_fields(), row)}
Returns a dict of field name and cleaned value pairs to initialize the model. Beware, it aligns the lists of fields and row values with Nones to allow for adding fields not found in the CSV. Whitespace around the value of the cell is stripped.
366,870
def _commit(self, config_text=None, force=False, reload_original_config=True): def _execute(config_text): if config_text is None: config_text = self.compare_config() config_vdom = "" if self.vdom is None: pre = elif not ...
This method is the same as the :py:method:`commit`: method, however, it has an extra command that will trigger the reload of the running config. The reason behind this is that in some circumstances you don´ want to reload the running config, for example, when doing a rollback. See :py:method:`c...
366,871
def search_files(self, search=None): if search is None: search = model.FileRecordSearch() search_string = _to_encoded_string(search) url = self.base_url + .format(search_string) response = requests.get(url) response_object = safe_load(response.text) ...
Search for files, returning a FileRecord for each result. FileRecords have two additional methods patched into them, get_url() and download_to(file_name), which will retrieve the URL for the file content and download that content to a named file on disk, respectively. :param FileRecordSearch se...
366,872
def set_iter_mesh(self, mesh, shift=None, is_time_reversal=True, is_mesh_symmetry=True, is_eigenvectors=False, is_gamma_center=False): warnings.warn("Phonopy.set_iter_mes...
Create an IterMesh instancer Attributes ---------- See set_mesh method.
366,873
def stacks_2_eqns(self,stacks): if stacks: return list(map(lambda p: self.stack_2_eqn(p), stacks)) else: return []
returns equation strings from stacks
366,874
def get_all_reserved_instances_offerings(self, reserved_instances_id=None, instance_type=None, availability_zone=None, product_description=None, ...
Describes Reserved Instance offerings that are available for purchase. :type reserved_instances_id: str :param reserved_instances_id: Displays Reserved Instances with the specified offering IDs. :type instance_type: str :param instance_type: Displa...
366,875
def delete(self): url = self._imgur._base_url + "/3/message/{0}".format(self.id) return self._imgur._send_request(url, method=)
Delete the message.
366,876
def fb_github_project_workdir(self, project_and_path, github_org=): project, path = project_and_path.split(, 1) return self.github_project_workdir(github_org + + project, path)
This helper lets Facebook-internal CI special-cases FB projects
366,877
def timestamp(self, message="", checkpoint=None, finished=False, raise_error=True): elif checkpoint == self.start_point: self._active = True if not finished and checkpoint == self.stop_after: ...
Print message, time, and time elapsed, perhaps creating checkpoint. This prints your given message, along with the current time, and time elapsed since the previous timestamp() call. If you specify a HEADING by beginning the message with "###", it surrounds the message with newlines fo...
366,878
def _register_handler(event, fun, external=False): registry = core.HANDLER_REGISTRY if external: registry = core.EXTERNAL_HANDLER_REGISTRY if not isinstance(event, basestring): event = core.parse_event_to_name(event) if event in registry: registry[event]....
Register a function to be an event handler
366,879
def get_range(self): p, z = np.asarray(self.pan), np.asarray(self.zoom) x0, y0 = -1. / z - p x1, y1 = +1. / z - p return (x0, y0, x1, y1)
Return the bounds currently visible.
366,880
def cache_distribution(cls, zf, source, target_dir): dependency_basename = os.path.basename(source) if not os.path.exists(target_dir): target_dir_tmp = target_dir + + uuid.uuid4().hex for name in zf.namelist(): if name.startswith(source) and not name.endswith(): zf.extract(na...
Possibly cache an egg from within a zipfile into target_cache. Given a zipfile handle and a filename corresponding to an egg distribution within that zip, maybe write to the target cache and return a Distribution.
366,881
def set_chat_description(self, chat_id, description): return apihelper.set_chat_description(self.token, chat_id, description)
Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. :param chat_id: Int or Str: Unique identifier for the target chat or username of the target c...
366,882
def update_external_link(self, id, **kwargs): kwargs[] = True if kwargs.get(): return self.update_external_link_with_http_info(id, **kwargs) else: (data) = self.update_external_link_with_http_info(id, **kwargs) return data
Update a specific external link # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_external_link(id, async_req=True) >>> result = thread.get() :pa...
366,883
def announcements_view(request): page_name = "Manager Announcements" userProfile = UserProfile.objects.get(user=request.user) announcement_form = None manager_positions = Manager.objects.filter(incumbent=userProfile) if manager_positions: announcement_form = AnnouncementForm( ...
The view of manager announcements.
366,884
def transformation_get(node_id): exp = experiment(session) transformation_type = request_parameter(parameter="transformation_type", parameter_type="known_class", default=models.Transformation) if type(transfor...
Get all the transformations of a node. The node id must be specified in the url. You can also pass transformation_type.
366,885
def call_hook(self, hook, *args, **kwargs): for function in self.hooks[hook]: function.__call__(*args, **kwargs)
Calls each registered hook
366,886
def sweep(self, min_freq, max_freq, bins, repeats, runs=0, time_limit=0, overlap=0, fft_window=, fft_overlap=0.5, crop=False, log_scale=True, remove_dc=False, detrend=None, lnb_lo=0, tune_delay=0, reset_stream=False, base_buffer_size=0, max_buffer_size=0, max_threads=0, max_queue_size=0): ...
Sweep spectrum using frequency hopping
366,887
def dump_grammar(self, out=sys.stdout): for rule in sorted(self.rule2name.items()): out.write("%s\n" % rule2str(rule[0])) return
Print grammar rules
366,888
def get_requirement_from_url(url): link = Link(url) egg_info = link.egg_fragment if not egg_info: egg_info = splitext(link.filename)[0] return package_to_requirement(egg_info)
Get a requirement from the URL, if possible. This looks for #egg in the URL
366,889
def symbol(self): if self.color == BLACK: return PIECE_SYMBOLS[self.piece_type].upper() else: return PIECE_SYMBOLS[self.piece_type]
Gets the symbol `p`, `l`, `n`, etc.
366,890
def from_tibiadata(cls, content): json_data = parse_json(content) try: world_data = json_data["world"] world_info = world_data["world_information"] world = cls(world_info["name"]) if "location" not in world_info: return None ...
Parses a TibiaData.com response into a :class:`World` Parameters ---------- content: :class:`str` The raw JSON content from TibiaData Returns ------- :class:`World` The World described in the page, or ``None``. Raises ------ ...
366,891
def get_dataset(catalog, identifier=None, title=None): msg = "Se requiere un o para buscar el dataset." assert identifier or title, msg catalog = read_catalog_obj(catalog) if identifier: try: return _get_dataset_by_identifier(catalog, identifier) except BaseExce...
Devuelve un Dataset del catálogo.
366,892
def GetRootFileEntry(self): path_spec = encoded_stream_path_spec.EncodedStreamPathSpec( encoding_method=self._encoding_method, parent=self._path_spec.parent) return self.GetFileEntryByPathSpec(path_spec)
Retrieves the root file entry. Returns: EncodedStreamFileEntry: a file entry or None if not available.
366,893
def get(self, **url_params): if url_params: self.http_method_args["params"].update(url_params) return self.http_method("GET")
Makes the HTTP GET to the url.
366,894
def get_ontology(self, id=None, uri=None, match=None): if not id and not uri and not match: return None if type(id) == type("string"): uri = id id = None if not is_http(uri): match = uri uri = None if matc...
get the saved-ontology with given ID or via other methods...
366,895
def add_loss(self, loss, name=None): self.bookkeeper.add_loss(loss, name=name) return Loss(self.bookkeeper, tensor=loss, name=name)
Adds a loss and returns a wrapper for that loss.
366,896
def _increment(self, n=1): if self._cur_position >= self.num_tokens-1: self._cur_positon = self.num_tokens - 1 self._finished = True else: self._cur_position += n
Move forward n tokens in the stream.
366,897
def _get_url(url): try: data = HTTP_SESSION.get(url, stream=True) data.raise_for_status() except requests.exceptions.RequestException as exc: raise FetcherException(exc) return data
Retrieve requested URL
366,898
def getPreferenceCounts(self): preferenceCounts = [] for preference in self.preferences: preferenceCounts.append(preference.count) return preferenceCounts
Returns a list of the number of times each preference is given.
366,899
def default_fields(cls, include_virtual=True, **kwargs): output = cls._staticfields.copy() if include_virtual: output.update({name: VIRTUALFIELD_DTYPE for name in cls._virtualfields}) return output
The default fields and their dtypes. By default, this returns whatever the class's ``_staticfields`` and ``_virtualfields`` is set to as a dictionary of fieldname, dtype (the dtype of virtualfields is given by VIRTUALFIELD_DTYPE). This function should be overridden by subclasses to add d...