Unnamed: 0
int64
0
389k
code
stringlengths
26
79.6k
docstring
stringlengths
1
46.9k
374,400
def resync_package(ctx, opts, owner, repo, slug, skip_errors): click.echo( "Resynchonising the %(slug)s package ... " % {"slug": click.style(slug, bold=True)}, nl=False, ) context_msg = "Failed to resynchronise package!" with handle_api_exceptions( ctx, opts=opts, c...
Resynchronise a package.
374,401
def exit(self): if self.gdb_process: self.gdb_process.terminate() self.gdb_process.communicate() self.gdb_process = None return None
Terminate gdb process Returns: None
374,402
def _open_ftp(self): ftp = self.fs._open_ftp() ftp.voidcmd(str("TYPE I")) return ftp
Open an ftp object for the file.
374,403
def _modify_new_lines(code_to_modify, offset, code_to_insert): new_list = list(code_to_modify.co_lnotab) if not new_list: return None bytecode_delta = len(code_to_insert) byte_increments = code_to_modify.co_lnotab[0::2] line_increments = cod...
Update new lines: the bytecode inserted should be the last instruction of the previous line. :return: bytes sequence of code with updated lines offsets
374,404
def _cast_dict(self, data_dict): for key, value in data_dict.iteritems(): data_dict[key] = self._cast_value(value) if in data_dict: del data_dict[] return data_dict
Internal method that makes sure any dictionary elements are properly cast into the correct types, instead of just treating everything like a string from the csv file. Args: data_dict: dictionary containing bro log data. Returns: Cleaned Data dict.
374,405
def renderHTTP(self, context): request = IRequest(context) if request.isSecure(): renderer = self.wrappedResource else: renderer = _SecureWrapper(self.urlGenerator, self.wrappedResource) return renderer.renderHTTP(context)
Render the wrapped resource if HTTPS is already being used, otherwise invoke a helper which may generate a redirect.
374,406
def update(self, data, key): og_data = self.read() og_data[key] = data self.write(og_data)
Update a key's value's in a JSON file.
374,407
def populate_parallel_text(extract_dir: str, file_sets: List[Tuple[str, str, str]], dest_prefix: str, keep_separate: bool, head_n: int = 0): source_out = None target_out = None lines_written ...
Create raw parallel train, dev, or test files with a given prefix. :param extract_dir: Directory where raw files (inputs) are extracted. :param file_sets: Sets of files to use. :param dest_prefix: Prefix for output files. :param keep_separate: True if each file set (source-target pair) should have ...
374,408
def show(self): hyper_combos = itertools.product(*list(self.hyper_params.values())) if not self.models: c_values = [[idx + 1, list(val)] for idx, val in enumerate(hyper_combos)] print(H2OTwoDimTable( col_header=[, + .join(list(self.hyper_params.keys())) ...
Print models sorted by metric.
374,409
def jplace_split(self, original_jplace, cluster_dict): output_hash = {} for placement in original_jplace[]: alias_placements_list = [] nm_dict = {} p = placement[] if in placement.keys(): nm = placement[] elif in p...
To make GraftM more efficient, reads are dereplicated and merged into one file prior to placement using pplacer. This function separates the single jplace file produced by this process into the separate jplace files, one per input file (if multiple were provided) and backfills abundance ...
374,410
def bytes_from_readable_size(C, size, suffix=): s = re.split("^([0-9\.]+)\s*([%s]?)%s?" % (.join(C.SIZE_UNITS), suffix), size, flags=re.I) bytes, unit = round(float(s[1])), s[2].upper() while unit in C.SIZE_UNITS and C.SIZE_UNITS.index(unit) > 0: bytes *= 1024 un...
given a readable_size (as produced by File.readable_size()), return the number of bytes.
374,411
def count_variants_barplot(data): keys = OrderedDict() keys[] = {: } keys[] = {: } keys[] = {: } keys[] = {: } keys[] = {: } keys[] = {: } keys[] = {: } keys[] = {: } plot_conf = { : , : , : , : } return bargraph.plot(data, keys, plo...
Return HTML for the Variant Counts barplot
374,412
def unescape(b, encoding): return string_literal_re.sub( lambda m: unescape_string_literal(m.group(), encoding), b )
Unescape all string and unicode literals in bytes.
374,413
def _rescale(self, bands): self.output("Rescaling", normal=True, arrow=True) for key, band in enumerate(bands): self.output("band %s" % self.bands[key], normal=True, color=, indent=1) bands[key] = sktransform.rescale(band, 2) bands[key] = (bands[key] * 65535...
Rescale bands
374,414
def execute(self): scenario_name = self._command_args[] role_name = os.getcwd().split(os.sep)[-1] role_directory = util.abs_path(os.path.join(os.getcwd(), os.pardir)) msg = .format(scenario_name) LOG.info(msg) molecule_directory = config.molecule_directory( ...
Execute the actions necessary to perform a `molecule init scenario` and returns None. :return: None
374,415
def run_doxygen(folder): try: retcode = subprocess.call("cd %s; make doxygen" % folder, shell=True) if retcode < 0: sys.stderr.write("doxygen terminated by signal %s" % (-retcode)) except OSError as e: sys.stderr.write("doxygen execution failed: %s" % e)
Run the doxygen make command in the designated folder.
374,416
def l2norm_squared(a): value = 0 for i in xrange(a.shape[1]): value += np.dot(a[:,i],a[:,i]) return value
L2 normalize squared
374,417
def close_right(self): current_widget = self.widget(self.tab_under_menu()) index = self.indexOf(current_widget) if self._try_close_dirty_tabs(tab_range=range(index + 1, self.count())): while True: widget = self.widget(self.count() - 1) if widg...
Closes every editors tabs on the left of the current one.
374,418
def h(self): r if np.size(self._h) > 1: assert np.size(self._h) == self.n_modelparams return self._h else: return self._h * np.ones(self.n_modelparams)
r""" Returns the step size to be used in numerical differentiation with respect to the model parameters. The step size is given as a vector with length ``n_modelparams`` so that each model parameter can be weighted independently.
374,419
def persist_database(metamodel, path, mode=): with open(path, mode) as f: for kind in sorted(metamodel.metaclasses.keys()): metaclass = metamodel.metaclasses[kind] s = serialize_class(metaclass.clazz) f.write(s) for index_name, attribute_name...
Persist all instances, class definitions and association definitions in a *metamodel* by serializing them and saving to a *path* on disk.
374,420
def crop(img, center, sz, mode=): center = np.array(center) sz = np.array(sz) istart = (center - sz / 2.).astype() iend = istart + sz imsz = img.shape[:2] if np.any(istart < 0) or np.any(iend > imsz): padwidth = [(np.minimum(0, istart[0]), np.maximum(0, iend[0]-imsz[0])), ...
crop sz from ij as center :param img: :param center: ij :param sz: :param mode: :return:
374,421
def _notify_exit_thread(self, event): dwThreadId = event.get_tid() if self._has_thread_id(dwThreadId): self._del_thread(dwThreadId) return True
Notify the termination of a thread. This is done automatically by the L{Debug} class, you shouldn't need to call it yourself. @type event: L{ExitThreadEvent} @param event: Exit thread event. @rtype: bool @return: C{True} to call the user-defined handle, C{False} othe...
374,422
def availableRoles(self): s registration is not role-specific. ' eventRoles = self.eventrole_set.filter(capacity__gt=0) if eventRoles.count() > 0: return [x.role for x in eventRoles] elif isinstance(self,Series): return self.classDescription.danceT...
Returns the set of roles for this event. Since roles are not always custom specified for event, this looks for the set of available roles in multiple places. If no roles are found, then the method returns an empty list, in which case it can be assumed that the event's registration is not role-...
374,423
def create_thumbnail(uuid, thumbnail_width): size = thumbnail_width +
Create the thumbnail for an image.
374,424
def size(args): p = OptionParser(size.__doc__) opts, args = p.parse_args(args) if len(args) < 1: sys.exit(not p.print_help()) total_size = total_numrecords = 0 for f in args: cur_size = cur_numrecords = 0 for rec in iter_fastq(f): if not rec: ...
%prog size fastqfile Find the total base pairs in a list of fastq files
374,425
def chk_col_numbers(line_num, num_cols, tax_id_col, id_col, symbol_col): bad_col = if tax_id_col >= num_cols: bad_col = elif id_col >= num_cols: bad_col = elif symbol_col >= num_cols: bad_col = if bad_col: raise Exception( % (line_n...
Check that none of the input column numbers is out of range. (Instead of defining this function, we could depend on Python's built-in IndexError exception for this issue, but the IndexError exception wouldn't include line number information, which is helpful for users to find exactly which line is the c...
374,426
def get_common_password_hash(self, salt): password = self._password if password is None: raise SRPException() return self.hash(salt, self.hash(self._user, password, joiner=))
x = H(s | H(I | ":" | P)) :param int salt: :rtype: int
374,427
def guess_version_by_running_live_package( pkg_key, default="?" ): try: m = import_module(pkg_key) except ImportError: return default else: return getattr(m, "__version__", default)
Guess the version of a pkg when pip doesn't provide it. :param str pkg_key: key of the package :param str default: default version to return if unable to find :returns: version :rtype: string
374,428
def list(region=None, key=None, keyid=None, profile=None): try: conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) buckets = conn.list_buckets() if not bool(buckets.get()): log.warning() if in buckets: del buckets[] return buc...
List all buckets owned by the authenticated sender of the request. Returns list of buckets CLI Example: .. code-block:: yaml Owner: {...} Buckets: - {...} - {...}
374,429
def manage_request_types_view(request): request_types = RequestType.objects.all() return render_to_response(, { : "Admin - Manage Request Types", : request_types }, context_instance=RequestContext(request))
Manage requests. Display a list of request types with links to edit them. Also display a link to add a new request type. Restricted to presidents and superadmins.
374,430
def pip_search(self, search_string=None): extra_args = [, search_string] return self._call_pip(name=, extra_args=extra_args, callback=self._pip_search)
Search for pip packages in PyPI matching `search_string`.
374,431
def first_rec(ofile, Rec, file_type): keylist = [] opened = False while not opened: try: pmag_out = open(ofile, ) opened = True except IOError: time.sleep(1) outstring = "tab \t" + file_type + "\n" pmag_out.write(outstring) keyst...
opens the file ofile as a magic template file with headers as the keys to Rec
374,432
def draw_on_image(self, image, color=(0, 255, 0), alpha=1.0, size=3, copy=True, raise_if_out_of_image=False): if copy: image = np.copy(image) if image.ndim == 2: assert ia.is_single_number(color), ( "Got a 2D image. Expected then t...
Draw the keypoint onto a given image. The keypoint is drawn as a square. Parameters ---------- image : (H,W,3) ndarray The image onto which to draw the keypoint. color : int or list of int or tuple of int or (3,) ndarray, optional The RGB color of the k...
374,433
def push_notification_devices_destroy_many(self, data, **kwargs): "https://developer.zendesk.com/rest_api/docs/core/push_notification_devices api_path = "/api/v2/push_notification_devices/destroy_many.json" return self.call(api_path, method="POST", data=data, **kwargs)
https://developer.zendesk.com/rest_api/docs/core/push_notification_devices#bulk-unregister-push-notification-devices
374,434
def _set_redist_rip(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=redist_rip.redist_rip, is_container=, presence=False, yang_name="redist-rip", rest_name="redist-rip", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register...
Setter method for redist_rip, mapped from YANG variable /isis_state/router_isis_config/is_address_family_v6/redist_rip (container) If this variable is read-only (config: false) in the source YANG file, then _set_redist_rip is considered as a private method. Backends looking to populate this variable should ...
374,435
def clean_inputs(data): if not utils.get_in(data, ("config", "algorithm", "variant_regions_orig")): data["config"]["algorithm"]["variant_regions_orig"] = dd.get_variant_regions(data) clean_vr = clean_file(dd.get_variant_regions(data), data, prefix="cleaned-") merged_vr = merge_overlaps(clean_vr...
Clean BED input files to avoid overlapping segments that cause downstream issues. Per-merges inputs to avoid needing to call multiple times during later parallel steps.
374,436
def Decompress(self, compressed_data): try: if hasattr(lzma, ): uncompressed_data = self._lzma_decompressor.decompress( compressed_data, 0) else: uncompressed_data = self._lzma_decompressor.decompress(compressed_data) remaining_compressed_data = ...
Decompresses the compressed data. Args: compressed_data (bytes): compressed data. Returns: tuple(bytes, bytes): uncompressed data and remaining compressed data. Raises: BackEndError: if the XZ compressed stream cannot be decompressed.
374,437
def GetDatabaseAccount(self, url_connection=None): if url_connection is None: url_connection = self.url_connection initial_headers = dict(self.default_headers) headers = base.GetHeaders(self, initial_headers, ...
Gets database account info. :return: The Database Account. :rtype: documents.DatabaseAccount
374,438
def count_leaves(x): if hasattr(x, ): x = list(x.values()) if hasattr(x, ): return sum(map(count_leaves, x)) return 1
Return the number of non-sequence items in a given recursive sequence.
374,439
def runCLI(): args = docopt(__doc__, version=) try: check_arguments(args) command_list = [, , ] select = itemgetter(, , ) selectedCommand = command_list[select(args).index(True)] cmdClass = get_command_class(selectedCommand) obj = cmdClass(args) obj.e...
The starting point for the execution of the Scrapple command line tool. runCLI uses the docstring as the usage description for the scrapple command. \ The class for the required command is selected by a dynamic dispatch, and the \ command is executed through the execute_command() method of the command clas...
374,440
def delete_namespaced_deployment(self, name, namespace, **kwargs): kwargs[] = True if kwargs.get(): return self.delete_namespaced_deployment_with_http_info(name, namespace, **kwargs) else: (data) = self.delete_namespaced_deployment_with_http_info(name, namesp...
delete_namespaced_deployment # noqa: E501 delete a Deployment # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_namespaced_deployment(name, namespace, async_req=True) >...
374,441
def wrap_handler(self, handler, context_switcher): context_switcher.add_context_in(lambda: LOGGER.addHandler(self.handler)) context_switcher.add_context_out(lambda: LOGGER.removeHandler(self.handler))
Enable/Disable handler.
374,442
def convert_parameters(self, request, *args, **kwargs): args = list(args) urlparam_i = 0 parameters = self.view_parameters.get(request.method.lower()) or self.view_parameters.get(None) if parameters is not None: for parameter_i, parameter in enumerate(p...
Iterates the urlparams and converts them according to the type hints in the current view function. This is the primary function of the class.
374,443
def metadata_to_buffers(metadata): results = [] for key, value in metadata.items(): assert len(key) < 256 assert len(value) < 2 ** 32 results.extend([ struct.pack(, len(key)), key, struct.pack(, len(value)), value, ]) ret...
Transform a dict of metadata into a sequence of buffers. :param metadata: The metadata, as a dict. :returns: A list of buffers.
374,444
def fit_overlays(self, text, run_matchers=None, **kw): self._maybe_run_matchers(text, run_matchers) for i in self._list_match.fit_overlay(text, **kw): yield i
First all matchers will run and then I will try to combine them. Use run_matchers to force running(True) or not running(False) the matchers. See ListMatcher for arguments.
374,445
def groupfinder(userid, request): if userid and hasattr(request, "user") and request.user: groups = ["group:%s" % g.id for g in request.user.groups] return groups return []
Default groupfinder implementaion for pyramid applications :param userid: :param request: :return:
374,446
def update(self, pbar): if pbar.seconds_elapsed < 2e-6 or pbar.currval < 2e-6: scaled = power = 0 else: speed = pbar.currval / pbar.seconds_elapsed power = int(math.log(speed, 1000)) scaled = speed / 1000.**power return self._format % (...
Updates the widget with the current SI prefixed speed.
374,447
def uniform_random_global_network(loc=2000, scale=250, n=100): arr = (np.random.normal(loc, scale, n)).astype(int) return pd.DataFrame(data={: arr, : uniform_random_global_points(n), : uniform_random_global_points(n)})
Returns an array of `n` uniformally randomly distributed `shapely.geometry.Point` objects.
374,448
def search_profiles( self, parent, request_metadata, profile_query=None, page_size=None, offset=None, disable_spell_check=None, order_by=None, case_sensitive_sort=None, histogram_queries=None, retry=google.api_core.gapic_v1.method.D...
Searches for profiles within a tenant. For example, search by raw queries "software engineer in Mountain View" or search by structured filters (location filter, education filter, etc.). See ``SearchProfilesRequest`` for more information. Example: >>> from google.cl...
374,449
def fail(self, message, status=500, **kw): self.request.response.setStatus(status) result = {"success": False, "errors": message, "status": status} result.update(kw) return result
Set a JSON error object and a status to the response
374,450
def load_structure_from_file(context: InstaloaderContext, filename: str) -> JsonExportable: compressed = filename.endswith() if compressed: fp = lzma.open(filename, ) else: fp = open(filename, ) json_structure = json.load(fp) fp.close() if in json_structure and in json_str...
Loads a :class:`Post`, :class:`Profile` or :class:`StoryItem` from a '.json' or '.json.xz' file that has been saved by :func:`save_structure_to_file`. :param context: :attr:`Instaloader.context` linked to the new object, used for additional queries if neccessary. :param filename: Filename, ends in '.json' ...
374,451
def parse(cls, value, default=_no_default): if isinstance(value, cls): return value elif isinstance(value, int): e = cls._make_value(value) else: if not value: e = cls._make_value(0) else: r = 0 ...
Parses a flag integer or string into a Flags instance. Accepts the following types: - Members of this enum class. These are returned directly. - Integers. These are converted directly into a Flags instance with the given name. - Strings. The function accepts a comma-delimited list of fl...
374,452
def usedoc(other): docstring def inner(fnc): fnc.__doc__ = fnc.__doc__ or getattr(other, ) return fnc return inner
Decorator which copies __doc__ of given object into decorated one. Usage: >>> def fnc1(): ... """docstring""" ... pass >>> @usedoc(fnc1) ... def fnc2(): ... pass >>> fnc2.__doc__ 'docstring'collections.abc.D :param other: anything with a __doc__ attribute :type...
374,453
def get(name, function=None): if function is not None: if hasattr(function, Settings.FUNCTION_SETTINGS_NAME): if name in getattr(function, Settings.FUNCTION_SETTINGS_NAME): return getattr(function, Settings.FUNCTION_SETTINGS_NAME)[name] return Set...
Get a setting. `name` should be the name of the setting to look for. If the optional argument `function` is passed, this will look for a value local to the function before retrieving the global value.
374,454
def verify_fft_options(opt, parser): if len(opt.fft_backends) > 0: _all_backends = get_backend_names() for backend in opt.fft_backends: if backend not in _all_backends: parser.error("Backend {0} is not available".format(backend)) for backend in get_backend_modu...
Parses the FFT options and verifies that they are reasonable. Parameters ---------- opt : object Result of parsing the CLI with OptionParser, or any object with the required attributes. parser : object OptionParser instance.
374,455
def get_closed_indices(self): state = self.conn.cluster.state() status = self.status() indices_metadata = set(state[][].keys()) indices_status = set(status[].keys()) return indices_metadata.difference(indices_status)
Get all closed indices.
374,456
def _get_gs_path(): path = os.environ.get("PATH", os.defpath) for dir in path.split(os.pathsep): for name in ("gs", "gs.exe", "gswin32c.exe"): g = os.path.join(dir, name) if os.path.exists(g): return g raise Exception("Ghostscript not found. path=%s" % s...
Guess where the Ghostscript executable is and return its absolute path name.
374,457
def update_where(self, res, depth=0, since=None, **kwargs): "Like update() but uses WHERE-style args" fetch = lambda: self._fetcher.fetch_all_latest(res, 0, kwargs, since=since) self._update(res, fetch, depth)
Like update() but uses WHERE-style args
374,458
def subst_path(self, path, target=None, source=None): if not SCons.Util.is_List(path): path = [path] def s(obj): try: get = obj.get except AttributeError: obj = SCons.Util.to_String_for_subst(obj) els...
Substitute a path list, turning EntryProxies into Nodes and leaving Nodes (and other objects) as-is.
374,459
def thermal_conductivity_Magomedov(T, P, ws, CASRNs, k_w=None): rs values consistently. Examples -------- >>> thermal_conductivity_Magomedov(293., 1E6, [.25], [], k_w=0.59827) 0.548654049375 References ---------- .. [1] Magomedov, U. B. "The Thermal Conductivity of Binary and Mu...
r'''Calculate the thermal conductivity of an aqueous mixture of electrolytes using the form proposed by Magomedov [1]_. Parameters are loaded by the function as needed. Function will fail if an electrolyte is not in the database. .. math:: \lambda = \lambda_w\left[ 1 - \sum_{i=1}^n A_i (w_i + 2...
374,460
def all_pairs(seq1, seq2=None): if seq2 is None: seq2 = seq1 for item1 in seq1: for item2 in seq2: yield (item1, item2)
Yields all pairs drawn from ``seq1`` and ``seq2``. If ``seq2`` is ``None``, ``seq2 = seq1``. >>> stop_at.ed(all_pairs(xrange(100000), xrange(100000)), 8) ((0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7))
374,461
def set(self, prefix, url, obj): if not self.cache_dir: return filename = self._get_cache_file(prefix, url) try: os.makedirs(os.path.join(self.cache_dir, prefix)) except OSError: pass with open(filename, ) as file: pickl...
Add an object into the cache
374,462
def widget_from_django_field(cls, f, default=widgets.Widget): result = default internal_type = "" if callable(getattr(f, "get_internal_type", None)): internal_type = f.get_internal_type() if internal_type in cls.WIDGETS_MAP: result = cls.WIDGETS_MAP[inte...
Returns the widget that would likely be associated with each Django type. Includes mapping of Postgres Array and JSON fields. In the case that psycopg2 is not installed, we consume the error and process the field regardless.
374,463
def floating_ip_disassociate(self, server_name, floating_ip): nt_ks = self.compute_conn server_ = self.server_by_name(server_name) server = nt_ks.servers.get(server_.__dict__[]) server.remove_floating_ip(floating_ip) return self.floating_ip_list()[floating_ip]
Disassociate a floating IP from server .. versionadded:: 2016.3.0
374,464
def arr_astype(arr_type): b>Hi4f8 def f_astype(arr): return arr.astype(arr_type) f_astype.__name__ = "arr_astype_" + str(arr_type) return f_astype
Change dtype of array. Parameters: arr_type : str, np.dtype Character codes (e.g. 'b', '>H'), type strings (e.g. 'i4', 'f8'), Python types (e.g. float, int) and numpy dtypes (e.g. np.uint32) are allowed. Returns: array : np.array
374,465
def _init_display(self): self._command([ self.CMD_SSD1306_DISPLAY_OFF, self.CMD_SSD1306_SET_SCROLL_DEACTIVE, self.CMD_SSD1306_SET_MULTIPLEX_RATIO, 0x3F, self.CMD_SSD1306_SET_DISPLAY_OFFSET, ...
! \~english Initialize the SSD1306 display chip \~chinese 初始化SSD1306显示芯片
374,466
def _discovery(self): data = self.cluster_nodes() self.cluster_name = data["cluster_name"] for _, nodedata in list(data["nodes"].items()): server = nodedata[].replace("]", "").replace("inet[", "http:/") if server not in self.servers: self.servers....
Find other servers asking nodes to given server
374,467
def get(self, key, default=NoDefault): key = normalize_key(key) if default is NoDefault: defaults = [] else: defaults = [default] for options in self.options: try: value = options[key] except KeyError: ...
Retrieve a value from its key. Retrieval steps are: 1) Normalize the key 2) For each option group: a) Retrieve the value at that key b) If no value exists, continue c) If the value is an instance of 'Default', continue d) Otherwise, return the value ...
374,468
def drilldown_tree(self, session=None, json=False, json_fields=None): if not session: session = object_session(self) return self.get_tree( session, json=json, json_fields=json_fields, query=self._drilldown_query )
This method generate a branch from a tree, begining with current node. For example: node7.drilldown_tree() .. code:: level Nested sets example 1 1(1)22 --------------------- ___________...
374,469
def authenticate(self): if request.headers.get(, ).startswith(): in_token = base64.b64decode(request.headers[][10:]) try: creds = current_app.extensions[][] except KeyError: raise RuntimeError() ctx = gssapi.SecurityConte...
Attempts to authenticate the user if a token was provided.
374,470
def make_gui(self): self.option_window = Toplevel() self.option_window.protocol("WM_DELETE_WINDOW", self.on_exit) self.canvas_frame = tk.Frame(self, height=500) self.option_frame = tk.Frame(self.option_window, height=300) self.canvas_frame.pack(side=tk.LEFT, fill=tk.BOTH...
Setups the general structure of the gui, the first function called
374,471
def check_if_ready(self): try: results = self.manager.check(self.results_id) except exceptions.ResultsNotReady as e: self._is_ready = False self._not_ready_exception = e except exceptions.ResultsExpired as e: self._is_ready = True ...
Check for and fetch the results if ready.
374,472
def update_distant_reference(self, ref): self.validate_reference_data(ref["data"]) self._zotero_lib.update_item(ref)
Validate and update the reference in Zotero. Existing fields not present will be left unmodified.
374,473
def show_tracebacks(self): if self.broker.tracebacks: print(file=self.stream) print("Tracebacks:", file=self.stream) for t in self.broker.tracebacks.values(): print(t, file=self.stream)
Show tracebacks
374,474
def get_release_environment(self, project, release_id, environment_id): route_values = {} if project is not None: route_values[] = self._serialize.url(, project, ) if release_id is not None: route_values[] = self._serialize.url(, release_id, ) if environm...
GetReleaseEnvironment. [Preview API] Get a release environment. :param str project: Project ID or project name :param int release_id: Id of the release. :param int environment_id: Id of the release environment. :rtype: :class:`<ReleaseEnvironment> <azure.devops.v5_1.release.model...
374,475
def get_filter_func(patterns, prefix): prefix_len = len(prefix.strip(os.path.sep)) + 1 if any(i[1] for i in patterns): def _exclusion_func(tarinfo): name = tarinfo.name[prefix_len:] exclude = False for match_str, is_negative in patterns: if is_neg...
Provides a filter function that can be used as filter argument on ``tarfile.add``. Generates the filter based on the patterns and prefix provided. Patterns should be a list of tuples. Each tuple consists of a compiled RegEx pattern and a boolean, indicating if it is an ignore entry or a negative exclusion (i.e....
374,476
def add_header_info(data_api, struct_inflator): struct_inflator.set_header_info(data_api.r_free, data_api.r_work, data_api.resolution, data_api.title, data_api.deposit...
Add ancilliary header information to the structure. :param data_api the interface to the decoded data :param struct_inflator the interface to put the data into the client object
374,477
def cmdloop(self, intro=None): self.preloop() if self.use_rawinput and self.completekey: try: import readline self.old_completer = readline.get_completer() readline.set_completer(self.complete) readline.parse_...
Override the command loop to handle Ctrl-C.
374,478
def accessibles(self, roles=None): return [org[] for org in self.get_accessibles(self.request, roles=roles)]
Returns the list of *slugs* for which the accounts are accessibles by ``request.user`` filtered by ``roles`` if present.
374,479
def update_firewall_rule(firewall_rule, protocol=None, action=None, name=None, description=None, ip_version=None, source_ip_address=None, destina...
Update a firewall rule CLI Example: .. code-block:: bash salt '*' neutron.update_firewall_rule firewall_rule protocol=PROTOCOL action=ACTION name=NAME description=DESCRIPTION ip_version=IP_VERSION source_ip_address=SOURCE_IP_ADDRESS destination_ip_address=DESTINATION_I...
374,480
def get_version(brain_or_object): obj = get_object(brain_or_object) if not is_versionable(obj): return None return getattr(aq_base(obj), "version_id", 0)
Get the version of the current object :param brain_or_object: A single catalog brain or content object :type brain_or_object: ATContentType/DexterityContentType/CatalogBrain :returns: The current version of the object, or None if not available :rtype: int or None
374,481
def removeSessionWithKey(self, key): self.store.query( PersistentSession, PersistentSession.sessionKey == key).deleteFromStore()
Remove a persistent session, if it exists. @type key: L{bytes} @param key: The persistent session identifier.
374,482
def _method_complete(self, result): if isinstance(result, PrettyTensor): self._head = result return self elif isinstance(result, Loss): return result elif isinstance(result, PrettyTensorTupleMixin): self._head = result[0] return result else: self._head = self._he...
Called after an extention method with the result.
374,483
def _load_actor_from_local(self, driver_id, function_descriptor): module_name, class_name = (function_descriptor.module_name, function_descriptor.class_name) try: module = importlib.import_module(module_name) actor_class = getattr(modul...
Load actor class from local code.
374,484
def locked_get(self): credentials = None _helpers.validate_file(self._filename) try: f = open(self._filename, ) content = f.read() f.close() except IOError: return credentials try: credentials = client.Credenti...
Retrieve Credential from file. Returns: oauth2client.client.Credentials Raises: IOError if the file is a symbolic link.
374,485
def _wraptext(self, text, indent=0, width=0): return .join(self._wrap(par, indent, width) for par in text)
Shorthand for '\n'.join(self._wrap(par, indent, width) for par in text).
374,486
def customFilter(self, filterFunc): ret = self.__class__() for item in self: if filterFunc(item): ret.append(item) return ret
customFilter - Apply a custom filter to elements and return a QueryableList of matches @param filterFunc <lambda/function< - A lambda/function that is passed an item, and returns True if the item matches (will be returned), otherwise False. @return - A QueryableList object of th...
374,487
def clear_processes(self): for aProcess in self.iter_processes(): aProcess.clear() self.__processDict = dict()
Removes all L{Process}, L{Thread} and L{Module} objects in this snapshot.
374,488
def populate_field_list(self, excluded_fields=None): if excluded_fields is None: excluded_fields = [] self.field_list.clear() for field in self.layer.fields(): if field.type() not in qvariant_numbers: continue fie...
Helper to add field of the layer to the list. :param excluded_fields: List of field that want to be excluded. :type excluded_fields: list
374,489
def runif(self, seed=None): fr = H2OFrame._expr(expr=ExprNode("h2o.runif", self, -1 if seed is None else seed)) fr._ex._cache.ncols = 1 fr._ex._cache.nrows = self.nrow return fr
Generate a column of random numbers drawn from a uniform distribution [0,1) and having the same data layout as the source frame. :param int seed: seed for the random number generator. :returns: Single-column H2OFrame filled with doubles sampled uniformly from [0,1).
374,490
def collect_ansible_classes(): def trace_calls(frame, event, arg): if event != : return try: _locals = inspect.getargvalues(frame).locals if not in _locals: return _class = _locals[].__class__ _class_repr = ...
Run playbook and collect classes of ansible that are run.
374,491
def logspace(self,bins=None,units=None,conversion_function=convert_time,resolution=None,end_at_end=True): if type(bins) in [list, np.ndarray]: return bins min = conversion_function(self.min,from_units=self.units,to_units=units) max = conversion_function(self.max,from_units=s...
bins overwrites resolution
374,492
def send_await(self, msg, deadline=None): receiver = self.send_async(msg) response = receiver.get(deadline) data = response.unpickle() _vv and IOLOG.debug(, self, data) return data
Like :meth:`send_async`, but expect a single reply (`persist=False`) delivered within `deadline` seconds. :param mitogen.core.Message msg: The message. :param float deadline: If not :data:`None`, seconds before timing out waiting for a reply. :returns: ...
374,493
def _head_object(s3_conn, bucket, key): try: return s3_conn.head_object(Bucket=bucket, Key=key) except botocore.exceptions.ClientError as e: if e.response[][] == : return None else: raise
Retrieve information about an object in S3 if it exists. Args: s3_conn (botocore.client.S3): S3 connection to use for operations. bucket (str): name of the bucket containing the key. key (str): name of the key to lookup. Returns: dict: S3 object information, or None if the obje...
374,494
def getAllData(self, temp = True, accel = True, gyro = True): allData = {} if temp: allData["temp"] = self.getTemp() if accel: allData["accel"] = self.getAccelData( raw = False ) if gyro: allData["gyro"] = self.getGyroData() return ...
! Get all the available data. @param temp: True - Allow to return Temperature data @param accel: True - Allow to return Accelerometer data @param gyro: True - Allow to return Gyroscope data @return a dictionary data @retval {} Did not read any data @retv...
374,495
def refresh(self): response = requests.get( % (API_BASE_URL, self.name)) attributes = response.json() self.ancestors = [Category(name) for name in attributes[]] self.contents = WikiText(attributes[], attributes[]) self.description = attributes[]...
Refetch instance data from the API.
374,496
def _raise_unrecoverable_error_payplug(self, exception): message = ( + repr(exception) + ) raise exceptions.ClientError(message, client_exception=exception)
Raises an exceptions.ClientError with a message telling that the error probably comes from PayPlug. :param exception: Exception that caused the ClientError. :type exception: Exception :raise exceptions.ClientError
374,497
def GetLastKey(self, voice=1): voice_obj = self.GetChild(voice) if voice_obj is not None: key = BackwardSearch(KeyNode, voice_obj, 1) if key is not None: return key else: if hasattr(self, "key"): return sel...
key as in musical key, not index
374,498
def receive_message(self, message, data): if data[MESSAGE_TYPE] == TYPE_DEVICE_ADDED: uuid = data[][] name = data[][] self._add_member(uuid, name) return True if data[MESSAGE_TYPE] == TYPE_DEVICE_REMOVED: uuid = data[] s...
Called when a multizone message is received.
374,499
def format_hexdump(arg): line = for i in range(0, len(arg), 16): if i > 0: line += chunk = arg[i:i + 16] hex_chunk = hexlify(chunk).decode() hex_line = .join(hex_chunk[j:j + 2] for j in range(0, len(hex_chunk), 2)) if len(hex_line) < (3 * 16) - 1: ...
Convert the bytes object to a hexdump. The output format will be: <offset, 4-byte> <16-bytes of output separated by 1 space> <16 ascii characters>