code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def increment(version): """Return an incremented version string.""" release_version = os.environ.get("RELEASE_VERSION", None) if release_version is not None: return release_version if isinstance(version, LegacyVersion): msg = """{0} is considered a legacy version ...
Return an incremented version string.
Below is the the instruction that describes the task: ### Input: Return an incremented version string. ### Response: def increment(version): """Return an incremented version string.""" release_version = os.environ.get("RELEASE_VERSION", None) if release_version is not None: retu...
def convert_batchnorm(node, **kwargs): """Map MXNet's BatchNorm operator attributes to onnx's BatchNormalization operator and return the created node. """ name, input_nodes, attrs = get_inputs(node, kwargs) momentum = float(attrs.get("momentum", 0.9)) eps = float(attrs.get("eps", 0.001)) b...
Map MXNet's BatchNorm operator attributes to onnx's BatchNormalization operator and return the created node.
Below is the the instruction that describes the task: ### Input: Map MXNet's BatchNorm operator attributes to onnx's BatchNormalization operator and return the created node. ### Response: def convert_batchnorm(node, **kwargs): """Map MXNet's BatchNorm operator attributes to onnx's BatchNormalization operat...
def discover_all_plugins(self): """ Load all plugins from dgit extension """ for v in pkg_resources.iter_entry_points('dgit.plugins'): m = v.load() m.setup(self)
Load all plugins from dgit extension
Below is the the instruction that describes the task: ### Input: Load all plugins from dgit extension ### Response: def discover_all_plugins(self): """ Load all plugins from dgit extension """ for v in pkg_resources.iter_entry_points('dgit.plugins'): m = v.load() ...
def align_unaligned_seqs(seqs, moltype=DNA, params=None): """Returns an Alignment object from seqs. seqs: SequenceCollection object, or data that can be used to build one. moltype: a MolType object. DNA, RNA, or PROTEIN. params: dict of parameters to pass in to the Muscle app controller. Result...
Returns an Alignment object from seqs. seqs: SequenceCollection object, or data that can be used to build one. moltype: a MolType object. DNA, RNA, or PROTEIN. params: dict of parameters to pass in to the Muscle app controller. Result will be an Alignment object.
Below is the the instruction that describes the task: ### Input: Returns an Alignment object from seqs. seqs: SequenceCollection object, or data that can be used to build one. moltype: a MolType object. DNA, RNA, or PROTEIN. params: dict of parameters to pass in to the Muscle app controller. Re...
def dilated_attention_1d(x, hparams, attention_type="masked_dilated_1d", q_padding="VALID", kv_padding="VALID", gap_size=2): """Dilated 1d self attention.""" # self-attention x, x_shape, is...
Dilated 1d self attention.
Below is the the instruction that describes the task: ### Input: Dilated 1d self attention. ### Response: def dilated_attention_1d(x, hparams, attention_type="masked_dilated_1d", q_padding="VALID", kv_padding="VALID...
def hasDependencyRecursively(self, name, target=None, test_dependencies=False): ''' Check if this module, or any of its dependencies, have a dependencies with the specified name in their dependencies, or in their targetDependencies corresponding to the specified target. Note...
Check if this module, or any of its dependencies, have a dependencies with the specified name in their dependencies, or in their targetDependencies corresponding to the specified target. Note that if recursive dependencies are not installed, this test may return a false-...
Below is the the instruction that describes the task: ### Input: Check if this module, or any of its dependencies, have a dependencies with the specified name in their dependencies, or in their targetDependencies corresponding to the specified target. Note that if recursive depe...
def raw_conf_process_pyramid(raw_conf): """ Loads the process pyramid of a raw configuration. Parameters ---------- raw_conf : dict Raw mapchete configuration as dictionary. Returns ------- BufferedTilePyramid """ return BufferedTilePyramid( raw_conf["pyramid"][...
Loads the process pyramid of a raw configuration. Parameters ---------- raw_conf : dict Raw mapchete configuration as dictionary. Returns ------- BufferedTilePyramid
Below is the the instruction that describes the task: ### Input: Loads the process pyramid of a raw configuration. Parameters ---------- raw_conf : dict Raw mapchete configuration as dictionary. Returns ------- BufferedTilePyramid ### Response: def raw_conf_process_pyramid(raw_con...
def tag(collector, image, artifact, **kwargs): """Tag an image!""" if artifact in (None, "", NotSpecified): raise BadOption("Please specify a tag using the artifact option") if image.image_index in (None, "", NotSpecified): raise BadOption("Please specify an image with an image_index option...
Tag an image!
Below is the the instruction that describes the task: ### Input: Tag an image! ### Response: def tag(collector, image, artifact, **kwargs): """Tag an image!""" if artifact in (None, "", NotSpecified): raise BadOption("Please specify a tag using the artifact option") if image.image_index in (No...
def get(self, name, default=None): """Return the value of the requested parameter or `default` if None.""" value = self.parameters.get(name) self._processed_parameters.append(name) if value is None: return default return value
Return the value of the requested parameter or `default` if None.
Below is the the instruction that describes the task: ### Input: Return the value of the requested parameter or `default` if None. ### Response: def get(self, name, default=None): """Return the value of the requested parameter or `default` if None.""" value = self.parameters.get(name) self....
def _zeropad(sig, N, axis=0): """pads with N zeros at the end of the signal, along given axis""" # ensures concatenation dimension is the first sig = np.moveaxis(sig, axis, 0) # zero pad out = np.zeros((sig.shape[0] + N,) + sig.shape[1:]) out[:sig.shape[0], ...] = sig # put back axis in plac...
pads with N zeros at the end of the signal, along given axis
Below is the the instruction that describes the task: ### Input: pads with N zeros at the end of the signal, along given axis ### Response: def _zeropad(sig, N, axis=0): """pads with N zeros at the end of the signal, along given axis""" # ensures concatenation dimension is the first sig = np.moveaxis(s...
def instantiate(repo, validator_name=None, filename=None, rulesfiles=None): """ Instantiate the validation specification """ default_validators = repo.options.get('validator', {}) validators = {} if validator_name is not None: # Handle the case validator is specified.. if valid...
Instantiate the validation specification
Below is the the instruction that describes the task: ### Input: Instantiate the validation specification ### Response: def instantiate(repo, validator_name=None, filename=None, rulesfiles=None): """ Instantiate the validation specification """ default_validators = repo.options.get('validator', {}...
def erosion(mapfile, dilated): """ We will continue to work with the modified Mapfile If we wanted to start from scratch we could simply reread it """ ll = mappyfile.find(mapfile["layers"], "name", "line") ll["status"] = "OFF" pl = mappyfile.find(mapfile["layers"], "name", "polygon") #...
We will continue to work with the modified Mapfile If we wanted to start from scratch we could simply reread it
Below is the the instruction that describes the task: ### Input: We will continue to work with the modified Mapfile If we wanted to start from scratch we could simply reread it ### Response: def erosion(mapfile, dilated): """ We will continue to work with the modified Mapfile If we wanted to start ...
def set_emission_scenario_setup(self, scenario, config_dict): """Set the emissions flags correctly. Parameters ---------- scenario : :obj:`pymagicc.io.MAGICCData` Scenario to run. config_dict : dict Dictionary with current input configurations which is t...
Set the emissions flags correctly. Parameters ---------- scenario : :obj:`pymagicc.io.MAGICCData` Scenario to run. config_dict : dict Dictionary with current input configurations which is to be validated and updated where necessary. Returns ...
Below is the the instruction that describes the task: ### Input: Set the emissions flags correctly. Parameters ---------- scenario : :obj:`pymagicc.io.MAGICCData` Scenario to run. config_dict : dict Dictionary with current input configurations which is to be...
def _make_child_iterator(node, with_links, current_depth=0): """Returns an iterator over a node's children. In case of using a trajectory as a run (setting 'v_crun') some sub branches that do not belong to the run are blinded out. """ cdp1 = current_depth + 1 if with_li...
Returns an iterator over a node's children. In case of using a trajectory as a run (setting 'v_crun') some sub branches that do not belong to the run are blinded out.
Below is the the instruction that describes the task: ### Input: Returns an iterator over a node's children. In case of using a trajectory as a run (setting 'v_crun') some sub branches that do not belong to the run are blinded out. ### Response: def _make_child_iterator(node, with_links, current_d...
def date_to_um_date(date): """ Convert a date object to 'year, month, day, hour, minute, second.' """ assert date.hour == 0 and date.minute == 0 and date.second == 0 return [date.year, date.month, date.day, 0, 0, 0]
Convert a date object to 'year, month, day, hour, minute, second.'
Below is the the instruction that describes the task: ### Input: Convert a date object to 'year, month, day, hour, minute, second.' ### Response: def date_to_um_date(date): """ Convert a date object to 'year, month, day, hour, minute, second.' """ assert date.hour == 0 and date.minute == 0 and dat...
def _shift2boolean(self, q_mesh_shift, is_gamma_center=False, tolerance=1e-5): """ Tolerance is used to judge zero/half gird shift. This value is not necessary to be changed usually. """ if q_mesh_shift is None:...
Tolerance is used to judge zero/half gird shift. This value is not necessary to be changed usually.
Below is the the instruction that describes the task: ### Input: Tolerance is used to judge zero/half gird shift. This value is not necessary to be changed usually. ### Response: def _shift2boolean(self, q_mesh_shift, is_gamma_center=False, ...
def next(self): """Returns the next input from this input reader, a record. Returns: The next input from this input reader in the form of a record read from an LevelDB file. Raises: StopIteration: The ordered set records has been exhausted. """ while True: if not hasattr(se...
Returns the next input from this input reader, a record. Returns: The next input from this input reader in the form of a record read from an LevelDB file. Raises: StopIteration: The ordered set records has been exhausted.
Below is the the instruction that describes the task: ### Input: Returns the next input from this input reader, a record. Returns: The next input from this input reader in the form of a record read from an LevelDB file. Raises: StopIteration: The ordered set records has been exhausted. #...
def rpoplpush(self, src, dst): """ RPOP a value off of the ``src`` list and atomically LPUSH it on to the ``dst`` list. Returns the value. """ with self.pipe as pipe: f = Future() res = pipe.rpoplpush(self.redis_key(src), self.redis_key(dst)) ...
RPOP a value off of the ``src`` list and atomically LPUSH it on to the ``dst`` list. Returns the value.
Below is the the instruction that describes the task: ### Input: RPOP a value off of the ``src`` list and atomically LPUSH it on to the ``dst`` list. Returns the value. ### Response: def rpoplpush(self, src, dst): """ RPOP a value off of the ``src`` list and atomically LPUSH it on ...
def load_srm(filename): """Load a Project from an ``.srm`` file. :param filename: the name of the file from which to load :rtype: :py:class:`pylsdj.Project` """ # .srm files are just decompressed projects without headers # In order to determine the file's size in compressed blocks, we have to...
Load a Project from an ``.srm`` file. :param filename: the name of the file from which to load :rtype: :py:class:`pylsdj.Project`
Below is the the instruction that describes the task: ### Input: Load a Project from an ``.srm`` file. :param filename: the name of the file from which to load :rtype: :py:class:`pylsdj.Project` ### Response: def load_srm(filename): """Load a Project from an ``.srm`` file. :param filename: the na...
def equiv(self, other): """Return True if other is an equivalent weighting. Returns ------- equivalent : bool ``True`` if ``other`` is a `Weighting` instance with the same `Weighting.impl`, which yields the same result as this weighting for any input,...
Return True if other is an equivalent weighting. Returns ------- equivalent : bool ``True`` if ``other`` is a `Weighting` instance with the same `Weighting.impl`, which yields the same result as this weighting for any input, ``False`` otherwise. This is check...
Below is the the instruction that describes the task: ### Input: Return True if other is an equivalent weighting. Returns ------- equivalent : bool ``True`` if ``other`` is a `Weighting` instance with the same `Weighting.impl`, which yields the same result as this ...
def __value_compare(self, target): """ Comparing result based on expectation if arg_type is "VALUE" Args: Anything Return: Boolean """ if self.expectation == "__ANY__": return True elif self.expectation == "__DEFINED__": return True if targ...
Comparing result based on expectation if arg_type is "VALUE" Args: Anything Return: Boolean
Below is the the instruction that describes the task: ### Input: Comparing result based on expectation if arg_type is "VALUE" Args: Anything Return: Boolean ### Response: def __value_compare(self, target): """ Comparing result based on expectation if arg_type is "VALUE" Args...
def is_active(self): """Determines whether this plugin is active. This plugin is active if any health pills information is present for any run. Returns: A boolean. Whether this plugin is active. """ return bool( self._grpc_port is not None and self._event_multiplexer and ...
Determines whether this plugin is active. This plugin is active if any health pills information is present for any run. Returns: A boolean. Whether this plugin is active.
Below is the the instruction that describes the task: ### Input: Determines whether this plugin is active. This plugin is active if any health pills information is present for any run. Returns: A boolean. Whether this plugin is active. ### Response: def is_active(self): """Determines whethe...
def writexlsx(self, path, sheetname="default"): """ Writes this table to an .xlsx file at the specified path. If you'd like to specify a sheetname, you may do so. If you'd like to write one workbook with different DataTables for each sheet, import the `excel` function from acry...
Writes this table to an .xlsx file at the specified path. If you'd like to specify a sheetname, you may do so. If you'd like to write one workbook with different DataTables for each sheet, import the `excel` function from acrylic. You can see that code in `utils.py`. Note that...
Below is the the instruction that describes the task: ### Input: Writes this table to an .xlsx file at the specified path. If you'd like to specify a sheetname, you may do so. If you'd like to write one workbook with different DataTables for each sheet, import the `excel` function from acr...
def process_bind_param(self, value, dialect): """ Returns the integer value of the usage mask bitmask. This value is stored in the database. Args: value(list<enums.CryptographicUsageMask>): list of enums in the usage mask dialect(string): SQL dialect ...
Returns the integer value of the usage mask bitmask. This value is stored in the database. Args: value(list<enums.CryptographicUsageMask>): list of enums in the usage mask dialect(string): SQL dialect
Below is the the instruction that describes the task: ### Input: Returns the integer value of the usage mask bitmask. This value is stored in the database. Args: value(list<enums.CryptographicUsageMask>): list of enums in the usage mask dialect(string): SQL diale...
def list_packages(conn=None): ''' List files for an installed package ''' close = False if conn is None: close = True conn = init() ret = [] data = conn.execute('SELECT package FROM packages') for pkg in data.fetchall(): ret.append(pkg) if close: con...
List files for an installed package
Below is the the instruction that describes the task: ### Input: List files for an installed package ### Response: def list_packages(conn=None): ''' List files for an installed package ''' close = False if conn is None: close = True conn = init() ret = [] data = conn.ex...
def _ReadPartial(self, length): """Read as much as possible, but not more than length.""" chunk = self.offset // self.chunksize chunk_offset = self.offset % self.chunksize # If we're past the end of the file, we don't have a chunk to read from, so # we can't read anymore. We return the empty string...
Read as much as possible, but not more than length.
Below is the the instruction that describes the task: ### Input: Read as much as possible, but not more than length. ### Response: def _ReadPartial(self, length): """Read as much as possible, but not more than length.""" chunk = self.offset // self.chunksize chunk_offset = self.offset % self.chunksize ...
def store_atomic(self, value, ptr, ordering, align): """ Store value to pointer, with optional guaranteed alignment: *ptr = name """ if not isinstance(ptr.type, types.PointerType): raise TypeError("cannot store to value of type %s (%r): not a pointer" ...
Store value to pointer, with optional guaranteed alignment: *ptr = name
Below is the the instruction that describes the task: ### Input: Store value to pointer, with optional guaranteed alignment: *ptr = name ### Response: def store_atomic(self, value, ptr, ordering, align): """ Store value to pointer, with optional guaranteed alignment: *ptr = ...
async def verify_credentials(self): """Verify credentials with device.""" _, public_key = self.srp.initialize() msg = messages.crypto_pairing({ tlv8.TLV_SEQ_NO: b'\x01', tlv8.TLV_PUBLIC_KEY: public_key}) resp = await self.protocol.send_and_receive( ms...
Verify credentials with device.
Below is the the instruction that describes the task: ### Input: Verify credentials with device. ### Response: async def verify_credentials(self): """Verify credentials with device.""" _, public_key = self.srp.initialize() msg = messages.crypto_pairing({ tlv8.TLV_SEQ_NO: b'\x01...
def normalize_range(e, n): """ Return the range tuple normalized for an ``n``-element object. The semantics of a range is slightly different than that of a slice. In particular, a range is similar to a list in meaning (and on Py2 it was eagerly expanded into a list). Thus we do not allow the range...
Return the range tuple normalized for an ``n``-element object. The semantics of a range is slightly different than that of a slice. In particular, a range is similar to a list in meaning (and on Py2 it was eagerly expanded into a list). Thus we do not allow the range to generate indices that would be ...
Below is the the instruction that describes the task: ### Input: Return the range tuple normalized for an ``n``-element object. The semantics of a range is slightly different than that of a slice. In particular, a range is similar to a list in meaning (and on Py2 it was eagerly expanded into a list). ...
def _control_longitude(self): ''' Control on longitude values ''' if self.lonm < 0.0: self.lonm = 360.0 + self.lonm if self.lonM < 0.0: self.lonM = 360.0 + self.lonM if self.lonm > 360.0: self.lonm = self.lonm - 360.0 if self.lonM > 360.0: ...
Control on longitude values
Below is the the instruction that describes the task: ### Input: Control on longitude values ### Response: def _control_longitude(self): ''' Control on longitude values ''' if self.lonm < 0.0: self.lonm = 360.0 + self.lonm if self.lonM < 0.0: self.lonM = 360.0 + sel...
def cylinder(radius=1.0, height=1.0, sections=32, segment=None, transform=None, **kwargs): """ Create a mesh of a cylinder along Z centered at the origin. Parameters ---------- radius : float The radius of the cylinder heigh...
Create a mesh of a cylinder along Z centered at the origin. Parameters ---------- radius : float The radius of the cylinder height : float The height of the cylinder sections : int How many pie wedges should the cylinder have segment : (2, 3) float Endpoints of axis, ove...
Below is the the instruction that describes the task: ### Input: Create a mesh of a cylinder along Z centered at the origin. Parameters ---------- radius : float The radius of the cylinder height : float The height of the cylinder sections : int How many pie wedges should the ...
def map_element(self, obj, name, event): """ Handles mapping elements to diagram components """ canvas = self.diagram.diagram_canvas parser = XDotParser() for element in event.added: logger.debug("Mapping new element [%s] to diagram node" % element) for node_map...
Handles mapping elements to diagram components
Below is the the instruction that describes the task: ### Input: Handles mapping elements to diagram components ### Response: def map_element(self, obj, name, event): """ Handles mapping elements to diagram components """ canvas = self.diagram.diagram_canvas parser = XDotParser() ...
def _process_glsl_template(template, colors): """Replace $color_i by color #i in the GLSL template.""" for i in range(len(colors) - 1, -1, -1): color = colors[i] assert len(color) == 4 vec4_color = 'vec4(%.3f, %.3f, %.3f, %.3f)' % tuple(color) template = template.replace('$color_...
Replace $color_i by color #i in the GLSL template.
Below is the the instruction that describes the task: ### Input: Replace $color_i by color #i in the GLSL template. ### Response: def _process_glsl_template(template, colors): """Replace $color_i by color #i in the GLSL template.""" for i in range(len(colors) - 1, -1, -1): color = colors[i] ...
def _bumpUpWeakColumns(self): """ This method increases the permanence values of synapses of columns whose activity level has been too low. Such columns are identified by having an overlap duty cycle that drops too much below those of their peers. The permanence values for such columns are increased...
This method increases the permanence values of synapses of columns whose activity level has been too low. Such columns are identified by having an overlap duty cycle that drops too much below those of their peers. The permanence values for such columns are increased.
Below is the the instruction that describes the task: ### Input: This method increases the permanence values of synapses of columns whose activity level has been too low. Such columns are identified by having an overlap duty cycle that drops too much below those of their peers. The permanence values for...
def set_state(key, value, namespace=None, table_name=None, environment=None, layer=None, stage=None, shard_id=None, consistent=True, serializer=json.dumps, wait_exponential_multiplier=500, wait_exponential_max=5000, stop_max_delay=10000, ttl=None): """Set Lambda state value...
Set Lambda state value.
Below is the the instruction that describes the task: ### Input: Set Lambda state value. ### Response: def set_state(key, value, namespace=None, table_name=None, environment=None, layer=None, stage=None, shard_id=None, consistent=True, serializer=json.dumps, wait_exponential_multiplier=...
def add_instance(self, inst, index=None): """ Adds the specified instance to the dataset. :param inst: the Instance to add :type inst: Instance :param index: the 0-based index where to add the Instance :type index: int """ if index is None: se...
Adds the specified instance to the dataset. :param inst: the Instance to add :type inst: Instance :param index: the 0-based index where to add the Instance :type index: int
Below is the the instruction that describes the task: ### Input: Adds the specified instance to the dataset. :param inst: the Instance to add :type inst: Instance :param index: the 0-based index where to add the Instance :type index: int ### Response: def add_instance(self, inst, i...
def add_mixl_specific_results_to_estimation_res(estimator, results_dict): """ Stores particular items in the results dictionary that are unique to mixed logit-type models. In particular, this function calculates and adds `sequence_probs` and `expanded_sequence_probs` to the results dictionary. The `...
Stores particular items in the results dictionary that are unique to mixed logit-type models. In particular, this function calculates and adds `sequence_probs` and `expanded_sequence_probs` to the results dictionary. The `constrained_pos` object is also stored to the results_dict. Parameters ------...
Below is the the instruction that describes the task: ### Input: Stores particular items in the results dictionary that are unique to mixed logit-type models. In particular, this function calculates and adds `sequence_probs` and `expanded_sequence_probs` to the results dictionary. The `constrained_pos` ...
def measure_all(fbasename=None, log=None, ml_version=ml_version): """Measures mesh geometry, aabb and topology.""" ml_script1_file = 'TEMP3D_measure_gAndT.mlx' if ml_version == '1.3.4BETA': file_out = 'TEMP3D_aabb.xyz' else: file_out = None ml_script1 = mlx.FilterScript(file_in=fbas...
Measures mesh geometry, aabb and topology.
Below is the the instruction that describes the task: ### Input: Measures mesh geometry, aabb and topology. ### Response: def measure_all(fbasename=None, log=None, ml_version=ml_version): """Measures mesh geometry, aabb and topology.""" ml_script1_file = 'TEMP3D_measure_gAndT.mlx' if ml_version == '1.3...
def get_fqhostname(): ''' Returns the fully qualified hostname ''' # try getaddrinfo() fqdn = None try: addrinfo = socket.getaddrinfo( socket.gethostname(), 0, socket.AF_UNSPEC, socket.SOCK_STREAM, socket.SOL_TCP, socket.AI_CANONNAME ) for info in ...
Returns the fully qualified hostname
Below is the the instruction that describes the task: ### Input: Returns the fully qualified hostname ### Response: def get_fqhostname(): ''' Returns the fully qualified hostname ''' # try getaddrinfo() fqdn = None try: addrinfo = socket.getaddrinfo( socket.gethostname()...
def delete_events( self, project_name, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Deletes all error events of a given project. Example: >>> from google.cloud import...
Deletes all error events of a given project. Example: >>> from google.cloud import errorreporting_v1beta1 >>> >>> client = errorreporting_v1beta1.ErrorStatsServiceClient() >>> >>> project_name = client.project_path('[PROJECT]') >>> ...
Below is the the instruction that describes the task: ### Input: Deletes all error events of a given project. Example: >>> from google.cloud import errorreporting_v1beta1 >>> >>> client = errorreporting_v1beta1.ErrorStatsServiceClient() >>> >>> pr...
def size_of_varint(value): """ Number of bytes needed to encode an integer in variable-length format. """ value = (value << 1) ^ (value >> 63) if value <= 0x7f: return 1 if value <= 0x3fff: return 2 if value <= 0x1fffff: return 3 if value <= 0xfffffff: return ...
Number of bytes needed to encode an integer in variable-length format.
Below is the the instruction that describes the task: ### Input: Number of bytes needed to encode an integer in variable-length format. ### Response: def size_of_varint(value): """ Number of bytes needed to encode an integer in variable-length format. """ value = (value << 1) ^ (value >> 63) if val...
def next_chunk(self): """ Returns the chunk immediately following (and adjacent to) this one. """ raise NotImplementedError("%s not implemented for %s" % (self.next_chunk.__func__.__name__, self.__class__.__name__))
Returns the chunk immediately following (and adjacent to) this one.
Below is the the instruction that describes the task: ### Input: Returns the chunk immediately following (and adjacent to) this one. ### Response: def next_chunk(self): """ Returns the chunk immediately following (and adjacent to) this one. """ raise NotImplementedError("%s not impl...
def get_cell_length(flow_model): """Get flow direction induced cell length dict. Args: flow_model: Currently, "TauDEM", "ArcGIS", and "Whitebox" are supported. """ assert flow_model.lower() in FlowModelConst.d8_lens return FlowModelConst.d8_lens.get(flow_model.lower()...
Get flow direction induced cell length dict. Args: flow_model: Currently, "TauDEM", "ArcGIS", and "Whitebox" are supported.
Below is the the instruction that describes the task: ### Input: Get flow direction induced cell length dict. Args: flow_model: Currently, "TauDEM", "ArcGIS", and "Whitebox" are supported. ### Response: def get_cell_length(flow_model): """Get flow direction induced cell length dict. ...
def turbulent_Nunner(Re, Pr, fd, fd_smooth): r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{RePr(f/8)}{1 + 1.5Re^{-1/8}Pr^{-1/6}[Pr(f/f_s)-1]} Parameters ---------- Re : float Reynolds numbe...
r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{RePr(f/8)}{1 + 1.5Re^{-1/8}Pr^{-1/6}[Pr(f/f_s)-1]} Parameters ---------- Re : float Reynolds number, [-] Pr : float Prandtl number, [-]...
Below is the the instruction that describes the task: ### Input: r'''Calculates internal convection Nusselt number for turbulent flows in pipe according to [2]_ as shown in [1]_. .. math:: Nu = \frac{RePr(f/8)}{1 + 1.5Re^{-1/8}Pr^{-1/6}[Pr(f/f_s)-1]} Parameters ---------- Re : float ...
def match_config(filters, device, kind, default): """ Matches devices against multiple :class:`DeviceFilter`s. :param list filters: device filters :param Device device: device to be mounted :param str kind: value kind :param default: default value :returns: value of the first matching filte...
Matches devices against multiple :class:`DeviceFilter`s. :param list filters: device filters :param Device device: device to be mounted :param str kind: value kind :param default: default value :returns: value of the first matching filter
Below is the the instruction that describes the task: ### Input: Matches devices against multiple :class:`DeviceFilter`s. :param list filters: device filters :param Device device: device to be mounted :param str kind: value kind :param default: default value :returns: value of the first matchin...
def set_lic_text(self, doc, text): """Sets license extracted text. Raises SPDXValueError if text is not free form text. Raises OrderError if no license ID defined. """ if self.has_extr_lic(doc): if not self.extr_text_set: self.extr_text_set = True ...
Sets license extracted text. Raises SPDXValueError if text is not free form text. Raises OrderError if no license ID defined.
Below is the the instruction that describes the task: ### Input: Sets license extracted text. Raises SPDXValueError if text is not free form text. Raises OrderError if no license ID defined. ### Response: def set_lic_text(self, doc, text): """Sets license extracted text. Raises SPDX...
def show_inputs(client, workflow): """Show workflow inputs and exit.""" for input_ in workflow.inputs: click.echo( '{id}: {default}'.format( id=input_.id, default=_format_default(client, input_.default), ) ) sys.exit(0)
Show workflow inputs and exit.
Below is the the instruction that describes the task: ### Input: Show workflow inputs and exit. ### Response: def show_inputs(client, workflow): """Show workflow inputs and exit.""" for input_ in workflow.inputs: click.echo( '{id}: {default}'.format( id=input_.id, ...
def get_folder_contents_iter(self, uri): """Return iterator for directory contents. uri -- mediafire URI Example: for item in get_folder_contents_iter('mf:///Documents'): print(item) """ resource = self.get_resource_by_uri(uri) if not isins...
Return iterator for directory contents. uri -- mediafire URI Example: for item in get_folder_contents_iter('mf:///Documents'): print(item)
Below is the the instruction that describes the task: ### Input: Return iterator for directory contents. uri -- mediafire URI Example: for item in get_folder_contents_iter('mf:///Documents'): print(item) ### Response: def get_folder_contents_iter(self, uri): "...
async def create_collection(db, model_class: MongoCollectionMixin): ''' Creates a MongoDB collection and all the declared indices in the model's ``Meta`` class :param db: A database handle :type db: motor.motor_asyncio.AsyncIOMotorClient :param model_class: The model to cre...
Creates a MongoDB collection and all the declared indices in the model's ``Meta`` class :param db: A database handle :type db: motor.motor_asyncio.AsyncIOMotorClient :param model_class: The model to create :type model_class: Subclass of ``Model`` mixed with ``MongoColle...
Below is the the instruction that describes the task: ### Input: Creates a MongoDB collection and all the declared indices in the model's ``Meta`` class :param db: A database handle :type db: motor.motor_asyncio.AsyncIOMotorClient :param model_class: The model to create :ty...
def remove_sister(self, sister=None): """ Removes a sister node. It has the same effect as **`TreeNode.up.remove_child(sister)`** If a sister node is not supplied, the first sister will be deleted and returned. :argument sister: A node instance :return: The nod...
Removes a sister node. It has the same effect as **`TreeNode.up.remove_child(sister)`** If a sister node is not supplied, the first sister will be deleted and returned. :argument sister: A node instance :return: The node removed
Below is the the instruction that describes the task: ### Input: Removes a sister node. It has the same effect as **`TreeNode.up.remove_child(sister)`** If a sister node is not supplied, the first sister will be deleted and returned. :argument sister: A node instance :retu...
def get_study_items(self): """Get all study items (e.g., geneids).""" study_items = set() for rec in self.goea_results: study_items |= rec.study_items return study_items
Get all study items (e.g., geneids).
Below is the the instruction that describes the task: ### Input: Get all study items (e.g., geneids). ### Response: def get_study_items(self): """Get all study items (e.g., geneids).""" study_items = set() for rec in self.goea_results: study_items |= rec.study_items retu...
def _save_message(self, stack, type_, message, context=None, from_merge=False): 'Stores a message in the appropriate message stack.' uid = uuid.uuid4().hex message['uid'] = uid # Get the context for the message (if there's a context available) if context i...
Stores a message in the appropriate message stack.
Below is the the instruction that describes the task: ### Input: Stores a message in the appropriate message stack. ### Response: def _save_message(self, stack, type_, message, context=None, from_merge=False): 'Stores a message in the appropriate message stack.' uid = uuid.uu...
async def receive_events(self, request: HttpRequest): """ Events received from Facebook """ body = await request.read() s = self.settings() try: content = ujson.loads(body) except ValueError: return json_response({ 'error'...
Events received from Facebook
Below is the the instruction that describes the task: ### Input: Events received from Facebook ### Response: async def receive_events(self, request: HttpRequest): """ Events received from Facebook """ body = await request.read() s = self.settings() try: ...
def param(name, help=""): """Decorator that add a parameter to the wrapped command or function.""" def decorator(func): params = getattr(func, "params", []) _param = Param(name, help) # Insert at the beginning so the apparent order is preserved params.insert(0, _param) fu...
Decorator that add a parameter to the wrapped command or function.
Below is the the instruction that describes the task: ### Input: Decorator that add a parameter to the wrapped command or function. ### Response: def param(name, help=""): """Decorator that add a parameter to the wrapped command or function.""" def decorator(func): params = getattr(func, "params", ...
def assemble_tlg_author_filepaths(): """Reads TLG index and builds a list of absolute filepaths.""" plaintext_dir_rel = '~/cltk_data/greek/text/tlg/plaintext/' plaintext_dir = os.path.expanduser(plaintext_dir_rel) filepaths = [os.path.join(plaintext_dir, x + '.TXT') for x in TLG_INDEX] return filepa...
Reads TLG index and builds a list of absolute filepaths.
Below is the the instruction that describes the task: ### Input: Reads TLG index and builds a list of absolute filepaths. ### Response: def assemble_tlg_author_filepaths(): """Reads TLG index and builds a list of absolute filepaths.""" plaintext_dir_rel = '~/cltk_data/greek/text/tlg/plaintext/' plainte...
def create_crop(self, name, file_obj, x=None, x2=None, y=None, y2=None): """ Generate Version for an Image. value has to be a serverpath relative to MEDIA_ROOT. Returns the spec for the crop that was created. """ if name not in self._registry: ...
Generate Version for an Image. value has to be a serverpath relative to MEDIA_ROOT. Returns the spec for the crop that was created.
Below is the the instruction that describes the task: ### Input: Generate Version for an Image. value has to be a serverpath relative to MEDIA_ROOT. Returns the spec for the crop that was created. ### Response: def create_crop(self, name, file_obj, x=None, x2=None, y=None, y2=N...
def _swap_bytes(data): """swaps bytes for 16 bit, leaves remaining trailing bytes alone""" a, b = data[1::2], data[::2] data = bytearray().join(bytearray(x) for x in zip(a, b)) if len(b) > len(a): data += b[-1:] return bytes(data)
swaps bytes for 16 bit, leaves remaining trailing bytes alone
Below is the the instruction that describes the task: ### Input: swaps bytes for 16 bit, leaves remaining trailing bytes alone ### Response: def _swap_bytes(data): """swaps bytes for 16 bit, leaves remaining trailing bytes alone""" a, b = data[1::2], data[::2] data = bytearray().join(bytearray(x) for ...
def walk(self, start, end): """ Walk from `start` node to `end` node. Returns: (upwards, common, downwards): `upwards` is a list of nodes to go upward to. `common` top node. `downwards` is a list of nodes to go downward to. Raises: WalkError: on no c...
Walk from `start` node to `end` node. Returns: (upwards, common, downwards): `upwards` is a list of nodes to go upward to. `common` top node. `downwards` is a list of nodes to go downward to. Raises: WalkError: on no common root node. >>> from anytree impor...
Below is the the instruction that describes the task: ### Input: Walk from `start` node to `end` node. Returns: (upwards, common, downwards): `upwards` is a list of nodes to go upward to. `common` top node. `downwards` is a list of nodes to go downward to. Raises: ...
def input(self, data): """Set the input text data.""" self.data = data self.lexer.input(data)
Set the input text data.
Below is the the instruction that describes the task: ### Input: Set the input text data. ### Response: def input(self, data): """Set the input text data.""" self.data = data self.lexer.input(data)
def subprocess_run(*popenargs, input=None, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes wil...
Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check i...
Below is the the instruction that describes the task: ### Input: Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass std...
def join_event_view(request, id): """Join event page. If a POST request, actually add or remove the attendance of the current user. Otherwise, display a page with confirmation. id: event id """ event = get_object_or_404(Event, id=id) if request.method == "POST": if not event.show_att...
Join event page. If a POST request, actually add or remove the attendance of the current user. Otherwise, display a page with confirmation. id: event id
Below is the the instruction that describes the task: ### Input: Join event page. If a POST request, actually add or remove the attendance of the current user. Otherwise, display a page with confirmation. id: event id ### Response: def join_event_view(request, id): """Join event page. If a POST reques...
def OnSelectReader(self, reader): """Called when a reader is selected by clicking on the reader tree control or toolbar.""" SimpleSCardAppEventObserver.OnSelectReader(self, reader) self.feedbacktext.SetLabel('Selected reader: ' + repr(reader)) self.transmitbutton.Disable()
Called when a reader is selected by clicking on the reader tree control or toolbar.
Below is the the instruction that describes the task: ### Input: Called when a reader is selected by clicking on the reader tree control or toolbar. ### Response: def OnSelectReader(self, reader): """Called when a reader is selected by clicking on the reader tree control or toolbar.""" ...
def fill_parameters(self, path, blocks, exclude_free_params=False, check_parameters=False): """ Load parameters from file to fill all blocks sequentially. :type blocks: list of deepy.layers.Block """ if not os.path.exists(path): raise Exception("model {} does not exis...
Load parameters from file to fill all blocks sequentially. :type blocks: list of deepy.layers.Block
Below is the the instruction that describes the task: ### Input: Load parameters from file to fill all blocks sequentially. :type blocks: list of deepy.layers.Block ### Response: def fill_parameters(self, path, blocks, exclude_free_params=False, check_parameters=False): """ Load parameters ...
def crc16(cmd, use_byte=False): """ CRC16 检验 - 启用``use_byte`` 则返回 bytes 类型. :param cmd: 无crc检验的指令 :type cmd: :param use_byte: 是否返回byte类型 :type use_byte: :return: 返回crc值 :rtype: """ crc = 0xFFFF # crc16 计算方法, 需要使用 byte if hasattr(cmd, 'encode'): cmd =...
CRC16 检验 - 启用``use_byte`` 则返回 bytes 类型. :param cmd: 无crc检验的指令 :type cmd: :param use_byte: 是否返回byte类型 :type use_byte: :return: 返回crc值 :rtype:
Below is the the instruction that describes the task: ### Input: CRC16 检验 - 启用``use_byte`` 则返回 bytes 类型. :param cmd: 无crc检验的指令 :type cmd: :param use_byte: 是否返回byte类型 :type use_byte: :return: 返回crc值 :rtype: ### Response: def crc16(cmd, use_byte=False): """ CRC16 检验 ...
def entities(self, entity_ids): '''Get the default data for entities. @param entity_ids A list of entity ids either as strings or references. ''' url = '%s/meta/any?include=id&' % self.url for entity_id in entity_ids: url += 'id=%s&' % _get_path(entity_id) # ...
Get the default data for entities. @param entity_ids A list of entity ids either as strings or references.
Below is the the instruction that describes the task: ### Input: Get the default data for entities. @param entity_ids A list of entity ids either as strings or references. ### Response: def entities(self, entity_ids): '''Get the default data for entities. @param entity_ids A list of entit...
def remove_dups(head): """ Time Complexity: O(N) Space Complexity: O(N) """ hashset = set() prev = Node() while head: if head.val in hashset: prev.next = head.next else: hashset.add(head.val) prev = head head = head.next
Time Complexity: O(N) Space Complexity: O(N)
Below is the the instruction that describes the task: ### Input: Time Complexity: O(N) Space Complexity: O(N) ### Response: def remove_dups(head): """ Time Complexity: O(N) Space Complexity: O(N) """ hashset = set() prev = Node() while head: if head.val in hashset: ...
def select(self, comp_name, options=None): """ Select the components that will by played (with given options). `options` will be passed to :func:`.Optionable.parse_options` if the component is a subclass of :class:`Optionable`. .. Warning:: this function also setup the options (if give...
Select the components that will by played (with given options). `options` will be passed to :func:`.Optionable.parse_options` if the component is a subclass of :class:`Optionable`. .. Warning:: this function also setup the options (if given) of the selected component. Use :func:`cl...
Below is the the instruction that describes the task: ### Input: Select the components that will by played (with given options). `options` will be passed to :func:`.Optionable.parse_options` if the component is a subclass of :class:`Optionable`. .. Warning:: this function also setup the op...
def to_javascript_(self, table_name: str="data") -> str: """Convert the main dataframe to javascript code :param table_name: javascript variable name, defaults to "data" :param table_name: str, optional :return: a javascript constant with the data :rtype: str :example: ...
Convert the main dataframe to javascript code :param table_name: javascript variable name, defaults to "data" :param table_name: str, optional :return: a javascript constant with the data :rtype: str :example: ``ds.to_javastript_("myconst")``
Below is the the instruction that describes the task: ### Input: Convert the main dataframe to javascript code :param table_name: javascript variable name, defaults to "data" :param table_name: str, optional :return: a javascript constant with the data :rtype: str :example:...
def rmtree (self, errors='warn'): """Recursively delete this directory and its contents. The *errors* keyword specifies how errors are handled: "warn" (the default) Print a warning to standard error. "ignore" Ignore errors. """ import shutil ...
Recursively delete this directory and its contents. The *errors* keyword specifies how errors are handled: "warn" (the default) Print a warning to standard error. "ignore" Ignore errors.
Below is the the instruction that describes the task: ### Input: Recursively delete this directory and its contents. The *errors* keyword specifies how errors are handled: "warn" (the default) Print a warning to standard error. "ignore" Ignore errors. ### Response: def ...
def _defer_to_worker(deliver, worker, work, *args, **kwargs): """ Run a task in a worker, delivering the result as a ``Deferred`` in the reactor thread. """ deferred = Deferred() def wrapped_work(): try: result = work(*args, **kwargs) except BaseException: ...
Run a task in a worker, delivering the result as a ``Deferred`` in the reactor thread.
Below is the the instruction that describes the task: ### Input: Run a task in a worker, delivering the result as a ``Deferred`` in the reactor thread. ### Response: def _defer_to_worker(deliver, worker, work, *args, **kwargs): """ Run a task in a worker, delivering the result as a ``Deferred`` in the ...
def ldap_server_host_use_vrf(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ldap_server = ET.SubElement(config, "ldap-server", xmlns="urn:brocade.com:mgmt:brocade-aaa") host = ET.SubElement(ldap_server, "host") hostname_key = ET.SubElement(host,...
Auto Generated Code
Below is the the instruction that describes the task: ### Input: Auto Generated Code ### Response: def ldap_server_host_use_vrf(self, **kwargs): """Auto Generated Code """ config = ET.Element("config") ldap_server = ET.SubElement(config, "ldap-server", xmlns="urn:brocade.com:mgmt:br...
def _is_sub_intrinsic(data): """ Is this input data a Fn::Sub intrinsic function Parameters ---------- data Data to check Returns ------- bool True if the data Fn::Sub intrinsic function """ return isinstance(data,...
Is this input data a Fn::Sub intrinsic function Parameters ---------- data Data to check Returns ------- bool True if the data Fn::Sub intrinsic function
Below is the the instruction that describes the task: ### Input: Is this input data a Fn::Sub intrinsic function Parameters ---------- data Data to check Returns ------- bool True if the data Fn::Sub intrinsic function ### Response: def _is_...
def parse_date_range_arguments(options: dict, default_range='last_month') -> (datetime, datetime, list): """ :param options: :param default_range: Default datetime range to return if no other selected :return: begin, end, [(begin1,end1), (begin2,end2), ...] """ begin, end = get_date_range_by_nam...
:param options: :param default_range: Default datetime range to return if no other selected :return: begin, end, [(begin1,end1), (begin2,end2), ...]
Below is the the instruction that describes the task: ### Input: :param options: :param default_range: Default datetime range to return if no other selected :return: begin, end, [(begin1,end1), (begin2,end2), ...] ### Response: def parse_date_range_arguments(options: dict, default_range='last_month') -> (d...
def decode_value(stream): """Decode the contents of a value from a serialized stream. :param stream: Source data stream :type stream: io.BytesIO :returns: Decoded value :rtype: bytes """ length = decode_length(stream) (value,) = unpack_value(">{:d}s".format(length), stream) return v...
Decode the contents of a value from a serialized stream. :param stream: Source data stream :type stream: io.BytesIO :returns: Decoded value :rtype: bytes
Below is the the instruction that describes the task: ### Input: Decode the contents of a value from a serialized stream. :param stream: Source data stream :type stream: io.BytesIO :returns: Decoded value :rtype: bytes ### Response: def decode_value(stream): """Decode the contents of a value f...
def posterior_covariance_between_points(self, X1, X2): """ Computes the posterior covariance between points. :param X1: some input observations :param X2: other input observations """ return self.posterior.covariance_between_points(self.kern, self.X, X1, X2)
Computes the posterior covariance between points. :param X1: some input observations :param X2: other input observations
Below is the the instruction that describes the task: ### Input: Computes the posterior covariance between points. :param X1: some input observations :param X2: other input observations ### Response: def posterior_covariance_between_points(self, X1, X2): """ Computes the posterior ...
def addView(self, viewType): """ Adds a new view of the inputed view type. :param viewType | <subclass of XView> :return <XView> || None """ if not viewType: return None view = viewType.createInstance(self, self.view...
Adds a new view of the inputed view type. :param viewType | <subclass of XView> :return <XView> || None
Below is the the instruction that describes the task: ### Input: Adds a new view of the inputed view type. :param viewType | <subclass of XView> :return <XView> || None ### Response: def addView(self, viewType): """ Adds a new view of the inputed view type...
def dump_hash_prefix_values(self): """Export all hash prefix values. Returns a list of known hash prefix values """ q = '''SELECT distinct value from hash_prefix''' output = [] with self.get_cursor() as dbc: dbc.execute(q) output = [bytes(r[0]) fo...
Export all hash prefix values. Returns a list of known hash prefix values
Below is the the instruction that describes the task: ### Input: Export all hash prefix values. Returns a list of known hash prefix values ### Response: def dump_hash_prefix_values(self): """Export all hash prefix values. Returns a list of known hash prefix values """ q = ...
def is_domain(value, **kwargs): """Indicate whether ``value`` is a valid domain. .. caution:: This validator does not verify that ``value`` **exists** as a domain. It merely verifies that its contents *might* exist as a domain. .. note:: This validator checks to validate that ``value``...
Indicate whether ``value`` is a valid domain. .. caution:: This validator does not verify that ``value`` **exists** as a domain. It merely verifies that its contents *might* exist as a domain. .. note:: This validator checks to validate that ``value`` resembles a valid domain name. I...
Below is the the instruction that describes the task: ### Input: Indicate whether ``value`` is a valid domain. .. caution:: This validator does not verify that ``value`` **exists** as a domain. It merely verifies that its contents *might* exist as a domain. .. note:: This validator che...
def pipe_to_process(self, payload): """Send something to stdin of a specific process.""" message = payload['input'] key = payload['key'] if not self.process_handler.is_running(key): return {'message': 'No running process for this key', 'status': 'error'} ...
Send something to stdin of a specific process.
Below is the the instruction that describes the task: ### Input: Send something to stdin of a specific process. ### Response: def pipe_to_process(self, payload): """Send something to stdin of a specific process.""" message = payload['input'] key = payload['key'] if not self.process_...
def search(self, q=None, has_geo=False, callback=None, errback=None): """ Search within a zone for specific metadata. Zone must already be loaded. """ if not self.data: raise ZoneException('zone not loaded') return self._rest.search(self.zone, q, has_geo, callback, e...
Search within a zone for specific metadata. Zone must already be loaded.
Below is the the instruction that describes the task: ### Input: Search within a zone for specific metadata. Zone must already be loaded. ### Response: def search(self, q=None, has_geo=False, callback=None, errback=None): """ Search within a zone for specific metadata. Zone must already be loaded. ...
def make_folium_polyline(edge, edge_color, edge_width, edge_opacity, popup_attribute=None): """ Turn a row from the gdf_edges GeoDataFrame into a folium PolyLine with attributes. Parameters ---------- edge : GeoSeries a row from the gdf_edges GeoDataFrame edge_color : string ...
Turn a row from the gdf_edges GeoDataFrame into a folium PolyLine with attributes. Parameters ---------- edge : GeoSeries a row from the gdf_edges GeoDataFrame edge_color : string color of the edge lines edge_width : numeric width of the edge lines edge_opacity : num...
Below is the the instruction that describes the task: ### Input: Turn a row from the gdf_edges GeoDataFrame into a folium PolyLine with attributes. Parameters ---------- edge : GeoSeries a row from the gdf_edges GeoDataFrame edge_color : string color of the edge lines edge_w...
def print_vessel_errors(retdict): """ <Purpose> Prints out any errors that occurred while performing an action on vessels, in a human readable way. Errors will be printed out in the following format: description [reason] Affected vessels: nodelist To define a new error, add the following e...
<Purpose> Prints out any errors that occurred while performing an action on vessels, in a human readable way. Errors will be printed out in the following format: description [reason] Affected vessels: nodelist To define a new error, add the following entry to ERROR_RESPONSES in this functi...
Below is the the instruction that describes the task: ### Input: <Purpose> Prints out any errors that occurred while performing an action on vessels, in a human readable way. Errors will be printed out in the following format: description [reason] Affected vessels: nodelist To define a new...
def _get_tau_vector(self, tau_mean, tau_std, imt_list): """ Gets the vector of mean and variance of tau values corresponding to the specific model and returns them as dictionaries """ self.magnitude_limits = MAG_LIMS_KEYS[self.tau_model]["mag"] self.tau_keys = MAG_LIMS_KE...
Gets the vector of mean and variance of tau values corresponding to the specific model and returns them as dictionaries
Below is the the instruction that describes the task: ### Input: Gets the vector of mean and variance of tau values corresponding to the specific model and returns them as dictionaries ### Response: def _get_tau_vector(self, tau_mean, tau_std, imt_list): """ Gets the vector of mean and vari...
def transform(src, dst, converter, overwrite=False, stream=True, chunksize=1024**2, **kwargs): """ A file stream transform IO utility function. :param src: original file path :param dst: destination file path :param converter: binary content converter function :param overwrite: de...
A file stream transform IO utility function. :param src: original file path :param dst: destination file path :param converter: binary content converter function :param overwrite: default False, :param stream: default True, if True, use stream IO mode, chunksize has to be specified. :para...
Below is the the instruction that describes the task: ### Input: A file stream transform IO utility function. :param src: original file path :param dst: destination file path :param converter: binary content converter function :param overwrite: default False, :param stream: default True, if Tru...
def assign_descriptors(mol): """ Throws: RuntimeError: if minify_ring failed """ topology.recognize(mol) descriptor.assign_valence(mol) descriptor.assign_rotatable(mol) topology.minify_ring(mol) descriptor.assign_aromatic(mol)
Throws: RuntimeError: if minify_ring failed
Below is the the instruction that describes the task: ### Input: Throws: RuntimeError: if minify_ring failed ### Response: def assign_descriptors(mol): """ Throws: RuntimeError: if minify_ring failed """ topology.recognize(mol) descriptor.assign_valence(mol) descriptor.assig...
def get_members(self, selector): """ Returns the members that satisfy the given selector. :param selector: (:class:`~hazelcast.core.MemberSelector`), Selector to be applied to the members. :return: (List), List of members. """ members = [] for member in self.get_...
Returns the members that satisfy the given selector. :param selector: (:class:`~hazelcast.core.MemberSelector`), Selector to be applied to the members. :return: (List), List of members.
Below is the the instruction that describes the task: ### Input: Returns the members that satisfy the given selector. :param selector: (:class:`~hazelcast.core.MemberSelector`), Selector to be applied to the members. :return: (List), List of members. ### Response: def get_members(self, selector): ...
def get_private_key_from_wif(wif: str) -> bytes: """ This interface is used to decode a WIF encode ECDSA private key. :param wif: a WIF encode private key. :return: a ECDSA private key in the form of bytes. """ if wif is None or wif is "": raise Exception("no...
This interface is used to decode a WIF encode ECDSA private key. :param wif: a WIF encode private key. :return: a ECDSA private key in the form of bytes.
Below is the the instruction that describes the task: ### Input: This interface is used to decode a WIF encode ECDSA private key. :param wif: a WIF encode private key. :return: a ECDSA private key in the form of bytes. ### Response: def get_private_key_from_wif(wif: str) -> bytes: """ ...
def filter_to_pass_and_reject(in_file, paired, out_dir=None): """Filter VCF to only those with a strict PASS/REJECT: somatic + germline. Removes low quality calls filtered but also labeled with REJECT. """ from bcbio.heterogeneity import bubbletree out_file = "%s-prfilter.vcf.gz" % utils.splitext_p...
Filter VCF to only those with a strict PASS/REJECT: somatic + germline. Removes low quality calls filtered but also labeled with REJECT.
Below is the the instruction that describes the task: ### Input: Filter VCF to only those with a strict PASS/REJECT: somatic + germline. Removes low quality calls filtered but also labeled with REJECT. ### Response: def filter_to_pass_and_reject(in_file, paired, out_dir=None): """Filter VCF to only those ...
def sitetree_tree(parser, token): """Parses sitetree tag parameters. Two notation types are possible: 1. Two arguments: {% sitetree_tree from "mytree" %} Used to render tree for "mytree" site tree. 2. Four arguments: {% sitetree_tree from "mytree" template "sit...
Parses sitetree tag parameters. Two notation types are possible: 1. Two arguments: {% sitetree_tree from "mytree" %} Used to render tree for "mytree" site tree. 2. Four arguments: {% sitetree_tree from "mytree" template "sitetree/mytree.html" %} Used to ...
Below is the the instruction that describes the task: ### Input: Parses sitetree tag parameters. Two notation types are possible: 1. Two arguments: {% sitetree_tree from "mytree" %} Used to render tree for "mytree" site tree. 2. Four arguments: {% sitetree_tree...
def compute_tls13_resumption_secret(self): """ self.handshake_messages should be ClientHello...ClientFinished. """ if self.connection_end == "server": hkdf = self.prcs.hkdf elif self.connection_end == "client": hkdf = self.pwcs.hkdf rs = hkdf.deriv...
self.handshake_messages should be ClientHello...ClientFinished.
Below is the the instruction that describes the task: ### Input: self.handshake_messages should be ClientHello...ClientFinished. ### Response: def compute_tls13_resumption_secret(self): """ self.handshake_messages should be ClientHello...ClientFinished. """ if self.connection_end ==...
def init_app(self, app): """Flask application initialization.""" app.cli.add_command(upgrader_cmd) app.extensions['invenio-upgrader'] = self
Flask application initialization.
Below is the the instruction that describes the task: ### Input: Flask application initialization. ### Response: def init_app(self, app): """Flask application initialization.""" app.cli.add_command(upgrader_cmd) app.extensions['invenio-upgrader'] = self
def express_route_connections(self): """Instance depends on the API version: * 2018-08-01: :class:`ExpressRouteConnectionsOperations<azure.mgmt.network.v2018_08_01.operations.ExpressRouteConnectionsOperations>` """ api_version = self._get_api_version('express_route_connections') ...
Instance depends on the API version: * 2018-08-01: :class:`ExpressRouteConnectionsOperations<azure.mgmt.network.v2018_08_01.operations.ExpressRouteConnectionsOperations>`
Below is the the instruction that describes the task: ### Input: Instance depends on the API version: * 2018-08-01: :class:`ExpressRouteConnectionsOperations<azure.mgmt.network.v2018_08_01.operations.ExpressRouteConnectionsOperations>` ### Response: def express_route_connections(self): """Insta...
def upcoming_viewings(self): """ Returns an array of upcoming viewings for a property. :return: """ upcoming_viewings = [] try: if self._data_from_search: viewings = self._data_from_search.find_all( 'div', {'class': 'smi-onv...
Returns an array of upcoming viewings for a property. :return:
Below is the the instruction that describes the task: ### Input: Returns an array of upcoming viewings for a property. :return: ### Response: def upcoming_viewings(self): """ Returns an array of upcoming viewings for a property. :return: """ upcoming_viewings = [] ...
def main(ylib: str = None, path: str = None, scope: ValidationScope = ValidationScope.all, ctype: ContentType = ContentType.config, set_id: bool = False, tree: bool = False, no_types: bool = False, digest: bool = False, validate: str = None) -> int: """Entry-point for a validatio...
Entry-point for a validation script. Args: ylib: Name of the file with YANG library path: Colon-separated list of directories to search for YANG modules. scope: Validation scope (syntax, semantics or all). ctype: Content type of the data instance (config, nonconfig or all) ...
Below is the the instruction that describes the task: ### Input: Entry-point for a validation script. Args: ylib: Name of the file with YANG library path: Colon-separated list of directories to search for YANG modules. scope: Validation scope (syntax, semantics or all). ctype: ...
def queryProxy(self, query): """Override Qt method.""" # Query is a QNetworkProxyQuery valid_proxies = [] query_scheme = query.url().scheme() query_host = query.url().host() query_scheme_host = '{0}://{1}'.format(query_scheme, query_host) proxy_servers = process_...
Override Qt method.
Below is the the instruction that describes the task: ### Input: Override Qt method. ### Response: def queryProxy(self, query): """Override Qt method.""" # Query is a QNetworkProxyQuery valid_proxies = [] query_scheme = query.url().scheme() query_host = query.url().host() ...
def get_channel(self, name): """ Details about an individual channel. :param name: The channel name :type name: str """ return self._api_get('/api/channels/{0}'.format( urllib.parse.quote_plus(name) ))
Details about an individual channel. :param name: The channel name :type name: str
Below is the the instruction that describes the task: ### Input: Details about an individual channel. :param name: The channel name :type name: str ### Response: def get_channel(self, name): """ Details about an individual channel. :param name: The channel name :ty...
def generatorInit(self, U0): """ Based on GeneratorInit.m from MatDyn by Stijn Cole, developed at Katholieke Universiteit Leuven. See U{http://www.esat.kuleuven.be/ electa/teaching/matdyn/} for more information. @rtype: tuple @return: Initial generator conditions. """ ...
Based on GeneratorInit.m from MatDyn by Stijn Cole, developed at Katholieke Universiteit Leuven. See U{http://www.esat.kuleuven.be/ electa/teaching/matdyn/} for more information. @rtype: tuple @return: Initial generator conditions.
Below is the the instruction that describes the task: ### Input: Based on GeneratorInit.m from MatDyn by Stijn Cole, developed at Katholieke Universiteit Leuven. See U{http://www.esat.kuleuven.be/ electa/teaching/matdyn/} for more information. @rtype: tuple @return: Initial generato...
def _aloadstr(ins): ''' Loads a string value from a memory address. ''' output = _addr(ins.quad[2]) output.append('call __ILOADSTR') output.append('push hl') REQUIRES.add('loadstr.asm') return output
Loads a string value from a memory address.
Below is the the instruction that describes the task: ### Input: Loads a string value from a memory address. ### Response: def _aloadstr(ins): ''' Loads a string value from a memory address. ''' output = _addr(ins.quad[2]) output.append('call __ILOADSTR') output.append('push hl') REQUIRES....
def extract(self): """Extract a common dependency. Returns: A (_PackageScope, Requirement) tuple, containing the new scope copy with the extraction, and the extracted package range. If no package was extracted, then (self,None) is returned. """ if not...
Extract a common dependency. Returns: A (_PackageScope, Requirement) tuple, containing the new scope copy with the extraction, and the extracted package range. If no package was extracted, then (self,None) is returned.
Below is the the instruction that describes the task: ### Input: Extract a common dependency. Returns: A (_PackageScope, Requirement) tuple, containing the new scope copy with the extraction, and the extracted package range. If no package was extracted, then (self,None) ...
def dotted(self): """Return just the tract number, excluding the state and county, in the dotted format""" v = str(self.geoid.tract).zfill(6) return v[0:4] + '.' + v[4:]
Return just the tract number, excluding the state and county, in the dotted format
Below is the the instruction that describes the task: ### Input: Return just the tract number, excluding the state and county, in the dotted format ### Response: def dotted(self): """Return just the tract number, excluding the state and county, in the dotted format""" v = str(self.geoid.tract).zfil...