Unnamed: 0
int64
0
389k
code
stringlengths
26
79.6k
docstring
stringlengths
1
46.9k
353,700
def depth_texture(self, size, data=None, *, samples=0, alignment=4) -> : res = Texture.__new__(Texture) res.mglo, res._glo = self.mglo.depth_texture(size, data, samples, alignment) res._size = size res._components = 1 res._samples = samples res._dtype = ...
Create a :py:class:`Texture` object. Args: size (tuple): The width and height of the texture. data (bytes): Content of the texture. Keyword Args: samples (int): The number of samples. Value 0 means no multisample format. alignment...
353,701
def login(self, username=None, password=None, login_url=None, auth_url=None): return super(ConnectionBasic, self).login(username, password, login_url, auth_url)
This will automatically log the user into the pre-defined account Feel free to overwrite this with an endpoint on endpoint load :param username: str of the user name to login in as :param password: str of the password to login as :param login_url: str of the url for the server's logi...
353,702
def readerForDoc(cur, URL, encoding, options): ret = libxml2mod.xmlReaderForDoc(cur, URL, encoding, options) if ret is None:raise treeError() return xmlTextReader(_obj=ret)
Create an xmltextReader for an XML in-memory document. The parsing flags @options are a combination of xmlParserOption.
353,703
def MakeSuiteFromCdf(cdf, name=None): if name is None: name = cdf.name suite = Suite(name=name) prev = 0.0 for val, prob in cdf.Items(): suite.Incr(val, prob - prev) prev = prob return suite
Makes a normalized Suite from a Cdf object. Args: cdf: Cdf object name: string name for the new Suite Returns: Suite object
353,704
def calculate_dimensionality_of_site(bonded_structure, site_index, inc_vertices=False): def neighbours(comp_index): return [(s.index, s.jimage) for s in bonded_structure.get_connected_sites(comp_index)] def rank(vertices): if len(vertice...
Calculates the dimensionality of the component containing the given site. Implements directly the modified breadth-first-search algorithm described in Algorithm 1 of: P. Larsem, M. Pandey, M. Strange, K. W. Jacobsen, 2018, arXiv:1808.02114 Args: bonded_structure (StructureGraph): A structure ...
353,705
def validate(self, obj, pointer=None): pointer = pointer or validator = deepcopy(self) validator.errors = [] validator.fail_fast = False obj = deepcopy(obj) obj = validator.validate_enum(obj, pointer) obj = validator.validate_type(obj, pointer) ...
Validate object against validator :param obj: the object to validate
353,706
def popen(args, **kwargs): if "stdin" not in kwargs: try: file_no = sys.stdin.fileno() except AttributeError: file_no = sys.__stdin__.fileno() if file_no not in (0, 1, 2): kwargs["stdin"] = subprocess.PIPE return subprocess.Popen(args, **kwargs)
Wrapper for `subprocess.Popen`. Avoids python bug described here: https://bugs.python.org/issue3905. This can arise when apps (maya) install a non-standard stdin handler. In newer version of maya and katana, the sys.stdin object can also become replaced by an object with no 'fileno' attribute, this is...
353,707
def restore_retention_data(self, data): if not in data: logger.warning("Retention data are not correct, no property!") return for host_name in data[]: host = self.hosts.find_by_name(host_name) if host is not None: s...
Restore retention data Data coming from retention will override data coming from configuration It is kinda confusing when you modify an attribute (external command) and it get saved by retention :param data: data from retention :type data: dict :return: None
353,708
def request(url, args=None, data=None, headers=None, method=None, credentials=None, raw_response=False, stats=None): if headers is None: headers = {} headers[] = if args is not None: qs = urllib.parse.urlencode(args) url = url + + qs if data is not...
Issues HTTP requests. Args: url: the URL to request. args: optional query string arguments. data: optional data to be sent within the request. headers: optional headers to include in the request. method: optional HTTP method to use. If unspecified this is inferred (GET or PO...
353,709
async def run(self, command, timeout=None): action = client.ActionFacade.from_connection(self.connection) log.debug( , command, self.name) if timeout: timeout = int(timeout * 1000000000) res = await action.Run( [], ...
Run command on this unit. :param str command: The command to run :param int timeout: Time, in seconds, to wait before command is considered failed :returns: A :class:`juju.action.Action` instance.
353,710
def create_span( span_id, parent_span_id, trace_id, span_name, annotations, binary_annotations, timestamp_s, duration_s, ): trace_id_length = len(trace_id) trace_id_high = None if trace_id_length > 16: assert trace_id_length == 32 trace_id, trace_id_...
Takes a bunch of span attributes and returns a thriftpy2 representation of the span. Timestamps passed in are in seconds, they're converted to microseconds before thrift encoding.
353,711
def dir(base_dir: str, rr_id: str) -> str: LOGGER.debug(, base_dir, rr_id) if not ok_rev_reg_id(rr_id): LOGGER.debug(, rr_id) raise BadIdentifier(.format(rr_id)) rv = join(base_dir, rev_reg_id2cred_def_id(rr_id)) LOGGER.debug(, rv) return rv
Return correct subdirectory of input base dir for artifacts corresponding to input rev reg id. :param base_dir: base directory for tails files, thereafter split by cred def id :param rr_id: rev reg id
353,712
def _get_fiber_image(self, cpores): r fiber_rad = self.network.fiber_rad vox_len = self.network.resolution fiber_rad = np.around((fiber_rad-(vox_len/2))/vox_len, 0).astype(int) verts = self[] [vxmin, vxmax, vymin, vymax, vzmin, vzmax] = self.vertex_dimen...
r""" Produce image by filling in voxels along throat edges using Bresenham line then performing distance transform on fiber voxels to erode the pore space
353,713
def symlink(source, target, isfile=True): from fortpy.code import config from os import path if config.symlink: from os import symlink, remove if path.isfile(target) or path.islink(target): remove(target) elif path.isdir(target): msg.warn("Cannot auto-del...
Creates a symlink at target *file* pointing to source. :arg isfile: when True, if symlinking is disabled in the global config, the file is copied instead with fortpy.utility.copyfile; otherwise fortpy.utility.copy is used and the target is considered a directory.
353,714
def sort(records: Sequence[Record]) -> List[Record]: "Sort records into a canonical order, suitable for comparison." return sorted(records, key=_record_key)
Sort records into a canonical order, suitable for comparison.
353,715
def min_between(min_reps=3, max_reps=8, percentile=0.33): higher_limit = min_reps + (max_reps - min_reps) * percentile return min_reps, math.ceil(higher_limit)
Function to decide the minimum number of reps to perform given `min_reps` and `max_rep`. Parameters ---------- min_reps The minimum number of repeitions. max_reps The maximum number of repetitions. percentile The percentile to cap at. Return ------- (low, ...
353,716
def draw(self): self.ax.plot(self.alphas, self.errors, label=self.name.lower()) alpha = self.alphas[np.where(self.errors == self.errors.max())][0] label = "$\\alpha_{{max}}={:0.3f}$".format(alpha) self.ax.axvline(alpha, color=, linestyle=, label=label) ...
Draws the alphas values against their associated error in a similar fashion to the AlphaSelection visualizer.
353,717
def set_selected_radio_button(self): dont_use_button = self.default_input_button_group.button( len(self._parameter.default_values) - 2) dont_use_button.setChecked(True)
Set selected radio button to 'Do not report'.
353,718
def write(self, handle): handle.seek(0) handle.write(struct.pack(self.BINARY_FORMAT, self.parameter_block, 0x50, self.point_count, self.analog_count, ...
Write binary header data to a file handle. This method writes exactly 512 bytes to the beginning of the given file handle. Parameters ---------- handle : file handle The given handle will be reset to 0 using `seek` and then 512 bytes will be written to d...
353,719
async def _get_input_dialog(self, dialog): try: if dialog.SUBCLASS_OF_ID == 0xa21c9795: dialog.peer = await self.get_input_entity(dialog.peer) return dialog elif dialog.SUBCLASS_OF_ID == 0xc91c90b6: return types.InputDialogPeer...
Returns a :tl:`InputDialogPeer`. This is a bit tricky because it may or not need access to the client to convert what's given into an input entity.
353,720
def get_public_datasets_and_tokens(self): datasets = {} tokens = self.get_public_tokens() for t in tokens: dataset = self.get_token_dataset(t) if dataset in datasets: datasets[dataset].append(t) else: datasets[dataset] ...
NOTE: VERY SLOW! Get a dictionary relating key:dataset to value:[tokens] that rely on that dataset. Arguments: None Returns: dict: relating key:dataset to value:[tokens]
353,721
def Eq(value, message="Not equal to {!s}"): @wraps(Eq) def built(_value): if _value != value: raise Error(message.format(value)) return _value return built
Creates a validator that compares the equality of the given value to ``value``. A custom message can be specified with ``message``. It will be formatted with ``value``.
353,722
def _dict_to_tuple(d): retval[0:5] = map(operator.__neg__, retval[0:5]) return tuple(retval)
Convert a dictionary to a time tuple. Depends on key values in the regexp pattern!
353,723
def qgis_expressions(): all_expressions = { fct[0]: fct[1] for fct in getmembers(generic_expressions) if fct[1].__class__.__name__ == } all_expressions.update({ fct[0]: fct[1] for fct in getmembers(infographic) if fct[1].__class__.__name__ == }) all_expressions.update({ ...
Retrieve all QGIS Expressions provided by InaSAFE. :return: Dictionary of expression name and the expression itself. :rtype: dict
353,724
def get_meas_los(self, user_lo_config): try: _m_los = self.default_meas_los.copy() except KeyError: raise PulseError() for channel, lo_freq in user_lo_config.meas_lo_dict().items(): _m_los[channel.index] = lo_freq if _m_los == self.default_m...
Embed default meas LO frequencies from backend and format them to list object. If configured lo frequency is the same as default, this method returns `None`. Args: user_lo_config (LoConfig): A dictionary of LOs to format. Returns: list: A list of meas LOs. Rais...
353,725
def flat_map(iterable, func): results = [] for element in iterable: result = func(element) if len(result) > 0: results.extend(result) return results
func must take an item and return an interable that contains that item. this is flatmap in the classic mode
353,726
def getdminfo(self, columnname=None): dminfo = self._getdminfo() if columnname is None: return dminfo for fld in dminfo.values(): if columnname in fld["COLUMNS"]: fldc = fld.copy() del fldc[] return fldc ...
Get data manager info. Each column in a table is stored using a data manager. A storage manager is a data manager storing the physically in a file. A virtual column engine is a data manager that does not store data but calculates it on the fly (e.g. scaling floats to short to re...
353,727
def alias_package(package, alias, extra_modules={}): path = package.__path__ alias_prefix = alias + prefix = package.__name__ + for _, name, _ in pkgutil.walk_packages(path, prefix): if name.startswith(): continue try: if name not in sys.modul...
Alias a python package properly. It ensures that modules are not duplicated by trying to import and alias all the submodules recursively.
353,728
def get_adjustments(self, zero_qtr_data, requested_qtr_data, last_per_qtr, dates, assets, columns, **kwargs): split_adjusted_cols_for_g...
Calculates both split adjustments and overwrites for all sids.
353,729
def minimise_tables(routing_tables, target_lengths, methods=(remove_default_entries, ordered_covering)): if not isinstance(target_lengths, dict): lengths = collections.defaultdict(lambda: target_lengths) else: lengths = target_lengths new_tables = dict() ...
Utility function which attempts to minimises routing tables for multiple chips. For each routing table supplied, this function will attempt to use the minimisation algorithms given (or some sensible default algorithms), trying each sequentially until a target number of routing entries has been reac...
353,730
def get_default_config_help(self): config = super(SentryHandler, self).get_default_config_help() config.update({ : , }) return config
Returns the help text for the configuration options for this handler
353,731
def standard(target, mol_weight=, density=): r MW = target[mol_weight] rho = target[density] value = rho/MW return value
r""" Calculates the molar density from the molecular weight and mass density Parameters ---------- target : OpenPNM Object The object for which these values are being calculated. This controls the length of the calculated array, and also provides access to other necessary therm...
353,732
def _get_go2pydotnode(self): go2node = {} for goid, goobj in self.godag.go2obj.items(): txt = self._get_node_text(goid, goobj) fillcolor = self.goid2color.get(goid, "white") node = self.pydot.Node( txt, shape="box", ...
Create pydot Nodes.
353,733
def ProcessBlocks(self, block_limit=1000): self._lock.acquire() try: blockcount = 0 while self._current_height <= Blockchain.Default().Height and (block_limit == 0 or blockcount < block_limit): block = Blockchain.Default().GetBlockByHeight(self._current_...
Method called on a loop to check the current height of the blockchain. If the height of the blockchain is more than the current stored height in the wallet, we get the next block in line and processes it. In the case that the wallet height is far behind the height of the blockchain, we do this...
353,734
def extract_common_args(command, parser, cl_args): try: cluster_role_env = cl_args.pop() except KeyError: try: cluster_role_env = cl_args.pop() except KeyError: subparser = config.get_subparser(parser, command) print(subparser.format_help()) return dict() new_cl_ar...
Extract all the common args for all commands :param command: :param parser: :param cl_args: :return:
353,735
def evolve(self, new_date): if all(p.state.date == new_date for p in self.producers): return [p.state for p in self.producers] if self._cholesky is not None: q = [self.random.gauss(0., 1.) for _ in range(len(self._cholesky))] q = list(self._cholesky.dot(q)) ...
evolve to the new process state at the next date :param date new_date: date or point in time of the new state :return State:
353,736
def pipeline(self, transaction=True, shard_hint=None): args_dict = { : self.connection_pool, : self.response_callbacks, : transaction, : shard_hint, : self.logger, } return StonePipeline(**args_dict)
Return a pipeline that support StoneRedis custom methods
353,737
def adjust_contrast_log(arr, gain): if arr.dtype.name == "uint8": min_value, _center_value, max_value = iadt.get_value_range_of_dtype(arr.dtype) dynamic_range = max_value - min_value value_range = np.linspace(0, 1.0, num=dynamic_range+1, dtype=np.float32) ...
Adjust contrast by scaling each pixel value to ``255 * gain * log_2(1 + I_ij/255)``. dtype support:: * ``uint8``: yes; fully tested (1) (2) (3) * ``uint16``: yes; tested (2) (3) * ``uint32``: yes; tested (2) (3) * ``uint64``: yes; tested (2) (3) (4) * ``int8``: limited; tes...
353,738
def _replace_local_codeuri(self): all_resources = self.sam_template.get("Resources", {}) for _, resource in all_resources.items(): resource_type = resource.get("Type") resource_dict = resource.get("Properties") if resource_type == "AWS::Serverless::Functi...
Replaces the CodeUri in AWS::Serverless::Function and DefinitionUri in AWS::Serverless::Api to a fake S3 Uri. This is to support running the SAM Translator with valid values for these fields. If this in not done, the template is invalid in the eyes of SAM Translator (the translator does not support loca...
353,739
def serialize(self): log_items = [] data = msgpack.unpackb(self.data, raw=False) for item in data.items(): value_to_store = ( None if not isinstance(item[1], numbers.Number) or isinf(item[1]) or isnan(item[1])...
serialize.
353,740
def _to_dict(self): _dict = {} if hasattr(self, ) and self.overwrite is not None: _dict[] = self.overwrite return _dict
Return a json dictionary representing this model.
353,741
def _get_chrbands(self, limit, taxon): if limit is None: limit = sys.maxsize model = Model(self.graph) line_counter = 0 myfile = .join((self.rawdir, self.files[taxon][])) LOG.info("Processing Chr bands from FILE: %s", myfile) geno = Genotype(self....
:param limit: :return:
353,742
def get_headers(self, cmd, msg_length, extra_headers): cmd_header = "%s %s" % (cmd, PROTOCOL_VERSION) len_header = "Content-length: %s" % msg_length headers = [cmd_header, len_header] if self.user: user_header = "User: %s" % self.user headers.append(user_...
Returns the headers string based on command to execute
353,743
def all(self, timeout=None, max_concurrency=64, auto_batch=True): return self.fanout(, timeout=timeout, max_concurrency=max_concurrency, auto_batch=auto_batch)
Fanout to all hosts. Works otherwise exactly like :meth:`fanout`. Example:: with cluster.all() as client: client.flushdb()
353,744
def _check_ising_quadratic_ranges(quad_ranges, graph): if quad_ranges is None: quad_ranges = {} for u in graph: if u not in quad_ranges: quad_ranges[u] = {} if quad_ranges[u][v] != quad_ranges[v][u]: ...
check correctness/populate defaults for ising_quadratic_ranges.
353,745
def create(cls, name_value, name_type): if isinstance(name_value, Name.NameValue): value = name_value elif isinstance(name_value, str): value = cls.NameValue(name_value) else: name = msg = exceptions.ErrorStrings.BAD_EXP_RECV ...
Returns a Name object, populated with the given value and type
353,746
def get_packet_type(cls, type_): if type_ <= ether.ETH_TYPE_IEEE802_3: type_ = ether.ETH_TYPE_IEEE802_3 return cls._TYPES.get(type_)
Override method for the Length/Type field (self.ethertype). The Length/Type field means Length or Type interpretation, same as ethernet IEEE802.3. If the value of Length/Type field is less than or equal to 1500 decimal(05DC hexadecimal), it means Length interpretation and be pass...
353,747
def _url_collapse_path(path): path_parts = path.split() head_parts = [] for part in path_parts[:-1]: if part == : head_parts.pop() elif part and part != : head_parts.append( part ) if path_parts: tail_part = path_parts.pop() if tail...
Given a URL path, remove extra '/'s and '.' path elements and collapse any '..' references and returns a colllapsed path. Implements something akin to RFC-2396 5.2 step 6 to parse relative paths. The utility of this function is limited to is_cgi method and helps preventing some security attacks. R...
353,748
def delete(stack, region, profile): ini_data = {} environment = {} environment[] = stack if region: environment[] = region else: environment[] = find_myself() if profile: environment[] = profile ini_data[] = environment if start_smash(ini_data): s...
Delete the given CloudFormation stack.
353,749
def __calculate_volume(self): volume = 0.0 for i in range(0, len(self.__max_corner)): side_length = self.__max_corner[i] - self.__min_corner[i] if side_length != 0.0: if volume == 0.0: volume = side_length else: volume *= side_l...
! @brief Calculates volume of current spatial block. @details If empty dimension is detected (where all points has the same value) then such dimension is ignored during calculation of volume. @return (double) Volume of current spatial block.
353,750
def pack(self, value=None): if isinstance(value, type(self)): return value.pack() try: if value is None: value = self.value packed = struct.pack(self._fmt, bytes(value, )) return packed[:-1] + b except struct.error as er...
Pack the value as a binary representation. Returns: bytes: The binary representation. Raises: struct.error: If the value does not fit the binary format.
353,751
def Sum(input_vertex: vertex_constructor_param_types, label: Optional[str]=None) -> Vertex: return Double(context.jvm_view().SumVertex, label, cast_to_double_vertex(input_vertex))
Performs a sum across all dimensions :param input_vertex: the vertex to have its values summed
353,752
def crop_square(im, r, c, sz): return im[r:r+sz, c:c+sz]
crop image into a square of size sz,
353,753
def create_synchronised_files(in_path=((, ), (, )), channels=(1, 1), file_name=): h5_channels = [+str(i) for i in channels] txt_channels = [ + str(i) for i in channels] generate_sync_h5_file(in_path[1], channels=h5_channels, new_path=file_name+) generate_sync_txt_file(in_path[...
----- Brief ----- This function creates .txt and .h5 files with synchronised signals. ----------- Description ----------- OpenSignals software generates 3 types of files structured in specific ways. The formats are .txt, .h5 and .edf. Those files follow specific structures in order to n...
353,754
def read_reporting_discussions(self, project=None, continuation_token=None, max_page_size=None): route_values = {} if project is not None: route_values[] = self._serialize.url(, project, ) query_parameters = {} if continuation_token is not None: query_par...
ReadReportingDiscussions. [Preview API] :param str project: Project ID or project name :param str continuation_token: :param int max_page_size: :rtype: :class:`<ReportingWorkItemRevisionsBatch> <azure.devops.v5_1.work-item-tracking.models.ReportingWorkItemRevisionsBatch>`
353,755
def print_msg(msg, ofd, hdr): payloadlen = c_int(nlmsg_len(hdr)) attrlen = 0 data = nlmsg_data(hdr) ops = nl_cache_ops_associate_safe(msg.nm_protocol, hdr.nlmsg_type) if ops: attrlen = nlmsg_attrlen(hdr, ops.co_hdrsize) payloadlen.value -= attrlen if msg.nm_protocol == libnl...
https://github.com/thom311/libnl/blob/libnl3_2_25/lib/msg.c#L929. Positional arguments: msg -- Netlink message (nl_msg class instance). ofd -- function to call with arguments similar to `logging.debug`. hdr -- Netlink message header (nlmsghdr class instance).
353,756
def key(self): s values {}:{}:obj'.format(prefix, self.id)
Returns the redis key to access this object's values
353,757
def set_regex(self, regex=None, reset=False): if reset: text = else: text = self.finder.text().replace(, ).lower() self.proxy_model.set_filter(text) self.source_model.update_search_letters(text) self.sortByColumn(SEARCH_SCORE, Qt.Ascend...
Update the regex text for the shortcut finder.
353,758
def task(self, func, *args, **kwargs): task = self.gator.task_class(**self.task_kwargs) return self.gator.push(task, func, *args, **kwargs)
Pushes a task onto the queue (with the specified options). This will instantiate a ``Gator.task_class`` instance, configure the task execution options, configure the callable & its arguments, then push it onto the queue. You'll typically call this method when specifying advanced option...
353,759
def create_target_group(name, protocol, port, vpc_id, region=None, key=None, keyid=None, profile=None, health_check_protocol=, health_check_port=, health_check_path=, health_check_interval_seconds=30, health_check_timeout_se...
.. versionadded:: 2017.11.0 Create target group if not present. name (string) - The name of the target group. protocol (string) - The protocol to use for routing traffic to the targets port (int) - The port on which the targets receive traffic. This port is used unless ...
353,760
def get_headers(params, boundary): headers = {} boundary = urllib.quote_plus(boundary) headers[] = "multipart/form-data; boundary=%s" % boundary headers[] = str(get_body_size(params, boundary)) return headers
Returns a dictionary with Content-Type and Content-Length headers for the multipart/form-data encoding of ``params``.
353,761
def cancel_global_db_replication(): local_url = config["local_server"]["url"] server = Server(local_url) for db_name in global_dbs: server.cancel_replication(db_name)
Cancel replication of the global databases from the cloud server to the local server.
353,762
def flatten_maps(*args, **kwargs): def _recur(arg, work): if is_map(arg): work.append(arg) elif is_str(arg) or not hasattr(arg, ): raise ValueError() else: for a in arg: _recur(a, work) res = [] for arg in args: _recur(arg, res) if len(kwargs) > 0: re...
flatten_maps(*args, **kwags) yields a tuple of the maps in the given arguments; this flattens over lists and iterables so long as all elements eventually yield True to is_map(el). The optional keyword arguments passed make up the final map. This funtion does not evaluate any values of any of the maps a...
353,763
def GetMessageStrings(cls, formatter_mediator, event): formatter_object = cls.GetFormatterObject(event.data_type) return formatter_object.GetMessages(formatter_mediator, event)
Retrieves the formatted message strings for a specific event object. Args: formatter_mediator (FormatterMediator): mediates the interactions between formatters and other components, such as storage and Windows EventLog resources. event (EventObject): event. Returns: list[...
353,764
def decr(self, key, value, noreply=False): key = self.check_key(key) cmd = b + key + b + six.text_type(value).encode() if noreply: cmd += b cmd += b results = self._misc_cmd([cmd], b, noreply) if noreply: return None if results[0] ...
The memcached "decr" command. Args: key: str, see class docs for details. value: int, the amount by which to increment the value. noreply: optional bool, False to wait for the reply (the default). Returns: If noreply is True, always returns None. Otherwise retur...
353,765
def nowrange_(self, col, timeframe): df = self._nowrange(col, timeframe) if df is None: self.err("Can not select range data from now") return return self._duplicate_(df)
Returns a Dataswim instance with rows within a date range from now ex: ds.nowrange("Date", "3D") for a 3 days range. Units are: S, H, D, W, M, Y
353,766
def _reset_errors(self, msg=None): if msg is not None and msg in self._errors: del self._errors[msg] else: self._errors = {}
Resets the logging throttle cache, so the next error is emitted regardless of the value in `self.server_error_interval` :param msg: if present, only this key is reset. Otherwise, the whole cache is cleaned.
353,767
def predict(self, h=5): if self.latent_variables.estimated is False: raise Exception("No latent variables estimated!") else: y_holder = self.y.copy() full_X = self.X.copy() full_X = np.append(full_X,np.array([np.append(1.0, y_holder...
Makes forecast with the estimated model Parameters ---------- h : int (default : 5) How many steps ahead would you like to forecast? Returns ---------- - pd.DataFrame with predictions
353,768
def present(name=None, ipv4addr=None, data=None, ensure_data=True, **api_opts): ret = {: name, : False, : , : {}} if not data: data = {} if not in data: data.update({: name}) if not in data: data.update({: ipv4addr}) obj = __salt__[](name=name, ipv4addr=ipv4addr, all...
Ensure infoblox A record. When you wish to update a hostname ensure `name` is set to the hostname of the current record. You can give a new name in the `data.name`. State example: .. code-block:: yaml infoblox_a.present: - name: example-ha-0.domain.com - data: ...
353,769
def _action_add(self, ids): return self._action_get((self.listen_to_node(id_) for id_ in ids))
Add IDs to the group Parameters ---------- ids : {list, set, tuple, generator} of str The IDs to add Returns ------- list of dict The details of the added jobs
353,770
def pdf_mmd(self, lon, lat, mag_1, mag_2, distance_modulus, mask, delta_mag=0.03, steps=1000): logger.info() roi = mask.roi mmd = self.signalMMD(mask,distance_modulus,delta_mag=delta_mag,mass_steps=steps) nedges = np.rint((roi.bins_mag[-1]-roi.bins_mag[0])/de...
Ok, now here comes the beauty of having the signal MMD.
353,771
def update(self, permission): data = values.of({: serialize.map(permission, lambda e: e), }) payload = self._version.update( , self._uri, data=data, ) return RoleInstance( self._version, payload, service_s...
Update the RoleInstance :param unicode permission: A permission the role should have :returns: Updated RoleInstance :rtype: twilio.rest.chat.v2.service.role.RoleInstance
353,772
def augmentTextWithCONLLstr( conll_str_array, text ): s output. More specifically, adds information about SYNTAX_LABEL, SYNTAX_HEAD and DEPREL to each token in the Text object; \ts output: ",\ estnltkToken, maltparserToken ) j += 1 j += 1
Augments given Text object with the information from Maltparser's output. More specifically, adds information about SYNTAX_LABEL, SYNTAX_HEAD and DEPREL to each token in the Text object;
353,773
def set_managers(sender, **kwargs): cls = sender if issubclass(cls, ModelBase): cls.add_to_class(, PermittedManager())
Make sure all classes have the appropriate managers
353,774
def start(self, threaded=None): if threaded is not None: self.threaded = threaded run = {: {: False}} self.project = project.project( self.desc, run, root_file=self.project_file) self._run = self.project.run self._runner.start(self.threaded)
Creates and starts the project.
353,775
def _position_in_feature(pos_a, pos_b): strd = "-" if pos_a[2] in pos_b[2]: strd = "+" if pos_a[2] in "+" and pos_b[2] in "+": lento5 = pos_a[0] - pos_b[1] + 1 lento3 = pos_a[1] - pos_b[1] + 1 if pos_a[2] in "+" and pos_b[2] in "-": lento5 = pos_a[1] - pos_b[0] + 1 ...
return distance to 3' and 5' end of the feature
353,776
def get_instance(self, payload): return TaskQueuesStatisticsInstance( self._version, payload, workspace_sid=self._solution[], )
Build an instance of TaskQueuesStatisticsInstance :param dict payload: Payload response from the API :returns: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQueuesStatisticsInstance :rtype: twilio.rest.taskrouter.v1.workspace.task_queue.task_queues_statistics.TaskQu...
353,777
def handle(self): while True: data = self.request.recv(1024) if not data: break self.request.send(data) return True
Reimplements the :meth:`SocketServer.BaseRequestHandler.handle` method. :return: Method success. :rtype: bool
353,778
def elasprepFD(self): self.dx4 = self.dx**4 self.D = self.E*self.Te**3/(12*(1-self.nu**2))
dx4, D = elasprepFD(dx,Te,E=1E11,nu=0.25) Defines the variables (except for the subset flexural rigidity) that are needed to run "coeff_matrix_1d"
353,779
def group_records(self, key_function): sorted_records = sorted(self.records, key=key_function) grouped_records = itertools.groupby(sorted_records, key=key_function) return dict([(key, list(group)) for key, group in grouped_records])
Return a dict with the records grouped by the key returned by `key_function`. `key_function` takes a record and returns the value from the record to group by (see examples in the group_records_by_* methods below). The return value is a dict, a key in this dict is...
353,780
def yaml_to_job_list(yaml_file, base_dir): yaml_dict = get_yaml_dict(yaml_file) job_list = [] for key, value in yaml_dict.items(): job_list.append((value, rel_to_cwd(base_dir, key))) return job_list
Return a job_list consisting of git repos from $yaml_file as well as their base target directory.
353,781
def call(self, method, params): msgid = self._endpoint.send_request(method, params) while True: if not self._endpoint.receive_messages(): raise EOFError("EOF") res = self._endpoint.get_response(msgid) if res: result, error = re...
synchronous call. send a request and wait for a response. return a result. or raise RPCError exception if the peer sends us an error.
353,782
def expire_hit(self, hitid): if not self.connect_to_turk(): return False try: self.mtc.update_expiration_for_hit( HITId=hitid, ExpireAt=datetime.datetime.now() ) return True except Exception as e: ...
Expire HIT
353,783
def generate_setter(value): @wraps(set_) def setter(self): self.set_(value) return setter
Generate setter for given value.
353,784
def features(self, expand=False): fs = [] if self._avm is not None: if len(self._feats) == len(self._avm): feats = self._feats else: feats = list(self._avm) for feat in feats: val = self._avm[feat] ...
Return the list of tuples of feature paths and feature values. Args: expand (bool): if `True`, expand all feature paths Example: >>> fs = FeatureStructure([('A.B', 1), ('A.C', 2)]) >>> fs.features() [('A', <FeatureStructure object at ...>)] >>...
353,785
def _kpost(url, data): headers = {"Content-Type": "application/json"} log.trace("url is: %s, data is: %s", url, data) ret = http.query(url, method=, header_dict=headers, data=salt.utils.json.dumps(data)) if ret.get(): ...
create any object in kubernetes based on URL
353,786
def remove(name=None, pkgs=None, saltenv=, **kwargs): admin_source****["foo", "bar"] try: pkg_params = __salt__[](name, pkgs)[0] except MinionError as exc: raise CommandExecutionError(exc) old = list_pkgs() targets = [x for x in pkg_params if x in old] if not targets: re...
Remove packages with pkgrm name The name of the package to be deleted By default salt automatically provides an adminfile, to automate package removal, with these options set:: email= instance=quit partial=nocheck runlevel=nocheck idepend=nocheck rd...
353,787
def _write_arg_to_bytes(builder, arg, args, name=None): if arg.generic_definition: return if name is None: name = .format(arg.name) if arg.is_flag: if arg.type == : return elif arg.is_vector: ...
Writes the .__bytes__() code for the given argument :param builder: The source code builder :param arg: The argument to write :param args: All the other arguments in TLObject same __bytes__. This is required to determine the flags value :param name: The name of the argument. Defaults to...
353,788
def get_neighbors(self, index): if ( (self._ccore_network_pointer is not None) and (self._osc_conn is None) ): self._osc_conn = wrapper.sync_connectivity_matrix(self._ccore_network_pointer); return super().get_neighbors(index);
! @brief Finds neighbors of the oscillator with specified index. @param[in] index (uint): index of oscillator for which neighbors should be found in the network. @return (list) Indexes of neighbors of the specified oscillator.
353,789
def wrap_function(func): if is_text(func): return compile_expression(func) numarg = func.__code__.co_argcount if numarg == 0: def temp(row, rownum, rows): return func() return temp elif numarg == 1: def temp(row, rownum, rows): return func...
RETURN A THREE-PARAMETER WINDOW FUNCTION TO MATCH
353,790
def same_as(self, rows: List[Row], column: Column) -> List[Row]: cell_value = rows[0].values[column.name] return_list = [] for table_row in self.table_data: if table_row.values[column.name] == cell_value: return_list.append(table_row) return return_li...
Takes a row and a column and returns a list of rows from the full set of rows that contain the same value under the given column as the given row.
353,791
def reentrancies(self): entrancies = defaultdict(int) entrancies[self.top] += 1 for t in self.edges(): entrancies[t.target] += 1 return dict((v, cnt - 1) for v, cnt in entrancies.items() if cnt >= 2)
Return a mapping of variables to their re-entrancy count. A re-entrancy is when more than one edge selects a node as its target. These graphs are rooted, so the top node always has an implicit entrancy. Only nodes with re-entrancies are reported, and the count is only for the entrant ed...
353,792
def get_name(cls): global _registry_loaded if not _registry_loaded: load_message_classes() try: return _class_to_schema_name[cls] except KeyError: raise TypeError( "The class {} is not in the message registry, which indicates it is" " Pl...
Retrieve the schema name associated with a message class. Returns: str: The schema name. Raises: TypeError: If the message class isn't registered. Check your entry point for correctness.
353,793
def get_attribute(module_name: str, attribute_name: str): assert isinstance(module_name, str) assert isinstance(attribute_name, str) _module = importlib.import_module(module_name) return getattr(_module, attribute_name)
Get the specified module attribute. It most cases, it will be a class or function. :param module_name: module name :param attribute_name: attribute name :return: module attribute
353,794
def cleanup_event_loop(self): for task in asyncio.Task.all_tasks(loop=self.loop): if self.debug: warnings.warn( % task) task._log_destroy_pending = False task.cancel() self.loop.close() self.loop.set_exception_handler(self.loop_excepti...
Cleanup an event loop and close it down forever.
353,795
def set_custom(self,gmin,gmu,gsigma): self._gauss_min = gmin self._gauss_mu = gmu self._gauss_sigma = gsigma
Set a minimum lengtha, and then the gaussian distribution parameters for cutting For any sequence longer than the minimum the guassian parameters will be used
353,796
def all(self) -> List[Any]: values = [] for name, value in self._entrypoints.items(): if isinstance(value, EntryPoint): value = self._entrypoints[name] = value.load() values.append(value) return values
Load all entry points (if not already loaded) in this namespace and return the resulting objects as a list.
353,797
def write(text, filename, encoding=, mode=): text, encoding = encode(text, encoding) if in mode: with open(filename, mode) as textfile: textfile.write(text) else: with atomic_write(filename, overwrite=True, mode=m...
Write 'text' to file ('filename') assuming 'encoding' in an atomic way Return (eventually new) encoding
353,798
def df64bitto32bit(tbl): newtbl = pd.DataFrame(index=tbl.index) for colname in tbl.columns: newtbl[colname] = series64bitto32bit(tbl[colname]) return newtbl
Convert a Pandas dataframe from 64 bit types to 32 bit types to save memory or disk space. Parameters ---------- tbl : The dataframe to convert Returns ------- The converted dataframe
353,799
def _parse_match_info(match, soccer=False): match_info = {} i_open = match.index() i_close = match.index() match_info[] = match[i_open + 1:i_close].strip() match = match[i_close + 1:] i_vs = match.index() i_colon = match.index() match_info[] = match[0:i_vs].replace(, ).strip() ...
Parse string containing info of a specific match :param match: Match data :type match: string :param soccer: Set to true if match contains soccer data, defaults to False :type soccer: bool, optional :return: Dictionary containing match information :rtype: dict