Unnamed: 0
int64
0
389k
code
stringlengths
26
79.6k
docstring
stringlengths
1
46.9k
379,600
def autozoom(self, points): points = np.asarray(points) extraoff = 0.01 abc = np.array([self.a, self.b, self.c]) old_geom_center = points.sum(axis=0)/len(points) points = points.copy() + self.position ...
Fit the current view to the correct zoom level to display all *points*. The camera viewing direction and rotation pivot match the geometric center of the points and the distance from that point is calculated in order for all points to be in the field of view. This is currently u...
379,601
def prebinned_hist(counts, binlims, ax=None, *args, **kwargs): ax = get_ax(ax) x = bincenters(binlims) weights = counts return ax.hist(x, bins=binlims, weights=weights, *args, **kwargs)
Plot a histogram with counts, binlims already given. Example ======= >>> gaus = np.random.normal(size=100) >>> counts, binlims = np.histogram(gaus, bins='auto') >>> prebinned_hist(countsl binlims)
379,602
def entails(self, other): other = BoolCell.coerce(other) return other.is_entailed_by(self)
Inverse is_entailed_by
379,603
def irregular_sampling(T, N, rseed=None): sampling_period = (T/float(N)) N = int(N) np.random.seed(rseed) t = np.linspace(0, T, num=5*N) t[1:-1] += sampling_period*0.5*np.random.randn(5*N-2) P = np.random.permutation(5*N) t_irr = np.sort(t[P[:N]]) return t_irr
Generates an irregularly sampled time vector by perturbating a linearly spaced vector and latter deleting a certain number of points Parameters ---------- T: float Time span of the vector, i.e. how long it is in time N: positive integer Number of samples of the resulting t...
379,604
def fit(self, X, y=None): if self.normalize: X = normalize(X) self._check_force_weights() random_state = check_random_state(self.random_state) X = self._check_fit_data(X) ( self.cluster_centers_, self.labels_, self.inerti...
Compute mixture of von Mises Fisher clustering. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features)
379,605
def _fingerprint_target_specs(self, specs): assert self._build_graph is not None, ( .format(specs) ) hasher = sha1() for spec in sorted(specs): for target in sorted(self._build_graph.resolve(spec)): return hasher.hexdigest()
Returns a fingerprint of the targets resolved from given target specs.
379,606
def parse_option(self, option, block_name, *values): if option.endswith(): status = values[0] if status not in self.VALID_STATUSES: raise ValueError(u.format(status)) if len(values) > 2: raise TypeError if option == : ...
Parse status, end_status, timer_status and status_msg options.
379,607
def from_config(cls, cp, model, nprocesses=1, use_mpi=False): section = "sampler" assert cp.get(section, "name") == cls.name, ( "name in section [sampler] must match mine") nwalkers = int(cp.get(section, "nwalkers")) obj.set_burn_in_from_co...
Loads the sampler from the given config file.
379,608
def get_cgi_parameter_str_or_none(form: cgi.FieldStorage, key: str) -> Optional[str]: s = get_cgi_parameter_str(form, key) if s is None or len(s) == 0: return None return s
Extracts a string parameter from a CGI form, or ``None`` if the key doesn't exist or the string is zero-length.
379,609
def sort(self, column, order=Qt.AscendingOrder): ascending = order == Qt.AscendingOrder self.model.sort(self.COLUMN_INDEX, order=ascending) return True
Overriding sort method.
379,610
def push(self, line): if transforms.FROM_EXPERIMENTAL.match(line): transforms.add_transformers(line) self.buffer.append("\n") else: self.buffer.append(line) add_pass = False if line.rstrip().endswith(":"): add_pass = True ...
Transform and push a line to the interpreter. The line should not have a trailing newline; it may have internal newlines. The line is appended to a buffer and the interpreter's runsource() method is called with the concatenated contents of the buffer as source. If this indicat...
379,611
def _FormatMessage(self, event): message, _ = self._output_mediator.GetFormattedMessages(event) if message is None: data_type = getattr(event, , ) raise errors.NoFormatterFound( .format(data_type)) return message
Formats the message. Args: event (EventObject): event. Returns: str: message field. Raises: NoFormatterFound: if no event formatter can be found to match the data type in the event.
379,612
def getSingle(self, type_uri, default=None): values = self.data.get(type_uri) if not values: return default elif len(values) == 1: return values[0] else: raise AXError( % (type_uri,))
Get a single value for an attribute. If no value was sent for this attribute, use the supplied default. If there is more than one value for this attribute, this method will fail. @type type_uri: str @param type_uri: The URI for the attribute @param default: The value to return ...
379,613
async def eat(self, philosopher): loop = philosopher._loop while True: forks = self.forks if forks: if len(forks) == 2: self.thinking = 0 self.eaten += 1 philoso...
The ``philosopher`` performs one of these two actions: * eat, if he has both forks and then :meth:`release_forks`. * try to :meth:`pickup_fork`, if he has fewer than 2 forks.
379,614
def _hm_read_address(self): response = self._hm_send_address(self.address, 0, 0, 0) lookup = self.config[] offset = self.config[] keydata = {} for i in lookup: try: kdata = lookup[i] ddata = response[i + offset] ...
Reads from the DCB and maps to yaml config file.
379,615
def internal_name(self): unq = + super().internal_name() if self.tparams is not None: unq += "_" + "_".join(self.tparams) if self.tret is not None: unq += "_" + self.tret return unq
Return the unique internal name
379,616
def stream(self, date_created_from=values.unset, date_created_to=values.unset, limit=None, page_size=None): limits = self._version.read_limits(limit, page_size) page = self.page( date_created_from=date_created_from, date_created_to=date_created_to, ...
Streams ExecutionInstance records from the API as a generator stream. This operation lazily loads records as efficiently as possible until the limit is reached. The results are returned as a generator, so this operation is memory efficient. :param datetime date_created_from: Only show E...
379,617
async def _send_loop(self): while self._user_connected and not self._reconnecting: if self._pending_ack: ack = RequestState(MsgsAck(list(self._pending_ack)), self._loop) self._send_queue.append(ack) self._last_acks.append(ack) ...
This loop is responsible for popping items off the send queue, encrypting them, and sending them over the network. Besides `connect`, only this method ever sends data.
379,618
def fix_lines(source_lines, options, filename=): original_newline = find_newline(source_lines) tmp_source = .join(normalize_line_endings(source_lines, )) previous_hashes = set() if options.line_range: fixed_source = tmp_source else: fixed_sourc...
Return fixed source code.
379,619
def __gen_token_anno_file(self, top_level_layer): base_paula_id = .format(self.corpus_name, self.name) paula_id = .format(top_level_layer, self.corpus_name, self.name) E, tree = gen_pau...
creates an etree representation of a <multiFeat> file that describes all the annotations that only span one token (e.g. POS, lemma etc.). Note: discoursegraphs will create one token annotation file for each top level layer (e.g. conano, tiger etc.).
379,620
def process_form(self, instance, field, form, empty_marker=None, emptyReturnsMarker=False, validating=True): service_uids = form.get("uids", []) return service_uids, {}
Return UIDs of the selected services
379,621
def _extra_trust_root_validation(self): store = None cert_chain_context_pointer = None try: store = crypt32.CertOpenStore( Crypt32Const.CERT_STORE_PROV_MEMORY, Crypt32Const.X509_ASN_ENCODING, null(),...
Manually invoked windows certificate chain builder and verification step when there are extra trust roots to include in the search process
379,622
def _get_init_args(self): args = {} for rop in self.ro_properties: if rop in self.properties: args[rop] = self.properties[rop] return args
Creates dict with properties marked as readonly
379,623
def process_flagged_blocks(self, content: str) -> str: def _sub(flagged_block): options = self.get_options(flagged_block.group()) required_flags = { flag.lower() for flag in re.split(self._flag_delimiters, options.get(, )) if fla...
Replace flagged blocks either with their contents or nothing, depending on the value of ``FOLIANT_FLAGS`` environment variable and ``flags`` config value. :param content: Markdown content :returns: Markdown content without flagged blocks
379,624
def getProjectAreas(self, archived=False, returned_properties=None): return self._getProjectAreas(archived=archived, returned_properties=returned_properties)
Get all :class:`rtcclient.project_area.ProjectArea` objects If no :class:`rtcclient.project_area.ProjectArea` objects are retrieved, `None` is returned. :param archived: (default is False) whether the project area is archived :param returned_properties: the returned propert...
379,625
def names(self): if is_term(self.terms): return frozenset([self.terms.name]) return frozenset(term.name for term in com.flatten(self.terms))
Get the names in an expression
379,626
def path_wrapper(func): @functools.wraps(func) def wrapped(node, context=None, _func=func, **kwargs): if context is None: context = contextmod.InferenceContext() if context.push(node): return None yielded = set() generator = _func(node, con...
return the given infer function wrapped to handle the path Used to stop inference if the node has already been looked at for a given `InferenceContext` to prevent infinite recursion
379,627
def days(self): monday = self.day(0) return [monday + timedelta(days=i) for i in range(7)]
Return the 7 days of the week as a list (of datetime.date objects)
379,628
def _press_special_key(self, key, down): key_code = special_key_translate_table[key] ev = NSEvent.otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2_( NSSystemDefined, (0,0), 0xa00 if down else 0xb00, ...
Helper method for special keys. Source: http://stackoverflow.com/questions/11045814/emulate-media-key-press-on-mac
379,629
def _validate_alias_command(alias_command): if not alias_command: raise CLIError(EMPTY_ALIAS_ERROR) split_command = shlex.split(alias_command) boundary_index = len(split_command) for i, subcommand in enumerate(split_command): if not re.match(, subcommand.lower()) or i > COLLISION_C...
Check if the alias command is valid. Args: alias_command: The command to validate.
379,630
def insert(self): if not self.curs: raise LIGOLwDBError, "Database connection not initalized" if len(self.table) == 0: raise LIGOLwDBError, for tab in self.table.keys(): generate = [] missingcols = [k for k in self.ldb.uniqueids[tab] if k not in self.table[tab][...
Insert the object into the database
379,631
def fade_to_rgb_uncorrected(self, fade_milliseconds, red, green, blue, led_number=0): action = ord() fade_time = int(fade_milliseconds / 10) th = (fade_time & 0xff00) >> 8 tl = fade_time & 0x00ff buf = [REPORT_ID, action, int(red), int(green), int(blue), th, tl, led_numb...
Command blink(1) to fade to RGB color, no color correction applied.
379,632
def predict(self): if self.w_ is not None: sigmoid = lambda t: 1. / (1. + np.exp(-t)) return sigmoid(np.dot(self.centers, self.w_[:-1]) + self.w_[-1]) else: pass
Returns ------- proba : ndarray, shape=(n_clusters, ) The probability of given cluster being label 1.
379,633
def temp_output_file(prefix="tmp", suffix="", dir=None, make_parents=False, always_clean=False): return _temp_output(False, prefix=prefix, suffix=suffix, dir=dir, make_parents=make_parents, always_clean=always_clean)
A context manager for convenience in creating a temporary file, which is deleted when exiting the context. Usage: with temp_output_file() as (fd, path): ...
379,634
def get_families_by_ids(self, *args, **kwargs): catalogs = self._get_provider_session().get_families_by_ids(*args, **kwargs) cat_list = [] for cat in catalogs: cat_list.append(Family(self._provider_manager, cat, self._runtime, self._proxy)) return F...
Pass through to provider FamilyLookupSession.get_families_by_ids
379,635
def set_proxy(self, proxy, update=True): update_web_driver = False if self.current_proxy != proxy: update_web_driver = True self.current_proxy = proxy if proxy is None: self.driver_args[] = self.default_service_args else: ...
Set proxy for requests session
379,636
def debug(self): debug = False if os.path.isfile(os.path.join(self.tcex.args.tc_temp_path, )): debug = True return debug
Return debug setting
379,637
def _apply_over_vars_with_dim(func, self, dim=None, **kwargs): ds = type(self)(coords=self.coords, attrs=self.attrs) for name, var in self.data_vars.items(): if dim in var.dims: ds[name] = func(var, dim=dim, **kwargs) else: ds[name] = var return ds
wrapper for datasets
379,638
def mode_yubikey_otp(self, private_uid, aes_key): if not self.capabilities.have_yubico_OTP(): raise yubikey_base.YubiKeyVersionError( \ % (self.capabilities.model, self.ykver[0], self.ykver[1])) if private_uid.startswith(b): ...
Set the YubiKey up for standard OTP validation.
379,639
def commit(self): if not self.connection: import boto self.connection = boto.connect_route53() return self.connection.change_rrsets(self.hosted_zone_id, self.to_xml())
Commit this change
379,640
def check_content(content, **kwargs): try: tree = fragment_fromstring(content) processed = False if isinstance(kwargs[], bool): if not kwargs[]: kwargs[] = else: raise ImproperlyConfigured() ...
check content for "active" urls
379,641
def _parse_function_return_types_from_doc(cls, doc): data = dict(name=, col_types=[], col_names=[], _type=None) if doc: return_doc = __doc__.split()[-1].strip() data[] = return_doc.split()[0] if data[].startswith(): if data[].endswith(): ...
This will extract the return type for list of lists so that the repr can display the header. :param doc: str of the function doc :return dict of {func.__name__:{'api_type':'type','col_name':[], 'col_type':[],'repr_type':None}}
379,642
def get_http_authentication(private_key: RsaKey, private_key_id: str) -> HTTPSignatureHeaderAuth: key = private_key.exportKey() return HTTPSignatureHeaderAuth( headers=["(request-target)", "user-agent", "host", "date"], algorithm="rsa-sha256", key=key, key_id=private_key_id,...
Get HTTP signature authentication for a request.
379,643
def nii_ones_like(in_file, value, dtype, newpath=None): import os import numpy as np import nibabel as nb nii = nb.load(in_file) data = np.ones(nii.shape, dtype=float) * value out_file = os.path.join(newpath or os.getcwd(), "filled.nii.gz") nii = nb.Nifti1Image(data, nii.affine, nii.h...
Create a NIfTI file filled with ``value``, matching properties of ``in_file``
379,644
def enum_check(*args, func=None): func = func or inspect.stack()[2][3] for var in args: if not isinstance(var, (enum.EnumMeta, aenum.EnumMeta)): name = type(var).__name__ raise EnumError( f)
Check if arguments are of protocol type.
379,645
def _query(self, path, args=None, skip_cache=False, skip_sleep=False): if args is None: args = {} def _cacheable(r): return not ("no-cache" in r and lxml.etree.XML(r).xpath("//meta/@content=")) ...
return results for a NCBI query, possibly from the cache :param: path: relative query path (e.g., 'einfo.fcgi') :param: args: dictionary of query args :param: skip_cache: whether to bypass the cache on reading :param: skip_sleep: whether to bypass query throttling :rtype: xml st...
379,646
def exit_standby(name, instance_ids, should_decrement_desired_capacity=False, region=None, key=None, keyid=None, profile=None): ["i-xxxxxx"] conn = _get_conn_autoscaling_boto3( region=region, key=key, keyid=keyid, profile=profile) try: response = conn.exit_standby( ...
Exit desired instances from StandBy mode .. versionadded:: 2016.11.0 CLI example:: salt-call boto_asg.exit_standby my_autoscale_group_name '["i-xxxxxx"]'
379,647
def get_all_handleable_leaves(self): nodes = self.get_device_tree() return [node.device for node in sorted(nodes.values(), key=DevNode._sort_key) if not node.ignored and node.device and all(child.ignored for child in node.children)]
Get list of all handleable devices, return only those that represent leaf nodes within the filtered device tree.
379,648
def multidict(D): keys = list(D.keys()) if len(keys) == 0: return [[]] try: N = len(D[keys[0]]) islist = True except: N = 1 islist = False dlist = [dict() for d in range(N)] for k in keys: if islist: for i in range(N): ...
creates a multidictionary
379,649
def create_from_hdu(cls, hdu, ebins): hpx = HPX.create_from_hdu(hdu, ebins) colnames = hdu.columns.names cnames = [] if hpx.conv.convname == : pixs = hdu.data.field() chans = hdu.data.field() keys = chans * hpx.npix + pixs vals = h...
Creates and returns an HpxMap object from a FITS HDU. hdu : The FITS ebins : Energy bin edges [optional]
379,650
def print_item_callback(item): print(.format( item.get(, ), item.get(, ), item.get(, )))
Print an item callback, used by &listen.
379,651
def update_stats(self, stats, value, _type, sample_rate=1): stats = self.format(stats, value, _type, self.prefix) self.send(self.sample(stats, sample_rate), self.addr)
Pipeline function that formats data, samples it and passes to send() >>> client = StatsdClient() >>> client.update_stats('example.update_stats', 73, "c", 0.9)
379,652
def _macs2_cmd(method="chip"): if method.lower() == "chip": cmd = ("{macs2} callpeak -t {chip_bam} -c {input_bam} {paired} " " {genome_size} -n {name} -B {options}") elif method.lower() == "atac": cmd = ("{macs2} callpeak -t {chip_bam} --nomodel " " {paired} {...
Main command for macs2 tool.
379,653
def RgbToHsl(r, g, b): minVal = min(r, g, b) maxVal = max(r, g, b) l = (maxVal + minVal) / 2.0 if minVal==maxVal: return (0.0, 0.0, l) d = maxVal - minVal if l < 0.5: s = d / (maxVal + minVal) else: s = d / (2.0 - maxVal - minVal) dr, dg, db = [(...
Convert the color from RGB coordinates to HSL. Parameters: :r: The Red component value [0...1] :g: The Green component value [0...1] :b: The Blue component value [0...1] Returns: The color as an (h, s, l) tuple in the range: h[0...360], s[0...1], ...
379,654
def strip_rts_retries(self, idx): rts_retries, = struct.unpack_from(, self._rtap, idx) return idx + 1, rts_retries
strip(1 byte) rts_retries :idx: int :return: int idx :return: int
379,655
def fetch_items(self, category, **kwargs): from_date = kwargs[] to_date = kwargs[] branches = kwargs[] latest_items = kwargs[] no_update = kwargs[] ncommits = 0 try: if os.path.isfile(self.gitpath): commits = self.__fetch_fro...
Fetch the commits :param category: the category of items to fetch :param kwargs: backend arguments :returns: a generator of items
379,656
def generate_dummy_graph(network): graph = pypsa.descriptors.OrderedGraph() graph.add_nodes_from([bus for bus in network.buses.index if bus not in buses_to_split]) for node in graph.nodes(): graph.node[node]["pos"] = np.array(network.buses.loc[node,["x","y"]],dtype=float) ...
Generate a dummy graph to feed to the FIAS libraries. It adds the "pos" attribute and removes the 380 kV duplicate buses when the buses have been split, so that all load and generation is attached to the 220kV bus.
379,657
def reset(self): self.__mem.reset() self.__cpu.reset() self.__tainter.reset() self.__instr_handler_pre = None, None self.__instr_handler_post = None, None self.__set_default_handlers()
Reset emulator. All registers and memory are reset.
379,658
def diff_lines(self): start_lines = self._build_file_source_lines[:] end_lines = self.build_file_lines() diff_generator = unified_diff(start_lines, end_lines, fromfile=self.build_file.relpath, tofile=s...
A diff between the original BUILD file and the resulting BUILD file.
379,659
def parse(self, sentence): words = np.zeros((len(sentence) + 1, 1), np.int32) tags = np.zeros((len(sentence) + 1, 1), np.int32) words[0, 0] = ParserVocabulary.ROOT tags[0, 0] = ParserVocabulary.ROOT vocab = self._vocab for i, (word, tag) in enumerate(sentence): ...
Parse raw sentence into ConllSentence Parameters ---------- sentence : list a list of (word, tag) tuples Returns ------- ConllSentence ConllSentence object
379,660
def get_members(cls, member_class=None, is_member=None, sort_key=None, _parameter=None): if member_class is None and is_member is None: raise TypeError("get_members either needs a member_class parameter or an is_member check function (or both)") members = OrderedDict() for base in cls.__bases_...
Collect all class level attributes matching the given criteria. :param class member_class: Class(es) to collect :param is_member: Function to determine if an object should be collected :param sort_key: Function to invoke on members to obtain ordering (Default is to use ordering from `creation_o...
379,661
def set_permissions(filename, uid=None, gid=None, mode=0775): if uid is None: uid = get_ftp_uid() if gid is None: gid = -1 os.chown(filename, uid, gid) os.chmod(filename, mode)
Set pemissions for given `filename`. Args: filename (str): name of the file/directory uid (int, default proftpd): user ID - if not set, user ID of `proftpd` is used gid (int): group ID, if not set, it is not changed mode (int, default 0775): unix ...
379,662
def dump(data, abspath, indent_format=False, float_precision=None, ensure_ascii=True, overwrite=False, enable_verbose=True): prt("\nDump to ..." % abspath, enable_verbose) abspath = lower_ext(str(abspath)) is_json = is_json_file(abspath) if os.path.ex...
Dump Json serializable object to file. Provides multiple choice to customize the behavior. :param data: Serializable python object. :type data: dict or list :param abspath: ``save as`` path, file extension has to be ``.json`` or ``.gz`` (for compressed Json) :type abspath: string :par...
379,663
def _get_choices(self, gandi): packages = super(CertificatePackageType, self)._get_choices(gandi) return list(set([pack.split()[1] for pack in packages]))
Internal method to get choices list
379,664
def benchmark_setup(self): def f(): self._setup() self.mod_ext.synchronize(**self.ext_kwargs) f() self.setup_stat = self._calc_benchmark_stat(f)
Benchmark setup execution.
379,665
def p_gate_op_5(self, program): program[0] = node.Barrier([program[2]]) self.verify_bit_list(program[2]) self.verify_distinct([program[2]])
gate_op : BARRIER id_list ';'
379,666
def get_devicecore_api(self): from devicecloud.devicecore import DeviceCoreAPI return DeviceCoreAPI(self._conn, self.get_sci_api())
Returns a :class:`.DeviceCoreAPI` bound to this device cloud instance This provides access to the same API as :attr:`.DeviceCloud.devicecore` but will create a new object (with a new cache) each time called. :return: devicecore API object bound to this device cloud account :rtype: :cla...
379,667
def _ConvertValueMessage(value, message): if isinstance(value, dict): _ConvertStructMessage(value, message.struct_value) elif isinstance(value, list): _ConvertListValueMessage(value, message.list_value) elif value is None: message.null_value = 0 elif isinstance(value, bool): message.bool_valu...
Convert a JSON representation into Value message.
379,668
def stem_singular_word(self, word): context = Context(word, self.dictionary, self.visitor_provider) context.execute() return context.result
Stem a singular word to its common stem form.
379,669
def to_array_with_default(value, default_value): result = ArrayConverter.to_nullable_array(value) return result if result != None else default_value
Converts value into array object with specified default. Single values are converted into arrays with single element. :param value: the value to convert. :param default_value: default array object. :return: array object or default array when value is None.
379,670
async def delete_shade_from_scene(self, shade_id, scene_id): return await self.request.delete( self._base_path, params={ATTR_SCENE_ID: scene_id, ATTR_SHADE_ID: shade_id} )
Delete a shade from a scene.
379,671
def next(self, times=1): return Range(copy(self.end), self.end + self.elapse, tz=self.start.tz)
Returns a new instance of self times is not supported yet.
379,672
def randkey(bits, keyspace=string.ascii_letters + string.digits + , rng=None): return "".join(char for char in iter_random_chars(bits, keyspace, rng))
Returns a cryptographically secure random key of desired @bits of entropy within @keyspace using :class:random.SystemRandom @bits: (#int) minimum bits of entropy @keyspace: (#str) or iterable allowed output chars @rng: the random number generator to use. Defaults to :class:r...
379,673
def local_check (self): log.debug(LOG_CHECK, "Checking %s", unicode(self)) assert not self.extern[1], log.debug(LOG_CHECK, "checking connection") try: self.check_connection() self.set_content_type() self.add_size_info() ...
Local check function can be overridden in subclasses.
379,674
def discard(self, element): try: i = int(element) set.discard(self, i) except ValueError: pass
Remove element from the RangeSet if it is a member. If the element is not a member, do nothing.
379,675
def for_category(self, category, live_only=False): filters = {: category.tag} if live_only: filters.update({: True}) return self.filter(**filters)
Returns queryset of EntryTag instances for specified category. :param category: the Category instance. :param live_only: flag to include only "live" entries. :rtype: django.db.models.query.QuerySet.
379,676
def binary(self): if isinstance(self.value, bytes): length = len(self.value) if length > 4294967295: raise OutputException() elif self.bits != 8: return ( b_chr(_TAG_BIT_BINARY_EXT) + struct.pack...
return encoded representation
379,677
def _free(self, ptr): raise NotImplementedError("%s not implemented for %s" % (self._free.__func__.__name__, self.__class__.__name__))
Handler for any libc `free` SimProcedure call. If the heap has faithful support for `free`, it ought to be implemented in a `free` function (as opposed to the `_free` function). :param ptr: the location in memory to be freed
379,678
def getDocFactory(self, fragmentName, default=None): themes = self._preferredThemes() for t in themes: fact = t.getDocFactory(fragmentName, None) if fact is not None: return fact return default
Retrieve a Nevow document factory for the given name. @param fragmentName: a short string that names a fragment template. @param default: value to be returned if the named template is not found.
379,679
def send_mail( subject, sender, to, message, html_message=None, cc=None, bcc=None, attachments=None, host=None, port=None, auth_user=None, auth_password=None, use_tls=False, fail_silently=False, ): if message is None and html_message is N...
Send a single email to a recipient list. All members of the recipient list will see the other recipients in the 'To' field. Note: The API for this method is frozen. New code wanting to extend the functionality should use the EmailMessage class directly.
379,680
def _ProcessTask(self, task): logger.debug(.format(task.identifier)) if self._tasks_profiler: self._tasks_profiler.Sample(task, ) self._task = task storage_writer = self._storage_writer.CreateTaskStorage(task) if self._serializers_profiler: storage_writer.SetSerializersProfiler(...
Processes a task. Args: task (Task): task.
379,681
def report_numbers2marc(self, key, value): def _get_mangled_source(source): if source == : return return source source = _get_mangled_source(value.get()) if value.get(): return { : source, : value.get(), } return { : so...
Populate the ``037`` MARC field.
379,682
def read(self, line, f, data): data["energy"] = float(f.readline().split()[1]) N = len(data["symbols"]) gradient = data.get("gradient") if gradient is None: gradient = np.zeros((N,3), float) data["gradient"] = gradient for i in range(N): ...
See :meth:`PunchParser.read`
379,683
def is_valid(self): is_valid = super(GAErrorReportingMixin, self).is_valid() if self.is_bound and not is_valid: try: self.report_errors_to_ga(self.errors) except: logger.exception() return is_valid
Error reporting is triggered when a form is checked for validity
379,684
def power_spectrum(self, input_filepath): effect_args = [, , , ] _, _, stat_output = self.build( input_filepath, None, extra_args=effect_args, return_output=True ) power_spectrum = [] lines = stat_output.split() for line in lines: split_...
Calculates the power spectrum (4096 point DFT). This method internally invokes the stat command with the -freq option. Note: The file is downmixed to mono prior to computation. Parameters ---------- input_filepath : str Path to input file to compute stats on. ...
379,685
def getLocation(self): method = try: data = _doget(method, photo_id=self.id) except FlickrError: return None loc = data.rsp.photo.location return [loc.latitude, loc.longitude]
Return the latitude+longitutde of the picture. Returns None if no location given for this pic.
379,686
def cli(env): manager = CapacityManager(env.client) result = manager.list() table = formatting.Table( ["ID", "Name", "Capacity", "Flavor", "Location", "Created"], title="Reserved Capacity" ) for r_c in result: occupied_string = " available_string = "-" * int(r_c....
List Reserved Capacity groups.
379,687
def properties_strict(instance): if instance[] not in enums.TYPES: return defined_props = enums.PROPERTIES.get(instance[], []) for prop in instance.keys(): if prop not in defined_props: yield JSONError("Property is not one of those defined in the" ...
Ensure that no custom properties are used, but only the official ones from the specification.
379,688
def reduce_min(attrs, inputs, proto_obj): new_attrs = translation_utils._fix_attribute_names(attrs, {:}) return , new_attrs, inputs
Reduce the array along a given axis by minimum value
379,689
def get_task_fs(self, courseid, taskid): if not id_checker(courseid): raise InvalidNameException("Course with invalid name: " + courseid) if not id_checker(taskid): raise InvalidNameException("Task with invalid name: " + taskid) return self._filesystem.from_subfo...
:param courseid: the course id of the course :param taskid: the task id of the task :raise InvalidNameException :return: A FileSystemProvider to the folder containing the task files
379,690
def update(self, max_norm=None): if max_norm is not None: self._clip_by_global_norm(max_norm) self._module.update()
Updates parameters according to the installed optimizer and the gradients computed in the previous forward-backward batch. Gradients are clipped by their global norm if `max_norm` is set. Parameters ---------- max_norm: float, optional If set, clip values of all grad...
379,691
def get(self): try: cluster = self.get_argument_cluster() role = self.get_argument_role() environ = self.get_argument_environ() topology_name = self.get_argument_topology() component = self.get_argument_component() metric_names = self.get_required_arguments_metricnames() ...
get method
379,692
def incr(self, key, to_add=1): if key not in self.value: self.value[key] = CountMetric() self.value[key].incr(to_add)
Increments the value of a given key by ``to_add``
379,693
def summary(self, solution=None, threshold=1E-06, fva=None, names=False, floatfmt=): from cobra.flux_analysis.summary import model_summary return model_summary(self, solution=solution, threshold=threshold, fva=fva, names=names, floatfmt=floatfmt)
Print a summary of the input and output fluxes of the model. Parameters ---------- solution: cobra.Solution, optional A previously solved model solution to use for generating the summary. If none provided (default), the summary method will resolve the model. ...
379,694
def install_payment_instruction(self, instruction, token_type="Unrestricted", transaction_id=None): if(transaction_id == None): transaction_id = uuid.uuid4() params = {} params[] = instruction p...
InstallPaymentInstruction instruction: The PaymentInstruction to send, for example: MyRole=='Caller' orSay 'Roles do not match'; token_type: Defaults to "Unrestricted" transaction_id: Defaults to a new ID
379,695
def get_mass(chebi_id): if len(__MASSES) == 0: __parse_chemical_data() return __MASSES[chebi_id] if chebi_id in __MASSES else float()
Returns mass
379,696
def execute(self): if self.args and self.argument(0) == "help": self.error(self.usage() + "\n\n" + self.help()) return False return True
Execute the command. Intercepts the help subsubcommand to show the help text.
379,697
def update_view(self, table, view): body = { : { : table.project_id, : table.dataset_id, : table.table_id }, : { : view } } if self.table_exists(table): self.cli...
Updates the SQL query for a view. If the output table exists, it is replaced with the supplied view query. Otherwise a new table is created with this view. :param table: The table to contain the view. :type table: BQTable :param view: The SQL query for the view. :type v...
379,698
def identifiers(self, identifiers): if (isinstance(identifiers, subject_abcs.IdentifierCollection) or identifiers is None): self._identifiers = identifiers else: raise ValueError()
:type identifiers: subject_abcs.IdentifierCollection
379,699
def deploy_snmp(snmp, host=None, admin_username=None, admin_password=None, module=None): return __execute_cmd(.format(snmp), host=host, admin_username=admin_username, admin_password=admin_password, ...
Change the QuickDeploy SNMP community string, used for switches as well CLI Example: .. code-block:: bash salt dell dracr.deploy_snmp SNMP_STRING host=<remote DRAC or CMC> admin_username=<DRAC user> admin_password=<DRAC PW> salt dell dracr.deploy_password diana secret