Unnamed: 0
int64
0
389k
code
stringlengths
26
79.6k
docstring
stringlengths
1
46.9k
382,400
def dispatch(self, test=False): if not self.new_to_dispatch: raise DispatcherError("Dispatcher cannot dispatch, " "because no configuration is prepared!") if self.first_dispatch_done: raise DispatcherError("Dispatcher cannot dispatch,...
Send configuration to satellites :return: None
382,401
def exhaust_stream(f): def wrapper(self, stream, *args, **kwargs): try: return f(self, stream, *args, **kwargs) finally: exhaust = getattr(stream, "exhaust", None) if exhaust is not None: exhaust() else: while 1: ...
Helper decorator for methods that exhausts the stream on return.
382,402
def execute_command_with_path_in_process(command, path, shell=False, cwd=None, logger=None): if logger is None: logger = _logger logger.debug("Opening path with command: {0} {1}".format(command, path)) args = shlex.split(.format(command, path)) try: subprocess.Popen(args, ...
Executes a specific command in a separate process with a path as argument. :param command: the command to be executed :param path: the path as first argument to the shell command :param bool shell: Whether to use a shell :param str cwd: The working directory of the command :param logger: optional l...
382,403
def _get_parameter(self, name, tp, timeout=1.0, max_retries=2): if self.driver.command_error(response) \ or len(response[4]) == 0 \ or not response[4][0].startswith( + name): raise CommandError( + name) ...
Gets the specified drive parameter. Gets a parameter from the drive. Only supports ``bool``, ``int``, and ``float`` parameters. Parameters ---------- name : str Name of the parameter to check. It is always the command to set it but without the value. ...
382,404
def send_facebook(self, token): self.send_struct( % len(token), 81, *map(ord, token)) self.facebook_token = token
Tells the server which Facebook account this client uses. After sending, the server takes some time to get the data from Facebook. Seems to be broken in recent versions of the game.
382,405
def cmd(send, _, args): adminlist = [] for admin in args[].query(Permissions).order_by(Permissions.nick).all(): if admin.registered: adminlist.append("%s (V)" % admin.nick) else: adminlist.append("%s (U)" % admin.nick) send(", ".join(adminlist), target=args[])
Returns a list of admins. V = Verified (authed to NickServ), U = Unverified. Syntax: {command}
382,406
def encode(char_data, encoding=): if type(char_data) is unicode: return char_data.encode(encoding, ) else: return char_data
Encode the parameter as a byte string. :param char_data: :rtype: bytes
382,407
def normalizeGlyphRightMargin(value): if not isinstance(value, (int, float)) and value is not None: raise TypeError("Glyph right margin must be an :ref:`type-int-float`, " "not %s." % type(value).__name__) return value
Normalizes glyph right margin. * **value** must be a :ref:`type-int-float` or `None`. * Returned value is the same type as the input value.
382,408
def _approximate_eigenvalues(A, tol, maxiter, symmetric=None, initial_guess=None): from scipy.sparse.linalg import aslinearoperator A = aslinearoperator(A) t = A.dtype.char eps = np.finfo(np.float).eps feps = np.finfo(np.single).eps geps = np.finfo(np.l...
Apprixmate eigenvalues. Used by approximate_spectral_radius and condest. Returns [W, E, H, V, breakdown_flag], where W and E are the eigenvectors and eigenvalues of the Hessenberg matrix H, respectively, and V is the Krylov space. breakdown_flag denotes whether Lanczos/Arnoldi suffered breakdown....
382,409
def count_matrix(self): if self.hidden_state_trajectories is None: raise RuntimeError() C = msmest.count_matrix(self.hidden_state_trajectories, 1, nstates=self._nstates) return C.toarray()
Compute the transition count matrix from hidden state trajectory. Returns ------- C : numpy.array with shape (nstates,nstates) C[i,j] is the number of transitions observed from state i to state j Raises ------ RuntimeError A RuntimeError is raise...
382,410
def main_base_ramp(self) -> "Ramp": if hasattr(self, "cached_main_base_ramp"): return self.cached_main_base_ramp self.cached_main_base_ramp = min( {ramp for ramp in self.game_info.map_ramps if len(ramp.upper2_for_ramp_wall) == 2}, key=(lambda r: self.start_lo...
Returns the Ramp instance of the closest main-ramp to start location. Look in game_info.py for more information
382,411
def _validate_logical(self, rule, field, value): if not isinstance(value, Sequence): self._error(field, errors.BAD_TYPE) return validator = self._get_child_validator( document_crumb=rule, allow_unknown=False, schema=self.target_validator.validati...
{'allowed': ('allof', 'anyof', 'noneof', 'oneof')}
382,412
def set(self, key, val): return self.evolver().set(key, val).persistent()
Return a new PMap with key and val inserted. >>> m1 = m(a=1, b=2) >>> m2 = m1.set('a', 3) >>> m3 = m1.set('c' ,4) >>> m1 pmap({'a': 1, 'b': 2}) >>> m2 pmap({'a': 3, 'b': 2}) >>> m3 pmap({'a': 1, 'c': 4, 'b': 2})
382,413
def _build_flavors(p, flist, qualdecl=None): flavors = {} if ( in flist and in flist) \ or \ ( in flist and in flist): raise MOFParseError(parser_token=p, msg="Conflicting flavors are" "invalid") if qualdecl is not None: flavors = {: qu...
Build and return a dictionary defining the flavors from the flist argument. This function maps from the input keyword definitions for the flavors (ex. EnableOverride) to the PyWBEM internal definitions (ex. overridable) Uses the qualdecl argument as a basis if it exists. This i...
382,414
def validate(self): if not self.api_token or not self.api_token_secret: raise ImproperlyConfigured(" and are required for authentication.") if self.response_type not in ["json", "pson", "xml", "debug", None]: raise ImproperlyConfigured(" is an invalid response_type" % ...
Perform validation check on properties.
382,415
def describe_unsupported(series, **kwargs): leng = len(series) count = series.count() n_infinite = count - series.count() results_data = {: count, : 1 - count * 1.0 / leng, : leng - count, : n_infinite * 1.0 / leng, ...
Compute summary statistics of a unsupported (`S_TYPE_UNSUPPORTED`) variable (a Series). Parameters ---------- series : Series The variable to describe. Returns ------- Series The description of the variable as a Series with index being stats keys.
382,416
def publish(self, message, tag=b): self.send(tag + b + message)
Publish `message` with specified `tag`. :param message: message data :type message: str :param tag: message tag :type tag: str
382,417
def update(self): stats = self.get_init_value() if self.input_method == : stats = [] try: temperature = self.__set_type(self.glancesgrabsensors.get(), ) except E...
Update sensors stats using the input method.
382,418
def transformer_en_de_512(dataset_name=None, src_vocab=None, tgt_vocab=None, pretrained=False, ctx=cpu(), root=os.path.join(get_home_dir(), ), **kwargs): r predefined_args = {: 512, : 2048, : 0.1, : 0.1, ...
r"""Transformer pretrained model. Embedding size is 400, and hidden layer size is 1150. Parameters ---------- dataset_name : str or None, default None src_vocab : gluonnlp.Vocab or None, default None tgt_vocab : gluonnlp.Vocab or None, default None pretrained : bool, default False ...
382,419
def format(logger, show_successful=True, show_errors=True, show_traceback=True): output = [] errors = logger.get_aborted_actions() if show_errors and errors: output += _underline() for log in logger.get_aborted_logs(): if show_traceback...
Prints a report of the actions that were logged by the given Logger. The report contains a list of successful actions, as well as the full error message on failed actions. :type logger: Logger :param logger: The logger that recorded what happened in the queue. :rtype: string :return: A string...
382,420
def get_root_path(self, language): path = None if self.main and self.main.projects: path = self.main.projects.get_active_project_path() if language == : path = get_conf_p...
Get root path to pass to the LSP servers. This can be the current project path or the output of getcwd_or_home (except for Python, see below).
382,421
def _call_process(self, method, *args, **kwargs): _kwargs = dict() for kwarg in execute_kwargs: try: _kwargs[kwarg] = kwargs.pop(kwarg) except KeyError: pass opt_args = self.transform_kwargs(**kwargs) ext_args = self.__unpack_args([a for a in args if a is not None]) args = opt_ar...
Run the given git command with the specified arguments and return the result as a String :param method: is the command. Contained "_" characters will be converted to dashes, such as in 'ls_files' to call 'ls-files'. :param args: is the list of arguments. If None is included, it will be pruned. This ...
382,422
def get_cpu_info(self) -> str: output, _ = self._execute( , self.device_sn, , , ) return output
Show device CPU information.
382,423
def get_coeffs(expr, expand=False, epsilon=0.): if expand: expr = expr.expand() ret = defaultdict(int) operands = expr.operands if isinstance(expr, OperatorPlus) else [expr] for e in operands: c, t = _coeff_term(e) try: if abs(complex(c)) < epsilon: ...
Create a dictionary with all Operator terms of the expression (understood as a sum) as keys and their coefficients as values. The returned object is a defaultdict that return 0. if a term/key doesn't exist. Args: expr: The operator expression to get all coefficients from. expand: Wheth...
382,424
def _send_packet( self, ip, port, packet, update_timestamp=True, acknowledge_packet=True ): if acknowledge_packet: packet.header.sequence_number = self._send_seq_num self._send_seq_num += 1 packet.header.device_id = self._device_id try...
Send a packet :param ip: Ip to send to :type ip: str :param port: Port to send to :type port: int :param packet: Packet to be transmitted :type packet: APPMessage :param update_timestamp: Should update timestamp to current :type update_timestamp: bool ...
382,425
def get_model(cls, name=None, status=ENABLED): ppath = cls.get_pythonpath() if is_plugin_point(cls): if name is not None: kwargs = {} if status is not None: kwargs[] = status return Plugin.objects.get(point__pythonp...
Returns model instance of plugin point or plugin, depending from which class this methos is called. Example:: plugin_model_instance = MyPlugin.get_model() plugin_model_instance = MyPluginPoint.get_model('plugin-name') plugin_point_model_instance = MyPluginPoint.get_...
382,426
def coerce(cls, arg): try: return cls(arg).value except (ValueError, TypeError): raise InvalidParameterDatatype("%s coerce error" % (cls.__name__,))
Given an arg, return the appropriate value given the class.
382,427
def _get_simple_dtype_and_shape(self, colnum, rows=None): npy_type, isvar, istbit = self._get_tbl_numpy_dtype(colnum) info = self._info[][colnum] name = info[] if rows is None: nrows = self._info[] else: nrows = rows.size shape...
When reading a single column, we want the basic data type and the shape of the array. for scalar columns, shape is just nrows, otherwise it is (nrows, dim1, dim2) Note if rows= is sent and only a single row is requested, the shape will be (dim2,dim2)
382,428
def predict_is(self, h=5, fit_once=True, fit_method=, intervals=False): predictions = [] for t in range(0,h): data1 = self.data_original.iloc[:-h+t,:] data2 = self.data_original.iloc[-h+t:,:] x = DynReg(formula=self.formula, data=data1) if...
Makes dynamic in-sample predictions with the estimated model Parameters ---------- h : int (default : 5) How many steps would you like to forecast? fit_once : boolean (default: True) Fits only once before the in-sample prediction; if False, fits after every new ...
382,429
def extend(self, *args): args = list(args) for i in args: self.obj.update(i) return self._wrap(self.obj)
Extend a given object with all the properties in passed-in object(s).
382,430
def add(self, fact): token = Token.valid(fact) MATCHER.debug("<BusNode> added %r", token) for child in self.children: child.callback(token)
Create a VALID token and send it to all children.
382,431
def widgetEdited(self, event=None, val=None, action=, skipDups=True): if not self._editedCallbackObj and not self._flagNonDefaultVals: return curVal = val if curVal is None: curVal = self.choice.get() self.flagThisPar(curVal...
A general method for firing any applicable triggers when a value has been set. This is meant to be easily callable from any part of this class (or its subclasses), so that it can be called as soon as need be (immed. on click?). This is smart enough to be called multiple...
382,432
def get_default_config(self): config = super(IPMISensorCollector, self).get_default_config() config.update({ : , : False, : , : , : False, : }) return c...
Returns the default collector settings
382,433
def curated(name): return cached_download( + name, os.path.join(, name.replace(, os.path.sep)))
Download and return a path to a sample that is curated by the PyAV developers. Data is handled by :func:`cached_download`.
382,434
def power(self, n): if n > 0: return super().power(n) return Kraus(SuperOp(self).power(n))
The matrix power of the channel. Args: n (int): compute the matrix power of the superoperator matrix. Returns: Kraus: the matrix power of the SuperOp converted to a Kraus channel. Raises: QiskitError: if the input and output dimensions of the Qu...
382,435
def tar(filename, dirs=[], gzip=False): if gzip: cmd = % filename else: cmd = % filename if type(dirs) != : dirs = [dirs] cmd += .join(str(x) for x in dirs) retcode, output = sh(cmd) return (retcode, output, filename)
Create a tar-file or a tar.gz at location: filename. params: gzip: if True - gzip the file, default = False dirs: dirs to be tared returns a 3-tuple with returncode (integer), terminal output (string) and the new filename.
382,436
def filter_by_cols(self, cols, ID=None): rows = to_list(cols) fil = lambda x: x in rows applyto = {k: self._positions[k][1] for k in self.keys()} if ID is None: ID = self.ID + return self.filter(fil, applyto=applyto, ID=ID)
Keep only Measurements in corresponding columns.
382,437
def strip_empty_lines_forward(self, content, i): while i < len(content): line = content[i].strip() if line != : break self.debug_print_strip_msg(i, content[i]) i += 1 return i
Skip over empty lines :param content: parsed text :param i: current parsed line :return: number of skipped lined
382,438
def from_pdf( cls, pdf, filename, width=288, height=432, dpi=203, font_path=None, center_of_pixel=False, use_bindings=False ): setpagedevice = [ , ] cmd = [ , , , , , ...
Filename is 1-8 alphanumeric characters to identify the GRF in ZPL. Dimensions and DPI are for a typical 4"x6" shipping label. E.g. 432 points / 72 points in an inch / 203 dpi = 6 inches Using center of pixel will improve barcode quality but may decrease the quality of some text. ...
382,439
def get_people(self, user_alias=None): user_alias = user_alias or self.api.user_alias content = self.api.req(API_PEOPLE_HOME % user_alias).content xml = self.api.to_xml(re.sub(b, b, content)) try: xml_user = xml.xpath() if not xml_user: re...
获取用户信息 :param user_alias: 用户ID :return:
382,440
def _strOrDate(st): if isinstance(st, string_types): return st elif isinstance(st, datetime): return st.strftime() raise PyEXception(, str(st))
internal
382,441
def touch(self, connection=None): self.create_marker_table() if connection is None: connection = self.connect() connection.autocommit = True connection.cursor().execute( .format(marker_table=self.marker_table), (self.update_id, self.ta...
Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created.
382,442
def get_or_create_ec2_key_pair(name=None, verbose=1): verbose = int(verbose) name = name or env.vm_ec2_keypair_name pem_path = % (env.ROLE, name) conn = get_ec2_connection() kp = conn.get_key_pair(name) if kp: print( % name) else: kp = conn.create_key_...
Creates and saves an EC2 key pair to a local PEM file.
382,443
def get(self, hash, account="*", max_transactions=100, min_confirmations=6, raw=False): if len(hash) < 64: txs = self._service.list_transactions(hash, account=account, max_transactions=max_transactions) unspents = self._service.list_unspents(hash, min_confirmations=min_confirmat...
Args: hash: can be a bitcoin address or a transaction id. If it's a bitcoin address it will return a list of transactions up to ``max_transactions`` a list of unspents with confirmed transactions greater or equal to ``min_confirmantions`` account (...
382,444
def cache_method(func=None, prefix=): def decorator(func): @wraps(func) def wrapper(self, *args, **kwargs): cache_key_prefix = prefix or .format(func.__name__) cache_key = get_cache_key(cache_key_prefix, *args, **kwargs) if not hasattr(self, cache_key): ...
Cache result of function execution into the `self` object (mostly useful in models). Calculate cache key based on `args` and `kwargs` of the function (except `self`).
382,445
def get_schema(self): path = os.path.join(self._get_schema_folder(), self._name + ".json") with open(path, "rb") as file: schema = json.loads(file.read().decode("UTF-8")) return schema
Return the schema.
382,446
def export(self, path, session): def variables_saver(variables_path): if self._saver: self._saver.save( session, variables_path, write_meta_graph=False, write_state=False) self._spec._export(path, variables_saver)
See `Module.export`.
382,447
def draw_markers(self): self._canvas_markers.clear() for marker in self._markers.values(): self.create_marker(marker["category"], marker["start"], marker["finish"], marker)
Draw all created markers on the TimeLine Canvas
382,448
def hide_routemap_holder_route_map_content_set_dampening_half_life(self, **kwargs): config = ET.Element("config") hide_routemap_holder = ET.SubElement(config, "hide-routemap-holder", xmlns="urn:brocade.com:mgmt:brocade-ip-policy") route_map = ET.SubElement(hide_routemap_holder, "route-m...
Auto Generated Code
382,449
def reinforce(self, **kwargs): results = reinforce_grid( self, max_while_iterations=kwargs.get( , 10), copy_graph=kwargs.get(, False), timesteps_pfa=kwargs.get(, None), combined_analysis=kwargs.get(, False)) if not kwargs...
Reinforces the grid and calculates grid expansion costs. See :meth:`edisgo.flex_opt.reinforce_grid` for more information.
382,450
def _send_data(self, data, start_offset, file_len): headers = {} end_offset = start_offset + len(data) - 1 if data: headers[] = ( % (start_offset, end_offset, file_len)) else: headers[] = ( % file_len) status, response_headers, content = self._api...
Send the block to the storage service. This is a utility method that does not modify self. Args: data: data to send in str. start_offset: start offset of the data in relation to the file. file_len: an int if this is the last data to append to the file. Otherwise '*'.
382,451
def setName( self, name ): self.name = name self.errmsg = "Expected " + self.name if hasattr(self,"exception"): self.exception.msg = self.errmsg return self
Define name for this expression, makes debugging and exception messages clearer. Example:: Word(nums).parseString("ABC") # -> Exception: Expected W:(0123...) (at char 0), (line:1, col:1) Word(nums).setName("integer").parseString("ABC") # -> Exception: Expected integer (at char 0), (l...
382,452
def kana2alphabet(text): text = text.replace(, ).replace(, ).replace(, ) text = text.replace(, ).replace(, ).replace(, ) text = text.replace(, ).replace(, ).replace(, ) text = text.replace(, ).replace(, ).replace(, ) text = text.replace(, ).replace(, ).replace(, ) text = text.replace(, ).re...
Convert Hiragana to hepburn-style alphabets Parameters ---------- text : str Hiragana string. Return ------ str Hepburn-style alphabets string. Examples -------- >>> print(jaconv.kana2alphabet('まみさん')) mamisan
382,453
def bipartition(seq): return [(tuple(seq[i] for i in part0_idx), tuple(seq[j] for j in part1_idx)) for part0_idx, part1_idx in bipartition_indices(len(seq))]
Return a list of bipartitions for a sequence. Args: a (Iterable): The sequence to partition. Returns: list[tuple[tuple]]: A list of tuples containing each of the two partitions. Example: >>> bipartition((1,2,3)) [((), (1, 2, 3)), ((1,), (2, 3)), ((2,), (1, 3)), ((1...
382,454
def get_all_fields(self, arr): for k, v in self.fields.items(): arr.append(v) if self.extends: parent = self.contract.get(self.extends) if parent: return parent.get_all_fields(arr) return arr
Returns a list containing this struct's fields and all the fields of its ancestors. Used during validation.
382,455
def _xfs_info_get_kv(serialized): if serialized.startswith("="): serialized = serialized[1:].strip() serialized = serialized.replace(" = ", "=*** ").replace(" =", "=") opt = [] for tkn in serialized.split(" "): if not opt or "=" in tkn: opt.append(tkn) ...
Parse one line of the XFS info output.
382,456
def delist(target): result = target if type(target) is dict: for key in target: target[key] = delist(target[key]) if type(target) is list: if len(target)==0: result = None elif len(target)==1: result = delist(target[0]) else: ...
for any "list" found, replace with a single entry if the list has exactly one entry
382,457
def add_oxidation_state_by_guess(self, **kwargs): oxid_guess = self.composition.oxi_state_guesses(**kwargs) oxid_guess = oxid_guess or \ [dict([(e.symbol, 0) for e in self.composition])] self.add_oxidation_state_by_element(oxid_guess[0])
Decorates the structure with oxidation state, guessing using Composition.oxi_state_guesses() Args: **kwargs: parameters to pass into oxi_state_guesses()
382,458
def dictlist_replace(dict_list: Iterable[Dict], key: str, value: Any) -> None: for d in dict_list: d[key] = value
Process an iterable of dictionaries. For each dictionary ``d``, change (in place) ``d[key]`` to ``value``.
382,459
def run(host=, port=5000, reload=True, debug=True): from werkzeug.serving import run_simple app = bootstrap.get_app() return run_simple( hostname=host, port=port, application=app, use_reloader=reload, use_debugger=debug, )
Run development server
382,460
def get_documents(self): return self.session.query(Document).order_by(Document.name).all()
Return all the parsed ``Documents`` in the database. :rtype: A list of all ``Documents`` in the database ordered by name.
382,461
def display_widgets(self): for child in self.children: if child.displayable: if self.layout != "grid": child.tk.pack_forget() else: child.tk.grid_forget() ...
Displays all the widgets associated with this Container. Should be called when the widgets need to be "re-packed/gridded".
382,462
def remove(self, docid): docid = int(docid) self.store.executeSQL(self.removeSQL, (docid,))
Remove a document from the database.
382,463
def _id(self): result = while self.char is not None and (self.char.isalnum() or self.char == ): result += self.char self.advance() token = RESERVED_KEYWORDS.get(result, Token(Nature.ID, result)) return token
Handle identifiers and reserverd keywords.
382,464
def surface_state(num_lat=90, num_lon=None, water_depth=10., T0=12., T2=-40.): if num_lon is None: sfc = domain.zonal_mean_surface(num_lat=num_lat, water_depth=water_depth) else: ...
Sets up a state variable dictionary for a surface model (e.g. :class:`~climlab.model.ebm.EBM`) with a uniform slab ocean depth. The domain is either 1D (latitude) or 2D (latitude, longitude) depending on whether the input argument num_lon is supplied. Returns a single state variable `Ts`, the temperat...
382,465
def shift(func, *args, **kwargs): @wraps(func) def wrapped(x): return func(x, *args, **kwargs) return wrapped
This function is basically a beefed up lambda x: func(x, *args, **kwargs) :func:`shift` comes in handy when it is used in a pipeline with a function that needs the passed value as its first argument. :param func: a function :param args: objects :param kwargs: keywords >>> def div(x, y): retur...
382,466
def task(**kwargs): def wrapper(wrapped): def callback(scanner, name, obj): celery_app = scanner.config.registry.celery_app celery_app.task(**kwargs)(obj) venusian.attach(wrapped, callback) return wrapped return wrapper
A function task decorator used in place of ``@celery_app.task``.
382,467
def import_keyset(self, keyset): try: jwkset = json_decode(keyset) except Exception: raise InvalidJWKValue() if not in jwkset: raise InvalidJWKValue() for k, v in iteritems(jwkset): if k == : for jwk in v: ...
Imports a RFC 7517 keyset using the standard JSON format. :param keyset: The RFC 7517 representation of a JOSE Keyset.
382,468
def integratedAutocorrelationTime(A_n, B_n=None, fast=False, mintime=3): g = statisticalInefficiency(A_n, B_n, fast, mintime) tau = (g - 1.0) / 2.0 return tau
Estimate the integrated autocorrelation time. See Also -------- statisticalInefficiency
382,469
def consulta(self, endereco, primeiro=False, uf=None, localidade=None, tipo=None, numero=None): if uf is None: url = data = { : endereco.encode(), : , : , : 1, : , ...
Consulta site e retorna lista de resultados
382,470
def _update_task(self, task): self.task = task self.task.data.update(self.task_data) self.task_type = task.task_spec.__class__.__name__ self.spec = task.task_spec self.task_name = task.get_name() self.activity = getattr(self.spec, , ) self._set_lane_data(...
Assigns current task step to self.task then updates the task's data with self.task_data Args: task: Task object.
382,471
def _set_overlay_service_policy(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=overlay_service_policy.overlay_service_policy, is_container=, presence=False, yang_name="overlay-service-policy", rest_name="overlay-service-policy", parent=self, path_hel...
Setter method for overlay_service_policy, mapped from YANG variable /overlay_gateway/overlay_service_policy (container) If this variable is read-only (config: false) in the source YANG file, then _set_overlay_service_policy is considered as a private method. Backends looking to populate this variable should...
382,472
def _process_using_meta_feature_generator(self, X, meta_feature_generator): all_learner_meta_features = [] for idx, base_learner in enumerate(self.base_learners): single_learner_meta_features = getattr(base_learner, self.meta_featu...
Process using secondary learner meta-feature generator Since secondary learner meta-feature generator can be anything e.g. predict, predict_proba, this internal method gives the ability to use any string. Just make sure secondary learner has the method. Args: X (array-like)...
382,473
def extract_input(pipe_def=None, pipe_generator=None): if pipe_def: pyinput = gen_input(pipe_def) elif pipe_generator: pyinput = pipe_generator(Context(describe_input=True)) else: raise Exception() return sorted(list(pyinput))
Extract inputs required by a pipe
382,474
def validate_units(self): if (not isinstance(self.waveunits, units.WaveUnits)): raise TypeError("%s is not a valid WaveUnit" % self.waveunits) if (not isinstance(self.fluxunits, units.FluxUnits)): raise TypeError("%s is not a valid FluxUnit" % self.fluxunits)
Ensure that wavelenth and flux units belong to the correct classes. Raises ------ TypeError Wavelength unit is not `~pysynphot.units.WaveUnits` or flux unit is not `~pysynphot.units.FluxUnits`.
382,475
def clear(self): self.io.seek(0) self.io.truncate() for item in self.monitors: item[2] = 0
Removes all data from the buffer.
382,476
def propertyWidgetMap(self): out = {} scaffold = self.scaffold() for widget in self.findChildren(QtGui.QWidget): propname = unwrapVariant(widget.property()) if not propname: continue prop = scaffold.property(pro...
Returns the mapping for this page between its widgets and its scaffold property. :return {<projex.scaffold.Property>: <QtGui.QWidget>, ..}
382,477
def directory_open(self, path, filter_p, flags): if not isinstance(path, basestring): raise TypeError("path can only be an instance of type basestring") if not isinstance(filter_p, basestring): raise TypeError("filter_p can only be an instance of type basestring") ...
Opens a directory in the guest and creates a :py:class:`IGuestDirectory` object that can be used for further operations. This method follows symbolic links by default at the moment, this may change in the future. in path of type str Path to the directory to open. G...
382,478
def parse_date(datestring): datestring = str(datestring).strip() if not datestring[0].isdigit(): raise ParseError() if in datestring.upper(): try: datestring = datestring[:-1] + str(int(datestring[-1:]) -1) except: pass for regex, pattern in DATE_...
Attepmts to parse an ISO8601 formatted ``datestring``. Returns a ``datetime.datetime`` object.
382,479
def makedirs(path, ignore_extsep=False): if not ignore_extsep and op.basename(path).find(os.extsep) > -1: path = op.dirname(path) try: os.makedirs(path) except: return False return True
Makes all directories required for given path; returns true if successful and false otherwise. **Examples**: :: auxly.filesys.makedirs("bar/baz")
382,480
def cross_origin(app, *args, **kwargs): _options = kwargs _real_decorator = cors.decorate(app, *args, run_middleware=False, with_context=False, **kwargs) def wrapped_decorator(f): spf = SanicPluginsFramework(app) try: plugin = spf.register_plugin(cors, skip_reg=True) ...
This function is the decorator which is used to wrap a Sanic route with. In the simplest case, simply use the default parameters to allow all origins in what is the most permissive configuration. If this method modifies state or performs authentication which may be brute-forced, you should add some degr...
382,481
def match(self, *args): self.fall = self.fall or not args self.fall = self.fall or (self.value in args) return self.fall
Whether or not to enter a given case statement
382,482
def add_to_context(self, name, **attrs): context = self.get_context(name=name) attrs_ = context[] attrs_.update(**attrs)
Add attributes to a context.
382,483
def find_by(cls, parent=None, **attributes): all_nones = not all(attributes.values()) if not attributes or all_nones: raise cls.ResourceError() matches = cls.filter(parent, **attributes) if matches: return matches[0]
Gets the first resource of the given type and parent (if provided) with matching attributes. This will trigger an api GET request. :param parent ResourceBase: the parent of the resource - used for nesting the request url, optional :param **attributes: any number of keyword arguments as attribute...
382,484
def get_history_kline(self, code, start=None, end=None, ktype=KLType.K_DAY, autype=AuType.QFQ, fields=[KL_FIELD.ALL]): return self._get_history_kline_impl(GetHistoryKlineQ...
得到本地历史k线,需先参照帮助文档下载k线 :param code: 股票代码 :param start: 开始时间,例如'2017-06-20' :param end: 结束时间,例如'2017-06-30' start和end的组合如下: ========== ========== ======================================== start类型 end类型 说明 ...
382,485
def bgblack(cls, string, auto=False): return cls.colorize(, string, auto=auto)
Color-code entire string. :param str string: String to colorize. :param bool auto: Enable auto-color (dark/light terminal). :return: Class instance for colorized string. :rtype: Color
382,486
def reporter(self): logging.info(.format(self.analysistype)) make_path(self.reportpath) header = data = for sample in self.metadata: try: data += .format(sample.name, sample[self.analysist...
Create the MASH report
382,487
def stats(self, index=None, metric=None, params=None): return self.transport.perform_request( "GET", _make_path(index, "_stats", metric), params=params )
Retrieve statistics on different operations happening on an index. `<http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html>`_ :arg index: A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices :arg metric...
382,488
def _create_archive(self): try: self.archive_path = os.path.join(self.report_dir, "%s.tar.gz" % self.session) self.logger.con_out(, self.archive_path) t = tarfile.open(self.archive_path, ) for dirpath, dirnames, filenames in os.walk(self.dir_path): ...
This will create a tar.gz compressed archive of the scrubbed directory
382,489
def _parse_line(sep, line): strs = line.split(sep, 1) return (strs[0].strip(), None) if len(strs) == 1 else (strs[0].strip(), strs[1].strip())
Parse a grub commands/config with format: cmd{sep}opts Returns: (name, value): value can be None
382,490
def load_shapefile(self, feature_type, base_path): path = % base_path if not os.path.exists(path): message = self.tr( % path) raise FileMissingError(message) self.iface.addVectorLayer(path, feature_type, )
Load downloaded shape file to QGIS Main Window. TODO: This is cut & paste from OSM - refactor to have one method :param feature_type: What kind of features should be downloaded. Currently 'buildings', 'building-points' or 'roads' are supported. :type feature_type: str :par...
382,491
def outline(self, face_ids=None, **kwargs): from .path.exchange.misc import faces_to_path from .path.exchange.load import _create_path path = _create_path(**faces_to_path(self, face_ids, **kwargs)) ...
Given a list of face indexes find the outline of those faces and return it as a Path3D. The outline is defined here as every edge which is only included by a single triangle. Note that this implies a non-watertight mesh as the outline of a watertight mesh is an empty path. ...
382,492
def optimize(self, x0, f=None, df=None, f_df=None): if len(self.bounds) == 1: raise IndexError("CMA does not work in problems of dimension 1.") try: import cma def CMA_f_wrapper(f): def g(x): return f(np.array([x])) ...
:param x0: initial point for a local optimizer. :param f: function to optimize. :param df: gradient of the function to optimize. :param f_df: returns both the function to optimize and its gradient.
382,493
def kruskal(dv=None, between=None, data=None, detailed=False, export_filename=None): from scipy.stats import chi2, rankdata, tiecorrect _check_dataframe(dv=dv, between=between, data=data, effects=) data = data.dropna() data = data.reset_index(drop=...
Kruskal-Wallis H-test for independent samples. Parameters ---------- dv : string Name of column containing the dependant variable. between : string Name of column containing the between factor. data : pandas DataFrame DataFrame export_filename : string Filename (...
382,494
def mod_repo(repo, **kwargs): ** repos = list_repos() found = False uri = if in kwargs: uri = kwargs[] for repository in repos: source = repos[repository][0] if source[] == repo: found = True repostr = if in kwargs and not kwargs[]...
Modify one or more values for a repo. If the repo does not exist, it will be created, so long as uri is defined. The following options are available to modify a repo definition: repo alias by which opkg refers to the repo. uri the URI to the repo. compressed defines (True ...
382,495
def wiki_list(self, title=None, creator_id=None, body_matches=None, other_names_match=None, creator_name=None, hide_deleted=None, other_names_present=None, order=None): params = { : title, : creator_id, : body_matches, ...
Function to retrieves a list of every wiki page. Parameters: title (str): Page title. creator_id (int): Creator id. body_matches (str): Page content. other_names_match (str): Other names. creator_name (str): Creator name. hide_deleted (str...
382,496
def create_parser_options(lazy_mfcollection_parsing: bool = False) -> Dict[str, Dict[str, Any]]: return {MultifileCollectionParser.__name__: {: lazy_mfcollection_parsing}}
Utility method to create a default options structure with the lazy parsing inside :param lazy_mfcollection_parsing: :return: the options structure filled with lazyparsing option (for the MultifileCollectionParser)
382,497
def getSpanDurations(self, time_stamp, service_name, rpc_name): self.send_getSpanDurations(time_stamp, service_name, rpc_name) return self.recv_getSpanDurations()
Given a time stamp, server service name, and rpc name, fetch all of the client services calling in paired with the lists of every span duration (list<i64>) from the server to client. The lists of span durations include information on call counts and mean/stdDev/etc of call durations. The three arguments sp...
382,498
def paramtypes(self): for m in [p[1] for p in self.ports]: for p in [p[1] for p in m]: for pd in p: if pd[1] in self.params: continue item = (pd[1], pd[1].resolve()) self.params.append(item)
get all parameter types
382,499
def unquote(str): if len(str) > 1: if str.startswith() and str.endswith(): return str[1:-1].replace(, ).replace(, ) if str.startswith() and str.endswith(): return str[1:-1] return str
Remove quotes from a string.