code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
def timeseries_reactive(self): """ Reactive power time series in kvar. Parameters ----------- timeseries_reactive : :pandas:`pandas.Seriese<series>` Series containing reactive power in kvar. Returns ------- :pandas:`pandas.Series<series>` or ...
Reactive power time series in kvar. Parameters ----------- timeseries_reactive : :pandas:`pandas.Seriese<series>` Series containing reactive power in kvar. Returns ------- :pandas:`pandas.Series<series>` or None Series containing reactive power t...
def usearch61_smallmem_cluster(intermediate_fasta, percent_id=0.97, minlen=64, rev=False, output_dir=".", remove_usearch_logs=False, w...
Performs usearch61 de novo clustering via cluster_smallmem option Only supposed to be used with length sorted data (and performs length sorting automatically) and does not support reverse strand matching intermediate_fasta: fasta filepath to be clustered with usearch61 percent_id: percentage id to c...
def display(self, image): """ Takes a 32-bit RGBA :py:mod:`PIL.Image` and dumps it to the daisy-chained APA102 neopixels. If a pixel is not fully opaque, the alpha channel value is used to set the brightness of the respective RGB LED. """ assert(image.mode == self.mode) ...
Takes a 32-bit RGBA :py:mod:`PIL.Image` and dumps it to the daisy-chained APA102 neopixels. If a pixel is not fully opaque, the alpha channel value is used to set the brightness of the respective RGB LED.
def dfa_word_acceptance(dfa: dict, word: list) -> bool: """ Checks if a given **word** is accepted by a DFA, returning True/false. The word w is accepted by a DFA if DFA has an accepting run on w. Since A is deterministic, :math:`w ∈ L(A)` if and only if :math:`ρ(s_0 , w) ∈ F` . :param dict df...
Checks if a given **word** is accepted by a DFA, returning True/false. The word w is accepted by a DFA if DFA has an accepting run on w. Since A is deterministic, :math:`w ∈ L(A)` if and only if :math:`ρ(s_0 , w) ∈ F` . :param dict dfa: input DFA; :param list word: list of actions ∈ dfa['alpha...
def start_request(self, headers, *, end_stream=False): """ Start a request by sending given headers on a new stream, and return the ID of the new stream. This may block until the underlying transport becomes writable, and the number of concurrent outbound requests (open outbound...
Start a request by sending given headers on a new stream, and return the ID of the new stream. This may block until the underlying transport becomes writable, and the number of concurrent outbound requests (open outbound streams) is less than the value of peer config MAX_CONCURRENT_STRE...
def check_database_connected(db): """ A built-in check to see if connecting to the configured default database backend succeeds. It's automatically added to the list of Dockerflow checks if a :class:`~flask_sqlalchemy.SQLAlchemy` object is passed to the :class:`~dockerflow.flask.app.Dockerflow`...
A built-in check to see if connecting to the configured default database backend succeeds. It's automatically added to the list of Dockerflow checks if a :class:`~flask_sqlalchemy.SQLAlchemy` object is passed to the :class:`~dockerflow.flask.app.Dockerflow` class during instantiation, e.g.:: ...
def reverse(self): 'S.reverse() -- reverse *IN PLACE*' n = len(self) for i in range(n//2): self[i], self[n-i-1] = self[n-i-1], self[i]
S.reverse() -- reverse *IN PLACE*
def _set_cpu_queue_info_state(self, v, load=False): """ Setter method for cpu_queue_info_state, mapped from YANG variable /cpu_queue_info_state (container) If this variable is read-only (config: false) in the source YANG file, then _set_cpu_queue_info_state is considered as a private method. Backend...
Setter method for cpu_queue_info_state, mapped from YANG variable /cpu_queue_info_state (container) If this variable is read-only (config: false) in the source YANG file, then _set_cpu_queue_info_state is considered as a private method. Backends looking to populate this variable should do so via calling...
def get_data(self): """Returns data from each field.""" result = {} for field in self.fields: result[field.name] = self.data.get(field.name) return result
Returns data from each field.
def button(self): """The button that triggered this event. For events that are not of type :attr:`~libinput.constant.EventType.TABLET_TOOL_BUTTON`, this property raises :exc:`AttributeError`. Returns: int: The button triggering this event. """ if self.type != EventType.TABLET_TOOL_BUTTON: raise A...
The button that triggered this event. For events that are not of type :attr:`~libinput.constant.EventType.TABLET_TOOL_BUTTON`, this property raises :exc:`AttributeError`. Returns: int: The button triggering this event.
def list_nodes_full(call=None): ''' List nodes, with all available information CLI Example: .. code-block:: bash salt-cloud -F ''' response = _query('grid', 'server/list') ret = {} for item in response['list']: name = item['name'] ret[name] = item ret...
List nodes, with all available information CLI Example: .. code-block:: bash salt-cloud -F
def _finalCleanup(self): """ Clean up all of our connections by issuing application-level close and stop notifications, sending hail-mary final FIN packets (which may not reach the other end, but nevertheless can be useful) when possible. """ for conn in self._connections...
Clean up all of our connections by issuing application-level close and stop notifications, sending hail-mary final FIN packets (which may not reach the other end, but nevertheless can be useful) when possible.
def gps_message_arrived(self, m): '''adjust time base from GPS message''' # msec-style GPS message? gps_week = getattr(m, 'Week', None) gps_timems = getattr(m, 'TimeMS', None) if gps_week is None: # usec-style GPS message? gps_week = getattr(m, 'GWk', None...
adjust time base from GPS message
def move_identity(session, identity, uidentity): """Move an identity to a unique identity. Shifts `identity` to the unique identity given in `uidentity`. The function returns whether the operation was executed successfully. When `uidentity` is the unique identity currently related to `identity...
Move an identity to a unique identity. Shifts `identity` to the unique identity given in `uidentity`. The function returns whether the operation was executed successfully. When `uidentity` is the unique identity currently related to `identity`, this operation does not have any effect and `Fals...
def inquire_property(name, doc=None): """Creates a property based on an inquire result This method creates a property that calls the :python:`_inquire` method, and return the value of the requested information. Args: name (str): the name of the 'inquire' result information Returns: ...
Creates a property based on an inquire result This method creates a property that calls the :python:`_inquire` method, and return the value of the requested information. Args: name (str): the name of the 'inquire' result information Returns: property: the created property
def reverse_transform(self, col): """Converts data back into original format. Args: col(pandas.DataFrame): Data to transform. Returns: pandas.DataFrame """ output = pd.DataFrame(index=col.index) output[self.col_name] = col.apply(self.safe_round,...
Converts data back into original format. Args: col(pandas.DataFrame): Data to transform. Returns: pandas.DataFrame
def delete(name): '''Delete the given virtual folder. This operation is irreversible! NAME: Name of a virtual folder. ''' with Session() as session: try: session.VFolder(name).delete() print_done('Deleted.') except Exception as e: print_error(e) ...
Delete the given virtual folder. This operation is irreversible! NAME: Name of a virtual folder.
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ serverInfo = MemcachedInfo(self._host, self._port, self._socket_file) return (serverInfo is not None)
Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise.
def stream_events(signals: Sequence[Signal], filter: Callable[[T_Event], bool] = None, *, max_queue_size: int = 0) -> AsyncIterator[T_Event]: """ Return an async generator that yields events from the given signals. Only events that pass the filter callable (if one has been given) are retu...
Return an async generator that yields events from the given signals. Only events that pass the filter callable (if one has been given) are returned. If no filter function was given, all events are yielded from the generator. :param signals: the signals to get events from :param filter: a callable that...
def from_array(filename, data, iline=189, xline=193, format=SegySampleFormat.IBM_FLOAT_4_BYTE, dt=4000, delrt=0): """ Create a new SEGY file from an n-dimentional array. Create a structured ...
Create a new SEGY file from an n-dimentional array. Create a structured SEGY file with defaulted headers from a 2-, 3- or 4-dimensional array. ilines, xlines, offsets and samples are inferred from the size of the array. Please refer to the documentation for functions from_array2D, from_array3D and from_...
def send(msg_type, send_async=False, *args, **kwargs): """ Constructs a message class and sends the message. Defaults to sending synchronously. Set send_async=True to send asynchronously. Args: :msg_type: (str) the type of message to send, i.e. 'Email' :send_async: (bool) default i...
Constructs a message class and sends the message. Defaults to sending synchronously. Set send_async=True to send asynchronously. Args: :msg_type: (str) the type of message to send, i.e. 'Email' :send_async: (bool) default is False, set True to send asynchronously. :kwargs: (dict) k...
def shift_coordinate_grid(self, x_shift, y_shift, pixel_unit=False): """ shifts the coordinate system :param x_shif: shift in x (or RA) :param y_shift: shift in y (or DEC) :param pixel_unit: bool, if True, units of pixels in input, otherwise RA/DEC :return: updated data c...
shifts the coordinate system :param x_shif: shift in x (or RA) :param y_shift: shift in y (or DEC) :param pixel_unit: bool, if True, units of pixels in input, otherwise RA/DEC :return: updated data class with change in coordinate system
def triangulize(image, tile_size): """Processes the given image by breaking it down into tiles of the given size and applying a triangular effect to each tile. Returns the processed image as a PIL Image object. The image can be given as anything suitable for passing to `Image.open` (ie, the path to...
Processes the given image by breaking it down into tiles of the given size and applying a triangular effect to each tile. Returns the processed image as a PIL Image object. The image can be given as anything suitable for passing to `Image.open` (ie, the path to an image or as a file-like object contain...
def search(self, index_name, query): """Search the given index_name with the given ELS query. Args: index_name: Name of the Index query: The string to be searched. Returns: List of results. Raises: RuntimeError: When the search query fai...
Search the given index_name with the given ELS query. Args: index_name: Name of the Index query: The string to be searched. Returns: List of results. Raises: RuntimeError: When the search query fails.
def searchForGroups(self, name, limit=10): """ Find and get group thread by its name :param name: Name of the group thread :param limit: The max. amount of groups to fetch :return: :class:`models.Group` objects, ordered by relevance :rtype: list :raises: FBchatEx...
Find and get group thread by its name :param name: Name of the group thread :param limit: The max. amount of groups to fetch :return: :class:`models.Group` objects, ordered by relevance :rtype: list :raises: FBchatException if request failed
def avail_platforms(): ''' Return which platforms are available CLI Example: .. code-block:: bash salt myminion genesis.avail_platforms ''' ret = {} for platform in CMD_MAP: ret[platform] = True for cmd in CMD_MAP[platform]: if not salt.utils.path.which...
Return which platforms are available CLI Example: .. code-block:: bash salt myminion genesis.avail_platforms
def add_intercept_term(self, x): """ Adds a column of ones to estimate the intercept term for separation boundary """ nr_x,nr_f = x.shape intercept = np.ones([nr_x,1]) x = np.hstack((intercept,x)) return x
Adds a column of ones to estimate the intercept term for separation boundary
def create_collection(self, name, codec_options=None, read_preference=None, write_concern=None, read_concern=None, **kwargs): """Create a new :class:`~pymongo.collection.Collection` in this database. Normally collection creation is automatic. ...
Create a new :class:`~pymongo.collection.Collection` in this database. Normally collection creation is automatic. This method should only be used to specify options on creation. :class:`~pymongo.errors.CollectionInvalid` will be raised if the collection already exists. ...
def walk_dir(path, args, state): """ Check all files in `path' to see if there is any requests that we should send out on the bus. """ if args.debug: sys.stderr.write("Walking %s\n" % path) for root, _dirs, files in os.walk(path): if not safe_process_files(root, files, args, sta...
Check all files in `path' to see if there is any requests that we should send out on the bus.
def as_dict(self): """ Bson-serializable dict representation of the VoronoiContainer. :return: dictionary that is BSON-encodable """ bson_nb_voro_list2 = self.to_bson_voronoi_list2() return {"@module": self.__class__.__module__, "@class": self.__class__.__...
Bson-serializable dict representation of the VoronoiContainer. :return: dictionary that is BSON-encodable
def add_model(self, *args, **kwargs): # type: (*Any, **Any) -> Part """Add a new child model to this model. In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as additional keyword=value argument to this method. This will improve performance o...
Add a new child model to this model. In order to prevent the backend from updating the frontend you may add `suppress_kevents=True` as additional keyword=value argument to this method. This will improve performance of the backend against a trade-off that someone looking at the frontend won't no...
def fill_subparser(subparser): """Sets up a subparser to convert the ILSVRC2012 dataset files. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `ilsvrc2012` command. """ subparser.add_argument( "--shuffle-seed", help="Seed to use for ran...
Sets up a subparser to convert the ILSVRC2012 dataset files. Parameters ---------- subparser : :class:`argparse.ArgumentParser` Subparser handling the `ilsvrc2012` command.
def parse_ns_headers(ns_headers): """Ad-hoc parser for Netscape protocol cookie-attributes. The old Netscape cookie format for Set-Cookie can for instance contain an unquoted "," in the expires field, so we have to use this ad-hoc parser instead of split_header_words. XXX This may not make the bes...
Ad-hoc parser for Netscape protocol cookie-attributes. The old Netscape cookie format for Set-Cookie can for instance contain an unquoted "," in the expires field, so we have to use this ad-hoc parser instead of split_header_words. XXX This may not make the best possible effort to parse all the crap ...
def rearrange_jupytext_metadata(metadata): """Convert the jupytext_formats metadata entry to jupytext/formats, etc. See #91""" # Backward compatibility with nbrmd for key in ['nbrmd_formats', 'nbrmd_format_version']: if key in metadata: metadata[key.replace('nbrmd', 'jupytext')] = metad...
Convert the jupytext_formats metadata entry to jupytext/formats, etc. See #91
def _lookup_identity_names(self): """ Batch resolve identities to usernames. Returns a dict mapping IDs to Usernames """ id_batch_size = 100 # fetch in batches of 100, store in a dict ac = get_auth_client() self._resolved_map = {} for i in range(0...
Batch resolve identities to usernames. Returns a dict mapping IDs to Usernames
def remote_tags(url): # type: (str) -> list """ List all available remote tags naturally sorted as version strings :rtype: list :param url: Remote URL of the repository :return: list of available tags """ tags = [] remote_git = Git() for line in remote_git.ls_remote('--tags', '--...
List all available remote tags naturally sorted as version strings :rtype: list :param url: Remote URL of the repository :return: list of available tags
def add_size_info (self): """Set size of URL content (if any).. Should be overridden in subclasses.""" maxbytes = self.aggregate.config["maxfilesizedownload"] if self.size > maxbytes: self.add_warning( _("Content size %(size)s is larger than %(maxbytes)s.") % ...
Set size of URL content (if any).. Should be overridden in subclasses.
def start(self): """Start scheduling""" self.stop() self.initialize() self.handle = self.loop.call_at(self.get_next(), self.call_next)
Start scheduling
def should_filter(items): """Check if we should do damage filtering on somatic calling with low frequency events. """ return (vcfutils.get_paired(items) is not None and any("damage_filter" in dd.get_tools_on(d) for d in items))
Check if we should do damage filtering on somatic calling with low frequency events.
def _update_digital_forms(self, **update_props): """ Update operation for ISO Digital Forms metadata :see: gis_metadata.utils._complex_definitions[DIGITAL_FORMS] """ digital_forms = wrap_value(update_props['values']) # Update all Digital Form properties: distributionFor...
Update operation for ISO Digital Forms metadata :see: gis_metadata.utils._complex_definitions[DIGITAL_FORMS]
def compute_K_numerical(dataframe, settings=None, keep_dir=None): """Use a finite-element modeling code to infer geometric factors for meshes with topography or irregular electrode spacings. Parameters ---------- dataframe : pandas.DataFrame the data frame that contains the data setting...
Use a finite-element modeling code to infer geometric factors for meshes with topography or irregular electrode spacings. Parameters ---------- dataframe : pandas.DataFrame the data frame that contains the data settings : dict The settings required to compute the geometric factors. ...
def pdf_extract_text(path, pdfbox_path, pwd='', timeout=120): """Utility to use PDFBox from pdfbox.apache.org to extract Text from a PDF Parameters ---------- path : str Path to source pdf-file pdfbox_path : str Path to pdfbox-app-x.y.z.jar pwd : str, optional Passwo...
Utility to use PDFBox from pdfbox.apache.org to extract Text from a PDF Parameters ---------- path : str Path to source pdf-file pdfbox_path : str Path to pdfbox-app-x.y.z.jar pwd : str, optional Password for protected pdf files timeout : int, optional Second...
def asarray(self, out=None, squeeze=True, lock=None, reopen=True, maxsize=None, maxworkers=None, validate=True): """Read image data from file and return as numpy array. Raise ValueError if format is unsupported. Parameters ---------- out : numpy.ndarray, str, or...
Read image data from file and return as numpy array. Raise ValueError if format is unsupported. Parameters ---------- out : numpy.ndarray, str, or file-like object Buffer where image data will be saved. If None (default), a new array will be created. ...
def commissionerUnregister(self): """stop commissioner Returns: True: successful to stop commissioner False: fail to stop commissioner """ print '%s call commissionerUnregister' % self.port cmd = 'commissioner stop' print cmd return self._...
stop commissioner Returns: True: successful to stop commissioner False: fail to stop commissioner
def _get(self, url, param_dict={}, securityHandler=None, additional_headers=[], handlers=[], proxy_url=None, proxy_port=None, compress=True, custom_handlers=[], out_folder=None, file_name=No...
Performs a GET operation Inputs: Output: returns dictionary, string or None
def set_default_init_cli_cmds(self): """ Default init commands are set --retcode true, echo off, set --vt100 off, set dut <dut name> and set testcase <tc name> :return: List of default cli initialization commands. """ init_cli_cmds = [] init_cli_cmds.append("set ...
Default init commands are set --retcode true, echo off, set --vt100 off, set dut <dut name> and set testcase <tc name> :return: List of default cli initialization commands.
def _check_callback(callback): """ Turns a callback that is potentially a class into a callable object. Args: callback (object): An object that might be a class, method, or function. if the object is a class, this creates an instance of it. Raises: ValueError: If an instance ca...
Turns a callback that is potentially a class into a callable object. Args: callback (object): An object that might be a class, method, or function. if the object is a class, this creates an instance of it. Raises: ValueError: If an instance can't be created or it isn't a callable objec...
def loop(self, max_seconds=None): """ Main loop for the process. This will run continuously until maxiter """ loop_started = datetime.datetime.now() self._is_running = True while self._is_running: self.process_error_queue(self.q_error) if max_se...
Main loop for the process. This will run continuously until maxiter
def ReadVarString(self, max=sys.maxsize): """ Similar to `ReadString` but expects a variable length indicator instead of the fixed 1 byte indicator. Args: max (int): (Optional) maximum number of bytes to read. Returns: bytes: """ length = self.Re...
Similar to `ReadString` but expects a variable length indicator instead of the fixed 1 byte indicator. Args: max (int): (Optional) maximum number of bytes to read. Returns: bytes:
def make_posthook(self): """ Run the post hook into the project directory. """ print(id(self.posthook), self.posthook) print(id(super(self.__class__, self).posthook), super(self.__class__, self).posthook) import ipdb;ipdb.set_trace() if self.posthook: os.chdir(self.pr...
Run the post hook into the project directory.
def en004(self, value=None): """ Corresponds to IDD Field `en004` mean coincident dry-bulb temperature to Enthalpy corresponding to 0.4% annual cumulative frequency of occurrence Args: value (float): value for IDD Field `en004` Unit: kJ/kg if...
Corresponds to IDD Field `en004` mean coincident dry-bulb temperature to Enthalpy corresponding to 0.4% annual cumulative frequency of occurrence Args: value (float): value for IDD Field `en004` Unit: kJ/kg if `value` is None it will not be checked ag...
def console(self): """starts to interact (starts interactive console) Something like code.InteractiveConsole""" while True: if six.PY2: code = raw_input('>>> ') else: code = input('>>>') try: print(self.eval(code)) ...
starts to interact (starts interactive console) Something like code.InteractiveConsole
def set_attributes(self, cell_renderer, **attributes): """ :param cell_renderer: the :obj:`Gtk.CellRenderer` we're setting the attributes of :type cell_renderer: :obj:`Gtk.CellRenderer` {{ docs }} """ Gtk.CellLayout.clear_attributes(self, cell_renderer) for (na...
:param cell_renderer: the :obj:`Gtk.CellRenderer` we're setting the attributes of :type cell_renderer: :obj:`Gtk.CellRenderer` {{ docs }}
def creep_kill(self, target, timestamp): """ A creep was tragically killed. Need to split this into radiant/dire and neutrals """ self.creep_kill_types[target] += 1 matched = False for k, v in self.creep_types.iteritems(): if target.startswith(k): ...
A creep was tragically killed. Need to split this into radiant/dire and neutrals
def update(self, data_and_metadata: DataAndMetadata.DataAndMetadata, state: str, sub_area, view_id) -> None: """Called from hardware source when new data arrives.""" self.__state = state self.__sub_area = sub_area hardware_source_id = self.__hardware_source.hardware_source_id ch...
Called from hardware source when new data arrives.
def set_chat_photo(self, chat_id, photo): """ Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Note: In regular ...
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success. Note: In regular groups (non-supergroups), this method will only work if the ‘A...
def resolve_variables(self, provided_variables): """Resolve the values of the blueprint variables. This will resolve the values of the `VARIABLES` with values from the env file, the config, and any lookups resolved. Args: provided_variables (list of :class:`stacker.variable...
Resolve the values of the blueprint variables. This will resolve the values of the `VARIABLES` with values from the env file, the config, and any lookups resolved. Args: provided_variables (list of :class:`stacker.variables.Variable`): list of provided variables
def prt_results(self, goea_results): """Print GOEA results to the screen or to a file.""" # objaart = self.prepgrp.get_objaart(goea_results) if self.prepgrp is not None else None if self.args.outfile is None: self._prt_results(goea_results) else: # Users can print...
Print GOEA results to the screen or to a file.
def get_serializer(self, *args, **kwargs): """ Returns the serializer instance that should be used to the given action. If any action was given, returns the serializer_class """ action = kwargs.pop('action', None) serializer_class = self.get_serializer_class(acti...
Returns the serializer instance that should be used to the given action. If any action was given, returns the serializer_class
def iter_directory(directory): """Given a directory, yield all files recursivley as a two-tuple (filepath, s3key)""" for path, dir, files in os.walk(directory): for f in files: filepath = os.path.join(path, f) key = os.path.relpath(filepath, directory) yield (filepath...
Given a directory, yield all files recursivley as a two-tuple (filepath, s3key)
def pop(self): """Pop a reading off of this stream and return it.""" if self._count == 0: raise StreamEmptyError("Pop called on buffered stream walker without any data", selector=self.selector) while True: curr = self.engine.get(self.storage_type, self.offset) ...
Pop a reading off of this stream and return it.
def get_tokens_by_code(self, code, state): """Function to get access code for getting the user details from the OP. It is called after the user authorizes by visiting the auth URL. Parameters: * **code (string):** code, parse from the callback URL querystring * **state (...
Function to get access code for getting the user details from the OP. It is called after the user authorizes by visiting the auth URL. Parameters: * **code (string):** code, parse from the callback URL querystring * **state (string):** state value parsed from the callback URL ...
def _merge_mappings(*args): """Merges a sequence of dictionaries and/or tuples into a single dictionary. If a given argument is a tuple, it must have two elements, the first of which is a sequence of keys and the second of which is a single value, which will be mapped to from each of the keys in the sequen...
Merges a sequence of dictionaries and/or tuples into a single dictionary. If a given argument is a tuple, it must have two elements, the first of which is a sequence of keys and the second of which is a single value, which will be mapped to from each of the keys in the sequence.
def AddPoly(self, poly, smart_duplicate_handling=True): """ Adds a new polyline to the collection. """ inserted_name = poly.GetName() if poly.GetName() in self._name_to_shape: if not smart_duplicate_handling: raise ShapeError("Duplicate shape found: " + poly.GetName()) print ("W...
Adds a new polyline to the collection.
def get_genes_for_hgnc_id(self, hgnc_symbol): """ obtain the ensembl gene IDs that correspond to a HGNC symbol """ headers = {"content-type": "application/json"} # http://grch37.rest.ensembl.org/xrefs/symbol/homo_sapiens/KMT2A?content-type=application/json ...
obtain the ensembl gene IDs that correspond to a HGNC symbol
def main_nonexecutable_region_limbos_contain(self, addr, tolerance_before=64, tolerance_after=64): """ Sometimes there exists a pointer that points to a few bytes before the beginning of a section, or a few bytes after the beginning of the section. We take care of that here. :param int ...
Sometimes there exists a pointer that points to a few bytes before the beginning of a section, or a few bytes after the beginning of the section. We take care of that here. :param int addr: The address to check. :return: A 2-tuple of (bool, the closest base address) :rtype: tuple
def create_node(hostname, username, password, name, address): ''' Create a new node if it does not already exist. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the node to cr...
Create a new node if it does not already exist. hostname The host/address of the bigip device username The iControl REST username password The iControl REST password name The name of the node to create address The address of the node
def ReadSerializableArray(self, class_name, max=sys.maxsize): """ Deserialize a stream into the object specific by `class_name`. Args: class_name (str): a full path to the class to be deserialized into. e.g. 'neo.Core.Block.Block' max (int): (Optional) maximum number of ...
Deserialize a stream into the object specific by `class_name`. Args: class_name (str): a full path to the class to be deserialized into. e.g. 'neo.Core.Block.Block' max (int): (Optional) maximum number of bytes to read. Returns: list: list of `class_name` objects de...
def get_vnetwork_portgroups_output_vnetwork_pgs_vlan(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") get_vnetwork_portgroups = ET.Element("get_vnetwork_portgroups") config = get_vnetwork_portgroups output = ET.SubElement(get_vnetwork_portgroups, ...
Auto Generated Code
def _convert_pflags(self, pflags): """convert SFTP-style open() flags to Python's os.open() flags""" if (pflags & SFTP_FLAG_READ) and (pflags & SFTP_FLAG_WRITE): flags = os.O_RDWR elif pflags & SFTP_FLAG_WRITE: flags = os.O_WRONLY else: flags = os.O_RD...
convert SFTP-style open() flags to Python's os.open() flags
def get_requires(self, profile=None): """Get filtered list of Require objects in this Feature :param str profile: Return Require objects with this profile or None to return all Require objects. :return: list of Require objects """ out = [] for...
Get filtered list of Require objects in this Feature :param str profile: Return Require objects with this profile or None to return all Require objects. :return: list of Require objects
def get_relavent_units(self): ''' Retrieves the relevant units for this data block. Returns: All flags related to this block. ''' relavent_units = {} for location,unit in self.units.items(): if self.unit_is_related(location, self.worksheet): ...
Retrieves the relevant units for this data block. Returns: All flags related to this block.
def get_annotation_data_before_time(self, id_tier, time): """Give the annotation before a given time. When the tier contains reference annotations this will be returned, check :func:`get_ref_annotation_data_before_time` for the format. If an annotation overlaps with ``time`` that annotat...
Give the annotation before a given time. When the tier contains reference annotations this will be returned, check :func:`get_ref_annotation_data_before_time` for the format. If an annotation overlaps with ``time`` that annotation will be returned. :param str id_tier: Name of the tier. ...
def apply_index(self, i): """ Vectorized apply of DateOffset to DatetimeIndex, raises NotImplentedError for offsets without a vectorized implementation. Parameters ---------- i : DatetimeIndex Returns ------- y : DatetimeIndex """...
Vectorized apply of DateOffset to DatetimeIndex, raises NotImplentedError for offsets without a vectorized implementation. Parameters ---------- i : DatetimeIndex Returns ------- y : DatetimeIndex
def _draw_box(self, parent_node, quartiles, outliers, box_index, metadata): """ Return the center of a bounding box defined by a box plot. Draws a box plot on self.svg. """ width = (self.view.x(1) - self.view.x(0)) / self._order series_margin = width * self._series_margin...
Return the center of a bounding box defined by a box plot. Draws a box plot on self.svg.
def pkgPath(root, path, rpath="/"): """ Package up a path recursively """ global data_files if not os.path.exists(path): return files = [] for spath in os.listdir(path): # Ignore test directories if spath == 'test': continue subpath = os.path.j...
Package up a path recursively
def fit_labels_to_mask(label_image, mask): r""" Reduces a label images by overlaying it with a binary mask and assign the labels either to the mask or to the background. The resulting binary mask is the nearest expression the label image can form of the supplied binary mask. Parameters ----...
r""" Reduces a label images by overlaying it with a binary mask and assign the labels either to the mask or to the background. The resulting binary mask is the nearest expression the label image can form of the supplied binary mask. Parameters ---------- label_image : array_like A n...
def root_item_selected(self, item): """Root item has been selected: expanding it and collapsing others""" if self.show_all_files: return for root_item in self.get_top_level_items(): if root_item is item: self.expandItem(root_item) else: ...
Root item has been selected: expanding it and collapsing others
def _filter_modules(self, plugins, names): """ Internal helper method to parse all of the plugins and names through each of the module filters """ if self.module_plugin_filters: # check to make sure the number of plugins isn't changing original_length_plug...
Internal helper method to parse all of the plugins and names through each of the module filters
def _wait_and_except_if_failed(self, event, timeout=None): """Combines waiting for event and call to `_except_if_failed`. If timeout is not specified the configured sync_timeout is used. """ event.wait(timeout or self.__sync_timeout) self._except_if_failed(event)
Combines waiting for event and call to `_except_if_failed`. If timeout is not specified the configured sync_timeout is used.
def get_version(): """ Get the Windows OS version running on the machine. Params: None Returns: The Windows OS version running on the machine (comparables with the values list in the class). """ # Other OS check if not 'win' in sys.platform: return N...
Get the Windows OS version running on the machine. Params: None Returns: The Windows OS version running on the machine (comparables with the values list in the class).
def redraw(self, whence=0): """Redraw the canvas. Parameters ---------- whence See :meth:`get_rgb_object`. """ with self._defer_lock: whence = min(self._defer_whence, whence) if not self.defer_redraw: if self._hold_re...
Redraw the canvas. Parameters ---------- whence See :meth:`get_rgb_object`.
def set_mode_px4(self, mode, custom_mode, custom_sub_mode): '''enter arbitrary mode''' if isinstance(mode, str): mode_map = self.mode_mapping() if mode_map is None or mode not in mode_map: print("Unknown mode '%s'" % mode) return # PX4 ...
enter arbitrary mode
def updateStatus(self, dataset, is_dataset_valid): """ Used to toggle the status of a dataset is_dataset_valid=0/1 (invalid/valid) """ if( dataset == "" ): dbsExceptionHandler("dbsException-invalid-input", "DBSDataset/updateStatus. dataset is required.") conn = self...
Used to toggle the status of a dataset is_dataset_valid=0/1 (invalid/valid)
def Kdiag(self, X): """Compute the diagonal of the covariance matrix associated to X.""" vyt = self.variance_Yt vyx = self.variance_Yx lyt = 1./(2*self.lengthscale_Yt) lyx = 1./(2*self.lengthscale_Yx) a = self.a b = self.b c = self.c ## dk^2/dtd...
Compute the diagonal of the covariance matrix associated to X.
def collect(context=None, style=None, palette=None, **kwargs): """Returns the merged rcParams dict of the specified context, style, and palette. Parameters ---------- context: str style: str palette: str kwargs: - Returns ------- rcParams: dict The merged paramet...
Returns the merged rcParams dict of the specified context, style, and palette. Parameters ---------- context: str style: str palette: str kwargs: - Returns ------- rcParams: dict The merged parameter dicts of the specified context, style, and palette. Notes ...
def open_file(self, file_): """ Receives a file path has input and returns a string with the contents of the file """ with open(file_, 'r', encoding='utf-8') as file: text = '' for line in file: text += line return text
Receives a file path has input and returns a string with the contents of the file
def happens(intervals: Iterable[float], name: Optional[str] = None) -> Callable: """ Decorator used to set up a process that adds a new instance of another process at intervals dictated by the given sequence (which may be infinite). Example: the following program runs process named `my_process` 5 times...
Decorator used to set up a process that adds a new instance of another process at intervals dictated by the given sequence (which may be infinite). Example: the following program runs process named `my_process` 5 times, each time spaced by 2.0 time units. ``` from itertools import repeat sim = Si...
def last_archive(self): ''' Get the last available archive :return: ''' archives = {} for archive in self.archives(): archives[int(archive.split('.')[0].split('-')[-1])] = archive return archives and archives[max(archives)] or None
Get the last available archive :return:
def _make_image_to_vec_tito(feature_name, tmp_dir=None, checkpoint=None): """Creates a tensor-in-tensor-out function that produces embeddings from image bytes. Image to embedding is implemented with Tensorflow's inception v3 model and a pretrained checkpoint. It returns 1x2048 'PreLogits' embeddings for each ima...
Creates a tensor-in-tensor-out function that produces embeddings from image bytes. Image to embedding is implemented with Tensorflow's inception v3 model and a pretrained checkpoint. It returns 1x2048 'PreLogits' embeddings for each image. Args: feature_name: The name of the feature. Used only to identify t...
def get_hints(self, plugin): ''' Return plugin hints from ``plugin``. ''' hints = [] for hint_name in getattr(plugin, 'hints', []): hint_plugin = self._plugins.get(hint_name) if hint_plugin: hint_result = Result( name=hint_plugin.name,...
Return plugin hints from ``plugin``.
def _get_instance(self): """Retrieve instance matching instance_id.""" try: instance = self.compute_driver.ex_get_node( self.running_instance_id, zone=self.region ) except ResourceNotFoundError as e: raise GCECloudException( ...
Retrieve instance matching instance_id.
def intersection(self, other, ignore_conflicts=False): """Return a new definition from the intersection of the definitions.""" result = self.copy() result.intersection_update(other, ignore_conflicts) return result
Return a new definition from the intersection of the definitions.
def _assign_method(self, resource_class, method_type): """ Exactly the same code as the original except: - uid is now first parameter (after self). Therefore, no need to explicitly call 'uid=' - Ignored the other http methods besides GET (as they are not needed for the pokeapi.co API) ...
Exactly the same code as the original except: - uid is now first parameter (after self). Therefore, no need to explicitly call 'uid=' - Ignored the other http methods besides GET (as they are not needed for the pokeapi.co API) - Added cache wrapping function - Added a way to list all get...
def clean_metric_name(self, metric_name): """ Make sure the metric is free of control chars, spaces, tabs, etc. """ if not self._clean_metric_name: return metric_name metric_name = str(metric_name) for _from, _to in self.cleaning_replacement_list: ...
Make sure the metric is free of control chars, spaces, tabs, etc.
def pm(client, event, channel, nick, rest): 'Arggh matey' if rest: rest = rest.strip() Karma.store.change(rest, 2) rcpt = rest else: rcpt = channel if random.random() > 0.95: return f"Arrggh ye be doin' great, grand work, {rcpt}!" return f"Arrggh ye be doin' ...
Arggh matey
def from_description(cls, description, attrs): """ Create an object from a dynamo3 response """ hash_key = None range_key = None index_type = description["Projection"]["ProjectionType"] includes = description["Projection"].get("NonKeyAttributes") for data in description["...
Create an object from a dynamo3 response
def facts(self): """Iterate over the asserted Facts.""" fact = lib.EnvGetNextFact(self._env, ffi.NULL) while fact != ffi.NULL: yield new_fact(self._env, fact) fact = lib.EnvGetNextFact(self._env, fact)
Iterate over the asserted Facts.
def create_base_logger(config=None, parallel=None): """Setup base logging configuration, also handling remote logging. Correctly sets up for local, multiprocessing and distributed runs. Creates subscribers for non-local runs that will be references from local logging. Retrieves IP address using ti...
Setup base logging configuration, also handling remote logging. Correctly sets up for local, multiprocessing and distributed runs. Creates subscribers for non-local runs that will be references from local logging. Retrieves IP address using tips from http://stackoverflow.com/a/1267524/252589
def pre_serialize(self, raw, pkt, i): ''' Set length of the header based on ''' self.length = len(raw) + OpenflowHeader._MINLEN
Set length of the header based on