code
stringlengths
51
2.34k
docstring
stringlengths
11
171
def separators(self, reordered = True): if reordered: return [list(self.snrowidx[self.sncolptr[k]+self.snptr[k+1]-self.snptr[k]:self.sncolptr[k+1]]) for k in range(self.Nsn)] else: return [list(self.__p[self.snrowidx[self.sncolptr[k]+self.snptr[k+1]-self.snptr[k]:self.sncolptr[k...
Returns a list of separator sets
def _open_file(cls, writer_spec, filename_suffix, use_tmp_bucket=False): if use_tmp_bucket: bucket = cls._get_tmp_gcs_bucket(writer_spec) account_id = cls._get_tmp_account_id(writer_spec) else: bucket = cls._get_gcs_bucket(writer_spec) account_id = cls._get_account_id(writer_spec) fi...
Opens a new gcs file for writing.
def tilt(poly): num = len(poly) - 1 vec = unit_normal(poly[0], poly[1], poly[num]) vec_alt = np.array([vec[0], vec[1], vec[2]]) vec_z = np.array([0, 0, 1]) return angle2vecs(vec_alt, vec_z)
Tilt of a polygon poly
def kill_all(self): logger.info('Job {0} killing all currently running tasks'.format(self.name)) for task in self.tasks.itervalues(): if task.started_at and not task.completed_at: task.kill()
Kill all currently running jobs.
def autoencoder_residual_discrete(): hparams = autoencoder_residual() hparams.bottleneck_bits = 1024 hparams.bottleneck_noise = 0.05 hparams.add_hparam("discretize_warmup_steps", 16000) hparams.add_hparam("bottleneck_kind", "tanh_discrete") hparams.add_hparam("isemhash_noise_dev", 0.5) hparams.add_hparam(...
Residual discrete autoencoder model.
def to_python(self): mapping = {} for row in self.rows: mapping[row[0]] = _format_python_value(row[1]) return mapping
Decode this KeyValueTable object to standard Python types.
def keyPressEvent(self, evt): incr = 0 if evt.modifiers() == Qt.ControlModifier: n = self.tabWidget.count() if evt.key() in [Qt.Key_PageUp, Qt.Key_Backtab]: incr = -1 elif evt.key() in [Qt.Key_PageDown, Qt.Key_Tab]: incr = 1 ...
This handles Ctrl+PageUp, Ctrl+PageDown, Ctrl+Tab, Ctrl+Shift+Tab
def _combine_out_files(chr_files, work_dir, data): out_file = "%s.bed" % sshared.outname_from_inputs(chr_files) if not utils.file_exists(out_file): with file_transaction(data, out_file) as tx_out_file: with open(tx_out_file, "w") as out_handle: for chr_file in chr_files: ...
Concatenate all CNV calls into a single file.
def convert_unit(self, column, value): "If the user has provided a unit in the query, convert it into the column unit, if present." if column not in self.units: return value value = self.ureg(value) if isinstance(value, numbers.Number): return value column...
If the user has provided a unit in the query, convert it into the column unit, if present.
def metadata(self, filename): meta = self.get_metadata(filename) meta['mime'] = meta.get('mime') or files.mime(filename, self.DEFAULT_MIME) return meta
Fetch all available metadata for a given file
def namespace_to_dict(o): d = {} for k, v in o.__dict__.items(): if not callable(v): d[k] = v return d
Convert an argparse namespace object to a dictionary.
def disconnect(self): if self.connection_receive: self.connection_receive.close() if self.connection_respond: self.connection_respond.close() if self.connection_send: self.connection_send.close()
Close all connections that are set on this wire
def wrap(self, other): if other.childs: raise TagError(self, "Wrapping in a non empty Tag is forbidden.") if self.parent: self.before(other) self.parent.pop(self._own_index) other.append(self) return self
Wraps this element inside another empty tag.
def start_timer(self, reprate): print 'starting digital output at rate {} Hz'.format(reprate) self.trigger_task = DigitalOutTask(self.trigger_src, reprate) self.trigger_task.start()
Start the digital output task that serves as the acquistion trigger
def install_hg(path): hook = op.join(path, 'hgrc') if not op.isfile(hook): open(hook, 'w+').close() c = ConfigParser() c.readfp(open(hook, 'r')) if not c.has_section('hooks'): c.add_section('hooks') if not c.has_option('hooks', 'commit'): c.set('hooks', 'commit', 'python:...
Install hook in Mercurial repository.
def option2tuple(opt): if isinstance(opt[0], int): tup = opt[1], opt[2:] else: tup = opt[0], opt[1:] return tup
Return a tuple of option, taking possible presence of level into account
def run_socket_event_loop(self): try: while True: self._pool.join() if len(self._logger_data.keys()) == 0: time.sleep(0.5) except KeyboardInterrupt: pass finally: self._pool.kill()
Start monitoring managed loggers.
def render_node(node, context=None, edit=True): output = node.render(**context or {}) or u'' if edit: return u'<span data-i18n="{0}">{1}</span>'.format(node.uri.clone(scheme=None, ext=None, version=None), output) else: return output
Render node as html for templates, with edit tagging.
def multiplicon_file(self, value): assert os.path.isfile(value), "%s is not a valid file" % value self._multiplicon_file = value
Setter for _multiplicon_file attribute
def first(self): csvsource = CSVSource(self.source, self.factory, self.key()) try: item = csvsource.items().next() return item except StopIteration: return None
Returns the first ICachableItem in the ICachableSource
def fetch_appl(): yql = YQL('AAPL', '2014-01-01', '2014-01-10') for item in yql: print item.get('date'), item.get('price') yql.select('AAPL', '2014-01-01', '2014-01-10') for item in yql: print item.get('date'), item.get('price')
Returns stock prices for Apple company.
def update(self): for device in self.devices: device.update() for i in range(len(self._channel_dict["devices"])): device_dict = self._channel_dict["devices"][i] for device in self._devices: if device.name == device_dict["common.ALLTYPES_NAME"]: ...
Updates the dictionary of the channel
def focusOutEvent(self, event): event.ignore() if sys.platform == "darwin": if event.reason() != Qt.ActiveWindowFocusReason: self.close() else: self.close()
Reimplement Qt method to close the widget when loosing focus.
def __del_frozen(self): self.__delattr__('_frozen') for attr, val in self.__dict__.items(): if isinstance(val, Config) and hasattr(val, '_frozen'): val.__del_frozen()
Removes _frozen attribute from this instance and all its child configurations.
def _get_struct_gradientbevelfilter(self): obj = _make_object("GradientBevelFilter") obj.NumColors = num_colors = unpack_ui8(self._src) obj.GradientColors = [self._get_struct_rgba() for _ in range(num_colors)] obj.GradientRatio = [unpack_ui8(self._src) ...
Get the values for the GRADIENTBEVELFILTER record.
def bind(self, field_name, parent): assert parent.Meta.model is not None, \ "DRYPermissions is used on '{}' without a model".format(parent.__class__.__name__) for action in self.actions: if not self.object_only: global_method_name = "has_{action}_permission".forma...
Check the model attached to the serializer to see what methods are defined and save them.
def parse(cls, detail_string): split = detail_string.split(':') if len(split) != 4: raise Exception('invalid credentials') ltpk = binascii.unhexlify(split[0]) ltsk = binascii.unhexlify(split[1]) atv_id = binascii.unhexlify(split[2]) client_id = binascii.unhexl...
Parse a string represention of Credentials.
def preloop(self): if not self.already_prelooped: self.already_prelooped = True open('.psiturk_history', 'a').close() readline.read_history_file('.psiturk_history') for i in range(readline.get_current_history_length()): if readline.get_history_item...
Keep persistent command history.
def create_program_action(parent, text, name, icon=None, nt_name=None): if is_text_string(icon): icon = get_icon(icon) if os.name == 'nt' and nt_name is not None: name = nt_name path = programs.find_program(name) if path is not None: return create_action(parent, text, icon...
Create action to run a program
def resize_for_flows(self): if self.system.config.dime_enable: self.system.tds.config.compute_flows = True if self.system.tds.config.compute_flows: nflows = 2 * self.system.Bus.n + \ 8 * self.system.Line.n + \ 2 * self.system.Area.n_combi...
Extend `unamey` and `fnamey` for bus injections and line flows
def pre_process(self, xout, y0, params=()): for pre_processor in self.pre_processors: xout, y0, params = pre_processor(xout, y0, params) return [self.numpy.atleast_1d(arr) for arr in (xout, y0, params)]
Transforms input to internal values, used internally.
def SendVersion(self): m = Message("version", VersionPayload(settings.NODE_PORT, self.remote_nodeid, settings.VERSION_NAME)) self.SendSerializedMessage(m)
Send our client version.
def _gegetate_args(self, options): for optkey, optval in self._normalize_options(options): yield optkey if isinstance(optval, (list, tuple)): assert len(optval) == 2 and optval[0] and optval[ 1], 'Option value can only be either a string or a (tuple, l...
Generator of args parts based on options specification.
def __update_service_status(self, statuscode): if self.__service_status != statuscode: self.__service_status = statuscode self.__send_service_status_to_frontend()
Set the internal status of the service object, and notify frontend.
def _connect(dbfile: 'PathLike') -> apsw.Connection: conn = apsw.Connection(os.fspath(dbfile)) _set_foreign_keys(conn, 1) assert _get_foreign_keys(conn) == 1 return conn
Connect to SQLite database file.
def forward_backward(self, data_batch): self.forward(data_batch, is_train=True) self.backward()
A convenient function that calls both ``forward`` and ``backward``.
def to_native_units(self, motor): assert abs(self.rotations_per_second) <= motor.max_rps,\ "invalid rotations-per-second: {} max RPS is {}, {} was requested".format( motor, motor.max_rps, self.rotations_per_second) return self.rotations_per_second/motor.max_rps * motor.max_speed
Return the native speed measurement required to achieve desired rotations-per-second
def format_label(self, field, counter): return '<label for="id_formfield_%s" %s>%s</label>' % ( counter, field.field.required and 'class="required"', field.label)
Format the label for each field
def delete_user(self, user): assert self.user == 'catroot' or self.user == 'postgres' assert not user == 'public' con = self.connection or self._connect() cur = con.cursor() cur.execute('DROP SCHEMA {user} CASCADE;'.format(user=user)) cur.execute('REVOKE USAGE ON SCHEMA p...
Delete user and all data
def resolve_att(a, fallback): if a is None: return fallback if a.background in ['default', '']: bg = fallback.background else: bg = a.background if a.foreground in ['default', '']: fg = fallback.foreground else: fg = a.foreground return AttrSpec(fg, bg)
replace '' and 'default' by fallback values
def download_if_not_exists(url: str, filename: str, skip_cert_verify: bool = True, mkdir: bool = True) -> None: if os.path.isfile(filename): log.info("No need to download, already have: {}", filename) return if mkdir: directory, basen...
Downloads a URL to a file, unless the file already exists.
def rollback(self, date): if self.onOffset(date): return date else: return date - QuarterEnd(month=self.month)
Roll date backward to nearest end of quarter
def force_to_string(unknown): result = '' if type(unknown) is str: result = unknown if type(unknown) is int: result = str(unknown) if type(unknown) is float: result = str(unknown) if type(unknown) is dict: result = Dict2String(unknown) if type(unknown) is list: ...
converts and unknown type to string for display purposes.
def desc(self): if 'ects' in self: fmt = '%s (%s, S%d) [%s, %.2f ECTS]' fields = ('title', 'code', 'semester', 'status', 'ects') else: fmt = '%s' fields = ('title',) s = fmt % tuple([self[f] for f in fields]) if self['followed'] and self['s...
A textual description of this course
def ast2expr(ast): if ast[0] == 'const': return _CONSTS[ast[1]] elif ast[0] == 'var': return exprvar(ast[1], ast[2]) else: xs = [ast2expr(x) for x in ast[1:]] return ASTOPS[ast[0]](*xs, simplify=False)
Convert an abstract syntax tree to an Expression.
def _get_lonely_contract(self): contracts = {} try: raw_res = yield from self._session.get(MAIN_URL, timeout=self._timeout) except OSError: raise PyHydroQuebecError("Can not get main page") content = yield from ra...
Get contract number when we have only one contract.
def reject_all(self): keys = self.list_keys() for key in keys[self.PEND]: try: shutil.move( os.path.join( self.opts['pki_dir'], self.PEND, key), ...
Reject all keys in pre
def dispense(self): self.sendcommand(Vendapin.DISPENSE) time.sleep(1) response = self.receivepacket() print('Vendapin.dispense(): ' + str(response)) if not self.was_packet_accepted(response): raise Exception('DISPENSE packet not accepted: ' + str(response)) re...
dispense a card if ready, otherwise throw an Exception
def list_revisions_of_build_configuration(id=None, name=None, page_size=200, page_index=0, sort=""): data = list_revisions_of_build_configuration_raw(id, name, page_size, page_index, sort) if data: return utils.format_json_list(data)
List audited revisions of a BuildConfiguration
def LocalPathToCanonicalPath(path): path_components = path.split("/") result = [] for component in path_components: m = re.match(r"\\\\.\\", component) if not m: component = component.replace("\\", "/") result.append(component) return utils.JoinPath(*result)
Converts path from the local system's convention to the canonical.
def op_at_on(operation: ops.Operation, time: Timestamp, device: Device): return ScheduledOperation(time, device.duration_of(operation), operation)
Creates a scheduled operation with a device-determined duration.
def workaround_type_coercions_in_recursions(match_query): new_match_traversals = [] for current_traversal in match_query.match_traversals: new_traversal = [] for match_step in current_traversal: new_match_step = match_step has_coerce_type = match_step.coerce_type_block is...
Lower CoerceType blocks into Filter blocks within Recurse steps.
def close_window(self): if self.undocked_window is not None: self.undocked_window.close() self.undocked_window = None self.undock_action.setDisabled(False) self.close_plugin_action.setDisabled(False)
Close QMainWindow instance that contains this plugin.
def _match_metric(self, metric): if len(self._compiled_filters) == 0: return True for (collector, filter_regex) in self._compiled_filters: if collector != metric.getCollectorPath(): continue if filter_regex.match(metric.getMetricPath()): ...
matches the metric path, if the metrics are empty, it shorts to True
def ms_to_datetime(ms, tzinfo=None): if not isinstance(ms, (int, long)): raise TypeError('expected integer, not %s' % type(ms)) if tzinfo is None: tzinfo = mktz() return datetime.datetime.fromtimestamp(ms * 1e-3, tzinfo)
Convert a millisecond time value to an offset-aware Python datetime object.
def list_to_scope(scope): if isinstance(scope, unicode_type) or scope is None: return scope elif isinstance(scope, (set, tuple, list)): return " ".join([unicode_type(s) for s in scope]) else: raise ValueError("Invalid scope (%s), must be string, tuple, set, or list." % scope)
Convert a list of scopes to a space separated string.
def _coord2offset(self, coord): size = self.size offset = 0 for dim, index in enumerate(coord): size //= self._normshape[dim] offset += size * index return offset
Convert a normalized coordinate to an item offset.
def streams(self): if self._streams is None: self._streams = list(self._stream_df["STREAM"].values) return self._streams
A list of available streams
def auto_override_class(cls, force = False, force_recursive = False): if not pytypes.checking_enabled: return cls assert(isclass(cls)) if not force and is_no_type_check(cls): return cls keys = [key for key in cls.__dict__] for key in keys: memb = cls.__dict__[key] if ...
Works like auto_override, but is only applicable to classes.
def _get_remarks_component(self, string, initial_pos): remarks_code = string[initial_pos:initial_pos + self.ADDR_CODE_LENGTH] if remarks_code != 'REM': raise ish_reportException("Parsing remarks. Expected REM but got %s." % (remarks_code,)) expected_length = int(string[0:4]) + self.PREAMBLE_LENGTH ...
Parse the remarks into the _remarks dict
def create(self, item, dry_run=None): return self.backend.create(validate(item, version=self.version, context=self.context), dry_run=dry_run)
Create a new item in backend.
def OnCellBorderWidth(self, event): with undo.group(_("Border width")): self.grid.actions.set_border_attr("borderwidth", event.width, event.borders) self.grid.ForceRefresh() self.grid.update_attribute_toolbar() event.Skip()
Cell border width event handler
def emit_function(self, return_type=None, argtypes=[], proxy=True): if argtypes is not None: make_func = ctypes.CFUNCTYPE(return_type, *argtypes) else: make_func = ctypes.CFUNCTYPE(return_type) code = self.emit() func = make_func(code.value) func.address =...
Compiles code and returns a Python-callable function.
def _ExpandPath(self, target, vals, paths): if target not in self._TARGETS: return expanded = [] for val in vals: shellvar = self._SHELLVAR_RE.match(val) if not val: expanded.append(".") elif shellvar: existing = paths.get(shellvar.group(1).upper()) if existin...
Extract path information, interpolating current path values as needed.
def archaius(self): bucket = self.format['s3_bucket'].format(**self.data) path = self.format['s3_bucket_path'].format(**self.data) archaius_name = self.format['s3_archaius_name'].format(**self.data) archaius = {'s3': archaius_name, 'bucket': bucket, 'path': path} return archaius
Generate archaius bucket path.
def colour_rgb(self): hexvalue = self.status()[self.DPS][self.DPS_INDEX_COLOUR] return BulbDevice._hexvalue_to_rgb(hexvalue)
Return colour as RGB value
def parse_char(self, c): self.buf.extend(c) self.total_bytes_received += len(c) if self.native: if native_testing: self.test_buf.extend(c) m = self.__parse_char_native(self.test_buf) m2 = self.__parse_char_le...
input some data bytes, possibly returning a new message
def user_disable_throw_rest_endpoint(self, username, url='rest/scriptrunner/latest/custom/disableUser', param='userName'): url = "{}?{}={}".format(url, param, username) return self.get(path=url)
The disable method throw own rest enpoint
def Parse(factory, file): entities = [] while 1: data = GetNextStruct(file) if not data: break entities.extend(ProcessStruct(factory, data)) return entities
Parses the input file and returns C code and corresponding header file.
def purview_indices(self, direction): return { Direction.CAUSE: self.cause_indices, Direction.EFFECT: self.effect_indices }[direction]
The indices of nodes in the purview system.
def sampleLocationFromFeature(self, feature): if feature == "topDisc": return self._sampleLocationOnDisc(top=True) elif feature == "topEdge": return self._sampleLocationOnEdge(top=True) elif feature == "bottomDisc": return self._sampleLocationOnDisc(top=False) elif feature == "bottomEd...
Samples a location from the provided specific features.
def _build_session_groups(self): groups_by_name = {} run_to_tag_to_content = self._context.multiplexer.PluginRunToTagToContent( metadata.PLUGIN_NAME) for (run, tag_to_content) in six.iteritems(run_to_tag_to_content): if metadata.SESSION_START_INFO_TAG not in tag_to_content: continue ...
Returns a list of SessionGroups protobuffers from the summary data.
def remove_duplicate_notes(self): res = [] for x in self.notes: if x not in res: res.append(x) self.notes = res return res
Remove duplicate and enharmonic notes from the container.
def get(self, oid, host, port, community): ret = {} if not isinstance(oid, tuple): oid = self._convert_to_oid(oid) host = socket.gethostbyname(host) snmpAuthData = cmdgen.CommunityData( 'agent-{}'.format(community), community) snmpTransportData...
Perform SNMP get for a given OID
def do_ls(self, table=None): if table is None: fields = OrderedDict( [ ("Name", "name"), ("Status", "status"), ("Read", "total_read_throughput"), ("Write", "total_write_throughput"), ] ...
List all tables or print details of one table
def collect(self): cmd = [self.config['bin'], "list"] if str_to_bool(self.config['reset']): cmd.append("reset") if str_to_bool(self.config['use_sudo']): cmd.insert(0, self.config['sudo_cmd']) matcher = re.compile("{ pkts = (.*), bytes = (.*) } = (.*);") li...
Collect and publish netfilter counters
def _get_simple_assignments(tree): result = {} for node in ast.walk(tree): if isinstance(node, ast.Assign): for target in node.targets: if isinstance(target, ast.Name): result[target.id] = node.value return result
Get simple assignments from node tree.
def _validate_extra_component(bs_data): assert len(bs_data['elements']) > 0 for el in bs_data['elements'].values(): if not 'electron_shells' in el: continue for s in el['electron_shells']: nprim = len(s['exponents']) if nprim <= 0: raise Runtim...
Extra checks for component basis files
def remove_text_structure(self, text_structure): idx = self.hucit_has_structure.index(text_structure) ts = self.hucit_has_structure.pop(idx) ts.remove() self.update() return
Remove any citable text structure to the work.
def major_extent(self) -> complex: return max((self.max() - self.null, self.null - self.min()))
Maximum deviation from null.
def parent_dir(path): return os.path.abspath(os.path.join(path, os.pardir, os.pardir, '_build'))
Return the parent of a directory.
def relations_for_id(relid=None): relation_data = [] relid = relid or relation_ids() for unit in related_units(relid): unit_data = relation_for_unit(unit, relid) unit_data['__relid__'] = relid relation_data.append(unit_data) return relation_data
Get relations of a specific relation ID
def dav_index(context, data): url = data.get('url') result = context.http.request('PROPFIND', url) for resp in result.xml.findall('./{DAV:}response'): href = resp.findtext('./{DAV:}href') if href is None: continue rurl = urljoin(url, href) rdata = data.copy() ...
List files in a WebDAV directory.
def stChromaFeaturesInit(nfft, fs): freqs = numpy.array([((f + 1) * fs) / (2 * nfft) for f in range(nfft)]) Cp = 27.50 nChroma = numpy.round(12.0 * numpy.log2(freqs / Cp)).astype(int) nFreqsPerChroma = numpy.zeros((nChroma.shape[0], )) uChroma = numpy.unique(nChroma) for u in uChroma: ...
This function initializes the chroma matrices used in the calculation of the chroma features
def jboss_standalone_conf_file(broker): log_files = broker[JDRSpecs.jboss_standalone_server_log] if log_files: log_content = log_files[-1].content results = [] for line in log_content: if "sun.java.command =" in line and ".jdr" not in line and "-Djboss...
Get which jboss standalone conf file is using from server log
def select(select, tag, namespaces=None, limit=0, flags=0, **kwargs): return compile(select, namespaces, flags, **kwargs).select(tag, limit)
Select the specified tags.
def logger_new (self, loggername, **kwargs): args = self[loggername] args.update(kwargs) return self.loggers[loggername](**args)
Instantiate new logger and return it.
def downloadThumbnail(self, outPath): url = self._url + "/info/thumbnail" params = { } return self._get(url=url, out_folder=outPath, file_name=None, param_dict=params, security...
downloads the items's thumbnail
def unwrap_rtx(rtx, payload_type, ssrc): packet = RtpPacket( payload_type=payload_type, marker=rtx.marker, sequence_number=unpack('!H', rtx.payload[0:2])[0], timestamp=rtx.timestamp, ssrc=ssrc, payload=rtx.payload[2:]) packet.csrc = rtx.csrc packet.extensions ...
Recover initial packet from a retransmission packet.
def _apply_theme(self): self.theme.apply_axs(self.axs) self.theme.apply_figure(self.figure)
Apply theme attributes to Matplotlib objects
def oneImageNLF(img, img2=None, signal=None): x, y, weights, signal = calcNLF(img, img2, signal) _, fn, _ = _evaluate(x, y, weights) return fn, signal
Estimate the NLF from one or two images of the same kind
def from_serializable(cls, object_dict): key_class = cls._from_visible(cls.STARTS_WITH + 'class' + cls.ENDS_WITH) key_module = cls._from_visible(cls.STARTS_WITH + 'module' + cls.ENDS_WITH) obj_class = object_dict.pop(key_class) obj_module = object_dict.pop(key_module) if key_module in ob...
core class method to create visible objects from a dictionary
def wait_for_host(self, host): t = time.time() if host in self.times: due_time = self.times[host] if due_time > t: wait = due_time - t time.sleep(wait) t = time.time() wait_time = random.uniform(self.wait_time_min, self.wait...
Throttle requests to one host.
def _remove_remote_data_bags(): data_bags_path = os.path.join(env.node_work_path, 'data_bags') if exists(data_bags_path): sudo("rm -rf {0}".format(data_bags_path))
Remove remote data bags, so it won't leak any sensitive information
def split(self, tValues): if self.segmentType == "curve": on1 = self.previousOnCurve off1 = self.points[0].coordinates off2 = self.points[1].coordinates on2 = self.points[2].coordinates return bezierTools.splitCubicAtT(on1, off1, off2, on2, *tValues) ...
Split the segment according the t values
def _flds_shape(fieldname, header): shp = list(header['nts']) shp.append(header['ntb']) if fieldname == 'Velocity': shp.insert(0, 3) header['xp'] = int(header['nts'][0] != 1) shp[1] += header['xp'] header['yp'] = int(header['nts'][1] != 1) shp[2] += header['yp'] ...
Compute shape of flds variable.
def normalAt(self, i): normals = self.polydata(True).GetPointData().GetNormals() return np.array(normals.GetTuple(i))
Return the normal vector at vertex point `i`.
def last(values, axis, skipna=None): if (skipna or skipna is None) and values.dtype.kind not in 'iSU': _fail_on_dask_array_input_skipna(values) return nanlast(values, axis) return take(values, -1, axis=axis)
Return the last non-NA elements in this array along the given axis
def _CronJobFromRow(self, row): (job, create_time, enabled, forced_run_requested, last_run_status, last_run_time, current_run_id, state, leased_until, leased_by) = row job = rdf_cronjobs.CronJob.FromSerializedString(job) job.current_run_id = db_utils.IntToCronJobRunID(current_run_id) job.enabled = ...
Creates a cronjob object from a database result row.
def add_tags(self, *tags): normed_tags = self.api.manager._normalize_tags(tags) self.api.manager.add_tags(self.archive_name, normed_tags)
Set tags for a given archive