Unnamed: 0
int64
0
389k
code
stringlengths
26
79.6k
docstring
stringlengths
1
46.9k
386,400
def get_es_requirements(es_version): es_version = es_version.replace(, ) es_version = map(int, es_version.split()) if es_version >= [6]: return ">=6.0.0, <7.0.0" elif es_version >= [5]: return ">=5.0.0, <6.0.0" elif es_version >= [2]: return ">=2.0.0, <3.0.0" e...
Get the requirements string for elasticsearch-py library Returns a suitable requirements string for the elsaticsearch-py library according to the elasticsearch version to be supported (es_version)
386,401
def help_center_article_subscriptions(self, article_id, locale=None, **kwargs): "https://developer.zendesk.com/rest_api/docs/help_center/subscriptions api_path = "/api/v2/help_center/articles/{article_id}/subscriptions.json" api_path = api_path.format(article_id=article_id) if locale: ...
https://developer.zendesk.com/rest_api/docs/help_center/subscriptions#list-article-subscriptions
386,402
def on_create_view(self): d = self.declaration changed = not d.condition if changed: d.condition = True view = self.get_view() if changed: self.ready.set_result(True) return view
Trigger the click
386,403
def required_fields(self): return {f:v for f, v in self.normal_fields.items() if v.required}
The normal required fields (eg, no magic fields like _id are included)
386,404
def updateVocalAuto(self, component, files): auto_model = self.model().autoParams() row = auto_model.fileParameter(component) if len(files) > 1: clean_component = self.model().data(self.model().indexByComponent(component), AbstractDragView.DragRole) p = { : , ...
Updates the auto-parameter with selected *component* to have *files*. Adds auto-parameter if not already present. The auto-parameter is expected to have only one selected component (the one given). If length of files < 1, removes the auto-parameter from the model. :param component: Comp...
386,405
def parse_annotation(code): module = ast.parse(code) assert type(module) is ast.Module, assert len(module.body) == 1, assert type(module.body[0]) is ast.Expr, return module.body[0]
Parse an annotation string. Return an AST Expr node. code: annotation string (excluding '@')
386,406
def value_validate(self, value): if not isinstance(value, datetime.datetime): raise tldap.exceptions.ValidationError("is invalid date time")
Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this.
386,407
def _write( df, filename=None, schema=, taxon_col=, taxon_annotations=[], node_col=, node_annotations=[], branch_lengths=True, **kwargs ): tree = _pandas_df_to_dendropy_tree( df, taxon_col=taxon_col, taxon_annotations=taxon_annotations, no...
Write a phylopandas tree DataFrame to various formats. Parameters ---------- df : DataFrame DataFrame containing tree data. filename : str filepath to write out tree. If None, will return string. schema : str tree format to write out. taxon_col : str (optional) ...
386,408
def remove(self, items, working_tree=False, **kwargs): args = [] if not working_tree: args.append("--cached") args.append("--") paths = self._items_to_rela_paths(items) removed_paths = self.repo.git.rm(args, paths, **kwargs).splitlines() ...
Remove the given items from the index and optionally from the working tree as well. :param items: Multiple types of items are supported which may be be freely mixed. - path string Remove the given path at all stages. If it is a directory, you must ...
386,409
def _compute_total_chunks(self, chunk_size): try: if self._src_block_list is not None: blen = len(self._src_block_list) if blen > 0: return blen else: return 1 else: ...
Compute total number of chunks for entity :param Descriptor self: this :param int chunk_size: chunk size :rtype: int :return: num chunks
386,410
def persist(self): if self.app.dry: return for proj in self.subprojects.values(): proj.persist()
Banana banana
386,411
def locate(cls): if cls._INSTANCE is None: bootstrap_path = __file__ module_import_path = __name__.split() for _ in module_import_path: bootstrap_path = os.path.dirname(bootstrap_path) cls._INSTANCE = cls(sys_path_entry=bootstrap_path) return cls._INST...
Locates the active PEX bootstrap. :rtype: :class:`Bootstrap`
386,412
def auto_track_url(track): hub = track.root(cls=Hub) if hub is None: raise ValueError( "track is not fully connected because the root is %s" % repr(hub)) if hub.url is None: raise ValueError("hub.url is not set") if track.source is None: raise ValueError("track....
Automatically sets the bigDataUrl for `track`. Requirements: * the track must be fully connected, such that its root is a Hub object * the root Hub object must have the Hub.url attribute set * the track must have the `source` attribute set
386,413
def btc_tx_witness_strip( tx_serialized ): if not btc_tx_is_segwit(tx_serialized): return tx_serialized tx = btc_tx_deserialize(tx_serialized) for inp in tx[]: del inp[] tx_stripped = btc_tx_serialize(tx) return tx_stripped
Strip the witness information from a serialized transaction
386,414
def delete(self, *args, **kwargs): count = 0 max_retries=3 while True: try: return super(BaseModel, self).delete(*args, **kwargs) except django.db.utils.OperationalError: if count >= max_retries: raise ...
This method implements retries for object deletion.
386,415
def unquoted(self): key = str(self) if key.startswith() and key.endswith(): return key[1:-1] return key
Return *key* with one level of double quotes removed. Redshift stores some identifiers without quotes in internal tables, even though the name must be quoted elsewhere. In particular, this happens for tables named as a keyword.
386,416
def mutate(self,p_i,func_set,term_set): self.point_mutate(p_i,func_set,term_set)
point mutation, addition, removal
386,417
def createGroups(self, configFiles, dateTimeFormat=None): groupInfo = None groupFile = None iconPath = None startTime = None thumbnail = None result = None config = None sciptPath = None orgTools = None if dateTimeFormat is None: ...
Parses a JSON configuration file to create groups. Args: configFiles (list): A list of JSON files on disk containing configuration data for creating groups. dateTimeFormat (str): A valid date formatting directive, as understood by :py:meth:`datetime.datet...
386,418
def get_char_weights(doc_weighted_spans, preserve_density=None): if preserve_density is None: preserve_density = doc_weighted_spans.preserve_density char_weights = np.zeros(len(doc_weighted_spans.document)) feature_counts = Counter(f for f, _, __ in doc_weighted_spans.spans) for featur...
Return character weights for a text document with highlighted features. If preserve_density is True, then color for longer fragments will be less intensive than for shorter fragments, so that "sum" of intensities will correspond to feature weight. If preserve_density is None, then it's value is taken fr...
386,419
def interactive(plugin): items = [item for item in once(plugin) if not item.get_played()] parent_stack = [] selected_item = get_user_choice(items) while selected_item is not None: if parent_stack and selected_item == parent_stack[-1]: parent_stack.pop() e...
A run mode for the CLI that runs the plugin in a loop based on user input.
386,420
def get_kubernetes_configuration(self, mount_point=): url = .format(mount_point) return self._adapter.get(url).json()
GET /auth/<mount_point>/config :param mount_point: The "path" the k8s auth backend was mounted on. Vault currently defaults to "kubernetes". :type mount_point: str. :return: Parsed JSON response from the config GET request :rtype: dict.
386,421
def setQuickColor( self, color ): colorset = XPaletteColorSet() colorset.setPalette(QPalette(color)) self.setColorSet(colorset)
Sets the quick color for the palette to the given color. :param color | <QColor>
386,422
def batch_write_input(structures, vasp_input_set=MPRelaxSet, output_dir=".", make_dir_if_not_present=True, subfolder=None, sanitize=False, include_cif=False, **kwargs): output_dir = Path(output_dir) for i, s in enumerate(structures): formula = re.sub(r, "...
Batch write vasp input for a sequence of structures to output_dir, following the format output_dir/{group}/{formula}_{number}. Args: structures ([Structure]): Sequence of Structures. vasp_input_set (VaspInputSet): VaspInputSet class that creates vasp input files from structures. Not...
386,423
def parse_config(self, device=None, profile=None, native=None, attrs=None): if attrs is None: attrs = self.elements().values() for v in attrs: parser = Parser( v, device=device, profile=profile, native=native, is_config=True ) par...
Parse native configuration and load it into the corresponding models. Only models that have been added to the root object will be parsed. If ``native`` is passed to the method that's what we will parse, otherwise, we will use the ``device`` to retrieve it. Args: device (Net...
386,424
def read_node(self, name, **kwargs): kwargs[] = True if kwargs.get(): return self.read_node_with_http_info(name, **kwargs) else: (data) = self.read_node_with_http_info(name, **kwargs) return data
read_node # noqa: E501 read the specified Node # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.read_node(name, async_req=True) >>> result = thread.get() :param asyn...
386,425
def list_database_names(self, session=None): return [doc["name"] for doc in self.list_databases(session, nameOnly=True)]
Get a list of the names of all databases on the connected server. :Parameters: - `session` (optional): a :class:`~pymongo.client_session.ClientSession`. .. versionadded:: 3.6
386,426
def emitRecordMiddleClicked(self, item): if isinstance(item, XOrbRecordItem) and not self.signalsBlocked(): self.recordMiddleClicked.emit(item.record())
Emits the record clicked signal for the given item, provided the signals are not currently blocked. :param item | <QTreeWidgetItem>
386,427
def toggle_autojump(): if not autojump_enabled(): with open(AUTOJUMP_FILE, ) as ajfile: ajfile.write("enabled") else: os.remove(AUTOJUMP_FILE)
Toggles Autojump
386,428
def all(self, audience=None, page=None, per_page=None, include_totals=False, client_id=None): params = { : audience, : page, : per_page, : str(include_totals).lower(), : client_id, } return self.client.get(self._url(), params...
Retrieves all client grants. Args: audience (str, optional): URL encoded audience of a Resource Server to filter page (int, optional): The result's page number (zero based). per_page (int, optional): The amount of entries per page. include_tota...
386,429
def visit_attribute(self, node): for pattern in self.config.generated_members: if re.match(pattern, node.attrname): return if re.match(pattern, node.as_string()): return try: inferred = list(node.expr.infer()) ...
check that the accessed attribute exists to avoid too much false positives for now, we'll consider the code as correct if a single of the inferred nodes has the accessed attribute. function/method, super call and metaclasses are ignored
386,430
def add_field(self, field_instance_or_string): if isinstance(field_instance_or_string, basestring): field_instance = Field(field_instance_or_string) elif isinstance(field_instance_or_string, Field): field_instance_or_string = field_instance else: rais...
Appends a field, can be a :class:`~es_fluent.fields.Field` or string.
386,431
def camelize(word): return .join(w[0].upper() + w[1:] for w in re.sub(, , word).split())
Convert a word from lower_with_underscores to CamelCase. Args: word: The string to convert. Returns: The modified string.
386,432
def _is_instance(type_to_check, element, condition="any", deep=False): out = None if deep is False: if condition == "any": out = any(isinstance(el, type_to_check) for el in element) elif condition == "all": out = all(isinstance(el, type_to_check) for el in ele...
----- Brief ----- Function that verifies when "all" or "any" elements of the list "element" have the type specified in "type_to_check" input. ----------- Description ----------- In some biosignalsnotebooks functions their implementation is extremely dependent on a specific criterion...
386,433
def lookup_field_class(self, field, obj=None, default=None): css = "" if field in self.field_config and in self.field_config[field]: css = self.field_config[field][] elif default: css = default return css
Looks up any additional class we should include when rendering this field
386,434
def validateOneElement(self, doc, elem): if doc is None: doc__o = None else: doc__o = doc._o if elem is None: elem__o = None else: elem__o = elem._o ret = libxml2mod.xmlValidateOneElement(self._o, doc__o, elem__o) return ret
Try to validate a single element and it's attributes, basically it does the following checks as described by the XML-1.0 recommendation: - [ VC: Element Valid ] - [ VC: Required Attribute ] Then call xmlValidateOneAttribute() for each attribute present. The ID/IDREF checkings ar...
386,435
def set_tempo(self, bpm): self.bpm = bpm self.track_data += self.set_tempo_event(self.bpm)
Convert the bpm to a midi event and write it to the track_data.
386,436
def check_pre_approval_notification(self, code): response = self.get( url=self.config.PRE_APPROVAL_NOTIFICATION_URL % code) return PagSeguroPreApprovalNotificationResponse( response.content, self.config)
check a notification by its code
386,437
def _CheckStorageFile(self, storage_file_path): if os.path.exists(storage_file_path): if not os.path.isfile(storage_file_path): raise errors.BadConfigOption( .format( storage_file_path)) logger.warning() dirname = os.path.dirname(storage_file_path) if ...
Checks if the storage file path is valid. Args: storage_file_path (str): path of the storage file. Raises: BadConfigOption: if the storage file path is invalid.
386,438
def onPublish(self, topic, payload, qos, dup, retain, msgId): log.debug("msg={payload}", payload=payload)
Callback Receiving messages from publisher
386,439
def parse_stdout(self, filelike): from aiida.orm import Dict formulae = {} content = filelike.read().strip() if not content: return self.exit_codes.ERROR_EMPTY_OUTPUT_FILE try: for line in content.split(): datablock, formula = r...
Parse the formulae from the content written by the script to standard out. :param filelike: filelike object of stdout :returns: an exit code in case of an error, None otherwise
386,440
def audit_1_15(self): for policy in resources.iam.policies.all(): self.assertEqual(len(list(policy.attached_users.all())), 0, "{} has users attached to it".format(policy))
1.15 Ensure IAM policies are attached only to groups or roles (Scored)
386,441
def _integrate_plugins(): import sys from airflow.plugins_manager import macros_modules for macros_module in macros_modules: sys.modules[macros_module.__name__] = macros_module globals()[macros_module._name] = macros_module
Integrate plugins to the context
386,442
def expect_file_line_regex_match_count_to_be_between(self, regex, expected_min_count=0, expected_max_count=None, ...
Expect the number of times a regular expression appears on each line of a file to be between a maximum and minimum value. Args: regex: \ A string that can be compiled as valid regular expression to match expected_min_count (None or nonnegative integer): \ ...
386,443
def addGenotype( self, genotype_id, genotype_label, genotype_type=None, genotype_description=None ): if genotype_type is None: genotype_type = self.globaltt[] self.model.addIndividualToGraph( genotype_id, genotype_label, genotype_...
If a genotype_type is not supplied, we will default to 'intrinsic_genotype' :param genotype_id: :param genotype_label: :param genotype_type: :param genotype_description: :return:
386,444
def viewinfo(self, postinfo): out_json = { : postinfo.uid, : postinfo.time_update, : postinfo.title, : tornado.escape.xhtml_unescape(postinfo.cnt_html), } self.write(json.dumps(out_json))
View the info
386,445
def get_random(self): import random Statement = self.get_model() session = self.Session() count = self.count() if count < 1: raise self.EmptyDatabaseException() random_index = random.randrange(0, count) random_statement = session.query(Stat...
Returns a random statement from the database.
386,446
def calc_el_lz_v1(self): con = self.parameters.control.fastaccess der = self.parameters.derived.fastaccess flu = self.sequences.fluxes.fastaccess sta = self.sequences.states.fastaccess for k in range(con.nmbzones): if (con.zonetype[k] == ILAKE) and (flu.tc[k] > con.ttice[k]): ...
Calculate lake evaporation. Required control parameters: |NmbZones| |ZoneType| |TTIce| Required derived parameters: |RelZoneArea| Required fluxes sequences: |TC| |EPC| Updated state sequence: |LZ| Basic equations: :math:`\\frac{dLZ...
386,447
def _grabix_index(data): in_file = data["bgzip_file"] config = data["config"] grabix = config_utils.get_program("grabix", config) gbi_file = _get_grabix_index(in_file) if not gbi_file or _is_partial_index(gbi_file): if gbi_file: utils.remove_safe(gbi_file) else:...
Create grabix index of bgzip input file. grabix does not allow specification of output file, so symlink the original file into a transactional directory.
386,448
def from_proto(cls, repeated_split_infos): split_dict = cls() for split_info_proto in repeated_split_infos: split_info = SplitInfo() split_info.CopyFrom(split_info_proto) split_dict.add(split_info) return split_dict
Returns a new SplitDict initialized from the `repeated_split_infos`.
386,449
def mark_clean(self, entity): state = EntityState.get_state(entity) state.status = ENTITY_STATUS.CLEAN state.is_persisted = True
Marks the given entity as CLEAN. This is done when an entity is loaded fresh from the repository or after a commit.
386,450
def get_smtp_mail(self): header = self.get_smtp_header() body = self.get_body().replace(, ) return header + + body +
Returns the SMTP formatted email, as it may be passed to sendmail. :rtype: string :return: The SMTP formatted mail.
386,451
def _all_tag(self): all_tag = self.get_conf_value() if len(all_tag) == 0: return False else: return all_tag[0].lower() ==
Return the all tag of the Glances/Docker configuration file. # By default, Glances only display running containers # Set the following key to True to display all containers all=True
386,452
def nifti_copy(filename,prefix=None,gzip=True): if prefix==None: prefix = filename nifti_filename = globals()[](prefix) + ".nii" if gzip: nifti_filename += if not os.path.exists(nifti_filename): try: subprocess.check_call([,,nifti_filename,str(filename)]) ...
creates a ``.nii`` copy of the given dataset and returns the filename as a string
386,453
def memory_write32(self, addr, data, zone=None): return self.memory_write(addr, data, zone, 32)
Writes words to memory of a target system. Args: self (JLink): the ``JLink`` instance addr (int): start address to write to data (list): list of words to write zone (str): optional memory zone to access Returns: Number of words written to target. ...
386,454
def clean(self): if self.request: if not self.request.session.test_cookie_worked(): raise forms.ValidationError("Cookies must be enabled.") return self.cleaned_data
Check user has cookies enabled
386,455
def count(self): if not self.query.store.autocommit: self.query.store.checkpoint() target = .join([ tableClass.storeID.getColumnName(self.query.store) for tableClass in self.query.tableClass ]) sql, args = self.query._sqlAndArgs( , ...
Count the number of distinct results of the wrapped query. @return: an L{int} representing the number of distinct results.
386,456
def GetBatchJobHelper(self, version=sorted(_SERVICE_MAP.keys())[-1], server=None): if not server: server = _DEFAULT_ENDPOINT request_builder = BatchJobHelper.GetRequestBuilder( self, version=version, server=server) response_parser = BatchJobHelper.GetResponseParse...
Returns a BatchJobHelper to work with the BatchJobService. This is a convenience method. It is functionally identical to calling BatchJobHelper(adwords_client, version). Args: [optional] version: A string identifying the AdWords version to connect to. This defaults to what is cur...
386,457
def set_palette_name(self, palette_name): combo = self.get_widget() found = False log.debug("wanting palette: %r", palette_name) for i in combo.get_model(): if i[0] == palette_name: combo.set_active_iter(i.iter) found = True ...
If the given palette matches an existing one, shows it in the combobox
386,458
def _domain_differs(self, href): target = utils.get_domain(href) if not target: return False origin = utils.get_domain(self.url) return target != origin
Check that a link is not on the same domain as the source URL
386,459
def create(max_kl, cg_iters, line_search_iters, cg_damping, entropy_coef, vf_iters, discount_factor, gae_lambda=1.0, improvement_acceptance_ratio=0.1, max_grad_norm=0.5): return TrpoPolicyGradient( max_kl, int(cg_iters), int(line_search_iters), cg_damping, entropy_coef, vf_iters, dis...
Vel factory function
386,460
def pipe_xpathfetchpage(context=None, _INPUT=None, conf=None, **kwargs): conf = DotDict(conf) urls = utils.listize(conf[]) for item in _INPUT: for item_url in urls: url = utils.get_value(DotDict(item_url), DotDict(item), **kwargs) url = utils.get_abspath(url) ...
A source that fetches the content of a given website as DOM nodes or a string. Loopable. context : pipe2py.Context object _INPUT : pipeforever pipe or an iterable of items or fields conf : dict URL -- url object contain the URL to download xpath -- xpath to extract html5 -- use htm...
386,461
def _to_dict(self): _dict = {} if hasattr(self, ) and self.location is not None: _dict[] = self.location._to_dict() if hasattr(self, ) and self.text is not None: _dict[] = self.text if hasattr(self, ) and self.section_title is not None: _dict[...
Return a json dictionary representing this model.
386,462
def get_parent_aligned_annotation(self, ref_id): parentTier = self.tiers[self.annotations[ref_id]] while "PARENT_REF" in parentTier[2] and len(parentTier[2]) > 0: ref_id = parentTier[1][ref_id][0] parentTier = self.tiers[self.annotations[ref_id]] return parentTi...
Give the aligment annotation that a reference annotation belongs to directly, or indirectly through other reference annotations. :param str ref_id: Id of a reference annotation. :raises KeyError: If no annotation exists with the id or if it belongs to an alignment annotation. :returns: T...
386,463
def add_jump(self, name, min, max, num, warp=None, var_type=float): if not isinstance(var_type, type): if var_type == : var_type = int elif var_type == : var_type = float else: raise ValueError( ...
An integer/float-valued enumerable with `num` items, bounded between [`min`, `max`]. Note that the right endpoint of the interval includes `max`. This is a wrapper around the add_enum. `jump` can be a float or int.
386,464
def connect(config_dir=None, optional_config_files=None, cron_cfg="cron"): from pyrocore.scripts.base import ScriptBase from pyrocore.util import load_config ScriptBase.setup(cron_cfg=cron_cfg) load_config.ConfigLoader(config_dir).load(optional_config_files or []) from pyrocore import config ...
Initialize everything for interactive use. Returns a ready-to-use RtorrentEngine object.
386,465
def open_fileswitcher_dlg(self): if not self.tabs.count(): return if self.fileswitcher_dlg is not None and \ self.fileswitcher_dlg.is_visible: self.fileswitcher_dlg.hide() self.fileswitcher_dlg.is_visible = False return ...
Open file list management dialog box
386,466
def modify_order(self, modify_order_op, order_id, qty, price, adjust_limit=0, trd_env=TrdEnv.REAL, acc_id=0, acc_index=0): return super(OpenHKCCTradeContext, self).modify_order(modify_order_op=modify_order_op, order_id=order_id, qt...
详细说明见基类接口说明,但有以下不同:不支持改单。 可撤单。删除订单是本地操作。 :param modify_order_op: :param order_id: :param qty: :param price: :param adjust_limit: :param trd_env: :param acc_id: :return:
386,467
def my_main(context): print() if context[]: print() for k in context: print(.format(k, context[k])) print() return 0
The starting point for your app.
386,468
def generate_random_string(size=6, chars=string.ascii_uppercase + string.digits): return .join(random.choice(chars) for _ in range(size))
Generate random string. :param size: Length of the returned string. Default is 6. :param chars: List of the usable characters. Default is string.ascii_uppercase + string.digits. :type size: int :type chars: str :return: The random string. :rtype: str
386,469
def pbkdf2(seed: str or bytes, dk_len: int) -> bytes: key = b index = 1 bytes_seed = str_to_bytes(seed) while len(key) < dk_len: key += Digest.sha256(b.join([bytes_seed, index.to_bytes(4, , signed=True)])) index += 1 return key[:dk_len]
Derive one key from a seed. :param seed: the secret pass phrase to generate the keys from. :param dk_len: the length in bytes of every derived key. :return:
386,470
def build_url(base_url, partial_url): if not base_url.endswith(): base_url += if partial_url.startswith(): partial_url = partial_url[1:] return urlparse.urljoin(base_url, partial_url)
Makes sure the URL is built properly. >>> urllib.parse.urljoin('https://test.com/1/', '2/3') https://test.com/1/2/3 >>> urllib.parse.urljoin('https://test.com/1/', '/2/3') https://test.com/2/3 >>> urllib.parse.urljoin('https://test.com/1', '2/3') https://test.com/2/3'
386,471
def input_validate_yubikey_secret(data, name=): if isinstance(data, pyhsm.aead_cmd.YHSM_YubiKeySecret): data = data.pack() return input_validate_str(data, name)
Input validation for YHSM_YubiKeySecret or string.
386,472
def _clear_surface(self, surface, rect=None): clear_color = self._rgb_clear_color if self._clear_color is None else self._clear_color surface.fill(clear_color, rect)
Clear the buffer, taking in account colorkey or alpha :return:
386,473
def random_tickers( length, n_tickers, endswith=None, letters=None, slicer=itertools.islice ): if letters is None: letters = string.ascii_uppercase if endswith: length = length - len(endswith) join = "".join def yield_ticker(rand=rando...
Generate a length-n_tickers list of unique random ticker symbols. Parameters ---------- length : int The length of each ticker string. n_tickers : int Number of tickers to generate. endswith : str, default None Specify the ending element(s) of each ticker (for examp...
386,474
def radius_server_host_protocol(self, **kwargs): config = ET.Element("config") radius_server = ET.SubElement(config, "radius-server", xmlns="urn:brocade.com:mgmt:brocade-aaa") host = ET.SubElement(radius_server, "host") hostname_key = ET.SubElement(host, "hostname") host...
Auto Generated Code
386,475
def _Open(self, path_spec, mode=): if not path_spec.HasParent(): raise errors.PathSpecError( ) file_object = resolver.Resolver.OpenFileObject( path_spec.parent, resolver_context=self._resolver_context) cpio_archive_file = cpio.CPIOArchiveFile() try: cpio_archive_file...
Opens the file system defined by path specification. Args: path_spec (PathSpec): path specification. mode (Optional[str]): file access mode. The default is 'rb' which represents read-only binary. Raises: AccessError: if the access to open the file was denied. IOError: if the ...
386,476
def _raw_open(self, flags, mode=0o777): return self._accessor.open(self, flags, mode)
Open the file pointed by this path and return a file descriptor, as os.open() does.
386,477
def is_cython_function(fn): if hasattr(fn, "__func__"): fn = fn.__func__ name = type(fn).__name__ return ( name == "method_descriptor" or name == "cython_function_or_method" or name == "builtin_function_or_method" )
Checks if a function is compiled w/Cython.
386,478
def duration(self): if self._duration: return self._duration elif self.end: return self.end - self.begin else: return None
Get or set the duration of the event. | Will return a timedelta object. | May be set to anything that timedelta() understands. | May be set with a dict ({"days":2, "hours":6}). | If set to a non null value, removes any already existing end time.
386,479
def get_annotation_values(graph, annotation: str) -> Set[str]: return set(iter_annotation_values(graph, annotation))
Get all values for the given annotation. :param pybel.BELGraph graph: A BEL graph :param annotation: The annotation to summarize :return: A set of all annotation values
386,480
def sanitize(self): super(MapNotifyMessage, self).sanitize() if not isinstance(self.xtr_id, numbers.Integral) \ or self.xtr_id < 0 or self.xtr_id >= 2 ** 128: raise ValueError() if not isinstance(self.site_id, n...
Check if the current settings conform to the LISP specifications and fix them where possible.
386,481
def _fast_hit_windows(ref, est, window): ref = np.asarray(ref) est = np.asarray(est) ref_idx = np.argsort(ref) ref_sorted = ref[ref_idx] left_idx = np.searchsorted(ref_sorted, est - window, side=) right_idx = np.searchsorted(ref_sorted, est + window, side=) hit_ref, hit_est = [], [] ...
Fast calculation of windowed hits for time events. Given two lists of event times ``ref`` and ``est``, and a tolerance window, computes a list of pairings ``(i, j)`` where ``|ref[i] - est[j]| <= window``. This is equivalent to, but more efficient than the following: >>> hit_ref, hit_est = np.wher...
386,482
def updateHistory(self, activeCells, forceOutput=False): self._activeCellsHistory.append(activeCells) if len(self._activeCellsHistory) > self._historyLength: self._activeCellsHistory.pop(0) self._unionSDR = numpy.zeros(shape=(self._numInputs,)) if (len(self._activeCellsHistory) >= self._minH...
Computes one cycle of the Union Pooler algorithm. Return the union SDR Parameters: ---------------------------- @param activeCells: A list that stores indices of active cells @param forceOutput: if True, a union will be created without regard to minHistory
386,483
def resurrect(self, force=False): if self.dead.empty(): return try: timeout, connection = self.dead.get(block=False) except Empty: return if not force and timeout > time.time(): sel...
Attempt to resurrect a connection from the dead pool. It will try to locate one (not all) eligible (it's timeout is over) connection to return to th live pool. :arg force: resurrect a connection even if there is none eligible (used when we have no live connections)
386,484
def all(cls): query = meta.Session.query(SemanticTag) query = query.distinct().join(TagSemanticTag) return query
Return all tags that are currently applied to any dataset. :returns: a list of all tags that are currently applied to any dataset :rtype: list of ckan.model.tag.Tag objects
386,485
def set_instrument(self, channel, instr, bank=1): self.track_data += self.select_bank(channel, bank) self.track_data += self.program_change_event(channel, instr)
Add a program change and bank select event to the track_data.
386,486
def protected_resource_view(scopes=None): if scopes is None: scopes = [] def wrapper(view): def view_wrapper(request, *args, **kwargs): access_token = extract_access_token(request) try: try: kwargs[] = Token.objects.get(access_t...
View decorator. The client accesses protected resources by presenting the access token to the resource server. https://tools.ietf.org/html/rfc6749#section-7
386,487
def seek(self, offset, whence=SEEK_SET): self.data.seek(offset, whence) new_pos = self.data.tell() missing_bytes_to_read = new_pos - self._current_lob_length if missing_bytes_to_read > 0: ...
Seek pointer in lob data buffer to requested position. Might trigger further loading of data from the database if the pointer is beyond currently read data.
386,488
def run_failure_step_group(pipeline, context): logger.debug("starting") try: assert pipeline context=context) except Exception as exception: logger.error("Failure handler also failed. Swallowing.") logger.error(exception) logger.debug("done")
Run the on_failure step group if it exists. This function will swallow all errors, to prevent obfuscating the error condition that got it here to begin with.
386,489
def _provision_vm(name=None, session=None): if session is None: session = _get_session() log.info(, name) vm = _get_vm(name, session) task = session.xenapi.Async.VM.provision(vm) _run_async_task(task, session)
Provision vm right after clone/copy
386,490
def run(self, **kwargs): for key in kwargs: setattr(self, key, kwargs[key]) self.command = self.COMMAND_RUN
Drive servo to the position set in the `position_sp` attribute.
386,491
def getAll(self): if not bool(len(self.ATTRIBUTES)): self.load_attributes() return eval(str(self.ATTRIBUTES))
Return a dictionary with all variables
386,492
def tokenize(self, path): assert os.path.exists(path) with open(path, ) as f: tokens = 0 for line in f: words = line.split() + [] tokens += len(words) for word in words: self.dictionary.add_word...
Tokenizes a text file.
386,493
def is_all_field_none(self): if self._UserLight is not None: return False if self._UserPerson is not None: return False if self._UserCompany is not None: return False if self._UserApiKey is not None: return False retur...
:rtype: bool
386,494
def AgregarTambo(self, nro_tambo_interno, nro_renspa, fecha_venc_cert_tuberculosis, fecha_venc_cert_brucelosis, nro_tambo_provincial=None, **kwargs): "Agrego los datos del productor a la liq." tambo = {: nro_tambo_interno, : nro_tambo_provincial...
Agrego los datos del productor a la liq.
386,495
def open_zip(path_or_file, *args, **kwargs): if not path_or_file: raise InvalidZipPath(.format(path_or_file)) allowZip64 = kwargs.pop(, True) try: zf = zipfile.ZipFile(path_or_file, *args, allowZip64=allowZip64, **kwargs) except zipfile.BadZipfile as bze: raise zipfile.BadZipfile("Bad Zipfil...
A with-context for zip files. Passes through *args and **kwargs to zipfile.ZipFile. :API: public :param path_or_file: Full path to zip file. :param args: Any extra args accepted by `zipfile.ZipFile`. :param kwargs: Any extra keyword args accepted by `zipfile.ZipFile`. :raises: `InvalidZipPath` if path_or...
386,496
def modutf7_encode(data: str) -> bytes: ret = bytearray() is_usascii = True encode_start = None for i, symbol in enumerate(data): charpoint = ord(symbol) if is_usascii: if charpoint == 0x26: ret.extend(b) elif 0x20 <= charpoint <= 0x7e: ...
Encode the string using modified UTF-7. Args: data: The input string to encode.
386,497
def GetPixelColorsHorizontally(self, x: int, y: int, count: int) -> ctypes.Array: arrayType = ctypes.c_uint32 * count values = arrayType() _DllClient.instance().dll.BitmapGetPixelsHorizontally(ctypes.c_size_t(self._bitmap), x, y, values, count) return values
x: int. y: int. count: int. Return `ctypes.Array`, an iterable array of int values in argb form point x,y horizontally.
386,498
def ignore_whitespace_text_nodes(cls, wrapped_node): for child in wrapped_node.children: if child.is_text and child.value.strip() == : child.delete() else: cls.ignore_whitespace_text_nodes(child)
Find and delete any text nodes containing nothing but whitespace in in the given node and its descendents. This is useful for cleaning up excess low-value text nodes in a document DOM after parsing a pretty-printed XML document.
386,499
def fit_class1_pan_allele_models( self, n_models, architecture_hyperparameters, alleles, peptides, affinities, inequalities, models_dir_for_save=None, verbose=1, progress_preamble="", prog...
Fit one or more pan-allele predictors using a single neural network architecture. The new predictors are saved in the Class1AffinityPredictor instance and will be used on subsequent calls to `predict`. Parameters ---------- n_models : int Num...