code
stringlengths
75
104k
docstring
stringlengths
1
46.9k
text
stringlengths
164
112k
def getLocation(self): """ Return the latitude+longitutde of the picture. Returns None if no location given for this pic. """ method = 'flickr.photos.geo.getLocation' try: data = _doget(method, photo_id=self.id) except FlickrError: # Some other error m...
Return the latitude+longitutde of the picture. Returns None if no location given for this pic.
Below is the the instruction that describes the task: ### Input: Return the latitude+longitutde of the picture. Returns None if no location given for this pic. ### Response: def getLocation(self): """ Return the latitude+longitutde of the picture. Returns None if no location given f...
def from_numpy_vectors(cls, linear, quadratic, offset, vartype, variable_order=None): """Create a binary quadratic model from vectors. Args: linear (array_like): A 1D array-like iterable of linear biases. quadratic (tuple[array_like, array_like, array_like]): ...
Create a binary quadratic model from vectors. Args: linear (array_like): A 1D array-like iterable of linear biases. quadratic (tuple[array_like, array_like, array_like]): A 3-tuple of 1D array_like vectors of the form (row, col, bias). offse...
Below is the the instruction that describes the task: ### Input: Create a binary quadratic model from vectors. Args: linear (array_like): A 1D array-like iterable of linear biases. quadratic (tuple[array_like, array_like, array_like]): A 3-tuple of 1...
def mask(self): """ Returns mask associated with this layer. :return: :py:class:`~psd_tools.api.mask.Mask` or `None` """ if not hasattr(self, "_mask"): self._mask = Mask(self) if self.has_mask() else None return self._mask
Returns mask associated with this layer. :return: :py:class:`~psd_tools.api.mask.Mask` or `None`
Below is the the instruction that describes the task: ### Input: Returns mask associated with this layer. :return: :py:class:`~psd_tools.api.mask.Mask` or `None` ### Response: def mask(self): """ Returns mask associated with this layer. :return: :py:class:`~psd_tools.api.mask.Mask...
def create_node(self, network, participant): """Make a new node for participants.""" if network.role == "practice" or network.role == "catch": return RogersAgentFounder(network=network, participant=participant) elif network.size(type=Agent) < network.generation_size: retu...
Make a new node for participants.
Below is the the instruction that describes the task: ### Input: Make a new node for participants. ### Response: def create_node(self, network, participant): """Make a new node for participants.""" if network.role == "practice" or network.role == "catch": return RogersAgentFounder(netwo...
def select_site_view(self, request, form_url=''): """ Display a choice form to select which site to add settings. """ if not self.has_add_permission(request): raise PermissionDenied extra_qs = '' if request.META['QUERY_STRING']: extra_qs = '&' + r...
Display a choice form to select which site to add settings.
Below is the the instruction that describes the task: ### Input: Display a choice form to select which site to add settings. ### Response: def select_site_view(self, request, form_url=''): """ Display a choice form to select which site to add settings. """ if not self.has_add_permis...
def get_json_files(p): """ Scan the provided policy directory for all JSON policy files. """ f = [os.path.join(p, x) for x in os.listdir(p) if x.endswith(".json")] return sorted(f)
Scan the provided policy directory for all JSON policy files.
Below is the the instruction that describes the task: ### Input: Scan the provided policy directory for all JSON policy files. ### Response: def get_json_files(p): """ Scan the provided policy directory for all JSON policy files. """ f = [os.path.join(p, x) for x in os.listdir(p) if x.endswith(".js...
def failover_to_replicant(self, volume_id, replicant_id, immediate=False): """Failover to a volume replicant. :param integer volume_id: The id of the volume :param integer replicant_id: ID of replicant to failover to :param boolean immediate: Flag indicating if failover is immediate ...
Failover to a volume replicant. :param integer volume_id: The id of the volume :param integer replicant_id: ID of replicant to failover to :param boolean immediate: Flag indicating if failover is immediate :return: Returns whether failover was successful or not
Below is the the instruction that describes the task: ### Input: Failover to a volume replicant. :param integer volume_id: The id of the volume :param integer replicant_id: ID of replicant to failover to :param boolean immediate: Flag indicating if failover is immediate :return: Ret...
def get_argument_role(self): """ Helper function to get request argument. Raises exception if argument is missing. Returns the role argument. """ try: return self.get_argument(constants.PARAM_ROLE, default=None) except tornado.web.MissingArgumentError as e: raise Exception(e.log_...
Helper function to get request argument. Raises exception if argument is missing. Returns the role argument.
Below is the the instruction that describes the task: ### Input: Helper function to get request argument. Raises exception if argument is missing. Returns the role argument. ### Response: def get_argument_role(self): """ Helper function to get request argument. Raises exception if argument is m...
def get_clumpp_table(self, kvalues, max_var_multiple=0, quiet=False): """ Returns a dictionary of results tables for making structure barplots. This calls the same functions used in get_evanno_table() to call CLUMPP to permute replicates. Parameters: ----------- ...
Returns a dictionary of results tables for making structure barplots. This calls the same functions used in get_evanno_table() to call CLUMPP to permute replicates. Parameters: ----------- kvalues : list or int A kvalue or list of kvalues to run CLUMPP on and return...
Below is the the instruction that describes the task: ### Input: Returns a dictionary of results tables for making structure barplots. This calls the same functions used in get_evanno_table() to call CLUMPP to permute replicates. Parameters: ----------- kvalues : list or in...
def inspiral_range(psd, snr=8, mass1=1.4, mass2=1.4, fmin=None, fmax=None, horizon=False): """Calculate the inspiral sensitive distance from a GW strain PSD The method returns the distance (in megaparsecs) to which an compact binary inspiral with the given component masses would be detec...
Calculate the inspiral sensitive distance from a GW strain PSD The method returns the distance (in megaparsecs) to which an compact binary inspiral with the given component masses would be detectable given the instrumental PSD. The calculation is as defined in: https://dcc.ligo.org/LIGO-T030276/public...
Below is the the instruction that describes the task: ### Input: Calculate the inspiral sensitive distance from a GW strain PSD The method returns the distance (in megaparsecs) to which an compact binary inspiral with the given component masses would be detectable given the instrumental PSD. The calcul...
def create_namespaced_cron_job(self, namespace, body, **kwargs): """ create a CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_namespaced_cron_job(namespace, body, async_req=T...
create a CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_namespaced_cron_job(namespace, body, async_req=True) >>> result = thread.get() :param async_req bool :param ...
Below is the the instruction that describes the task: ### Input: create a CronJob This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.create_namespaced_cron_job(namespace, body, async_req=True) >>>...
def topDownCompute(self, encoded): """[ScalarEncoder class method override]""" #Decode to delta scalar if self._prevAbsolute==None or self._prevDelta==None: return [EncoderResult(value=0, scalar=0, encoding=numpy.zeros(self.n))] ret = self._adaptiveScalarEnc.topDownCo...
[ScalarEncoder class method override]
Below is the the instruction that describes the task: ### Input: [ScalarEncoder class method override] ### Response: def topDownCompute(self, encoded): """[ScalarEncoder class method override]""" #Decode to delta scalar if self._prevAbsolute==None or self._prevDelta==None: return [EncoderResult(...
def log_task( task, logger=logging, level='info', propagate_fail=True, uuid=None ): """ Parameterized decorator to wrap a function in a log task Example: >>> @log_task('mytask') ... def do_something(): ... pass """ def decorator(func): @wraps(func) d...
Parameterized decorator to wrap a function in a log task Example: >>> @log_task('mytask') ... def do_something(): ... pass
Below is the the instruction that describes the task: ### Input: Parameterized decorator to wrap a function in a log task Example: >>> @log_task('mytask') ... def do_something(): ... pass ### Response: def log_task( task, logger=logging, level='info', propagate_fail=True, uuid=...
def rightAt(self, offset=0): """ Returns point in the center of the region's right side (offset to the right by ``offset``) """ return Location(self.getX() + self.getW() + offset, self.getY() + (self.getH() / 2))
Returns point in the center of the region's right side (offset to the right by ``offset``)
Below is the the instruction that describes the task: ### Input: Returns point in the center of the region's right side (offset to the right by ``offset``) ### Response: def rightAt(self, offset=0): """ Returns point in the center of the region's right side (offset to the right by ``offset`...
def execute_ccm_remotely(remote_options, ccm_args): """ Execute CCM operation(s) remotely :return A tuple defining the execution of the command * output - The output of the execution if the output was not displayed * exit_status - The exit status of remotely executed script...
Execute CCM operation(s) remotely :return A tuple defining the execution of the command * output - The output of the execution if the output was not displayed * exit_status - The exit status of remotely executed script :raises Exception if invalid options are passed for `--dse-...
Below is the the instruction that describes the task: ### Input: Execute CCM operation(s) remotely :return A tuple defining the execution of the command * output - The output of the execution if the output was not displayed * exit_status - The exit status of remotely executed s...
def save(self, *args, **kwargs): """ Overrides the save method """ self.slug = self.create_slug() super(Slugable, self).save(*args, **kwargs)
Overrides the save method
Below is the the instruction that describes the task: ### Input: Overrides the save method ### Response: def save(self, *args, **kwargs): """ Overrides the save method """ self.slug = self.create_slug() super(Slugable, self).save(*args, **kwargs)
def update_endtime(jid, time): ''' Update (or store) the end time for a given job Endtime is stored as a plain text string ''' jid_dir = salt.utils.jid.jid_dir(jid, _job_dir(), __opts__['hash_type']) try: if not os.path.exists(jid_dir): os.makedirs(jid_dir) with salt...
Update (or store) the end time for a given job Endtime is stored as a plain text string
Below is the the instruction that describes the task: ### Input: Update (or store) the end time for a given job Endtime is stored as a plain text string ### Response: def update_endtime(jid, time): ''' Update (or store) the end time for a given job Endtime is stored as a plain text string '''...
def create_destination_id(client, container, name): # type: (azure.storage.StorageClient, str, str) -> str """Create a unique destination id :param azure.storage.StorageClient client: storage client :param str container: container name :param str name: entity name :rtype:...
Create a unique destination id :param azure.storage.StorageClient client: storage client :param str container: container name :param str name: entity name :rtype: str :return: unique id for the destination
Below is the the instruction that describes the task: ### Input: Create a unique destination id :param azure.storage.StorageClient client: storage client :param str container: container name :param str name: entity name :rtype: str :return: unique id for the destination ### R...
def run(self): """Processing the pipeline.""" self.logger.info("Running with Python %s", sys.version.replace("\n", "")) self.logger.info("Running on platform %s", platform.platform()) self.logger.info("Current cpu count is %d", multiprocessing.cpu_count()) configuration = self.l...
Processing the pipeline.
Below is the the instruction that describes the task: ### Input: Processing the pipeline. ### Response: def run(self): """Processing the pipeline.""" self.logger.info("Running with Python %s", sys.version.replace("\n", "")) self.logger.info("Running on platform %s", platform.platform()) ...
def save_item(self, item_form, *args, **kwargs): """Pass through to provider ItemAdminSession.update_item""" # Implemented from kitosid template for - # osid.resource.ResourceAdminSession.update_resource if item_form.is_for_update(): return self.update_item(item_form, *args, ...
Pass through to provider ItemAdminSession.update_item
Below is the the instruction that describes the task: ### Input: Pass through to provider ItemAdminSession.update_item ### Response: def save_item(self, item_form, *args, **kwargs): """Pass through to provider ItemAdminSession.update_item""" # Implemented from kitosid template for - # osid....
def send(self, data, opcode=websocket.ABNF.OPCODE_TEXT): """ Send message to server. data: message to send. If you set opcode to OPCODE_TEXT, data must be utf-8 string or unicode. opcode: operation code of data. default is OPCODE_TEXT. """ self.ws_client.se...
Send message to server. data: message to send. If you set opcode to OPCODE_TEXT, data must be utf-8 string or unicode. opcode: operation code of data. default is OPCODE_TEXT.
Below is the the instruction that describes the task: ### Input: Send message to server. data: message to send. If you set opcode to OPCODE_TEXT, data must be utf-8 string or unicode. opcode: operation code of data. default is OPCODE_TEXT. ### Response: def send(self, data, opcode=we...
def _update_dPrxy(self): """Update `dPrxy`, accounting for dependence of `Prxy` on `omega2`.""" super(ExpCM_empirical_phi_divpressure, self)._update_dPrxy() if 'omega2' in self.freeparams: with scipy.errstate(divide='raise', under='raise', over='raise', in...
Update `dPrxy`, accounting for dependence of `Prxy` on `omega2`.
Below is the the instruction that describes the task: ### Input: Update `dPrxy`, accounting for dependence of `Prxy` on `omega2`. ### Response: def _update_dPrxy(self): """Update `dPrxy`, accounting for dependence of `Prxy` on `omega2`.""" super(ExpCM_empirical_phi_divpressure, self)._update_dPrxy(...
def intersectingPoint(self, p): """ given a point, get intervals in the tree that are intersected. :param p: intersection point :return: the list of intersected intervals """ # perfect match if p == self.data.mid: return self.data.ends if p > self.data.mid: # we know all in...
given a point, get intervals in the tree that are intersected. :param p: intersection point :return: the list of intersected intervals
Below is the the instruction that describes the task: ### Input: given a point, get intervals in the tree that are intersected. :param p: intersection point :return: the list of intersected intervals ### Response: def intersectingPoint(self, p): """ given a point, get intervals in the tree that ar...
def check(self, data): """returns True if any match any regexp""" if isinstance(data, Iterable): data = "".join(str(x) for x in data) try: data = str(data) except UnicodeDecodeError: return False return bool(data and self.__regexp.match(data))
returns True if any match any regexp
Below is the the instruction that describes the task: ### Input: returns True if any match any regexp ### Response: def check(self, data): """returns True if any match any regexp""" if isinstance(data, Iterable): data = "".join(str(x) for x in data) try: data = str(d...
def get_url(self, version=None): """ Return the filename of the bundled bundle """ if self.fixed_bundle_url: return self.fixed_bundle_url return '%s.%s.%s' % (os.path.join(self.bundle_url_root, self.bundle_filename), version or self.get_version(), self.bundle_type)
Return the filename of the bundled bundle
Below is the the instruction that describes the task: ### Input: Return the filename of the bundled bundle ### Response: def get_url(self, version=None): """ Return the filename of the bundled bundle """ if self.fixed_bundle_url: return self.fixed_bundle_url retu...
def scroll(self, clicks): """Zoom using a mouse scroll wheel motion. Parameters ---------- clicks : int The number of clicks. Positive numbers indicate forward wheel movement. """ target = self._target ratio = 0.90 mult = 1.0 ...
Zoom using a mouse scroll wheel motion. Parameters ---------- clicks : int The number of clicks. Positive numbers indicate forward wheel movement.
Below is the the instruction that describes the task: ### Input: Zoom using a mouse scroll wheel motion. Parameters ---------- clicks : int The number of clicks. Positive numbers indicate forward wheel movement. ### Response: def scroll(self, clicks): """Zoo...
def _update_targets(vesseldicts, environment_dict): """ <Purpose> Connects to the nodes in the vesseldicts and adds them to the list of valid targets. <Arguments> vesseldicts: A list of vesseldicts obtained through SeattleClearinghouseClient calls. <Side Effects> All valid targ...
<Purpose> Connects to the nodes in the vesseldicts and adds them to the list of valid targets. <Arguments> vesseldicts: A list of vesseldicts obtained through SeattleClearinghouseClient calls. <Side Effects> All valid targets that the user can access on the specified nodes are ...
Below is the the instruction that describes the task: ### Input: <Purpose> Connects to the nodes in the vesseldicts and adds them to the list of valid targets. <Arguments> vesseldicts: A list of vesseldicts obtained through SeattleClearinghouseClient calls. <Side Effects> All v...
def trim(self): """ Trims data based on propensity score to create a subsample with better covariate balance. The default cutoff value is set to 0.1. To set a custom cutoff value, modify the object attribute named cutoff directly. This method should only be executed after the propensity score has bee...
Trims data based on propensity score to create a subsample with better covariate balance. The default cutoff value is set to 0.1. To set a custom cutoff value, modify the object attribute named cutoff directly. This method should only be executed after the propensity score has been estimated.
Below is the the instruction that describes the task: ### Input: Trims data based on propensity score to create a subsample with better covariate balance. The default cutoff value is set to 0.1. To set a custom cutoff value, modify the object attribute named cutoff directly. This method should only be e...
def count_hom_ref(self, axis=None): """Count homozygous reference genotypes. Parameters ---------- axis : int, optional Axis over which to count, or None to perform overall count. """ b = self.is_hom_ref() return np.sum(b, axis=axis)
Count homozygous reference genotypes. Parameters ---------- axis : int, optional Axis over which to count, or None to perform overall count.
Below is the the instruction that describes the task: ### Input: Count homozygous reference genotypes. Parameters ---------- axis : int, optional Axis over which to count, or None to perform overall count. ### Response: def count_hom_ref(self, axis=None): """Count homoz...
def get_device_name(self): """ return the device name :return: str """ command = const.CMD_OPTIONS_RRQ command_string = b'~DeviceName\x00' response_size = 1024 cmd_response = self.__send_command(command, command_string, response_size) if cmd_resp...
return the device name :return: str
Below is the the instruction that describes the task: ### Input: return the device name :return: str ### Response: def get_device_name(self): """ return the device name :return: str """ command = const.CMD_OPTIONS_RRQ command_string = b'~DeviceName\x00' ...
def open_channel(self): """ Open a new channel on this connection. This method is a :ref:`coroutine <coroutine>`. :return: The new :class:`Channel` object. """ if self._closing: raise ConnectionClosed("Closed by application") if self.closed.done(): ...
Open a new channel on this connection. This method is a :ref:`coroutine <coroutine>`. :return: The new :class:`Channel` object.
Below is the the instruction that describes the task: ### Input: Open a new channel on this connection. This method is a :ref:`coroutine <coroutine>`. :return: The new :class:`Channel` object. ### Response: def open_channel(self): """ Open a new channel on this connection. ...
def checkTikaServer(scheme="http", serverHost=ServerHost, port=Port, tikaServerJar=TikaServerJar, classpath=None, config_path=None): ''' Check that tika-server is running. If not, download JAR file and start it up. :param scheme: e.g. http or https :param serverHost: :param port: :param tikaSer...
Check that tika-server is running. If not, download JAR file and start it up. :param scheme: e.g. http or https :param serverHost: :param port: :param tikaServerJar: :param classpath: :return:
Below is the the instruction that describes the task: ### Input: Check that tika-server is running. If not, download JAR file and start it up. :param scheme: e.g. http or https :param serverHost: :param port: :param tikaServerJar: :param classpath: :return: ### Response: def checkTikaServe...
def quality(self, tests, alias=None): """ Run a series of tests and return the corresponding results. Args: tests (list): a list of functions. alias (dict): a dictionary mapping mnemonics to lists of mnemonics. Returns: list. The results. Stick to bo...
Run a series of tests and return the corresponding results. Args: tests (list): a list of functions. alias (dict): a dictionary mapping mnemonics to lists of mnemonics. Returns: list. The results. Stick to booleans (True = pass) or ints.
Below is the the instruction that describes the task: ### Input: Run a series of tests and return the corresponding results. Args: tests (list): a list of functions. alias (dict): a dictionary mapping mnemonics to lists of mnemonics. Returns: list. The results. ...
def discovery_redis(self): """ Installs the Redis discovery bundles and instantiates components """ # Install the bundle self.context.install_bundle("pelix.remote.discovery.redis").start() with use_waiting_list(self.context) as ipopo: # Instantiate the discov...
Installs the Redis discovery bundles and instantiates components
Below is the the instruction that describes the task: ### Input: Installs the Redis discovery bundles and instantiates components ### Response: def discovery_redis(self): """ Installs the Redis discovery bundles and instantiates components """ # Install the bundle self.conte...
def associate_route_table(self, route_table_id, subnet_id): """ Associates a route table with a specific subnet. :type route_table_id: str :param route_table_id: The ID of the route table to associate. :type subnet_id: str :param subnet_id: The ID of the subnet to assoc...
Associates a route table with a specific subnet. :type route_table_id: str :param route_table_id: The ID of the route table to associate. :type subnet_id: str :param subnet_id: The ID of the subnet to associate with. :rtype: str :return: The ID of the association creat...
Below is the the instruction that describes the task: ### Input: Associates a route table with a specific subnet. :type route_table_id: str :param route_table_id: The ID of the route table to associate. :type subnet_id: str :param subnet_id: The ID of the subnet to associate with. ...
def _init_values(self, context=None): """Retrieve field values from the server. May be used to restore the original values in the purpose to cancel all changes made. """ if context is None: context = self.env.context # Get basic fields (no relational ones) ...
Retrieve field values from the server. May be used to restore the original values in the purpose to cancel all changes made.
Below is the the instruction that describes the task: ### Input: Retrieve field values from the server. May be used to restore the original values in the purpose to cancel all changes made. ### Response: def _init_values(self, context=None): """Retrieve field values from the server. ...
def disambiguate_fname(files_path_list, filename): """Get tab title without ambiguation.""" fname = os.path.basename(filename) same_name_files = get_same_name_files(files_path_list, fname) if len(same_name_files) > 1: compare_path = shortest_path(same_name_files) if compare_path ==...
Get tab title without ambiguation.
Below is the the instruction that describes the task: ### Input: Get tab title without ambiguation. ### Response: def disambiguate_fname(files_path_list, filename): """Get tab title without ambiguation.""" fname = os.path.basename(filename) same_name_files = get_same_name_files(files_path_list, fnam...
def dial(self, target): ''' connects to a node :param url: string (optional) - resource in which to connect. if not provided, will use default for the stage :returns: provider, error ''' if not target: return None, "target network must be specified w...
connects to a node :param url: string (optional) - resource in which to connect. if not provided, will use default for the stage :returns: provider, error
Below is the the instruction that describes the task: ### Input: connects to a node :param url: string (optional) - resource in which to connect. if not provided, will use default for the stage :returns: provider, error ### Response: def dial(self, target): ''' connects to ...
def _make_server(self): """Constructs the TensorBoard WSGI app and instantiates the server.""" app = application.standard_tensorboard_wsgi(self.flags, self.plugin_loaders, self.assets_zip_provider) return self.se...
Constructs the TensorBoard WSGI app and instantiates the server.
Below is the the instruction that describes the task: ### Input: Constructs the TensorBoard WSGI app and instantiates the server. ### Response: def _make_server(self): """Constructs the TensorBoard WSGI app and instantiates the server.""" app = application.standard_tensorboard_wsgi(self.flags, ...
def threshold(self, value, inclusive=False): """Return True if > than treshold value (or >= threshold value if inclusive=True). """ if inclusive: def function(x, y): return True if x >= y else False else: def function(x, y): ...
Return True if > than treshold value (or >= threshold value if inclusive=True).
Below is the the instruction that describes the task: ### Input: Return True if > than treshold value (or >= threshold value if inclusive=True). ### Response: def threshold(self, value, inclusive=False): """Return True if > than treshold value (or >= threshold value if inclusive=True). ...
def sapm_aoi_loss(aoi, module, upper=None): """ Calculates the SAPM angle of incidence loss coefficient, F2. Parameters ---------- aoi : numeric Angle of incidence in degrees. Negative input angles will return zeros. module : dict-like A dict, Series, or DataFrame defin...
Calculates the SAPM angle of incidence loss coefficient, F2. Parameters ---------- aoi : numeric Angle of incidence in degrees. Negative input angles will return zeros. module : dict-like A dict, Series, or DataFrame defining the SAPM performance parameters. See the :py...
Below is the the instruction that describes the task: ### Input: Calculates the SAPM angle of incidence loss coefficient, F2. Parameters ---------- aoi : numeric Angle of incidence in degrees. Negative input angles will return zeros. module : dict-like A dict, Series, or Da...
def span_case(self, i, case): """Uppercase or lowercase the next range of characters until end marker is found.""" # A new \L, \C or \E should pop the last in the stack. if self.span_stack: self.span_stack.pop() if self.single_stack: self.single_stack.pop() ...
Uppercase or lowercase the next range of characters until end marker is found.
Below is the the instruction that describes the task: ### Input: Uppercase or lowercase the next range of characters until end marker is found. ### Response: def span_case(self, i, case): """Uppercase or lowercase the next range of characters until end marker is found.""" # A new \L, \C or \E shou...
def fetch_max(self, cluster, metric, topology, component, instance, timerange, environ=None): ''' :param cluster: :param metric: :param topology: :param component: :param instance: :param timerange: :param environ: :return: ''' components = [component] if component != "*" els...
:param cluster: :param metric: :param topology: :param component: :param instance: :param timerange: :param environ: :return:
Below is the the instruction that describes the task: ### Input: :param cluster: :param metric: :param topology: :param component: :param instance: :param timerange: :param environ: :return: ### Response: def fetch_max(self, cluster, metric, topology, component, instance, timerange, env...
def get_page_name(id): """Return name of a page based on passed page id. Parameters: - id: id of a Confluence page. """ data = _json.loads(_api.rest("/" + str(id) + "?expand=body.storage")) return data["title"]
Return name of a page based on passed page id. Parameters: - id: id of a Confluence page.
Below is the the instruction that describes the task: ### Input: Return name of a page based on passed page id. Parameters: - id: id of a Confluence page. ### Response: def get_page_name(id): """Return name of a page based on passed page id. Parameters: - id: id of a Confluence page. """ ...
def mtf_bitransformer_tiny(): """Small encoder-decoder model for testing.""" hparams = mtf_bitransformer_base() hparams.batch_size = 2 hparams.mesh_shape = "" hparams.d_model = 128 hparams.encoder_layers = ["self_att", "drd"] * 2 hparams.decoder_layers = ["self_att", "enc_att", "drd"] * 2 hparams.num_he...
Small encoder-decoder model for testing.
Below is the the instruction that describes the task: ### Input: Small encoder-decoder model for testing. ### Response: def mtf_bitransformer_tiny(): """Small encoder-decoder model for testing.""" hparams = mtf_bitransformer_base() hparams.batch_size = 2 hparams.mesh_shape = "" hparams.d_model = 128 hp...
async def _registration_completed(self, message): """ We're connected and registered. Receive proper nickname and emit fake NICK message. """ if not self.registered: # Re-enable throttling. self.registered = True self.connection.throttle = True target = m...
We're connected and registered. Receive proper nickname and emit fake NICK message.
Below is the the instruction that describes the task: ### Input: We're connected and registered. Receive proper nickname and emit fake NICK message. ### Response: async def _registration_completed(self, message): """ We're connected and registered. Receive proper nickname and emit fake NICK message. """ ...
def get_flag_variables(ds): ''' Returns a list of variables that are defined as flag variables :param netCDF4.Dataset ds: An open netCDF4 Dataset ''' flag_variables = [] for name, ncvar in ds.variables.items(): standard_name = getattr(ncvar, 'standard_name', None) if isinstance(...
Returns a list of variables that are defined as flag variables :param netCDF4.Dataset ds: An open netCDF4 Dataset
Below is the the instruction that describes the task: ### Input: Returns a list of variables that are defined as flag variables :param netCDF4.Dataset ds: An open netCDF4 Dataset ### Response: def get_flag_variables(ds): ''' Returns a list of variables that are defined as flag variables :param ne...
def clean_file(c_source, virtualenv_dirname): """Strip trailing whitespace and clean up "local" names in C source. These source files are autogenerated from the ``cython`` CLI. Args: c_source (str): Path to a ``.c`` source file. virtualenv_dirname (str): The name of the ``virtualenv`` ...
Strip trailing whitespace and clean up "local" names in C source. These source files are autogenerated from the ``cython`` CLI. Args: c_source (str): Path to a ``.c`` source file. virtualenv_dirname (str): The name of the ``virtualenv`` directory where Cython is installed (this is ...
Below is the the instruction that describes the task: ### Input: Strip trailing whitespace and clean up "local" names in C source. These source files are autogenerated from the ``cython`` CLI. Args: c_source (str): Path to a ``.c`` source file. virtualenv_dirname (str): The name of the ``v...
def __set_buffer_watch(self, pid, address, size, action, bOneShot): """ Used by L{watch_buffer} and L{stalk_buffer}. @type pid: int @param pid: Process global ID. @type address: int @param address: Memory address of buffer to watch. @type size: int @...
Used by L{watch_buffer} and L{stalk_buffer}. @type pid: int @param pid: Process global ID. @type address: int @param address: Memory address of buffer to watch. @type size: int @param size: Size in bytes of buffer to watch. @type action: function @...
Below is the the instruction that describes the task: ### Input: Used by L{watch_buffer} and L{stalk_buffer}. @type pid: int @param pid: Process global ID. @type address: int @param address: Memory address of buffer to watch. @type size: int @param size: Size in...
def LL(n): """constructs the LL context""" if (n<=0):return Context('0') else: LL1=LL(n-1) r1 = C1(3**(n-1),2**(n-1)) - LL1 - LL1 r2 = LL1 - LL1 - LL1 return r1 + r2
constructs the LL context
Below is the the instruction that describes the task: ### Input: constructs the LL context ### Response: def LL(n): """constructs the LL context""" if (n<=0):return Context('0') else: LL1=LL(n-1) r1 = C1(3**(n-1),2**(n-1)) - LL1 - LL1 r2 = LL1 - LL1 - LL1 return r1 + r2
def merge_wgts(em_sz, wgts, itos_pre, itos_new): """ :meth: `merge_wgts` insert pretrained weights and vocab into a new set of weights and vocab; use average if vocab not in pretrained vocab :param int em_sz: embedding size :param wgts: torch model weights :param list itos_pre: pretrained list o...
:meth: `merge_wgts` insert pretrained weights and vocab into a new set of weights and vocab; use average if vocab not in pretrained vocab :param int em_sz: embedding size :param wgts: torch model weights :param list itos_pre: pretrained list of vocab :param list itos_new: list of new vocab :retu...
Below is the the instruction that describes the task: ### Input: :meth: `merge_wgts` insert pretrained weights and vocab into a new set of weights and vocab; use average if vocab not in pretrained vocab :param int em_sz: embedding size :param wgts: torch model weights :param list itos_pre: pretraine...
def _resetWidgets(self): """Resets all widgets of this dialog to its inital state. """ self._filenameLineEdit.setText('') self._encodingComboBox.setCurrentIndex(0) self._delimiterBox.reset() self._headerCheckBox.setChecked(False) self._statusBar.showMessage('') ...
Resets all widgets of this dialog to its inital state.
Below is the the instruction that describes the task: ### Input: Resets all widgets of this dialog to its inital state. ### Response: def _resetWidgets(self): """Resets all widgets of this dialog to its inital state. """ self._filenameLineEdit.setText('') self._encodingComboBox.set...
def register(self, bug: Bug) -> None: """ Dynamically registers a given bug with the server. Note that the registration will not persist beyond the lifetime of the server. (I.e., when the server is closed, the bug will be deregistered.) Raises: BugAlreadyExists: if t...
Dynamically registers a given bug with the server. Note that the registration will not persist beyond the lifetime of the server. (I.e., when the server is closed, the bug will be deregistered.) Raises: BugAlreadyExists: if there is already a bug registered on the se...
Below is the the instruction that describes the task: ### Input: Dynamically registers a given bug with the server. Note that the registration will not persist beyond the lifetime of the server. (I.e., when the server is closed, the bug will be deregistered.) Raises: BugAlreadyE...
def compose_telegram(body): """ Compose a SCS message body: list containing the body of the message. returns: full telegram expressed (bytes instance) """ msg = [b"A8"] + body + [checksum_bytes(body)] + [b"A3"] return str.encode("".join([x.decode() for x in msg]))
Compose a SCS message body: list containing the body of the message. returns: full telegram expressed (bytes instance)
Below is the the instruction that describes the task: ### Input: Compose a SCS message body: list containing the body of the message. returns: full telegram expressed (bytes instance) ### Response: def compose_telegram(body): """ Compose a SCS message body: list containing the body of...
def dump_json_file(json_data, pwd_dir_path, dump_file_name): """ dump json data to file """ class PythonObjectEncoder(json.JSONEncoder): def default(self, obj): try: return super().default(self, obj) except TypeError: return str(obj) logs_...
dump json data to file
Below is the the instruction that describes the task: ### Input: dump json data to file ### Response: def dump_json_file(json_data, pwd_dir_path, dump_file_name): """ dump json data to file """ class PythonObjectEncoder(json.JSONEncoder): def default(self, obj): try: ...
def search_datasets(self): """ Returns an iterator over the Datasets on the server. :return: An iterator over the :class:`ga4gh.protocol.Dataset` objects on the server. """ request = protocol.SearchDatasetsRequest() request.page_size = pb.int(self._page_size)...
Returns an iterator over the Datasets on the server. :return: An iterator over the :class:`ga4gh.protocol.Dataset` objects on the server.
Below is the the instruction that describes the task: ### Input: Returns an iterator over the Datasets on the server. :return: An iterator over the :class:`ga4gh.protocol.Dataset` objects on the server. ### Response: def search_datasets(self): """ Returns an iterator over the D...
def ensure_specifier_exists(db_spec): """Make sure a DB specifier exists, creating it if necessary.""" local_match = LOCAL_RE.match(db_spec) remote_match = REMOTE_RE.match(db_spec) plain_match = PLAIN_RE.match(db_spec) if local_match: db_name = local_match.groupdict().get('database') ...
Make sure a DB specifier exists, creating it if necessary.
Below is the the instruction that describes the task: ### Input: Make sure a DB specifier exists, creating it if necessary. ### Response: def ensure_specifier_exists(db_spec): """Make sure a DB specifier exists, creating it if necessary.""" local_match = LOCAL_RE.match(db_spec) remote_match = REMOTE_RE...
def RecursiveMultiListChildren(self, urns, limit=None, age=NEWEST_TIME): """Recursively lists bunch of directories. Args: urns: List of urns to list children. limit: Max number of children to list (NOTE: this is per urn). age: The age of the items to retrieve. Should be one of ALL_TIMES, ...
Recursively lists bunch of directories. Args: urns: List of urns to list children. limit: Max number of children to list (NOTE: this is per urn). age: The age of the items to retrieve. Should be one of ALL_TIMES, NEWEST_TIME or a range. Yields: (subject<->children urns) tuples...
Below is the the instruction that describes the task: ### Input: Recursively lists bunch of directories. Args: urns: List of urns to list children. limit: Max number of children to list (NOTE: this is per urn). age: The age of the items to retrieve. Should be one of ALL_TIMES, NEWEST_...
def gather_positions(tree): """Makes a list of positions and position commands from the tree""" pos = {'data-x': 'r0', 'data-y': 'r0', 'data-z': 'r0', 'data-rotate-x': 'r0', 'data-rotate-y': 'r0', 'data-rotate-z': 'r0', 'data-scale': 'r0', ...
Makes a list of positions and position commands from the tree
Below is the the instruction that describes the task: ### Input: Makes a list of positions and position commands from the tree ### Response: def gather_positions(tree): """Makes a list of positions and position commands from the tree""" pos = {'data-x': 'r0', 'data-y': 'r0', 'data-z':...
def findclass(self, name): """Find a vgroup given its class name, returning its reference number if found. Args:: name class name of the vgroup to find Returns:: vgroup reference number An exception is raised if the vgroup is not found. C lib...
Find a vgroup given its class name, returning its reference number if found. Args:: name class name of the vgroup to find Returns:: vgroup reference number An exception is raised if the vgroup is not found. C library equivalent: Vfind
Below is the the instruction that describes the task: ### Input: Find a vgroup given its class name, returning its reference number if found. Args:: name class name of the vgroup to find Returns:: vgroup reference number An exception is raised if the vgro...
def select_by_index(self, index): """Select the option at the given index. This is done by examing the "index" attribute of an element, and not merely by counting. :Args: - index - The option at this index will be selected throws NoSuchElementException If there is ...
Select the option at the given index. This is done by examing the "index" attribute of an element, and not merely by counting. :Args: - index - The option at this index will be selected throws NoSuchElementException If there is no option with specified index in SELECT
Below is the the instruction that describes the task: ### Input: Select the option at the given index. This is done by examing the "index" attribute of an element, and not merely by counting. :Args: - index - The option at this index will be selected throws NoSuchEleme...
def path_is_empty(p: tcod.path.AStar) -> bool: """Return True if a path is empty. Args: p (AStar): An AStar instance. Returns: bool: True if a path is empty. Otherwise False. """ return bool(lib.TCOD_path_is_empty(p._path_c))
Return True if a path is empty. Args: p (AStar): An AStar instance. Returns: bool: True if a path is empty. Otherwise False.
Below is the the instruction that describes the task: ### Input: Return True if a path is empty. Args: p (AStar): An AStar instance. Returns: bool: True if a path is empty. Otherwise False. ### Response: def path_is_empty(p: tcod.path.AStar) -> bool: """Return True if a path is empty....
def dt_weekofyear(x): """Returns the week ordinal of the year. :returns: an expression containing the week ordinal of the year, extracted from a datetime column. Example: >>> import vaex >>> import numpy as np >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:3...
Returns the week ordinal of the year. :returns: an expression containing the week ordinal of the year, extracted from a datetime column. Example: >>> import vaex >>> import numpy as np >>> date = np.array(['2009-10-12T03:31:00', '2016-02-11T10:17:34', '2015-11-12T11:34:22'], dtype=np.datetime64) ...
Below is the the instruction that describes the task: ### Input: Returns the week ordinal of the year. :returns: an expression containing the week ordinal of the year, extracted from a datetime column. Example: >>> import vaex >>> import numpy as np >>> date = np.array(['2009-10-12T03:31:00',...
def tuple_arg(fn): """ fun(1,2) -> fun((1,), (2,))로 f(1,2,3) => f((1,), (2,), (3,)) :param fn: :return: """ @wraps(fn) def wrapped(*args, **kwargs): args = map(tuplefy, args) return fn(*args, **kwargs) return wrapped
fun(1,2) -> fun((1,), (2,))로 f(1,2,3) => f((1,), (2,), (3,)) :param fn: :return:
Below is the the instruction that describes the task: ### Input: fun(1,2) -> fun((1,), (2,))로 f(1,2,3) => f((1,), (2,), (3,)) :param fn: :return: ### Response: def tuple_arg(fn): """ fun(1,2) -> fun((1,), (2,))로 f(1,2,3) => f((1,), (2,), (3,)) :param fn: :return: """ @wrap...
def decode_abi(self, types: Iterable[TypeStr], data: Decodable) -> Tuple[Any, ...]: """ Decodes the binary value ``data`` as a sequence of values of the ABI types in ``types`` via the head-tail mechanism into a tuple of equivalent python values. :param types: An iterable of stri...
Decodes the binary value ``data`` as a sequence of values of the ABI types in ``types`` via the head-tail mechanism into a tuple of equivalent python values. :param types: An iterable of string representations of the ABI types that will be used for decoding e.g. ``('uint256', 'bytes...
Below is the the instruction that describes the task: ### Input: Decodes the binary value ``data`` as a sequence of values of the ABI types in ``types`` via the head-tail mechanism into a tuple of equivalent python values. :param types: An iterable of string representations of the ABI types...
def get_query_tokens(query): """ :type query str :rtype: list[sqlparse.sql.Token] """ query = preprocess_query(query) parsed = sqlparse.parse(query) # handle empty queries (#12) if not parsed: return [] tokens = TokenList(parsed[0].tokens).flatten() # print([(token.valu...
:type query str :rtype: list[sqlparse.sql.Token]
Below is the the instruction that describes the task: ### Input: :type query str :rtype: list[sqlparse.sql.Token] ### Response: def get_query_tokens(query): """ :type query str :rtype: list[sqlparse.sql.Token] """ query = preprocess_query(query) parsed = sqlparse.parse(query) # han...
def cmdloop(self, intro=None): ''' Override the command loop to handle Ctrl-C. ''' self.preloop() # Set up completion with readline. if self.use_rawinput and self.completekey: try: import readline self.old_completer = readline.get_completer() ...
Override the command loop to handle Ctrl-C.
Below is the the instruction that describes the task: ### Input: Override the command loop to handle Ctrl-C. ### Response: def cmdloop(self, intro=None): ''' Override the command loop to handle Ctrl-C. ''' self.preloop() # Set up completion with readline. if self.use_rawinput and s...
def _logger_api(self): """Add API logging handler.""" from .tcex_logger import TcExLogHandler, TcExLogFormatter api = TcExLogHandler(self.session) api.set_name('api') api.setLevel(logging.DEBUG) api.setFormatter(TcExLogFormatter()) self.log.addHandler(api)
Add API logging handler.
Below is the the instruction that describes the task: ### Input: Add API logging handler. ### Response: def _logger_api(self): """Add API logging handler.""" from .tcex_logger import TcExLogHandler, TcExLogFormatter api = TcExLogHandler(self.session) api.set_name('api') api...
def desc(self): """Get a short description of the device.""" return '{0} (ID: {1}) - {2} - {3}'.format( self.name, self.device_id, self.type, self.status)
Get a short description of the device.
Below is the the instruction that describes the task: ### Input: Get a short description of the device. ### Response: def desc(self): """Get a short description of the device.""" return '{0} (ID: {1}) - {2} - {3}'.format( self.name, self.device_id, self.type, self.status)
def retry_connect(self): """Will be called when new channels in the token network are detected. If the minimum number of channels was not yet established, it will try to open new channels. If the connection manager has no funds, this is a noop. """ with self.lock: ...
Will be called when new channels in the token network are detected. If the minimum number of channels was not yet established, it will try to open new channels. If the connection manager has no funds, this is a noop.
Below is the the instruction that describes the task: ### Input: Will be called when new channels in the token network are detected. If the minimum number of channels was not yet established, it will try to open new channels. If the connection manager has no funds, this is a noop. ### Respo...
def spacing_file(path): """ Perform paranoid text spacing from file. """ # TODO: read line by line with open(os.path.abspath(path)) as f: return spacing_text(f.read())
Perform paranoid text spacing from file.
Below is the the instruction that describes the task: ### Input: Perform paranoid text spacing from file. ### Response: def spacing_file(path): """ Perform paranoid text spacing from file. """ # TODO: read line by line with open(os.path.abspath(path)) as f: return spacing_text(f.read())
def load(self, require=True, *args, **kwargs): """ Require packages for this EntryPoint, then resolve it. """ if not require or args or kwargs: warnings.warn( "Parameters to load are deprecated. Call .resolve and " ".require separately.", ...
Require packages for this EntryPoint, then resolve it.
Below is the the instruction that describes the task: ### Input: Require packages for this EntryPoint, then resolve it. ### Response: def load(self, require=True, *args, **kwargs): """ Require packages for this EntryPoint, then resolve it. """ if not require or args or kwargs: ...
def main(): """Main script function""" # Create simulation object, and start streaming SPEAD heaps sender = PulsarSender() # Parse command line arguments args = parse_command_line() # Initialise logging. _log = _init_log(level=logging.DEBUG if args.verbose else logging.INFO) # Load co...
Main script function
Below is the the instruction that describes the task: ### Input: Main script function ### Response: def main(): """Main script function""" # Create simulation object, and start streaming SPEAD heaps sender = PulsarSender() # Parse command line arguments args = parse_command_line() # Initi...
def find_file(name, directory): """Searches up from a directory looking for a file""" path_bits = directory.split(os.sep) for i in range(0, len(path_bits) - 1): check_path = path_bits[0:len(path_bits) - i] check_file = "%s%s%s" % (os.sep.join(check_path), os.sep, name) if os.path.exi...
Searches up from a directory looking for a file
Below is the the instruction that describes the task: ### Input: Searches up from a directory looking for a file ### Response: def find_file(name, directory): """Searches up from a directory looking for a file""" path_bits = directory.split(os.sep) for i in range(0, len(path_bits) - 1): check_p...
def send_document(self, peer: Peer, document: str, reply: int=None, on_success: callable=None, reply_markup: botapi.ReplyMarkup=None): """ Send document to peer. :param peer: Peer to send message to. :param document: File path to document to send. :param rep...
Send document to peer. :param peer: Peer to send message to. :param document: File path to document to send. :param reply: Message object or message_id to reply to. :param on_success: Callback to call when call is complete. :type reply: int or Message
Below is the the instruction that describes the task: ### Input: Send document to peer. :param peer: Peer to send message to. :param document: File path to document to send. :param reply: Message object or message_id to reply to. :param on_success: Callback to call when call is compl...
def _twofilter_smoothing_ON2(self, t, ti, info, phi, lwinfo): """O(N^2) version of two-filter smoothing. This method should not be called directly, see twofilter_smoothing. """ sp, sw = 0., 0. upb = lwinfo.max() + self.wgt[t].lw.max() if hasattr(self.model, 'upper_bound...
O(N^2) version of two-filter smoothing. This method should not be called directly, see twofilter_smoothing.
Below is the the instruction that describes the task: ### Input: O(N^2) version of two-filter smoothing. This method should not be called directly, see twofilter_smoothing. ### Response: def _twofilter_smoothing_ON2(self, t, ti, info, phi, lwinfo): """O(N^2) version of two-filter smoothing. ...
def gates_close(gate0: Gate, gate1: Gate, tolerance: float = TOLERANCE) -> bool: """Returns: True if gates are almost identical. Closeness is measured with the gate angle. """ return vectors_close(gate0.vec, gate1.vec, tolerance)
Returns: True if gates are almost identical. Closeness is measured with the gate angle.
Below is the the instruction that describes the task: ### Input: Returns: True if gates are almost identical. Closeness is measured with the gate angle. ### Response: def gates_close(gate0: Gate, gate1: Gate, tolerance: float = TOLERANCE) -> bool: """Returns: True if gates are almost ident...
def channelRelease(BaRange_presence=0, GroupChannelDescription_presence=0, GroupCipherKeyNumber_presence=0, GprsResumption_presence=0, BaListPref_presence=0): """CHANNEL RELEASE Section 9.1.7""" a = TpPd(pd=0x6) b = MessageType(mesType=0xD) # 00001101 c = RrCause(...
CHANNEL RELEASE Section 9.1.7
Below is the the instruction that describes the task: ### Input: CHANNEL RELEASE Section 9.1.7 ### Response: def channelRelease(BaRange_presence=0, GroupChannelDescription_presence=0, GroupCipherKeyNumber_presence=0, GprsResumption_presence=0, BaListPref_presence=0): """C...
def _add_childTnLst(self): """Add `./p:timing/p:tnLst/p:par/p:cTn/p:childTnLst` descendant. Any existing `p:timing` child element is ruthlessly removed and replaced. """ self.remove(self.get_or_add_timing()) timing = parse_xml(self._childTnLst_timing_xml()) self....
Add `./p:timing/p:tnLst/p:par/p:cTn/p:childTnLst` descendant. Any existing `p:timing` child element is ruthlessly removed and replaced.
Below is the the instruction that describes the task: ### Input: Add `./p:timing/p:tnLst/p:par/p:cTn/p:childTnLst` descendant. Any existing `p:timing` child element is ruthlessly removed and replaced. ### Response: def _add_childTnLst(self): """Add `./p:timing/p:tnLst/p:par/p:cTn/p:childTn...
def clean_params(self): """Retrieves the parameter OrderedDict without the context or self parameters. Useful for inspecting signature. """ result = self.params.copy() if self.cog is not None: # first parameter is self result.popitem(last=False) ...
Retrieves the parameter OrderedDict without the context or self parameters. Useful for inspecting signature.
Below is the the instruction that describes the task: ### Input: Retrieves the parameter OrderedDict without the context or self parameters. Useful for inspecting signature. ### Response: def clean_params(self): """Retrieves the parameter OrderedDict without the context or self parameters. ...
def _get_full_paths(fastq_dir, config, config_file): """Retrieve full paths for directories in the case of relative locations. """ if fastq_dir: fastq_dir = utils.add_full_path(fastq_dir) config_dir = utils.add_full_path(os.path.dirname(config_file)) galaxy_config_file = utils.add_full_path(...
Retrieve full paths for directories in the case of relative locations.
Below is the the instruction that describes the task: ### Input: Retrieve full paths for directories in the case of relative locations. ### Response: def _get_full_paths(fastq_dir, config, config_file): """Retrieve full paths for directories in the case of relative locations. """ if fastq_dir: ...
def get_crypt_class(self): """ Get the Keyczar class to use. The class can be customized with the ENCRYPTED_FIELD_MODE setting. By default, this setting is DECRYPT_AND_ENCRYPT. Set this to ENCRYPT to disable decryption. This is necessary if you are only providing public keys to ...
Get the Keyczar class to use. The class can be customized with the ENCRYPTED_FIELD_MODE setting. By default, this setting is DECRYPT_AND_ENCRYPT. Set this to ENCRYPT to disable decryption. This is necessary if you are only providing public keys to Keyczar. Returns: keyczar....
Below is the the instruction that describes the task: ### Input: Get the Keyczar class to use. The class can be customized with the ENCRYPTED_FIELD_MODE setting. By default, this setting is DECRYPT_AND_ENCRYPT. Set this to ENCRYPT to disable decryption. This is necessary if you are only pro...
def movie(self, cycles, plotstyle='',movname='',fps=12,**kwargs): from matplotlib import animation ''' Make an interactive movie in the matplotlib window for a number of different plot types: Plot types ---------- 'iso_abund' : abundance distr...
Make an interactive movie in the matplotlib window for a number of different plot types: Plot types ---------- 'iso_abund' : abundance distribution a la se.iso_abund() 'abu_chart' : abundance chart a la se.abu_chart() 'plot' : plot any number...
Below is the the instruction that describes the task: ### Input: Make an interactive movie in the matplotlib window for a number of different plot types: Plot types ---------- 'iso_abund' : abundance distribution a la se.iso_abund() 'abu_chart' : abundanc...
def P1(self, value): """Set private ``_P1`` and reset ``_block_matcher``.""" if value < self.P2: self._P1 = value else: raise InvalidFirstDisparityChangePenaltyError("P1 must be less " "than P2.") self._rep...
Set private ``_P1`` and reset ``_block_matcher``.
Below is the the instruction that describes the task: ### Input: Set private ``_P1`` and reset ``_block_matcher``. ### Response: def P1(self, value): """Set private ``_P1`` and reset ``_block_matcher``.""" if value < self.P2: self._P1 = value else: raise InvalidFirst...
def reset(self): """ Clears all entries. :return: None """ for i in range(len(self.values)): self.values[i].delete(0, tk.END) if self.defaults[i] is not None: self.values[i].insert(0, self.defaults[i])
Clears all entries. :return: None
Below is the the instruction that describes the task: ### Input: Clears all entries. :return: None ### Response: def reset(self): """ Clears all entries. :return: None """ for i in range(len(self.values)): self.values[i].delete(0, tk.END) i...
def _get_subnets_table(subnets): """Yields a formatted table to print subnet details. :param List[dict] subnets: List of subnets. :return Table: Formatted for subnet output. """ table = formatting.Table(['id', 'network identifier', 'cidr',...
Yields a formatted table to print subnet details. :param List[dict] subnets: List of subnets. :return Table: Formatted for subnet output.
Below is the the instruction that describes the task: ### Input: Yields a formatted table to print subnet details. :param List[dict] subnets: List of subnets. :return Table: Formatted for subnet output. ### Response: def _get_subnets_table(subnets): """Yields a formatted table to print subnet details....
def print_results(results): """Print `results` (the results of validation) to stdout. Args: results: A list of FileValidationResults or ObjectValidationResults instances. """ if not isinstance(results, list): results = [results] for r in results: try: ...
Print `results` (the results of validation) to stdout. Args: results: A list of FileValidationResults or ObjectValidationResults instances.
Below is the the instruction that describes the task: ### Input: Print `results` (the results of validation) to stdout. Args: results: A list of FileValidationResults or ObjectValidationResults instances. ### Response: def print_results(results): """Print `results` (the results of...
def coerceType(self, ftype, value): """Returns unicode(value) after trying to coerce it into the SOLR field type. @param ftype(string) The SOLR field type for the value @param value(any) The value that is to be represented as Unicode text. """ if value is None: retu...
Returns unicode(value) after trying to coerce it into the SOLR field type. @param ftype(string) The SOLR field type for the value @param value(any) The value that is to be represented as Unicode text.
Below is the the instruction that describes the task: ### Input: Returns unicode(value) after trying to coerce it into the SOLR field type. @param ftype(string) The SOLR field type for the value @param value(any) The value that is to be represented as Unicode text. ### Response: def coerceType(sel...
def icanhaz(parser, token): """ Finds the ICanHaz template for the given name and renders it surrounded by the requisite ICanHaz <script> tags. """ bits = token.contents.split() if len(bits) not in [2, 3]: raise template.TemplateSyntaxError( "'icanhaz' tag takes one argument...
Finds the ICanHaz template for the given name and renders it surrounded by the requisite ICanHaz <script> tags.
Below is the the instruction that describes the task: ### Input: Finds the ICanHaz template for the given name and renders it surrounded by the requisite ICanHaz <script> tags. ### Response: def icanhaz(parser, token): """ Finds the ICanHaz template for the given name and renders it surrounded by t...
def strip_cdata(text): """Removes all CDATA blocks from `text` if it contains them. Note: If the function contains escaped XML characters outside of a CDATA block, they will be unescaped. Args: A string containing one or more CDATA blocks. Returns: An XML unescaped str...
Removes all CDATA blocks from `text` if it contains them. Note: If the function contains escaped XML characters outside of a CDATA block, they will be unescaped. Args: A string containing one or more CDATA blocks. Returns: An XML unescaped string with CDATA block qualifier...
Below is the the instruction that describes the task: ### Input: Removes all CDATA blocks from `text` if it contains them. Note: If the function contains escaped XML characters outside of a CDATA block, they will be unescaped. Args: A string containing one or more CDATA blocks. ...
async def uint(self, elem, elem_type, params=None): """ Integer types :param elem: :param elem_type: :param params: :return: """ if self.writing: return IntegerModel(elem, elem_type.WIDTH) if self.modelize else elem else: re...
Integer types :param elem: :param elem_type: :param params: :return:
Below is the the instruction that describes the task: ### Input: Integer types :param elem: :param elem_type: :param params: :return: ### Response: async def uint(self, elem, elem_type, params=None): """ Integer types :param elem: :param elem_type: ...
def filter(self, versions, key=lambda x: x): """Filter all of the versions in an iterable that match this version range Args: versions (iterable): An iterable of SemanticVersion objects Returns: list: A list of the SemanticVersion objects that matched this range ...
Filter all of the versions in an iterable that match this version range Args: versions (iterable): An iterable of SemanticVersion objects Returns: list: A list of the SemanticVersion objects that matched this range
Below is the the instruction that describes the task: ### Input: Filter all of the versions in an iterable that match this version range Args: versions (iterable): An iterable of SemanticVersion objects Returns: list: A list of the SemanticVersion objects that matched this ...
def deserialize(cls, value, trusted=False, strict=False, assert_valid=False, **kwargs): """Create a Singleton instance from a serialized dictionary. This behaves identically to HasProperties.deserialize, except if the singleton is already found in the singleton registry the ...
Create a Singleton instance from a serialized dictionary. This behaves identically to HasProperties.deserialize, except if the singleton is already found in the singleton registry the existing value is used. .. note:: If property values differ from the existing singleton a...
Below is the the instruction that describes the task: ### Input: Create a Singleton instance from a serialized dictionary. This behaves identically to HasProperties.deserialize, except if the singleton is already found in the singleton registry the existing value is used. .. note::...
def postprocess(self): """ Postprocessing includes renaming and gzipping where necessary. """ # Add suffix to all sub_dir/{items} for path in self.neb_dirs: for f in VASP_NEB_OUTPUT_SUB_FILES: f = os.path.join(path, f) if os.path.exists...
Postprocessing includes renaming and gzipping where necessary.
Below is the the instruction that describes the task: ### Input: Postprocessing includes renaming and gzipping where necessary. ### Response: def postprocess(self): """ Postprocessing includes renaming and gzipping where necessary. """ # Add suffix to all sub_dir/{items} for...
def recover_devices(cls): """Track devices. Creates global dict to track device names across driver invocations and populates based on current devices configured on the system. """ if "_devices" in globals(): return global _devices confs_dir = os.pa...
Track devices. Creates global dict to track device names across driver invocations and populates based on current devices configured on the system.
Below is the the instruction that describes the task: ### Input: Track devices. Creates global dict to track device names across driver invocations and populates based on current devices configured on the system. ### Response: def recover_devices(cls): """Track devices. Creates gl...
def _parse_hosts_contents(self, hosts_contents): """ Parse the inventory contents. This returns a list of sections found in the inventory, which can then be used to figure out which hosts belong to which groups and such. Each section has a name, a type ('hosts', 'children', 'vars...
Parse the inventory contents. This returns a list of sections found in the inventory, which can then be used to figure out which hosts belong to which groups and such. Each section has a name, a type ('hosts', 'children', 'vars') and a list of entries for that section. Entries consist of...
Below is the the instruction that describes the task: ### Input: Parse the inventory contents. This returns a list of sections found in the inventory, which can then be used to figure out which hosts belong to which groups and such. Each section has a name, a type ('hosts', 'children', 'vars...
def out_format(data, out='nested', opts=None, **kwargs): ''' Return the formatted outputter string for the Python object. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configu...
Return the formatted outputter string for the Python object. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configuration options. Default: ``__opts__``. kwargs Arguments ...
Below is the the instruction that describes the task: ### Input: Return the formatted outputter string for the Python object. data The JSON serializable object. out: ``nested`` The name of the output to use to transform the data. Default: ``nested``. opts Dictionary of configu...
def execute(self, sensor_graph, scope_stack): """Execute this statement on the sensor_graph given the current scope tree. This adds a single node to the sensor graph with subtract as the function so that the current scope's trigger stream has the subtract_stream's value subtracted from ...
Execute this statement on the sensor_graph given the current scope tree. This adds a single node to the sensor graph with subtract as the function so that the current scope's trigger stream has the subtract_stream's value subtracted from it. Args: sensor_graph (SensorGraph)...
Below is the the instruction that describes the task: ### Input: Execute this statement on the sensor_graph given the current scope tree. This adds a single node to the sensor graph with subtract as the function so that the current scope's trigger stream has the subtract_stream's value subt...
def authenticate(self, *args, **kwargs): ''' Authenticate the user agains LDAP ''' # Get config username = kwargs.get("username", None) password = kwargs.get("password", None) # Check user in Active Directory (authorization == None if can not connect to Active D...
Authenticate the user agains LDAP
Below is the the instruction that describes the task: ### Input: Authenticate the user agains LDAP ### Response: def authenticate(self, *args, **kwargs): ''' Authenticate the user agains LDAP ''' # Get config username = kwargs.get("username", None) password = kwargs...
def serve(self, host='127.0.0.1', port=8888, limit=100, **kwargs): """Start a local proxy server. The server distributes incoming requests to a pool of found proxies. When the server receives an incoming request, it chooses the optimal proxy (based on the percentage of errors and avera...
Start a local proxy server. The server distributes incoming requests to a pool of found proxies. When the server receives an incoming request, it chooses the optimal proxy (based on the percentage of errors and average response time) and passes to it the incoming request. In a...
Below is the the instruction that describes the task: ### Input: Start a local proxy server. The server distributes incoming requests to a pool of found proxies. When the server receives an incoming request, it chooses the optimal proxy (based on the percentage of errors and average respon...